fern-api 4.78.0 → 4.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +11 -11
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1488,7 +1488,7 @@ Url: ${CGt(e)}`),!0}return!1}function Jol(e,t){return t?.length?EGt(e).some(r=>l
|
|
|
1488
1488
|
`),m=f.shift();if(!m)return e.destroy(),r(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),g=+(h[1]||0),A=h.slice(2).join(" "),b={};for(let v of f){if(!v)continue;let E=v.indexOf(":");if(E===-1)return e.destroy(),r(new Error(`Invalid header from proxy CONNECT response: "${v}"`));let I=v.slice(0,E).toLowerCase(),x=v.slice(E+1).trimStart(),C=b[I];typeof C=="string"?b[I]=[C,x]:Array.isArray(C)?C.push(x):b[I]=x}v9t("got proxy server response: %o %o",m,b),s(),t({connect:{statusCode:g,statusText:A,headers:b},buffered:p})}e.on("error",c),e.on("end",a),o()})}function XEt(...e){Zt.log("[https-proxy-agent]",...e)}var ZEt=class extends E9t{static __initStatic(){this.protocols=["http","https"]}constructor(t,r){super(r),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=r?.headers??{},XEt("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?Hps(r,"headers"):null,host:n,port:i}}async connect(t,r){let{proxy:n}=this;if(!r.host)throw new TypeError('No "host" provided');let i;if(n.protocol==="https:"){XEt("Creating `tls.Socket`: %o",this.connectOpts);let d=this.connectOpts.servername||this.connectOpts.host;i=oai.connect({...this.connectOpts,servername:d&&Soe.isIP(d)?void 0:d})}else XEt("Creating `net.Socket`: %o",this.connectOpts),i=Soe.connect(this.connectOpts);let o=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=Soe.isIPv6(r.host)?`[${r.host}]`:r.host,a=`CONNECT ${s}:${r.port} HTTP/1.1\r
|
|
1489
1489
|
`;if(n.username||n.password){let d=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}o.Host=`${s}:${r.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(o))a+=`${d}: ${o[d]}\r
|
|
1490
1490
|
`;let c=$ps(i);i.write(`${a}\r
|
|
1491
|
-
`);let{connect:u,buffered:l}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),u.statusCode===200){if(t.once("socket",Gll),r.secureEndpoint){XEt("Upgrading socket connection to TLS");let d=r.servername||r.host;return oai.connect({...Hps(r,"host","path","port"),socket:i,servername:Soe.isIP(d)?void 0:d})}return i}i.destroy();let p=new Soe.Socket({writable:!1});return p.readable=!0,t.once("socket",d=>{XEt("Replaying proxy buffer for failed request"),d.push(l),d.push(null)}),p}};ZEt.__initStatic();function Gll(e){e.resume()}function Hps(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}var Hll=1024*32;function Kll(e){return new Kps.Readable({read(){this.push(e),this.push(null)}})}function Yps(e){let t;try{t=new URL(e.url)}catch{return Rv(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),IEt(e,()=>Promise.resolve({}))}let r=t.protocol==="https:",n=Jll(t,e.proxy||(r?process.env.https_proxy:void 0)||process.env.http_proxy),i=r?$ll:Wll,o=e.keepAlive===void 0?!1:e.keepAlive,s=n?new ZEt(n):new i.Agent({keepAlive:o,maxSockets:30,timeout:2e3}),a=Yll(e,e.httpModule??i,s);return IEt(e,a)}function Jll(e,t){let{no_proxy:r}=process.env;if(!r?.split(",").some(i=>e.host.endsWith(i)||e.hostname.endsWith(i)))return t}function Yll(e,t,r){let{hostname:n,pathname:i,port:o,protocol:s,search:a}=new URL(e.url);return function(u){return new Promise((l,p)=>{Kze(()=>{let d=Kll(u.body),f={...e.headers};u.body.length>Hll&&(f["content-encoding"]="gzip",d=d.pipe((0,Jps.createGzip)()));let m=n.startsWith("["),h=t.request({method:"POST",agent:r,headers:f,hostname:m?n.slice(1,-1):n,path:`${i}${a}`,port:o,protocol:s,ca:e.caCerts},g=>{g.on("data",()=>{}),g.on("end",()=>{}),g.setEncoding("utf8");let A=g.headers["retry-after"]??null,b=g.headers["x-sentry-rate-limits"]??null;l({statusCode:g.statusCode,headers:{"retry-after":A,"x-sentry-rate-limits":Array.isArray(b)?b[0]||null:b}})});h.on("error",p),d.pipe(h)})})}}function Xps(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=Zze(process.env.SENTRY_SPOTLIGHT,{strict:!0}),r=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?r??!0:t??r}var I9t=require("path");function Zps(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function efs(e=process.argv[1]?Voi(process.argv[1]):process.cwd(),t=I9t.sep==="\\"){let r=t?Zps(e):e;return n=>{if(!n)return;let i=t?Zps(n):n,{dir:o,base:s,ext:a}=I9t.posix.parse(i);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,a.length*-1));let c=decodeURIComponent(s);o||(o=".");let u=o.lastIndexOf("/node_modules");if(u>-1)return`${o.slice(u+14).replace(/\//g,".")}:${c}`;if(o.startsWith(r)){let l=o.slice(r.length+1).replace(/\//g,".");return l?`${l}:${c}`:c}return c}}function tfs(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(Sc.SENTRY_RELEASE?.id)return Sc.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,r=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,n=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||r||n||e}var rfs=Wqt(Isi(efs()));var nfs=ve(require("os"),1);lo();Fu();var x9t=require("worker_threads");var Xll=6e4,w9t=class extends wEt{constructor(t){let r=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||nfs.hostname(),n={...t,platform:"node",runtime:t.runtime||{name:"node",version:global.process.version},serverName:r};t.openTelemetryInstrumentations&&YTe({instrumentations:t.openTelemetryInstrumentations}),dOe(n,"node"),Zt.log(`Initializing Sentry: process: ${process.pid}, thread: ${x9t.isMainThread?"main":`worker-${x9t.threadId}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Yze(this)},r&&this.on("beforeCaptureLog",i=>{i.attributes={...i.attributes,"server.address":r}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let t="@sentry/node",r=df,n=rs.getTracer(t,r);return this._tracer=n,n}async flush(t){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(t)}async close(t){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let r=await super.close(t);return this.traceProvider&&await this.traceProvider.shutdown(),r}startClientReportTracking(){let t=this.getOptions();t.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{dl&&Zt.log("Flushing client reports based on interval."),this._flushOutcomes()},t.clientReportFlushInterval??Xll).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){Foi(),super._setupIntegrations()}_getTraceInfoFromScope(t){return t?rps(this,t):[void 0,void 0]}};var ifs=ve(wii(),1),ofs=ve(require("module"),1);var Zll={};function sai(){if(Nps()&&!Sc._sentryEsmLoaderHookRegistered){Sc._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,ifs.createAddHookMessageChannel)();ofs.register("import-in-the-middle/hook.mjs",Zll.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){Zt.warn("Failed to register 'import-in-the-middle' hook",e)}}}function C9t(){return[_Gt(),xGt(),SGt(),TGt(),Wps(),Hoi(),BGt(),hls(),yls(),Lps(),Ups(),Cps(),Fps(),Aps(),dps(),zps(),Qps()]}function aai(e={}){return epl(e,C9t)}function epl(e={},t){let r=tpl(e,t);r.debug===!0&&(dl?Zt.enable():Rv(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),r.registerEsmLoaderHooks!==!1&&sai(),ops(),od().update(r.initialScope),r.spotlight&&!r.integrations.some(({name:o})=>o===nai)&&r.integrations.push(qps({sidecarUrl:typeof r.spotlight=="string"?r.spotlight:void 0})),dOe(r,"node-core");let i=new w9t(r);return od().setClient(i),i.init(),Zt.log(`SDK initialized from ${HEt()?"CommonJS":"ESM"}`),i.startClientReportTracking(),ipl(),zls(i),ips(i),process.env.VERCEL&&process.on("SIGTERM",async()=>{await i.flush(200)}),i}function cai(){if(!dl)return;let e=Wls(),t=["SentryContextManager","SentryPropagator"];Dv()&&t.push("SentrySpanProcessor");for(let r of t)e.includes(r)||Zt.error(`You have to set up the ${r}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);e.includes("SentrySampler")||Zt.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function tpl(e,t){let r=rpl(e.release),n=Xps(e.spotlight),i=npl(e.tracesSampleRate),o={...e,dsn:e.dsn??"",environment:e.environment??"production",sendClientReports:e.sendClientReports??!0,transport:e.transport??Yps,stackParser:Fii(e.stackParser||rfs),release:r,tracesSampleRate:i,spotlight:n,debug:Zze(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,a=e.defaultIntegrations??t(o);return{...o,integrations:_oi({defaultIntegrations:a,integrations:s})}}function rpl(e){if(e!==void 0)return e;let t=tfs();if(t!==void 0)return t}function npl(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let r=parseFloat(t);return isFinite(r)?r:void 0}function ipl(){if(Zze(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,r=aEt(e,t);od().setPropagationContext(r)}}function jg(e,t){e.setAttribute(bc,t)}function evt(e){let t=e.protocol||"",r=e.hostname||e.host||"",n=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(r)?"":`:${e.port}`,i=e.path?e.path:"/";return`${t}//${r}${n}${i}`}var uai="Http",sfs="@opentelemetry_sentry-patched/instrumentation-http",_9t=Y6.major===22&&Y6.minor>=12||Y6.major===23&&Y6.minor>=2||Y6.major>=24,opl=ws(`${uai}.sentry`,e=>new vOe(e)),spl=ws(uai,e=>{let t=new afs.HttpInstrumentation({...e,disableIncomingRequestInstrumentation:!0});try{t._diag=Pi.createComponentLogger({namespace:sfs}),t.instrumentationName=sfs}catch{}try{let r={get:()=>!1,set:()=>{}};Object.defineProperty(t,"_httpPatched",r),Object.defineProperty(t,"_httpsPatched",r)}catch{}return t});function apl(e,t={}){return typeof e.spans=="boolean"?e.spans:!(t.skipOpenTelemetrySetup||!Dv(t)&&_9t)}var cfs=(e={})=>{let t=e.spans??!0,r=e.disableIncomingRequestSpans,n={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},i={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},o=QEt(n),s=MEt(i),a=t&&!r;return{name:uai,setup(c){let u=c.getOptions();a&&Dv(u)&&s.setup(c)},setupOnce(){let c=La()?.getOptions()||{},u=apl(e,c);o.setupOnce();let l={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:typeof e.tracePropagation=="boolean"?e.tracePropagation:_9t||!u,createSpansForOutgoingRequests:_9t,spans:e.spans,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(p,d)=>{let f=evt(d);if(f.startsWith("data:")){let m=e5e(f);p.setAttribute("http.url",m),p.setAttribute(mde,m),p.updateName(`${d.method||"GET"} ${m}`)}e.instrumentation?.requestHook?.(p,d)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan};if(opl(l),u){let p=cpl(e);spl(p)}},processEvent(c){return s.processEvent(c)}}};function cpl(e={}){return{disableOutgoingRequestInstrumentation:_9t,ignoreOutgoingRequestHook:r=>{let n=evt(r);if(!n)return!1;let i=e.ignoreOutgoingRequests;return!!i?.(n,r)},requireParentforOutgoingSpans:!1,requestHook:(r,n)=>{jg(r,"auto.http.otel.http");let i=evt(n);if(i.startsWith("data:")){let o=e5e(i);r.setAttribute("http.url",o),r.setAttribute(mde,o),r.updateName(`${n.method||"GET"} ${o}`)}e.instrumentation?.requestHook?.(r,n)},responseHook:(r,n)=>{e.instrumentation?.responseHook?.(r,n)},applyCustomAttributesOnSpan:(r,n,i)=>{e.instrumentation?.applyCustomAttributesOnSpan?.(r,n,i)}}}var mfs=ve(ffs(),1);var hfs="NodeFetch",ppl=ws(hfs,mfs.UndiciInstrumentation,e=>hpl(e)),fpl=ws(`${hfs}.sentry`,IOe,e=>e),dpl=((e={})=>({name:"NodeFetch",setupOnce(){mpl(e,La()?.getOptions())&&ppl(e),fpl(e)}})),gfs=dpl;function dfs(e,t="/"){let r=`${e}`;return r.endsWith("/")&&t.startsWith("/")?`${r}${t.slice(1)}`:!r.endsWith("/")&&!t.startsWith("/")?`${r}/${t}`:`${r}${t}`}function mpl(e,t={}){return typeof e.spans=="boolean"?e.spans:!t.skipOpenTelemetrySetup&&Dv(t)}function hpl(e={}){return{requireParentforSpans:!1,ignoreRequestHook:r=>{let n=dfs(r.origin,r.path),i=e.ignoreOutgoingRequests;return!!(i&&n&&i(n))},startSpanHook:r=>{let n=dfs(r.origin,r.path);if(n.startsWith("data:")){let i=e5e(n);return{[bc]:"auto.http.otel.node_fetch","http.url":i,[mde]:i,[kU]:`${r.method||"GET"} ${i}`}}return{[bc]:"auto.http.otel.node_fetch"}},requestHook:e.requestHook,responseHook:e.responseHook,headersToSpanAttributes:e.headersToSpanAttributes}}var Sfs=ve(_fs(),1);var Bx=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Tfs="Express";function Ppl(e){jg(e,"auto.http.otel.express");let t=lc(e).data,r=t["express.type"];r&&e.setAttribute(Au,`${r}.express`);let n=t["express.name"];typeof n=="string"&&e.updateName(n)}function Rpl(e,t){if(Mp()===FU())return Bx&&Zt.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),t;if(e.layerType==="request_handler"){let r=e.request,n=r.method?r.method.toUpperCase():"GET";Mp().setTransactionName(`${n} ${e.route}`)}return t}var Ofs=ws(Tfs,()=>new Sfs.ExpressInstrumentation({requestHook:e=>Ppl(e),spanNameHook:(e,t)=>Rpl(e,t)})),Dpl=(()=>({name:Tfs,setupOnce(){Ofs()}})),Bfs=Dpl;var Gai=ve(require("diagnostics_channel"),1),ams=ve(tms(),1);lo();VA();Fu();Cf();var Boe;(function(e){let t="fastify.name";e.FASTIFY_NAME=t;let r="fastify.type";e.FASTIFY_TYPE=r;let n="hook.name";e.HOOK_NAME=n;let i="plugin.name";e.PLUGIN_NAME=i})(Boe||(Boe={}));var yvt;(function(e){let t="middleware";e.MIDDLEWARE=t;let r="request_handler";e.REQUEST_HANDLER=r})(yvt||(yvt={}));var bvt;(function(e){let t="middleware";e.MIDDLEWARE=t;let r="request handler";e.REQUEST_HANDLER=r})(bvt||(bvt={}));lo();var Evt=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function qai(e,t,r,n={}){let i=t.startSpan(r,{attributes:n}),o=e[Evt]||[];return o.push(i),Object.defineProperty(e,Evt,{enumerable:!1,configurable:!0,value:o}),i}function s7t(e,t){let r=e[Evt]||[];r.length&&(r.forEach(n=>{t&&(n.setStatus({code:uA.ERROR,message:t.message}),n.recordException(t)),n.end()}),delete e[Evt])}function nms(e,t,r){let n,i;try{i=e(),rms(i)&&i.then(o=>t(void 0,o),o=>t(o))}catch(o){n=o}finally{if(!rms(i)&&(t(n,i),n))throw n;return i}}function rms(e){return typeof e=="object"&&e&&typeof Object.getOwnPropertyDescriptor(e,"then")?.value=="function"||!1}var Wdl="0.1.0",$dl="@sentry/instrumentation-fastify-v3",ims="anonymous",Hdl=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),a7t=class extends yh{constructor(t={}){super($dl,Wdl,t)}init(){return[new bh("fastify",[">=3.0.0 <4"],t=>this._patchConstructor(t))]}_hookOnRequest(){let t=this;return function(n,i,o){if(!t.isEnabled())return o();t._wrap(i,"send",t._patchSend());let s=n,a=xze(Zi.active()),c=s.routeOptions?s.routeOptions.url:n.routerPath;c&&a?.type===hoe.HTTP&&(a.route=c);let u=n.method||"GET";Mp().setTransactionName(`${u} ${c}`),o()}}_wrapHandler(t,r,n,i){let o=this;return this._diag.debug("Patching fastify route.handler function"),function(...s){if(!o.isEnabled())return n.apply(this,s);let a=n.name||t||ims,c=`${bvt.MIDDLEWARE} - ${a}`,u=s[1],l=qai(u,o.tracer,c,{[Boe.FASTIFY_TYPE]:yvt.MIDDLEWARE,[Boe.PLUGIN_NAME]:t,[Boe.HOOK_NAME]:r}),p=i&&s[s.length-1];return p&&(s[s.length-1]=function(...d){s7t(u),p.apply(this,d)}),Zi.with(rs.setSpan(Zi.active(),l),()=>nms(()=>n.apply(this,s),d=>{d instanceof Error&&(l.setStatus({code:uA.ERROR,message:d.message}),l.recordException(d)),i||s7t(u)}))}}_wrapAddHook(){let t=this;return this._diag.debug("Patching fastify server.addHook function"),function(r){return function(...i){let o=i[0],s=i[1],a=this.pluginName;if(!Hdl.has(o))return r.apply(this,i);let c=typeof i[i.length-1]=="function"&&s.constructor.name!=="AsyncFunction";return r.apply(this,[o,t._wrapHandler(a,o,s,c)])}}}_patchConstructor(t){let r=this;function n(...i){let o=t.fastify.apply(this,i);return o.addHook("onRequest",r._hookOnRequest()),o.addHook("preHandler",r._hookPreHandler()),Kdl(),r._wrap(o,"addHook",r._wrapAddHook()),o}return t.errorCodes!==void 0&&(n.errorCodes=t.errorCodes),n.fastify=n,n.default=n,n}_patchSend(){let t=this;return this._diag.debug("Patching fastify reply.send function"),function(n){return function(...o){let s=o[0];return t.isEnabled()?WQ(()=>n.apply(this,o),a=>{!a&&s instanceof Error&&(a=s),s7t(this,a)}):n.apply(this,o)}}}_hookPreHandler(){let t=this;return this._diag.debug("Patching fastify preHandler function"),function(n,i,o){if(!t.isEnabled())return o();let s=n,a=s.routeOptions?.handler||s.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,u=`${bvt.REQUEST_HANDLER} - ${c||this.pluginName||ims}`,l={[Boe.PLUGIN_NAME]:this.pluginName,[Boe.FASTIFY_TYPE]:yvt.REQUEST_HANDLER,[_ni]:s.routeOptions?s.routeOptions.url:n.routerPath};c&&(l[Boe.FASTIFY_NAME]=c);let p=qai(i,t.tracer,u,l);oms(p);let{requestHook:d}=t.getConfig();return d&&WQ(()=>d(p,{request:n}),f=>{f&&t._diag.error("request hook failed",f)},!0),Zi.with(rs.setSpan(Zi.active(),p),()=>{o()})}}};function Kdl(){let e=La();e&&e.on("spanStart",t=>{oms(t)})}function oms(e){let t=lc(e).data,r=t["fastify.type"];if(t[Au]||!r)return;e.setAttributes({[bc]:"auto.http.otel.fastify",[Au]:`${r}.fastify`});let n=t["fastify.name"]||t["plugin.name"]||t["hook.name"];if(typeof n=="string"){let i=n.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(i)}}var c7t="Fastify",cms=ws(`${c7t}.v3`,()=>new a7t);function Jdl(){let e=La();if(e)return e.getIntegrationByName(c7t)}function sms(e,t,r,n){let i=Jdl()?.getShouldHandleError()||pms;if(n==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&n==="onError-hook"){Bx&&Zt.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}i(e,t,r)&&fl(e,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var ums=ws(`${c7t}.v5`,()=>{let e=new ams.FastifyOtelInstrumentation,t=e.plugin();return Gai.subscribe("fastify.initialization",r=>{let n=r.fastify;n?.register(t).after(i=>{i?Bx&&Zt.error("Failed to setup Fastify instrumentation",i):(Xdl(),n&&Zdl(n))})}),Gai.subscribe("tracing:fastify.request.handler:error",r=>{let{error:n,request:i,reply:o}=r;sms.call(sms,n,i,o,"diagnostics-channel")}),e}),Ydl=(({shouldHandleError:e})=>{let t;return{name:c7t,setupOnce(){t=e||pms,cms(),ums()},getShouldHandleError(){return t},setShouldHandleError(r){t=r}}}),lms=(e={})=>Ydl(e);function pms(e,t,r){let n=r.statusCode;return n>=500||n<=299}function fms(e){let t=lc(e),r=t.description,n=t.data,i=n["fastify.type"],o=i==="hook",s=i===r?.startsWith("handler -"),a=r==="request"||i==="request-handler";if(n[Au]||!s&&!a&&!o)return;let c=o?"hook":s?"middleware":a?"request_handler":"<unknown>";e.setAttributes({[bc]:"auto.http.otel.fastify",[Au]:`${c}.fastify`});let u=n["fastify.name"]||n["plugin.name"]||n["hook.name"];if(typeof u=="string"){let l=u.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(l)}}function Xdl(){let e=La();e&&e.on("spanStart",t=>{fms(t)})}function Zdl(e){e.addHook("onRequest",async(t,r)=>{if(t.opentelemetry){let{span:o}=t.opentelemetry();o&&fms(o)}let n=t.routeOptions?.url,i=t.method||"GET";Mp().setTransactionName(`${i} ${n}`)})}lo();var Dms=ve(Rms(),1);var Fms="Graphql",kms=ws(Fms,Dms.GraphQLInstrumentation,e=>{let t=jms(e);return{...t,responseHook(r,n){jg(r,"auto.graphql.otel.graphql"),n.errors?.length&&!lc(r).status&&r.setStatus({code:uA.ERROR});let o=lc(r).data,s=o["graphql.operation.type"],a=o["graphql.operation.name"];if(t.useOperationNameForRootSpan&&s){let c=TE(r),l=lc(c).data[b5e]||[],p=a?`${s} ${a}`:`${s}`;Array.isArray(l)?(l.push(p),c.setAttribute(b5e,l)):typeof l=="string"?c.setAttribute(b5e,[l,p]):c.setAttribute(b5e,p),lc(c).data["original-description"]||c.setAttribute("original-description",lc(c).description),c.updateName(`${lc(c).data["original-description"]} (${Eml(l)})`)}}}}),bml=((e={})=>({name:Fms,setupOnce(){kms(jms(e))}})),Nms=bml;function jms(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}function Eml(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(", "):`${t.slice(0,5).join(", ")}, +${t.length-5}`}return`${e}`}var Kms=ve(Hms(),1);var Jms="Kafka",Yms=ws(Jms,()=>new Kms.KafkaJsInstrumentation({consumerHook(e){jg(e,"auto.kafkajs.otel.consumer")},producerHook(e){jg(e,"auto.kafkajs.otel.producer")}})),Iml=(()=>({name:Jms,setupOnce(){Yms()}})),Xms=Iml;var ohs=ve(ihs(),1);var shs="LruMemoizer",ahs=ws(shs,()=>new ohs.LruMemoizerInstrumentation),xml=(()=>({name:shs,setupOnce(){ahs()}})),chs=xml;var Ahs=ve(ghs(),1);var yhs="Mongo",bhs=ws(yhs,()=>new Ahs.MongoDBInstrumentation({dbStatementSerializer:Oml,responseHook(e){jg(e,"auto.db.otel.mongo")}}));function Oml(e){let t=eci(e);return JSON.stringify(t)}function eci(e){if(Array.isArray(e))return e.map(t=>eci(t));if(Bml(e)){let t={};return Object.entries(e).map(([r,n])=>[r,eci(n)]).reduce((r,n)=>(Rml(n)&&(r[n[0]]=n[1]),r),t)}return"?"}function Bml(e){return typeof e=="object"&&e!==null&&!Pml(e)}function Pml(e){let t=!1;return typeof Buffer<"u"&&(t=Buffer.isBuffer(e)),t}function Rml(e){return Array.isArray(e)}var Dml=(()=>({name:yhs,setupOnce(){bhs()}})),Ehs=Dml;var Phs=ve(Bhs(),1);var Rhs="Mongoose",Dhs=ws(Rhs,()=>new Phs.MongooseInstrumentation({responseHook(e){jg(e,"auto.db.otel.mongoose")}})),zml=(()=>({name:Rhs,setupOnce(){Dhs()}})),Fhs=zml;var zhs=ve(Uhs(),1);var Vhs="Mysql",qhs=ws(Vhs,()=>new zhs.MySQLInstrumentation({})),Xml=(()=>({name:Vhs,setupOnce(){qhs()}})),Ghs=Xml;var Zhs=ve(Xhs(),1);var egs="Mysql2",tgs=ws(egs,()=>new Zhs.MySQL2Instrumentation({responseHook(e){jg(e,"auto.db.otel.mysql2")}})),dhl=(()=>({name:egs,setupOnce(){tgs()}})),rgs=dhl;var Tgs=ve(lgs(),1),Ogs=ve(wgs(),1);var Rhl=["get","set","setex"],vci=["get","mget"],Dhl=["set","setex"];function Fvt(e,t){return e.includes(t.toLowerCase())}function Ici(e){return Fvt(vci,e)?"cache.get":Fvt(Dhl,e)?"cache.put":void 0}function Fhl(e,t){return t.some(r=>e.startsWith(r))}function Cgs(e,t){try{if(t.length===0)return;let r=i=>typeof i=="string"||typeof i=="number"||Buffer.isBuffer(i)?[i.toString()]:Array.isArray(i)?xgs(i.map(o=>r(o))):["<unknown>"],n=t[0];return Fvt(Rhl,e)&&n!=null?r(n):xgs(t.map(i=>r(i)))}catch{return}}function _gs(e,t,r){if(!Ici(e))return!1;for(let n of t)if(Fhl(n,r))return!0;return!1}function Sgs(e){let t=r=>{try{return Buffer.isBuffer(r)?r.byteLength:typeof r=="string"?r.length:typeof r=="number"?r.toString().length:r==null?0:JSON.stringify(r).length}catch{return}};return Array.isArray(e)?e.reduce((r,n)=>{let i=t(n);return typeof i=="number"?r!==void 0?r+i:i:r},0):t(e)}function xgs(e){let t=[],r=n=>{n.forEach(i=>{Array.isArray(i)?r(i):t.push(i)})};return r(e),t}var G7t="Redis",kvt={},Bgs=(e,t,r,n)=>{e.setAttribute(bc,"auto.db.otel.redis");let i=Cgs(t,r),o=Ici(t);if(!i||!o||!kvt.cachePrefixes||!_gs(t,i,kvt.cachePrefixes))return;let s=lc(e).data["net.peer.name"],a=lc(e).data["net.peer.port"];a&&s&&e.setAttributes({"network.peer.address":s,"network.peer.port":a});let c=Sgs(n);c&&e.setAttribute(soi,c),Fvt(vci,t)&&c!==void 0&&e.setAttribute(ioi,c>0),e.setAttributes({[Au]:o,[ooi]:i});let u=i.join(", ");e.updateName(kvt.maxCacheKeyLength?ude(u,kvt.maxCacheKeyLength):u)},khl=ws(`${G7t}.IORedis`,()=>new Tgs.IORedisInstrumentation({responseHook:Bgs})),Nhl=ws(`${G7t}.Redis`,()=>new Ogs.RedisInstrumentation({responseHook:Bgs})),Pgs=Object.assign(()=>{khl(),Nhl()},{id:G7t}),jhl=((e={})=>({name:G7t,setupOnce(){kvt=e,Pgs()}})),Rgs=jhl;var Kgs=ve(Hgs(),1);var Jgs="Postgres",Ygs=ws(Jgs,Kgs.PgInstrumentation,e=>({requireParentSpan:!0,requestHook(t){jg(t,"auto.db.otel.postgres")},ignoreConnectSpans:e?.ignoreConnectSpans??!1})),Xhl=(e=>({name:Jgs,setupOnce(){Ygs(e)}})),Xgs=Xhl;lo();Fu();Cf();var Oci="PostgresJs",Zgs=[">=3.0.0 <4"],Zhl=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,egl=Symbol.for("sentry.query.from.instrumented.sql"),eAs=ws(Oci,e=>new Tci({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),Tci=class extends yh{constructor(t){super("sentry-postgres-js",df,t)}init(){let t=new bh("postgres",Zgs,r=>{try{return this._patchPostgres(r)}catch(n){return Bx&&Zt.error("Failed to patch postgres module:",n),r}},r=>r);return["src","cf/src","cjs/src"].forEach(r=>{t.files.push(new x1(`postgres/${r}/query.js`,Zgs,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),t}_patchPostgres(t){let r=typeof t=="function",n=r?t:t.default;if(typeof n!="function")return Bx&&Zt.warn("postgres module does not export a function. Skipping instrumentation."),t;let i=this,o=function(...s){let a=Reflect.construct(n,s);if(!a||typeof a!="function")return Bx&&Zt.warn("postgres() did not return a valid instance"),a;let c=i.getConfig();return $oi(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(o,s,a)}return r?o:(kEt(t,"default",o),t)}_shouldCreateSpans(){let t=this.getConfig();return rs.getSpan(Zi.active())!==void 0||!t.requireParentSpan}_setOperationName(t,r,n){if(n){t.setAttribute(bze,n);return}let i=r?.match(Zhl);i?.[1]&&t.setAttribute(bze,i[1].toUpperCase())}_reconstructQuery(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((r,n,i)=>i===0?n:`${r}$${i}${n}`,"")}_sanitizeSqlQuery(t){return t?t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(t){let r=this,n=t.Query.prototype.handle;return t.Query.prototype.handle=async function(...i){if(this[egl])return n.apply(this,i);if(!r._shouldCreateSpans())return n.apply(this,i);let o=r._reconstructQuery(this.strings),s=r._sanitizeSqlQuery(o);return DC({name:s||"postgresjs.query",op:"db"},a=>{jg(a,"auto.db.postgresjs"),a.setAttributes({[HTe]:"postgres",[Dni]:s});let c=r.getConfig(),{requestHook:u}=c;u&&WQ(()=>u(a,s,void 0),d=>{d&&(a.setAttribute("sentry.hook.error","requestHook failed"),Bx&&Zt.error(`Error in requestHook for ${Oci} integration:`,d))},!0);let l=this.resolve;this.resolve=new Proxy(l,{apply:(d,f,m)=>{try{r._setOperationName(a,s,m?.[0]?.command),a.end()}catch(h){Bx&&Zt.error("Error ending span in resolve callback:",h)}return Reflect.apply(d,f,m)}});let p=this.reject;this.reject=new Proxy(p,{apply:(d,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(Fni,m?.[0]?.code||"unknown"),a.setAttribute(kni,m?.[0]?.name||"unknown"),r._setOperationName(a,s),a.end()}catch(h){Bx&&Zt.error("Error ending span in reject callback:",h)}return Reflect.apply(d,f,m)}});try{return n.apply(this,i)}catch(d){throw a.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),a.end(),d}})},t.Query.prototype.handle.__sentry_original__=n,t}_unpatchQueryPrototype(t){return t.Query.prototype.handle.__sentry_original__&&(t.Query.prototype.handle=t.Query.prototype.handle.__sentry_original__),t}},tgl=(e=>({name:Oci,setupOnce(){eAs(e)}})),tAs=tgl;lo();lo();var Mvt=class{emit(t){}},rAs=new Mvt;var Bci=class{getLogger(t,r,n){return new Mvt}},X7t=new Bci;var Z7t=class{constructor(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):rAs}};var Lvt=class{getLogger(t,r,n){var i;return(i=this._getDelegateLogger(t,r,n))!==null&&i!==void 0?i:new Z7t(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:X7t}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,r,n)}};var eWt=typeof globalThis=="object"?globalThis:global;var Uvt=Symbol.for("io.opentelemetry.js.api.logs"),Y5e=eWt;function nAs(e,t,r){return n=>n===e?t:r}var Pci=1;var tWt=class e{constructor(){this._proxyLoggerProvider=new Lvt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return Y5e[Uvt]?this.getLoggerProvider():(Y5e[Uvt]=nAs(Pci,t,X7t),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=Y5e[Uvt])===null||t===void 0?void 0:t.call(Y5e,Pci))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete Y5e[Uvt],this._proxyLoggerProvider=new Lvt}};var iAs=tWt.getInstance();var koe=ve(require("path")),Qci=require("util");lo();var uAs=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,rgl=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,ngl={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function lAs(e,t,r){if(!igl(e))return Pi.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,"$1");let n=cgl(e);if(!n)return!1;let i=[],o=pAs(n,t,i,r);return o&&!r?.includePrerelease?sgl(n,i):o}function igl(e){return typeof e=="string"&&uAs.test(e)}function pAs(e,t,r,n){if(t.includes("||")){let i=t.trim().split("||");for(let o of i)if(Rci(e,o,r,n))return!0;return!1}else if(t.includes(" - "))t=Ogl(t,n);else if(t.includes(" ")){let i=t.trim().replace(/\s{2,}/g," ").split(" ");for(let o of i)if(!Rci(e,o,r,n))return!1;return!0}return Rci(e,t,r,n)}function Rci(e,t,r,n){if(t=agl(t,n),t.includes(" "))return pAs(e,t,r,n);{let i=ugl(t);return r.push(i),ogl(e,i)}}function ogl(e,t){if(t.invalid)return!1;if(!t.version||Fci(t.version))return!0;let r=sAs(e.versionSegments||[],t.versionSegments||[]);if(r===0){let n=e.prereleaseSegments||[],i=t.prereleaseSegments||[];!n.length&&!i.length?r=0:!n.length&&i.length?r=1:n.length&&!i.length?r=-1:r=sAs(n,i)}return ngl[t.op]?.includes(r)}function sgl(e,t){return e.prerelease?t.some(r=>r.prerelease&&r.version===e.version):!0}function agl(e,t){return e=e.trim(),e=Sgl(e,t),e=_gl(e),e=Tgl(e,t),e=e.trim(),e}function NR(e){return!e||e.toLowerCase()==="x"||e==="*"}function cgl(e){let t=e.match(uAs);if(!t){Pi.error(`Invalid version: ${e}`);return}let r=t.groups.version,n=t.groups.prerelease,i=t.groups.build,o=r.split("."),s=n?.split(".");return{op:void 0,version:r,versionSegments:o,versionSegmentCount:o.length,prerelease:n,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:i}}function ugl(e){if(!e)return{};let t=e.match(rgl);if(!t)return Pi.error(`Invalid range: ${e}`),{invalid:!0};let r=t.groups.op,n=t.groups.version,i=t.groups.prerelease,o=t.groups.build,s=n.split("."),a=i?.split(".");return r==="=="&&(r="="),{op:r||"=",version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:i,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:o}}function Fci(e){return e==="*"||e==="x"||e==="X"}function oAs(e){let t=parseInt(e,10);return isNaN(t)?e:t}function lgl(e,t){if(typeof e==typeof t){if(typeof e=="number")return[e,t];if(typeof e=="string")return[e,t];throw new Error("Version segments can only be strings or numbers")}else return[String(e),String(t)]}function pgl(e,t){if(Fci(e)||Fci(t))return 0;let[r,n]=lgl(oAs(e),oAs(t));return r>n?1:r<n?-1:0}function sAs(e,t){for(let r=0;r<Math.max(e.length,t.length);r++){let n=pgl(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0}var fAs="[a-zA-Z0-9-]",dAs="0|[1-9]\\d*",fgl=`\\d*[a-zA-Z-]${fAs}*`,dgl="((?:<|>)?=?)",aAs=`(?:${dAs}|${fgl})`,mgl=`(?:-(${aAs}(?:\\.${aAs})*))`,cAs=`${fAs}+`,hgl=`(?:\\+(${cAs}(?:\\.${cAs})*))`,Dci=`${dAs}|x|X|\\*`,zvt=`[v=\\s]*(${Dci})(?:\\.(${Dci})(?:\\.(${Dci})(?:${mgl})?${hgl}?)?)?`,ggl=`^${dgl}\\s*${zvt}$`,Agl=new RegExp(ggl),ygl=`^\\s*(${zvt})\\s+-\\s+(${zvt})\\s*$`,bgl=new RegExp(ygl),Egl="(?:~>?)",vgl=`^${Egl}${zvt}$`,Igl=new RegExp(vgl),wgl="(?:\\^)",xgl=`^${wgl}${zvt}$`,Cgl=new RegExp(xgl);function _gl(e){let t=Igl;return e.replace(t,(r,n,i,o,s)=>{let a;return NR(n)?a="":NR(i)?a=`>=${n}.0.0 <${+n+1}.0.0-0`:NR(o)?a=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:s?a=`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:a=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,a})}function Sgl(e,t){let r=Cgl,n=t?.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{let u;return NR(o)?u="":NR(s)?u=`>=${o}.0.0${n} <${+o+1}.0.0-0`:NR(a)?o==="0"?u=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`:c?o==="0"?s==="0"?u=`>=${o}.${s}.${a}-${c} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a}-${c} <${+o+1}.0.0-0`:o==="0"?s==="0"?u=`>=${o}.${s}.${a}${n} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a} <${+o+1}.0.0-0`,u})}function Tgl(e,t){let r=Agl;return e.replace(r,(n,i,o,s,a,c)=>{let u=NR(o),l=u||NR(s),p=l||NR(a),d=p;return i==="="&&d&&(i=""),c=t?.includePrerelease?"-0":"",u?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(s=0),a=0,i===">"?(i=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",l?o=+o+1:s=+s+1),i==="<"&&(c="-0"),n=`${i+o}.${s}.${a}${c}`):l?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:p&&(n=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`),n})}function Ogl(e,t){let r=bgl;return e.replace(r,(n,i,o,s,a,c,u,l,p,d,f,m)=>(NR(o)?i="":NR(s)?i=`>=${o}.0.0${t?.includePrerelease?"-0":""}`:NR(a)?i=`>=${o}.${s}.0${t?.includePrerelease?"-0":""}`:c?i=`>=${i}`:i=`>=${i}${t?.includePrerelease?"-0":""}`,NR(p)?l="":NR(d)?l=`<${+p+1}.0.0-0`:NR(f)?l=`<${p}.${+d+1}.0-0`:m?l=`<=${p}.${d}.${f}-${m}`:t?.includePrerelease?l=`<${p}.${d}.${+f+1}-0`:l=`<=${l}`,`${i} ${l}`.trim()))}var jR=console.error.bind(console);function Vvt(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var jOe=(e,t,r)=>{if(!e||!e[t]){jR("no original function "+String(t)+" to wrap");return}if(!r){jR("no wrapper function"),jR(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){jR("original object and wrapper must be functions");return}let i=r(n,t);return Vvt(i,"__original",n),Vvt(i,"__unwrap",()=>{e[t]===i&&Vvt(e,t,n)}),Vvt(i,"__wrapped",!0),Vvt(e,t,i),i},kci=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{jR("must provide one or more modules to patch"),jR(new Error().stack);return}if(!(t&&Array.isArray(t))){jR("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(i=>{jOe(n,i,r)})})},X5e=(e,t)=>{if(!e||!e[t]){jR("no function to unwrap."),jR(new Error().stack);return}let r=e[t];if(!r.__unwrap)jR("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},Nci=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{jR("must provide one or more modules to patch"),jR(new Error().stack);return}if(!(t&&Array.isArray(t))){jR("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{X5e(r,n)})})};function qvt(e){e&&e.logger&&(typeof e.logger!="function"?jR("new logger isn't a function, not replacing"):jR=e.logger)}qvt.wrap=jOe;qvt.massWrap=kci;qvt.unwrap=X5e;qvt.massUnwrap=Nci;lo();var rWt=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=Pi.createComponentLogger({namespace:t}),this._tracer=rs.getTracer(t,r),this._meter=VQ.getMeter(t,r),this._logger=iAs.getLogger(t,r),this._updateMetricInstruments()}_wrap=jOe;_unwrap=X5e;_massWrap=kci;_massUnwrap=Nci;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,i){if(t)try{t(n,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},o)}}};var hAs=ve(eOe()),jci=ve(require("path"));var nWt=class{hooks=[];children=new Map},iWt=class{_trie=new nWt;_counter=0;insert(t){let r=this._trie;for(let n of t.moduleName.split("/")){let i=r.children.get(n);i||(i=new nWt,r.children.set(n,i)),r=i}r.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:r,fullOnly:n}={}){let i=this._trie,o=[],s=!0;for(let a of t.split("/")){let c=i.children.get(a);if(!c){s=!1;break}n||o.push(...c.hooks),i=c}return n&&s&&o.push(...i.hooks),o.length===0?[]:o.length===1?[o[0].hook]:(r&&o.sort((a,c)=>a.insertedId-c.insertedId),o.map(({hook:a})=>a))}};var Pgl=["afterEach","after","beforeEach","before","describe","it"].every(e=>typeof global[e]=="function"),oWt=class e{_moduleNameTrie=new iWt;static _instance;constructor(){this._initialize()}_initialize(){new hAs.Hook(null,{internals:!0},(t,r,n)=>{let i=Rgl(r),o=this._moduleNameTrie.search(i,{maintainInsertionOrder:!0,fullOnly:n===void 0});for(let{onRequire:s}of o)t=s(t,r,n);return t})}register(t,r){let n={moduleName:t,onRequire:r};return this._moduleNameTrie.insert(n),n}static getInstance(){return Pgl?new e:this._instance=this._instance??new e}};function Rgl(e){return jci.sep!=="/"?e.split(jci.sep).join("/"):e}var yAs=ve(Pai());lo();var bAs=ve(eOe()),EAs=require("fs");function gAs(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var QOe=class extends rWt{_modules;_hooks=[];_requireInTheMiddleSingleton=oWt.getInstance();_enabled=!1;constructor(t,r,n){super(t,r,n);let i=this.init();i&&!Array.isArray(i)&&(i=[i]),this._modules=i||[],this._config.enabled&&this.enable()}_wrap=(t,r,n)=>{if(gAs(t[r])&&this._unwrap(t,r),Qci.types.isProxy(t)){let i=jOe(Object.assign({},t),r,n);return Object.defineProperty(t,r,{value:i}),i}else return jOe(t,r,n)};_unwrap=(t,r)=>Qci.types.isProxy(t)?Object.defineProperty(t,r,{value:t[r]}):X5e(t,r);_massWrap=(t,r,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Pi.error("must provide one or more modules to patch");return}if(!(r&&Array.isArray(r))){Pi.error("must provide one or more functions to wrap on modules");return}t.forEach(i=>{r.forEach(o=>{this._wrap(i,o,n)})})};_massUnwrap=(t,r)=>{if(t)Array.isArray(t)||(t=[t]);else{Pi.error("must provide one or more modules to patch");return}if(!(r&&Array.isArray(r))){Pi.error("must provide one or more functions to wrap on modules");return}t.forEach(n=>{r.forEach(i=>{this._unwrap(n,i)})})};_warnOnPreloadedModules(){this._modules.forEach(t=>{let{name:r}=t;try{let n=require.resolve(r);require.cache[n]&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(t){try{let r=(0,EAs.readFileSync)(koe.join(t,"package.json"),{encoding:"utf8"}),n=JSON.parse(r).version;return typeof n=="string"?n:void 0}catch{Pi.warn("Failed extracting version",t)}}_onRequire(t,r,n,i){if(!i)return typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:t.name}),t.patch(r)):r;let o=this._extractPackageVersion(i);if(t.moduleVersion=o,t.name===n)return AAs(t.supportedVersions,o,t.includePrerelease)&&typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:t.name,version:t.moduleVersion,baseDir:i}),t.patch(r,t.moduleVersion)):r;let s=t.files??[],a=koe.normalize(n);return s.filter(u=>u.name===a).filter(u=>AAs(u.supportedVersions,o,t.includePrerelease)).reduce((u,l)=>(l.moduleExports=u,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:t.name,version:t.moduleVersion,fileName:l.name,baseDir:i}),l.patch(u,t.moduleVersion)):u),r)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let t of this._modules){typeof t.patch=="function"&&t.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:t.name,version:t.moduleVersion}),t.patch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.patch(r.moduleExports,t.moduleVersion))}return}this._warnOnPreloadedModules();for(let t of this._modules){let r=(s,a,c)=>{if(!c&&koe.isAbsolute(a)){let u=koe.parse(a);a=u.name,c=u.dir}return this._onRequire(t,s,a,c)},n=(s,a,c)=>this._onRequire(t,s,a,c),i=koe.isAbsolute(t.name)?new bAs.Hook([t.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(t.name,n);this._hooks.push(i);let o=new yAs.Hook([t.name],{internals:!1},r);this._hooks.push(o)}}}disable(){if(this._enabled){this._enabled=!1;for(let t of this._modules){typeof t.unpatch=="function"&&t.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:t.name,version:t.moduleVersion}),t.unpatch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.unpatch(r.moduleExports,t.moduleVersion))}}}isEnabled(){return this._enabled}};function AAs(e,t,r){return typeof t>"u"?e.includes("*"):e.some(n=>lAs(t,n,{includePrerelease:r}))}var Gvt=class{name;supportedVersions;patch;unpatch;files;constructor(t,r,n,i,o){this.name=t,this.supportedVersions=r,this.patch=n,this.unpatch=i,this.files=o||[]}};lo();var Dgl={name:"@prisma/instrumentation-contract",version:"7.6.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},Fgl=Dgl.version.split(".")[0],Mci="PRISMA_INSTRUMENTATION",Lci=`V${Fgl}_PRISMA_INSTRUMENTATION`,Z5e=globalThis;function kgl(){let e=Z5e[Lci];return e?.helper?e.helper:Z5e[Mci]?.helper}function Ngl(e){let t={helper:e};Z5e[Lci]=t,Z5e[Mci]=t}function jgl(){delete Z5e[Lci],delete Z5e[Mci]}var Qgl=process.env.PRISMA_SHOW_ALL_TRACES==="true",Mgl="00-10-10-00";function Lgl(e){return e==="client"?Ng.CLIENT:Ng.INTERNAL}var Ugl=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:e,ignoreSpanTypes:t}){this.tracerProvider=e,this.ignoreSpanTypes=t}isEnabled(){return!0}getTraceParent(e){let t=rs.getSpanContext(e??Zi.active());return t?`00-${t.traceId}-${t.spanId}-0${t.traceFlags}`:Mgl}dispatchEngineSpans(e){let t=this.tracerProvider.getTracer("prisma"),r=new Map,n=e.filter(i=>i.parentId===null);for(let i of n)wAs(t,i,e,r,this.ignoreSpanTypes)}getActiveContext(){return Zi.active()}runInChildSpan(e,t){if(typeof e=="string"&&(e={name:e}),e.internal&&!Qgl)return t();let r=this.tracerProvider.getTracer("prisma"),n=e.context??this.getActiveContext(),i=`prisma:client:${e.name}`;if(xAs(i,this.ignoreSpanTypes))return t();if(e.active===!1){let o=r.startSpan(i,e,n);return vAs(o,t(o,n))}return r.startActiveSpan(i,e,o=>vAs(o,t(o,n)))}};function wAs(e,t,r,n,i){if(xAs(t.name,i))return;let o={attributes:t.attributes,kind:Lgl(t.kind),startTime:t.startTime};e.startActiveSpan(t.name,o,s=>{n.set(t.id,s.spanContext().spanId),t.links&&s.addLinks(t.links.flatMap(c=>{let u=n.get(c);return u?{context:{spanId:u,traceId:s.spanContext().traceId,traceFlags:s.spanContext().traceFlags}}:[]}));let a=r.filter(c=>c.parentId===t.id);for(let c of a)wAs(e,c,r,n,i);s.end(t.endTime)})}function vAs(e,t){return zgl(t)?t.then(r=>(e.end(),r),r=>{throw e.end(),r}):(e.end(),t)}function zgl(e){return e!=null&&typeof e.then=="function"}function xAs(e,t){return t.some(r=>typeof r=="string"?r===e:r.test(e))}var CAs={name:"@prisma/instrumentation",version:"7.6.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},IAs=CAs.version,Vgl=CAs.name,qgl="@prisma/client",_As=class extends QOe{tracerProvider;constructor(e={}){super(Vgl,IAs,e)}setTracerProvider(e){this.tracerProvider=e}init(){return[new Gvt(qgl,[IAs])]}enable(){let e=this._config;Ngl(new Ugl({tracerProvider:this.tracerProvider??rs.getTracerProvider(),ignoreSpanTypes:e.ignoreSpanTypes??[]}))}disable(){jgl()}isEnabled(){return kgl()!==void 0}};var SAs="Prisma";function Ggl(e){return!!e&&typeof e=="object"&&"dispatchEngineSpans"in e}function TAs(){let e=globalThis.PRISMA_INSTRUMENTATION;return e&&typeof e=="object"&&"helper"in e?e.helper:void 0}var Uci=class extends _As{constructor(t){super(t?.instrumentationConfig)}enable(){super.enable();let t=TAs();Ggl(t)&&(t.createEngineSpan=r=>{let n=rs.getTracer("prismaV5Compatibility"),i=n._idGenerator;if(!i){Rv(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{r.spans.forEach(o=>{let s=Wgl(o.kind),a=o.parent_span_id,c=o.span_id,u=o.trace_id,l=o.links?.map(d=>({context:{traceId:d.trace_id,spanId:d.span_id,traceFlags:Tb.SAMPLED}})),p=rs.setSpanContext(Zi.active(),{traceId:u,spanId:a,traceFlags:Tb.SAMPLED});Zi.with(p,()=>{let d={generateTraceId:()=>u,generateSpanId:()=>c};n._idGenerator=d,n.startSpan(o.name,{kind:s,links:l,startTime:o.start_time,attributes:o.attributes}).end(o.end_time),n._idGenerator=i})})}finally{n._idGenerator=i}})}};function Wgl(e){return e==="client"?Ng.CLIENT:Ng.INTERNAL}var $gl=ws(SAs,e=>new Uci(e)),OAs=e=>({name:SAs,setupOnce(){$gl(e)},setup(t){TAs()&&t.on("spanStart",r=>{let n=lc(r);n.description?.startsWith("prisma:")&&r.setAttribute(bc,"auto.db.otel.prisma"),n.description==="prisma:engine:db_query"&&n.data["db.query.text"]&&r.updateName(n.data["db.query.text"]),n.description==="prisma:engine:db_query"&&!n.data["db.system"]&&r.setAttribute("db.system","prisma")})}});var MAs=ve(QAs(),1);var LAs="Hapi",UAs=ws(LAs,()=>new MAs.HapiInstrumentation),sAl=(()=>({name:LAs,setupOnce(){UAs()}})),zAs=sAl;Cf();var $de={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Jvt={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};lo();Fu();var aAl="@sentry/instrumentation-hono",cAl="0.0.1",cWt=class extends yh{constructor(t={}){super(aAl,cAl,t)}init(){return[new bh("hono",[">=4.0.0 <5"],t=>this._patch(t))]}_patch(t){let r=this;class n extends t.Hono{constructor(...o){super(...o),r._wrap(this,"get",r._patchHandler()),r._wrap(this,"post",r._patchHandler()),r._wrap(this,"put",r._patchHandler()),r._wrap(this,"delete",r._patchHandler()),r._wrap(this,"options",r._patchHandler()),r._wrap(this,"patch",r._patchHandler()),r._wrap(this,"all",r._patchHandler()),r._wrap(this,"on",r._patchOnHandler()),r._wrap(this,"use",r._patchMiddlewareHandler())}}try{t.Hono=n}catch{return{...t,Hono:n}}return t}_patchHandler(){let t=this;return function(r){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return r.apply(this,[o]);let s=i.slice(1);return r.apply(this,[o,...s.map(a=>t._wrapHandler(a))])}return r.apply(this,i.map(o=>t._wrapHandler(o)))}}}_patchOnHandler(){let t=this;return function(r){return function(...i){let o=i.slice(2);return r.apply(this,[...i.slice(0,2),...o.map(s=>t._wrapHandler(s))])}}}_patchMiddlewareHandler(){let t=this;return function(r){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return r.apply(this,[o]);let s=i.slice(1);return r.apply(this,[o,...s.map(a=>t._wrapHandler(a))])}return r.apply(this,i.map(o=>t._wrapHandler(o)))}}}_wrapHandler(t){let r=this;return function(n,i){if(!r.isEnabled())return t.apply(this,[n,i]);let o=n.req.path,s=r.tracer.startSpan(o);return Zi.with(rs.setSpan(Zi.active(),s),()=>r._safeExecute(()=>{let a=t.apply(this,[n,i]);if(C1(a))return a.then(c=>{let u=r._determineHandlerType(c);return s.setAttributes({[$de.HONO_TYPE]:u,[$de.HONO_NAME]:u===Jvt.REQUEST_HANDLER?o:t.name||"anonymous"}),r.getConfig().responseHook?.(s),c});{let c=r._determineHandlerType(a);return s.setAttributes({[$de.HONO_TYPE]:c,[$de.HONO_NAME]:c===Jvt.REQUEST_HANDLER?o:t.name||"anonymous"}),r.getConfig().responseHook?.(s),a}},()=>s.end(),a=>{r._handleError(s,a),s.end()}))}}_safeExecute(t,r,n){try{let i=t();return C1(i)?i.then(()=>r(),o=>n(o)):r(),i}catch(i){throw n(i),i}}_determineHandlerType(t){return t===void 0?Jvt.MIDDLEWARE:Jvt.REQUEST_HANDLER}_handleError(t,r){r instanceof Error&&(t.setStatus({code:uA.ERROR,message:r.message}),t.recordException(r))}};var VAs="Hono";function uAl(e){let t=lc(e).data,r=t[$de.HONO_TYPE];if(t[Au]||!r)return;e.setAttributes({[bc]:"auto.http.otel.hono",[Au]:`${r}.hono`});let n=t[$de.HONO_NAME];if(typeof n=="string"&&e.updateName(n),Mp()===FU()){Bx&&Zt.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=t[doe],o=t[KTe];typeof i=="string"&&typeof o=="string"&&Mp().setTransactionName(`${o} ${i}`)}var qAs=ws(VAs,()=>new cWt({responseHook:e=>{uAl(e)}})),lAl=(()=>({name:VAs,setupOnce(){qAs()}})),GAs=lAl;var nys=ve(rys(),1);Cf();var iys="Koa",oys=ws(iys,nys.KoaInstrumentation,(e={})=>({ignoreLayersType:e.ignoreLayersType,requestHook(t,r){jg(t,"auto.http.otel.koa");let n=lc(t).data,i=n["koa.type"];i&&t.setAttribute(Au,`${i}.koa`);let o=n["koa.name"];if(typeof o=="string"&&t.updateName(o||"< unknown >"),Mp()===FU()){Bx&&Zt.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let s=n[doe],a=r.context?.request?.method?.toUpperCase()||"GET";s&&Mp().setTransactionName(`${a} ${s}`)}})),bAl=((e={})=>({name:iys,setupOnce(){oys(e)}})),sys=bAl;var hys=ve(mys(),1);var gys="Connect",Ays=ws(gys,()=>new hys.ConnectInstrumentation),OAl=(()=>({name:gys,setupOnce(){Ays()}})),yys=OAl;var Tys=ve(Sys(),1);var FAl=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),Oys="Tedious",Bys=ws(Oys,()=>new Tys.TediousInstrumentation({})),kAl=(()=>{let e;return{name:Oys,setupOnce(){let t=Bys();e=jEt(t)},setup(t){e?.(()=>t.on("spanStart",r=>{let{description:n,data:i}=lc(r);if(!n||i["db.system"]!=="mssql")return;let o=n.split(" ")[0]||"";FAl.has(o)&&r.setAttribute(bc,"auto.db.otel.tedious")}))}}}),Pys=kAl;var Nys=ve(kys(),1);var jys="GenericPool",Qys=ws(jys,()=>new Nys.GenericPoolInstrumentation({})),jAl=(()=>{let e;return{name:jys,setupOnce(){let t=Qys();e=jEt(t)},setup(t){e?.(()=>t.on("spanStart",r=>{let i=lc(r).description;(i==="generic-pool.aquire"||i==="generic-pool.acquire")&&r.setAttribute(bc,"auto.db.otel.generic_pool")}))}}}),Mys=jAl;var Kys=ve(Hys(),1);var Jys="Amqplib",HAl={consumeEndHook:e=>{jg(e,"auto.amqplib.otel.consumer")},publishHook:e=>{jg(e,"auto.amqplib.otel.publisher")}},Yys=ws(Jys,()=>new Kys.AmqplibInstrumentation(HAl)),KAl=(()=>({name:Jys,setupOnce(){Yys()}})),Xys=KAl;var tIt="VercelAI";Fu();var JAl=[">=3.0.0 <7"],Zys=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function YAl(e){if(typeof e!="object"||e===null)return!1;let t=e;return"type"in t&&"error"in t&&"toolName"in t&&"toolCallId"in t&&t.type==="tool-error"&&t.error instanceof Error}function XAl(e){if(typeof e!="object"||e===null||!("content"in e))return;let t=e;Array.isArray(t.content)&&(ZAl(t.content),eyl(t.content))}function ZAl(e){for(let t of e){if(!YAl(t))continue;let r=dsi(t.toolCallId);r?HQ(n=>{n.setContext("trace",{trace_id:r.traceId,span_id:r.spanId}),n.setTag("vercel.ai.tool.name",t.toolName),n.setTag("vercel.ai.tool.callId",t.toolCallId),n.setLevel("error"),fl(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):HQ(n=>{n.setTag("vercel.ai.tool.name",t.toolName),n.setTag("vercel.ai.tool.callId",t.toolCallId),n.setLevel("error"),fl(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function eyl(e){for(let t of e)typeof t=="object"&&t!==null&&"toolCallId"in t&&typeof t.toolCallId=="string"&&msi(t.toolCallId)}function tyl(e,t,r,n){let i=e?.recordInputs!==void 0?e.recordInputs:t.recordInputs!==void 0?t.recordInputs:r===!0?!0:n,o=e?.recordOutputs!==void 0?e.recordOutputs:t.recordOutputs!==void 0?t.recordOutputs:r===!0?!0:n;return{recordInputs:i,recordOutputs:o}}var xWt=class e extends yh{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(t={}){super("@sentry/instrumentation-vercel-ai",df,t),e.prototype.__init.call(this),e.prototype.__init2.call(this)}init(){return new bh("ai",JAl,this._patch.bind(this))}callWhenPatched(t){this._isPatched?t():this._callbacks.push(t)}_patch(t){this._isPatched=!0,this._callbacks.forEach(n=>n()),this._callbacks=[];let r=n=>new Proxy(n,{apply:(i,o,s)=>{let a=s[0].experimental_telemetry||{},c=a.isEnabled,u=La(),l=u?.getIntegrationByName(tIt),p=l?.options,d=l?!!u?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=tyl(p,a,c,d);return s[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},H6(()=>Reflect.apply(i,o,s),h=>{h&&typeof h=="object"&&ew(h,"_sentry_active_span",NU())},()=>{},h=>{XAl(h)})}});if(Object.prototype.toString.call(t)==="[object Module]"){for(let n of Zys)t[n]!=null&&(t[n]=r(t[n]));return t}else{let n=Zys.reduce((i,o)=>(t[o]!=null&&(i[o]=r(t[o])),i),{});return{...t,...n}}}};var ebs=ws(tIt,()=>new xWt({}));function ryl(e){return!!e.getIntegrationByName("Modules")?.getModules?.()?.ai}var nyl=((e={})=>{let t;return{name:tIt,options:e,setupOnce(){t=ebs()},afterAllSetup(r){e.force??ryl(r)?MGt(r):t?.callWhenPatched(()=>MGt(r))}}}),tbs=nyl;Fu();var iyl=[">=4.0.0 <7"],CWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-openai",df,t)}init(){return new bh("openai",iyl,this._patch.bind(this))}_patch(t){let r=t;return r=this._patchClient(r,"OpenAI"),r=this._patchClient(r,"AzureOpenAI"),r}_patchClient(t,r){let n=t[r];if(!n)return t;let i=this.getConfig(),o=function(...s){if(fOe(Ode))return Reflect.construct(n,s);let a=Reflect.construct(n,s);return UGt(a,i)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(o,s,a)}try{t[r]=o}catch{Object.defineProperty(t,r,{value:o,writable:!0,configurable:!0,enumerable:!0})}if(t.default===n)try{t.default=o}catch{Object.defineProperty(t,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return t}};var rbs=ws(Ode,e=>new CWt(e)),oyl=((e={})=>({name:Ode,setupOnce(){rbs(e)}})),nbs=oyl;Fu();var syl=[">=0.19.2 <1.0.0"],_Wt=class extends yh{constructor(t={}){super("@sentry/instrumentation-anthropic-ai",df,t)}init(){return new bh("@anthropic-ai/sdk",syl,this._patch.bind(this))}_patch(t){let r=t.Anthropic,n=this.getConfig(),i=function(...o){if(fOe(Bde))return Reflect.construct(r,o);let s=Reflect.construct(r,o);return zGt(s,n)};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.prototype,r.prototype);for(let o of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(i,o,s)}try{t.Anthropic=i}catch{Object.defineProperty(t,"Anthropic",{value:i,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=i}catch{Object.defineProperty(t,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return t}};var ibs=ws(Bde,e=>new _Wt(e)),ayl=((e={})=>({name:Bde,options:e,setupOnce(){ibs(e)}})),obs=ayl;Fu();var sbs=[">=0.10.0 <2"],SWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-google-genai",df,t)}init(){return new bh("@google/genai",sbs,r=>this._patch(r),r=>r,[new x1("@google/genai/dist/node/index.cjs",sbs,r=>this._patch(r),r=>r)])}_patch(t){let r=t.GoogleGenAI,n=this.getConfig();if(typeof r!="function")return t;let i=function(...o){if(fOe(Pde))return Reflect.construct(r,o);let s=Reflect.construct(r,o);return VGt(s,n)};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.prototype,r.prototype);for(let o of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(i,o,s)}return kEt(t,"GoogleGenAI",i),t}};var abs=ws(Pde,e=>new SWt(e)),cyl=((e={})=>({name:Pde,setupOnce(){abs(e)}})),cbs=cyl;Fu();var TWt=[">=0.1.0 <2.0.0"];function uyl(e,t){return e?Array.isArray(e)?e.includes(t)?e:[...e,t]:typeof e=="object"?[e,t]:e:[t]}function lyl(e,t,r){return new Proxy(e,{apply(n,i,o){let a=o[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},o[1]=a);let c=a.callbacks,u=uyl(c,t);return a.callbacks=u,Reflect.apply(n,i,o)}})}var OWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-langchain",df,t)}init(){let t=[],r=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let n of r)t.push(new bh(n,TWt,this._patch.bind(this),i=>i,[new x1(`${n}/dist/index.cjs`,TWt,this._patch.bind(this),i=>i)]));return t.push(new bh("langchain",TWt,this._patch.bind(this),n=>n,[new x1("langchain/dist/chat_models/universal.cjs",TWt,this._patch.bind(this),n=>n)])),t}_patch(t){Doi([Ode,Bde,Pde]);let r=GGt(this.getConfig());return this._patchRunnableMethods(t,r),t}_patchRunnableMethods(t,r){let n=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],i=t.universal_exports??t,o=Object.values(i).find(c=>typeof c=="function"&&n.includes(c.name));if(!o)return;let s=o.prototype;if(s.__sentry_patched__)return;s.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let u=s[c];typeof u=="function"&&(s[c]=lyl(u,r))}}};var ubs=ws(qGt,e=>new OWt(e)),pyl=((e={})=>({name:qGt,setupOnce(){ubs(e)}})),lbs=pyl;Fu();var pbs=[">=0.0.0 <2.0.0"],BWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-langgraph",df,t)}init(){return new bh("@langchain/langgraph",pbs,this._patch.bind(this),r=>r,[new x1("@langchain/langgraph/dist/index.cjs",pbs,this._patch.bind(this),r=>r)])}_patch(t){return t.StateGraph&&typeof t.StateGraph=="function"&&$Gt(t.StateGraph.prototype,this.getConfig()),t}};var fbs=ws(WGt,e=>new BWt(e)),fyl=((e={})=>({name:WGt,setupOnce(){fbs(e)}})),dbs=fyl;Fu();var hbs=ve(require("net"),1);lo();Fu();Cf();function gbs(e,t,r,n,i){let s=()=>{},a=i.firestoreSpanCreationHook;typeof a=="function"&&(s=l=>{WQ(()=>a(l),p=>{p&&Pi.error(p?.message)},!0)});let c=new bh("@firebase/firestore",t,l=>mbs(l,r,n,e,s)),u=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let l of u)c.files.push(new x1(l,t,p=>mbs(p,r,n,e,s),p=>Abs(p,n)));return c}function mbs(e,t,r,n,i){return Abs(e,r),t(e,"addDoc",dyl(n,i)),t(e,"getDocs",hyl(n,i)),t(e,"setDoc",gyl(n,i)),t(e,"deleteDoc",myl(n,i)),e}function Abs(e,t){for(let r of["addDoc","getDocs","setDoc","deleteDoc"])ide(e[r])&&t(e,r);return e}function dyl(e,t){return function(n){return function(i,o){let s=RWt(e,"addDoc",i);return t(s),PWt(s,()=>n(i,o))}}}function myl(e,t){return function(n){return function(i){let o=RWt(e,"deleteDoc",i.parent||i);return t(o),PWt(o,()=>n(i))}}}function hyl(e,t){return function(n){return function(i){let o=RWt(e,"getDocs",i);return t(o),PWt(o,()=>n(i))}}}function gyl(e,t){return function(n){return function(i,o,s){let a=RWt(e,"setDoc",i.parent||i);return t(a),PWt(a,()=>typeof s<"u"?n(i,o,s):n(i,o))}}}function PWt(e,t){return Zi.with(rs.setSpan(Zi.active(),e),()=>WQ(()=>t(),r=>{r&&e.recordException(r),e.end()},!0))}function RWt(e,t,r){let n=e.startSpan(`${t} ${r.path}`,{kind:Ng.CLIENT});return yyl(n,r),n.setAttribute(bze,t),n}function Ayl(e){let t,r;if(typeof e.host=="string")if(e.host.startsWith("[")){if(e.host.endsWith("]"))t=e.host.replace(/^\[|\]$/g,"");else if(e.host.includes("]:")){let n=e.host.lastIndexOf(":");n!==-1&&(t=e.host.slice(1,n).replace(/^\[|\]$/g,""),r=e.host.slice(n+1))}}else if(hbs.isIPv6(e.host))t=e.host;else{let n=e.host.lastIndexOf(":");n!==-1?(t=e.host.slice(0,n),r=e.host.slice(n+1)):t=e.host}return{address:t,port:r?parseInt(r,10):void 0}}function yyl(e,t){let r=t.firestore.app,n=r.options,o=(t.firestore.toJSON()||{}).settings||{},s={[Pni]:t.path,[Rni]:r.name,[HTe]:"firebase.firestore","firebase.firestore.type":t.type,"firebase.firestore.options.projectId":n.projectId,"firebase.firestore.options.appId":n.appId,"firebase.firestore.options.messagingSenderId":n.messagingSenderId,"firebase.firestore.options.storageBucket":n.storageBucket},{address:a,port:c}=Ayl(o);a&&(s[Uni]=a),c&&(s[zni]=c),e.setAttributes(s)}lo();Fu();function ybs(e,t,r,n,i){let o=()=>{},s=()=>{},a=i.functions?.errorHook,c=i.functions?.requestHook,u=i.functions?.responseHook;typeof u=="function"&&(s=(d,f)=>{WQ(()=>u(d,f),m=>{m&&Pi.error(m?.message)},!0)}),typeof c=="function"&&(o=d=>{WQ(()=>c(d),f=>{f&&Pi.error(f?.message)},!0)});let l=new bh("firebase-functions",t);return[{name:"firebase-functions/lib/v2/providers/https.js",triggerType:"function"},{name:"firebase-functions/lib/v2/providers/firestore.js",triggerType:"firestore"},{name:"firebase-functions/lib/v2/providers/scheduler.js",triggerType:"scheduler"},{name:"firebase-functions/lib/v2/storage.js",triggerType:"storage"}].forEach(({name:d,triggerType:f})=>{l.files.push(new x1(d,t,m=>byl(m,r,n,e,{requestHook:o,responseHook:s,errorHook:a},f),m=>bbs(m,n)))}),l}function MR(e,t,r){return function(i){return function(...o){let s=typeof o[0]=="function"?o[0]:o[1],a=typeof o[0]=="function"?void 0:o[0];if(!s)return i.call(this,...o);let c=async function(...u){let l=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",p=e.startSpan(`firebase.function.${r}`,{kind:Ng.SERVER}),d={"faas.name":l,"faas.trigger":r,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(d["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(d["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),p.setAttributes(d),t?.requestHook?.(p),Zi.with(rs.setSpan(Zi.active(),p),async()=>{let f,m;try{m=await s.apply(this,u)}catch(h){f=h}if(t?.responseHook?.(p,f),f&&p.recordException(f),p.end(),f)throw await t?.errorHook?.(p,f),f;return m})};return a?i.call(this,a,c):i.call(this,c)}}}function byl(e,t,r,n,i,o){switch(bbs(e,r),o){case"function":t(e,"onRequest",MR(n,i,"http.request")),t(e,"onCall",MR(n,i,"http.call"));break;case"firestore":t(e,"onDocumentCreated",MR(n,i,"firestore.document.created")),t(e,"onDocumentUpdated",MR(n,i,"firestore.document.updated")),t(e,"onDocumentDeleted",MR(n,i,"firestore.document.deleted")),t(e,"onDocumentWritten",MR(n,i,"firestore.document.written")),t(e,"onDocumentCreatedWithAuthContext",MR(n,i,"firestore.document.created")),t(e,"onDocumentUpdatedWithAuthContext",MR(n,i,"firestore.document.updated")),t(e,"onDocumentDeletedWithAuthContext",MR(n,i,"firestore.document.deleted")),t(e,"onDocumentWrittenWithAuthContext",MR(n,i,"firestore.document.written"));break;case"scheduler":t(e,"onSchedule",MR(n,i,"scheduler.scheduled"));break;case"storage":t(e,"onObjectFinalized",MR(n,i,"storage.object.finalized")),t(e,"onObjectArchived",MR(n,i,"storage.object.archived")),t(e,"onObjectDeleted",MR(n,i,"storage.object.deleted")),t(e,"onObjectMetadataUpdated",MR(n,i,"storage.object.metadataUpdated"));break}return e}function bbs(e,t){let r=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let n of r)ide(e[n])&&t(e,n);return e}var Ebs={},Eyl=[">=3.0.0 <5"],vyl=[">=6.0.0 <7"],DWt=class extends yh{constructor(t=Ebs){super("@sentry/instrumentation-firebase",df,t)}setConfig(t={}){super.setConfig({...Ebs,...t})}init(){let t=[];return t.push(gbs(this.tracer,Eyl,this._wrap,this._unwrap,this.getConfig())),t.push(ybs(this.tracer,vyl,this._wrap,this._unwrap,this.getConfig())),t}};var vbs="Firebase",Iyl={firestoreSpanCreationHook:e=>{jg(e,"auto.firebase.otel.firestore"),e.setAttribute(Au,"db.query")},functions:{requestHook:e=>{jg(e,"auto.firebase.otel.functions"),e.setAttribute(Au,"http.request")},errorHook:async(e,t)=>{t&&(fl(t,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await gGt(2e3))}}},Ibs=ws(vbs,()=>new DWt(Iyl)),wyl=(()=>({name:vbs,setupOnce(){Ibs()}})),wbs=wyl;function xbs(){return[Bfs(),lms(),Nms(),GAs(),Ehs(),Fhs(),Ghs(),rgs(),Rgs(),Xgs(),OAs(),zAs(),sys(),yys(),Pys(),Mys(),Xms(),Xys(),chs(),lbs(),dbs(),tbs(),nbs(),obs(),cbs(),tAs(),wbs()]}lo();Cf();var sui=1e6;function Cbs(e,t={}){e.getOptions().debug&&Ysi();let[r,n]=xyl(e,t);e.traceProvider=r,e.asyncLocalStorageLookup=n}function xyl(e,t={}){let r=new qEt({sampler:new m9t(e),resource:zEt().merge(n9t({[F0t]:"node",[Bni]:"sentry",[Vni]:df})),forceFlushTimeoutMillis:500,spanProcessors:[new d9t({timeout:Cyl(e.getOptions().maxSpanWaitDuration)}),...t.spanProcessors||[]]});rs.setGlobalTracerProvider(r),_R.setGlobalPropagator(new f9t);let n=new Jsi;return Zi.setGlobalContextManager(n),[r,n.getAsyncLocalStorageLookup()]}function Cyl(e){if(e!=null){if(e>sui)return Bx&&Zt.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${sui}`),sui;if(e<=0||Number.isNaN(e)){Bx&&Zt.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function _bs(){return C9t().filter(t=>t.name!=="Http"&&t.name!=="NodeFetch").concat(cfs(),gfs())}function Sbs(e){return[..._bs(),...Dv(e)?xbs():[]]}function rIt(e={}){return _yl(e,Sbs)}function _yl(e={},t){dOe(e,"node");let r=aai({...e,defaultIntegrations:e.defaultIntegrations??t(e)});return r&&!e.skipOpenTelemetrySetup&&(Cbs(r,{spanProcessors:e.openTelemetrySpanProcessors}),cai()),r}function Tbs(){let e=Rri();e!=null&&yEt("fern_run_id",e)}function Obs(){process.env.GITHUB_RUN_ID!=null&&yEt("github_run_id",process.env.GITHUB_RUN_ID)}function nIt(){Tbs(),Obs()}qui();o$t();function kE(e,t,r,n){e.command(t,r,i=>{for(let o of n)o(i);return i.usage(r).demandCommand(1).fail((o,s,a)=>{s!=null&&(process.stderr.write(`${s.message}
|
|
1491
|
+
`);let{connect:u,buffered:l}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),u.statusCode===200){if(t.once("socket",Gll),r.secureEndpoint){XEt("Upgrading socket connection to TLS");let d=r.servername||r.host;return oai.connect({...Hps(r,"host","path","port"),socket:i,servername:Soe.isIP(d)?void 0:d})}return i}i.destroy();let p=new Soe.Socket({writable:!1});return p.readable=!0,t.once("socket",d=>{XEt("Replaying proxy buffer for failed request"),d.push(l),d.push(null)}),p}};ZEt.__initStatic();function Gll(e){e.resume()}function Hps(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}var Hll=1024*32;function Kll(e){return new Kps.Readable({read(){this.push(e),this.push(null)}})}function Yps(e){let t;try{t=new URL(e.url)}catch{return Rv(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),IEt(e,()=>Promise.resolve({}))}let r=t.protocol==="https:",n=Jll(t,e.proxy||(r?process.env.https_proxy:void 0)||process.env.http_proxy),i=r?$ll:Wll,o=e.keepAlive===void 0?!1:e.keepAlive,s=n?new ZEt(n):new i.Agent({keepAlive:o,maxSockets:30,timeout:2e3}),a=Yll(e,e.httpModule??i,s);return IEt(e,a)}function Jll(e,t){let{no_proxy:r}=process.env;if(!r?.split(",").some(i=>e.host.endsWith(i)||e.hostname.endsWith(i)))return t}function Yll(e,t,r){let{hostname:n,pathname:i,port:o,protocol:s,search:a}=new URL(e.url);return function(u){return new Promise((l,p)=>{Kze(()=>{let d=Kll(u.body),f={...e.headers};u.body.length>Hll&&(f["content-encoding"]="gzip",d=d.pipe((0,Jps.createGzip)()));let m=n.startsWith("["),h=t.request({method:"POST",agent:r,headers:f,hostname:m?n.slice(1,-1):n,path:`${i}${a}`,port:o,protocol:s,ca:e.caCerts},g=>{g.on("data",()=>{}),g.on("end",()=>{}),g.setEncoding("utf8");let A=g.headers["retry-after"]??null,b=g.headers["x-sentry-rate-limits"]??null;l({statusCode:g.statusCode,headers:{"retry-after":A,"x-sentry-rate-limits":Array.isArray(b)?b[0]||null:b}})});h.on("error",p),d.pipe(h)})})}}function Xps(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=Zze(process.env.SENTRY_SPOTLIGHT,{strict:!0}),r=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?r??!0:t??r}var I9t=require("path");function Zps(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function efs(e=process.argv[1]?Voi(process.argv[1]):process.cwd(),t=I9t.sep==="\\"){let r=t?Zps(e):e;return n=>{if(!n)return;let i=t?Zps(n):n,{dir:o,base:s,ext:a}=I9t.posix.parse(i);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,a.length*-1));let c=decodeURIComponent(s);o||(o=".");let u=o.lastIndexOf("/node_modules");if(u>-1)return`${o.slice(u+14).replace(/\//g,".")}:${c}`;if(o.startsWith(r)){let l=o.slice(r.length+1).replace(/\//g,".");return l?`${l}:${c}`:c}return c}}function tfs(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(Sc.SENTRY_RELEASE?.id)return Sc.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,r=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,n=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||r||n||e}var rfs=Wqt(Isi(efs()));var nfs=ve(require("os"),1);lo();Fu();var x9t=require("worker_threads");var Xll=6e4,w9t=class extends wEt{constructor(t){let r=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||nfs.hostname(),n={...t,platform:"node",runtime:t.runtime||{name:"node",version:global.process.version},serverName:r};t.openTelemetryInstrumentations&&YTe({instrumentations:t.openTelemetryInstrumentations}),dOe(n,"node"),Zt.log(`Initializing Sentry: process: ${process.pid}, thread: ${x9t.isMainThread?"main":`worker-${x9t.threadId}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Yze(this)},r&&this.on("beforeCaptureLog",i=>{i.attributes={...i.attributes,"server.address":r}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let t="@sentry/node",r=df,n=rs.getTracer(t,r);return this._tracer=n,n}async flush(t){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(t)}async close(t){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let r=await super.close(t);return this.traceProvider&&await this.traceProvider.shutdown(),r}startClientReportTracking(){let t=this.getOptions();t.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{dl&&Zt.log("Flushing client reports based on interval."),this._flushOutcomes()},t.clientReportFlushInterval??Xll).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){Foi(),super._setupIntegrations()}_getTraceInfoFromScope(t){return t?rps(this,t):[void 0,void 0]}};var ifs=ve(wii(),1),ofs=ve(require("module"),1);var Zll={};function sai(){if(Nps()&&!Sc._sentryEsmLoaderHookRegistered){Sc._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,ifs.createAddHookMessageChannel)();ofs.register("import-in-the-middle/hook.mjs",Zll.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){Zt.warn("Failed to register 'import-in-the-middle' hook",e)}}}function C9t(){return[_Gt(),xGt(),SGt(),TGt(),Wps(),Hoi(),BGt(),hls(),yls(),Lps(),Ups(),Cps(),Fps(),Aps(),dps(),zps(),Qps()]}function aai(e={}){return epl(e,C9t)}function epl(e={},t){let r=tpl(e,t);r.debug===!0&&(dl?Zt.enable():Rv(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),r.registerEsmLoaderHooks!==!1&&sai(),ops(),od().update(r.initialScope),r.spotlight&&!r.integrations.some(({name:o})=>o===nai)&&r.integrations.push(qps({sidecarUrl:typeof r.spotlight=="string"?r.spotlight:void 0})),dOe(r,"node-core");let i=new w9t(r);return od().setClient(i),i.init(),Zt.log(`SDK initialized from ${HEt()?"CommonJS":"ESM"}`),i.startClientReportTracking(),ipl(),zls(i),ips(i),process.env.VERCEL&&process.on("SIGTERM",async()=>{await i.flush(200)}),i}function cai(){if(!dl)return;let e=Wls(),t=["SentryContextManager","SentryPropagator"];Dv()&&t.push("SentrySpanProcessor");for(let r of t)e.includes(r)||Zt.error(`You have to set up the ${r}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);e.includes("SentrySampler")||Zt.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function tpl(e,t){let r=rpl(e.release),n=Xps(e.spotlight),i=npl(e.tracesSampleRate),o={...e,dsn:e.dsn??"https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496",environment:e.environment??"production",sendClientReports:e.sendClientReports??!0,transport:e.transport??Yps,stackParser:Fii(e.stackParser||rfs),release:r,tracesSampleRate:i,spotlight:n,debug:Zze(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,a=e.defaultIntegrations??t(o);return{...o,integrations:_oi({defaultIntegrations:a,integrations:s})}}function rpl(e){if(e!==void 0)return e;let t=tfs();if(t!==void 0)return t}function npl(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let r=parseFloat(t);return isFinite(r)?r:void 0}function ipl(){if(Zze(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,r=aEt(e,t);od().setPropagationContext(r)}}function jg(e,t){e.setAttribute(bc,t)}function evt(e){let t=e.protocol||"",r=e.hostname||e.host||"",n=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(r)?"":`:${e.port}`,i=e.path?e.path:"/";return`${t}//${r}${n}${i}`}var uai="Http",sfs="@opentelemetry_sentry-patched/instrumentation-http",_9t=Y6.major===22&&Y6.minor>=12||Y6.major===23&&Y6.minor>=2||Y6.major>=24,opl=ws(`${uai}.sentry`,e=>new vOe(e)),spl=ws(uai,e=>{let t=new afs.HttpInstrumentation({...e,disableIncomingRequestInstrumentation:!0});try{t._diag=Pi.createComponentLogger({namespace:sfs}),t.instrumentationName=sfs}catch{}try{let r={get:()=>!1,set:()=>{}};Object.defineProperty(t,"_httpPatched",r),Object.defineProperty(t,"_httpsPatched",r)}catch{}return t});function apl(e,t={}){return typeof e.spans=="boolean"?e.spans:!(t.skipOpenTelemetrySetup||!Dv(t)&&_9t)}var cfs=(e={})=>{let t=e.spans??!0,r=e.disableIncomingRequestSpans,n={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},i={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},o=QEt(n),s=MEt(i),a=t&&!r;return{name:uai,setup(c){let u=c.getOptions();a&&Dv(u)&&s.setup(c)},setupOnce(){let c=La()?.getOptions()||{},u=apl(e,c);o.setupOnce();let l={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:typeof e.tracePropagation=="boolean"?e.tracePropagation:_9t||!u,createSpansForOutgoingRequests:_9t,spans:e.spans,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(p,d)=>{let f=evt(d);if(f.startsWith("data:")){let m=e5e(f);p.setAttribute("http.url",m),p.setAttribute(mde,m),p.updateName(`${d.method||"GET"} ${m}`)}e.instrumentation?.requestHook?.(p,d)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan};if(opl(l),u){let p=cpl(e);spl(p)}},processEvent(c){return s.processEvent(c)}}};function cpl(e={}){return{disableOutgoingRequestInstrumentation:_9t,ignoreOutgoingRequestHook:r=>{let n=evt(r);if(!n)return!1;let i=e.ignoreOutgoingRequests;return!!i?.(n,r)},requireParentforOutgoingSpans:!1,requestHook:(r,n)=>{jg(r,"auto.http.otel.http");let i=evt(n);if(i.startsWith("data:")){let o=e5e(i);r.setAttribute("http.url",o),r.setAttribute(mde,o),r.updateName(`${n.method||"GET"} ${o}`)}e.instrumentation?.requestHook?.(r,n)},responseHook:(r,n)=>{e.instrumentation?.responseHook?.(r,n)},applyCustomAttributesOnSpan:(r,n,i)=>{e.instrumentation?.applyCustomAttributesOnSpan?.(r,n,i)}}}var mfs=ve(ffs(),1);var hfs="NodeFetch",ppl=ws(hfs,mfs.UndiciInstrumentation,e=>hpl(e)),fpl=ws(`${hfs}.sentry`,IOe,e=>e),dpl=((e={})=>({name:"NodeFetch",setupOnce(){mpl(e,La()?.getOptions())&&ppl(e),fpl(e)}})),gfs=dpl;function dfs(e,t="/"){let r=`${e}`;return r.endsWith("/")&&t.startsWith("/")?`${r}${t.slice(1)}`:!r.endsWith("/")&&!t.startsWith("/")?`${r}/${t}`:`${r}${t}`}function mpl(e,t={}){return typeof e.spans=="boolean"?e.spans:!t.skipOpenTelemetrySetup&&Dv(t)}function hpl(e={}){return{requireParentforSpans:!1,ignoreRequestHook:r=>{let n=dfs(r.origin,r.path),i=e.ignoreOutgoingRequests;return!!(i&&n&&i(n))},startSpanHook:r=>{let n=dfs(r.origin,r.path);if(n.startsWith("data:")){let i=e5e(n);return{[bc]:"auto.http.otel.node_fetch","http.url":i,[mde]:i,[kU]:`${r.method||"GET"} ${i}`}}return{[bc]:"auto.http.otel.node_fetch"}},requestHook:e.requestHook,responseHook:e.responseHook,headersToSpanAttributes:e.headersToSpanAttributes}}var Sfs=ve(_fs(),1);var Bx=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Tfs="Express";function Ppl(e){jg(e,"auto.http.otel.express");let t=lc(e).data,r=t["express.type"];r&&e.setAttribute(Au,`${r}.express`);let n=t["express.name"];typeof n=="string"&&e.updateName(n)}function Rpl(e,t){if(Mp()===FU())return Bx&&Zt.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),t;if(e.layerType==="request_handler"){let r=e.request,n=r.method?r.method.toUpperCase():"GET";Mp().setTransactionName(`${n} ${e.route}`)}return t}var Ofs=ws(Tfs,()=>new Sfs.ExpressInstrumentation({requestHook:e=>Ppl(e),spanNameHook:(e,t)=>Rpl(e,t)})),Dpl=(()=>({name:Tfs,setupOnce(){Ofs()}})),Bfs=Dpl;var Gai=ve(require("diagnostics_channel"),1),ams=ve(tms(),1);lo();VA();Fu();Cf();var Boe;(function(e){let t="fastify.name";e.FASTIFY_NAME=t;let r="fastify.type";e.FASTIFY_TYPE=r;let n="hook.name";e.HOOK_NAME=n;let i="plugin.name";e.PLUGIN_NAME=i})(Boe||(Boe={}));var yvt;(function(e){let t="middleware";e.MIDDLEWARE=t;let r="request_handler";e.REQUEST_HANDLER=r})(yvt||(yvt={}));var bvt;(function(e){let t="middleware";e.MIDDLEWARE=t;let r="request handler";e.REQUEST_HANDLER=r})(bvt||(bvt={}));lo();var Evt=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function qai(e,t,r,n={}){let i=t.startSpan(r,{attributes:n}),o=e[Evt]||[];return o.push(i),Object.defineProperty(e,Evt,{enumerable:!1,configurable:!0,value:o}),i}function s7t(e,t){let r=e[Evt]||[];r.length&&(r.forEach(n=>{t&&(n.setStatus({code:uA.ERROR,message:t.message}),n.recordException(t)),n.end()}),delete e[Evt])}function nms(e,t,r){let n,i;try{i=e(),rms(i)&&i.then(o=>t(void 0,o),o=>t(o))}catch(o){n=o}finally{if(!rms(i)&&(t(n,i),n))throw n;return i}}function rms(e){return typeof e=="object"&&e&&typeof Object.getOwnPropertyDescriptor(e,"then")?.value=="function"||!1}var Wdl="0.1.0",$dl="@sentry/instrumentation-fastify-v3",ims="anonymous",Hdl=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),a7t=class extends yh{constructor(t={}){super($dl,Wdl,t)}init(){return[new bh("fastify",[">=3.0.0 <4"],t=>this._patchConstructor(t))]}_hookOnRequest(){let t=this;return function(n,i,o){if(!t.isEnabled())return o();t._wrap(i,"send",t._patchSend());let s=n,a=xze(Zi.active()),c=s.routeOptions?s.routeOptions.url:n.routerPath;c&&a?.type===hoe.HTTP&&(a.route=c);let u=n.method||"GET";Mp().setTransactionName(`${u} ${c}`),o()}}_wrapHandler(t,r,n,i){let o=this;return this._diag.debug("Patching fastify route.handler function"),function(...s){if(!o.isEnabled())return n.apply(this,s);let a=n.name||t||ims,c=`${bvt.MIDDLEWARE} - ${a}`,u=s[1],l=qai(u,o.tracer,c,{[Boe.FASTIFY_TYPE]:yvt.MIDDLEWARE,[Boe.PLUGIN_NAME]:t,[Boe.HOOK_NAME]:r}),p=i&&s[s.length-1];return p&&(s[s.length-1]=function(...d){s7t(u),p.apply(this,d)}),Zi.with(rs.setSpan(Zi.active(),l),()=>nms(()=>n.apply(this,s),d=>{d instanceof Error&&(l.setStatus({code:uA.ERROR,message:d.message}),l.recordException(d)),i||s7t(u)}))}}_wrapAddHook(){let t=this;return this._diag.debug("Patching fastify server.addHook function"),function(r){return function(...i){let o=i[0],s=i[1],a=this.pluginName;if(!Hdl.has(o))return r.apply(this,i);let c=typeof i[i.length-1]=="function"&&s.constructor.name!=="AsyncFunction";return r.apply(this,[o,t._wrapHandler(a,o,s,c)])}}}_patchConstructor(t){let r=this;function n(...i){let o=t.fastify.apply(this,i);return o.addHook("onRequest",r._hookOnRequest()),o.addHook("preHandler",r._hookPreHandler()),Kdl(),r._wrap(o,"addHook",r._wrapAddHook()),o}return t.errorCodes!==void 0&&(n.errorCodes=t.errorCodes),n.fastify=n,n.default=n,n}_patchSend(){let t=this;return this._diag.debug("Patching fastify reply.send function"),function(n){return function(...o){let s=o[0];return t.isEnabled()?WQ(()=>n.apply(this,o),a=>{!a&&s instanceof Error&&(a=s),s7t(this,a)}):n.apply(this,o)}}}_hookPreHandler(){let t=this;return this._diag.debug("Patching fastify preHandler function"),function(n,i,o){if(!t.isEnabled())return o();let s=n,a=s.routeOptions?.handler||s.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,u=`${bvt.REQUEST_HANDLER} - ${c||this.pluginName||ims}`,l={[Boe.PLUGIN_NAME]:this.pluginName,[Boe.FASTIFY_TYPE]:yvt.REQUEST_HANDLER,[_ni]:s.routeOptions?s.routeOptions.url:n.routerPath};c&&(l[Boe.FASTIFY_NAME]=c);let p=qai(i,t.tracer,u,l);oms(p);let{requestHook:d}=t.getConfig();return d&&WQ(()=>d(p,{request:n}),f=>{f&&t._diag.error("request hook failed",f)},!0),Zi.with(rs.setSpan(Zi.active(),p),()=>{o()})}}};function Kdl(){let e=La();e&&e.on("spanStart",t=>{oms(t)})}function oms(e){let t=lc(e).data,r=t["fastify.type"];if(t[Au]||!r)return;e.setAttributes({[bc]:"auto.http.otel.fastify",[Au]:`${r}.fastify`});let n=t["fastify.name"]||t["plugin.name"]||t["hook.name"];if(typeof n=="string"){let i=n.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(i)}}var c7t="Fastify",cms=ws(`${c7t}.v3`,()=>new a7t);function Jdl(){let e=La();if(e)return e.getIntegrationByName(c7t)}function sms(e,t,r,n){let i=Jdl()?.getShouldHandleError()||pms;if(n==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&n==="onError-hook"){Bx&&Zt.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}i(e,t,r)&&fl(e,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var ums=ws(`${c7t}.v5`,()=>{let e=new ams.FastifyOtelInstrumentation,t=e.plugin();return Gai.subscribe("fastify.initialization",r=>{let n=r.fastify;n?.register(t).after(i=>{i?Bx&&Zt.error("Failed to setup Fastify instrumentation",i):(Xdl(),n&&Zdl(n))})}),Gai.subscribe("tracing:fastify.request.handler:error",r=>{let{error:n,request:i,reply:o}=r;sms.call(sms,n,i,o,"diagnostics-channel")}),e}),Ydl=(({shouldHandleError:e})=>{let t;return{name:c7t,setupOnce(){t=e||pms,cms(),ums()},getShouldHandleError(){return t},setShouldHandleError(r){t=r}}}),lms=(e={})=>Ydl(e);function pms(e,t,r){let n=r.statusCode;return n>=500||n<=299}function fms(e){let t=lc(e),r=t.description,n=t.data,i=n["fastify.type"],o=i==="hook",s=i===r?.startsWith("handler -"),a=r==="request"||i==="request-handler";if(n[Au]||!s&&!a&&!o)return;let c=o?"hook":s?"middleware":a?"request_handler":"<unknown>";e.setAttributes({[bc]:"auto.http.otel.fastify",[Au]:`${c}.fastify`});let u=n["fastify.name"]||n["plugin.name"]||n["hook.name"];if(typeof u=="string"){let l=u.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(l)}}function Xdl(){let e=La();e&&e.on("spanStart",t=>{fms(t)})}function Zdl(e){e.addHook("onRequest",async(t,r)=>{if(t.opentelemetry){let{span:o}=t.opentelemetry();o&&fms(o)}let n=t.routeOptions?.url,i=t.method||"GET";Mp().setTransactionName(`${i} ${n}`)})}lo();var Dms=ve(Rms(),1);var Fms="Graphql",kms=ws(Fms,Dms.GraphQLInstrumentation,e=>{let t=jms(e);return{...t,responseHook(r,n){jg(r,"auto.graphql.otel.graphql"),n.errors?.length&&!lc(r).status&&r.setStatus({code:uA.ERROR});let o=lc(r).data,s=o["graphql.operation.type"],a=o["graphql.operation.name"];if(t.useOperationNameForRootSpan&&s){let c=TE(r),l=lc(c).data[b5e]||[],p=a?`${s} ${a}`:`${s}`;Array.isArray(l)?(l.push(p),c.setAttribute(b5e,l)):typeof l=="string"?c.setAttribute(b5e,[l,p]):c.setAttribute(b5e,p),lc(c).data["original-description"]||c.setAttribute("original-description",lc(c).description),c.updateName(`${lc(c).data["original-description"]} (${Eml(l)})`)}}}}),bml=((e={})=>({name:Fms,setupOnce(){kms(jms(e))}})),Nms=bml;function jms(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}function Eml(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(", "):`${t.slice(0,5).join(", ")}, +${t.length-5}`}return`${e}`}var Kms=ve(Hms(),1);var Jms="Kafka",Yms=ws(Jms,()=>new Kms.KafkaJsInstrumentation({consumerHook(e){jg(e,"auto.kafkajs.otel.consumer")},producerHook(e){jg(e,"auto.kafkajs.otel.producer")}})),Iml=(()=>({name:Jms,setupOnce(){Yms()}})),Xms=Iml;var ohs=ve(ihs(),1);var shs="LruMemoizer",ahs=ws(shs,()=>new ohs.LruMemoizerInstrumentation),xml=(()=>({name:shs,setupOnce(){ahs()}})),chs=xml;var Ahs=ve(ghs(),1);var yhs="Mongo",bhs=ws(yhs,()=>new Ahs.MongoDBInstrumentation({dbStatementSerializer:Oml,responseHook(e){jg(e,"auto.db.otel.mongo")}}));function Oml(e){let t=eci(e);return JSON.stringify(t)}function eci(e){if(Array.isArray(e))return e.map(t=>eci(t));if(Bml(e)){let t={};return Object.entries(e).map(([r,n])=>[r,eci(n)]).reduce((r,n)=>(Rml(n)&&(r[n[0]]=n[1]),r),t)}return"?"}function Bml(e){return typeof e=="object"&&e!==null&&!Pml(e)}function Pml(e){let t=!1;return typeof Buffer<"u"&&(t=Buffer.isBuffer(e)),t}function Rml(e){return Array.isArray(e)}var Dml=(()=>({name:yhs,setupOnce(){bhs()}})),Ehs=Dml;var Phs=ve(Bhs(),1);var Rhs="Mongoose",Dhs=ws(Rhs,()=>new Phs.MongooseInstrumentation({responseHook(e){jg(e,"auto.db.otel.mongoose")}})),zml=(()=>({name:Rhs,setupOnce(){Dhs()}})),Fhs=zml;var zhs=ve(Uhs(),1);var Vhs="Mysql",qhs=ws(Vhs,()=>new zhs.MySQLInstrumentation({})),Xml=(()=>({name:Vhs,setupOnce(){qhs()}})),Ghs=Xml;var Zhs=ve(Xhs(),1);var egs="Mysql2",tgs=ws(egs,()=>new Zhs.MySQL2Instrumentation({responseHook(e){jg(e,"auto.db.otel.mysql2")}})),dhl=(()=>({name:egs,setupOnce(){tgs()}})),rgs=dhl;var Tgs=ve(lgs(),1),Ogs=ve(wgs(),1);var Rhl=["get","set","setex"],vci=["get","mget"],Dhl=["set","setex"];function Fvt(e,t){return e.includes(t.toLowerCase())}function Ici(e){return Fvt(vci,e)?"cache.get":Fvt(Dhl,e)?"cache.put":void 0}function Fhl(e,t){return t.some(r=>e.startsWith(r))}function Cgs(e,t){try{if(t.length===0)return;let r=i=>typeof i=="string"||typeof i=="number"||Buffer.isBuffer(i)?[i.toString()]:Array.isArray(i)?xgs(i.map(o=>r(o))):["<unknown>"],n=t[0];return Fvt(Rhl,e)&&n!=null?r(n):xgs(t.map(i=>r(i)))}catch{return}}function _gs(e,t,r){if(!Ici(e))return!1;for(let n of t)if(Fhl(n,r))return!0;return!1}function Sgs(e){let t=r=>{try{return Buffer.isBuffer(r)?r.byteLength:typeof r=="string"?r.length:typeof r=="number"?r.toString().length:r==null?0:JSON.stringify(r).length}catch{return}};return Array.isArray(e)?e.reduce((r,n)=>{let i=t(n);return typeof i=="number"?r!==void 0?r+i:i:r},0):t(e)}function xgs(e){let t=[],r=n=>{n.forEach(i=>{Array.isArray(i)?r(i):t.push(i)})};return r(e),t}var G7t="Redis",kvt={},Bgs=(e,t,r,n)=>{e.setAttribute(bc,"auto.db.otel.redis");let i=Cgs(t,r),o=Ici(t);if(!i||!o||!kvt.cachePrefixes||!_gs(t,i,kvt.cachePrefixes))return;let s=lc(e).data["net.peer.name"],a=lc(e).data["net.peer.port"];a&&s&&e.setAttributes({"network.peer.address":s,"network.peer.port":a});let c=Sgs(n);c&&e.setAttribute(soi,c),Fvt(vci,t)&&c!==void 0&&e.setAttribute(ioi,c>0),e.setAttributes({[Au]:o,[ooi]:i});let u=i.join(", ");e.updateName(kvt.maxCacheKeyLength?ude(u,kvt.maxCacheKeyLength):u)},khl=ws(`${G7t}.IORedis`,()=>new Tgs.IORedisInstrumentation({responseHook:Bgs})),Nhl=ws(`${G7t}.Redis`,()=>new Ogs.RedisInstrumentation({responseHook:Bgs})),Pgs=Object.assign(()=>{khl(),Nhl()},{id:G7t}),jhl=((e={})=>({name:G7t,setupOnce(){kvt=e,Pgs()}})),Rgs=jhl;var Kgs=ve(Hgs(),1);var Jgs="Postgres",Ygs=ws(Jgs,Kgs.PgInstrumentation,e=>({requireParentSpan:!0,requestHook(t){jg(t,"auto.db.otel.postgres")},ignoreConnectSpans:e?.ignoreConnectSpans??!1})),Xhl=(e=>({name:Jgs,setupOnce(){Ygs(e)}})),Xgs=Xhl;lo();Fu();Cf();var Oci="PostgresJs",Zgs=[">=3.0.0 <4"],Zhl=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,egl=Symbol.for("sentry.query.from.instrumented.sql"),eAs=ws(Oci,e=>new Tci({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),Tci=class extends yh{constructor(t){super("sentry-postgres-js",df,t)}init(){let t=new bh("postgres",Zgs,r=>{try{return this._patchPostgres(r)}catch(n){return Bx&&Zt.error("Failed to patch postgres module:",n),r}},r=>r);return["src","cf/src","cjs/src"].forEach(r=>{t.files.push(new x1(`postgres/${r}/query.js`,Zgs,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),t}_patchPostgres(t){let r=typeof t=="function",n=r?t:t.default;if(typeof n!="function")return Bx&&Zt.warn("postgres module does not export a function. Skipping instrumentation."),t;let i=this,o=function(...s){let a=Reflect.construct(n,s);if(!a||typeof a!="function")return Bx&&Zt.warn("postgres() did not return a valid instance"),a;let c=i.getConfig();return $oi(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(o,s,a)}return r?o:(kEt(t,"default",o),t)}_shouldCreateSpans(){let t=this.getConfig();return rs.getSpan(Zi.active())!==void 0||!t.requireParentSpan}_setOperationName(t,r,n){if(n){t.setAttribute(bze,n);return}let i=r?.match(Zhl);i?.[1]&&t.setAttribute(bze,i[1].toUpperCase())}_reconstructQuery(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((r,n,i)=>i===0?n:`${r}$${i}${n}`,"")}_sanitizeSqlQuery(t){return t?t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(t){let r=this,n=t.Query.prototype.handle;return t.Query.prototype.handle=async function(...i){if(this[egl])return n.apply(this,i);if(!r._shouldCreateSpans())return n.apply(this,i);let o=r._reconstructQuery(this.strings),s=r._sanitizeSqlQuery(o);return DC({name:s||"postgresjs.query",op:"db"},a=>{jg(a,"auto.db.postgresjs"),a.setAttributes({[HTe]:"postgres",[Dni]:s});let c=r.getConfig(),{requestHook:u}=c;u&&WQ(()=>u(a,s,void 0),d=>{d&&(a.setAttribute("sentry.hook.error","requestHook failed"),Bx&&Zt.error(`Error in requestHook for ${Oci} integration:`,d))},!0);let l=this.resolve;this.resolve=new Proxy(l,{apply:(d,f,m)=>{try{r._setOperationName(a,s,m?.[0]?.command),a.end()}catch(h){Bx&&Zt.error("Error ending span in resolve callback:",h)}return Reflect.apply(d,f,m)}});let p=this.reject;this.reject=new Proxy(p,{apply:(d,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(Fni,m?.[0]?.code||"unknown"),a.setAttribute(kni,m?.[0]?.name||"unknown"),r._setOperationName(a,s),a.end()}catch(h){Bx&&Zt.error("Error ending span in reject callback:",h)}return Reflect.apply(d,f,m)}});try{return n.apply(this,i)}catch(d){throw a.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),a.end(),d}})},t.Query.prototype.handle.__sentry_original__=n,t}_unpatchQueryPrototype(t){return t.Query.prototype.handle.__sentry_original__&&(t.Query.prototype.handle=t.Query.prototype.handle.__sentry_original__),t}},tgl=(e=>({name:Oci,setupOnce(){eAs(e)}})),tAs=tgl;lo();lo();var Mvt=class{emit(t){}},rAs=new Mvt;var Bci=class{getLogger(t,r,n){return new Mvt}},X7t=new Bci;var Z7t=class{constructor(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):rAs}};var Lvt=class{getLogger(t,r,n){var i;return(i=this._getDelegateLogger(t,r,n))!==null&&i!==void 0?i:new Z7t(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:X7t}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,r,n)}};var eWt=typeof globalThis=="object"?globalThis:global;var Uvt=Symbol.for("io.opentelemetry.js.api.logs"),Y5e=eWt;function nAs(e,t,r){return n=>n===e?t:r}var Pci=1;var tWt=class e{constructor(){this._proxyLoggerProvider=new Lvt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return Y5e[Uvt]?this.getLoggerProvider():(Y5e[Uvt]=nAs(Pci,t,X7t),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=Y5e[Uvt])===null||t===void 0?void 0:t.call(Y5e,Pci))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete Y5e[Uvt],this._proxyLoggerProvider=new Lvt}};var iAs=tWt.getInstance();var koe=ve(require("path")),Qci=require("util");lo();var uAs=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,rgl=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,ngl={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function lAs(e,t,r){if(!igl(e))return Pi.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,"$1");let n=cgl(e);if(!n)return!1;let i=[],o=pAs(n,t,i,r);return o&&!r?.includePrerelease?sgl(n,i):o}function igl(e){return typeof e=="string"&&uAs.test(e)}function pAs(e,t,r,n){if(t.includes("||")){let i=t.trim().split("||");for(let o of i)if(Rci(e,o,r,n))return!0;return!1}else if(t.includes(" - "))t=Ogl(t,n);else if(t.includes(" ")){let i=t.trim().replace(/\s{2,}/g," ").split(" ");for(let o of i)if(!Rci(e,o,r,n))return!1;return!0}return Rci(e,t,r,n)}function Rci(e,t,r,n){if(t=agl(t,n),t.includes(" "))return pAs(e,t,r,n);{let i=ugl(t);return r.push(i),ogl(e,i)}}function ogl(e,t){if(t.invalid)return!1;if(!t.version||Fci(t.version))return!0;let r=sAs(e.versionSegments||[],t.versionSegments||[]);if(r===0){let n=e.prereleaseSegments||[],i=t.prereleaseSegments||[];!n.length&&!i.length?r=0:!n.length&&i.length?r=1:n.length&&!i.length?r=-1:r=sAs(n,i)}return ngl[t.op]?.includes(r)}function sgl(e,t){return e.prerelease?t.some(r=>r.prerelease&&r.version===e.version):!0}function agl(e,t){return e=e.trim(),e=Sgl(e,t),e=_gl(e),e=Tgl(e,t),e=e.trim(),e}function NR(e){return!e||e.toLowerCase()==="x"||e==="*"}function cgl(e){let t=e.match(uAs);if(!t){Pi.error(`Invalid version: ${e}`);return}let r=t.groups.version,n=t.groups.prerelease,i=t.groups.build,o=r.split("."),s=n?.split(".");return{op:void 0,version:r,versionSegments:o,versionSegmentCount:o.length,prerelease:n,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:i}}function ugl(e){if(!e)return{};let t=e.match(rgl);if(!t)return Pi.error(`Invalid range: ${e}`),{invalid:!0};let r=t.groups.op,n=t.groups.version,i=t.groups.prerelease,o=t.groups.build,s=n.split("."),a=i?.split(".");return r==="=="&&(r="="),{op:r||"=",version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:i,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:o}}function Fci(e){return e==="*"||e==="x"||e==="X"}function oAs(e){let t=parseInt(e,10);return isNaN(t)?e:t}function lgl(e,t){if(typeof e==typeof t){if(typeof e=="number")return[e,t];if(typeof e=="string")return[e,t];throw new Error("Version segments can only be strings or numbers")}else return[String(e),String(t)]}function pgl(e,t){if(Fci(e)||Fci(t))return 0;let[r,n]=lgl(oAs(e),oAs(t));return r>n?1:r<n?-1:0}function sAs(e,t){for(let r=0;r<Math.max(e.length,t.length);r++){let n=pgl(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0}var fAs="[a-zA-Z0-9-]",dAs="0|[1-9]\\d*",fgl=`\\d*[a-zA-Z-]${fAs}*`,dgl="((?:<|>)?=?)",aAs=`(?:${dAs}|${fgl})`,mgl=`(?:-(${aAs}(?:\\.${aAs})*))`,cAs=`${fAs}+`,hgl=`(?:\\+(${cAs}(?:\\.${cAs})*))`,Dci=`${dAs}|x|X|\\*`,zvt=`[v=\\s]*(${Dci})(?:\\.(${Dci})(?:\\.(${Dci})(?:${mgl})?${hgl}?)?)?`,ggl=`^${dgl}\\s*${zvt}$`,Agl=new RegExp(ggl),ygl=`^\\s*(${zvt})\\s+-\\s+(${zvt})\\s*$`,bgl=new RegExp(ygl),Egl="(?:~>?)",vgl=`^${Egl}${zvt}$`,Igl=new RegExp(vgl),wgl="(?:\\^)",xgl=`^${wgl}${zvt}$`,Cgl=new RegExp(xgl);function _gl(e){let t=Igl;return e.replace(t,(r,n,i,o,s)=>{let a;return NR(n)?a="":NR(i)?a=`>=${n}.0.0 <${+n+1}.0.0-0`:NR(o)?a=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:s?a=`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:a=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,a})}function Sgl(e,t){let r=Cgl,n=t?.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{let u;return NR(o)?u="":NR(s)?u=`>=${o}.0.0${n} <${+o+1}.0.0-0`:NR(a)?o==="0"?u=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`:c?o==="0"?s==="0"?u=`>=${o}.${s}.${a}-${c} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a}-${c} <${+o+1}.0.0-0`:o==="0"?s==="0"?u=`>=${o}.${s}.${a}${n} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a} <${+o+1}.0.0-0`,u})}function Tgl(e,t){let r=Agl;return e.replace(r,(n,i,o,s,a,c)=>{let u=NR(o),l=u||NR(s),p=l||NR(a),d=p;return i==="="&&d&&(i=""),c=t?.includePrerelease?"-0":"",u?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(s=0),a=0,i===">"?(i=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",l?o=+o+1:s=+s+1),i==="<"&&(c="-0"),n=`${i+o}.${s}.${a}${c}`):l?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:p&&(n=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`),n})}function Ogl(e,t){let r=bgl;return e.replace(r,(n,i,o,s,a,c,u,l,p,d,f,m)=>(NR(o)?i="":NR(s)?i=`>=${o}.0.0${t?.includePrerelease?"-0":""}`:NR(a)?i=`>=${o}.${s}.0${t?.includePrerelease?"-0":""}`:c?i=`>=${i}`:i=`>=${i}${t?.includePrerelease?"-0":""}`,NR(p)?l="":NR(d)?l=`<${+p+1}.0.0-0`:NR(f)?l=`<${p}.${+d+1}.0-0`:m?l=`<=${p}.${d}.${f}-${m}`:t?.includePrerelease?l=`<${p}.${d}.${+f+1}-0`:l=`<=${l}`,`${i} ${l}`.trim()))}var jR=console.error.bind(console);function Vvt(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var jOe=(e,t,r)=>{if(!e||!e[t]){jR("no original function "+String(t)+" to wrap");return}if(!r){jR("no wrapper function"),jR(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){jR("original object and wrapper must be functions");return}let i=r(n,t);return Vvt(i,"__original",n),Vvt(i,"__unwrap",()=>{e[t]===i&&Vvt(e,t,n)}),Vvt(i,"__wrapped",!0),Vvt(e,t,i),i},kci=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{jR("must provide one or more modules to patch"),jR(new Error().stack);return}if(!(t&&Array.isArray(t))){jR("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(i=>{jOe(n,i,r)})})},X5e=(e,t)=>{if(!e||!e[t]){jR("no function to unwrap."),jR(new Error().stack);return}let r=e[t];if(!r.__unwrap)jR("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},Nci=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{jR("must provide one or more modules to patch"),jR(new Error().stack);return}if(!(t&&Array.isArray(t))){jR("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{X5e(r,n)})})};function qvt(e){e&&e.logger&&(typeof e.logger!="function"?jR("new logger isn't a function, not replacing"):jR=e.logger)}qvt.wrap=jOe;qvt.massWrap=kci;qvt.unwrap=X5e;qvt.massUnwrap=Nci;lo();var rWt=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=Pi.createComponentLogger({namespace:t}),this._tracer=rs.getTracer(t,r),this._meter=VQ.getMeter(t,r),this._logger=iAs.getLogger(t,r),this._updateMetricInstruments()}_wrap=jOe;_unwrap=X5e;_massWrap=kci;_massUnwrap=Nci;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,i){if(t)try{t(n,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},o)}}};var hAs=ve(eOe()),jci=ve(require("path"));var nWt=class{hooks=[];children=new Map},iWt=class{_trie=new nWt;_counter=0;insert(t){let r=this._trie;for(let n of t.moduleName.split("/")){let i=r.children.get(n);i||(i=new nWt,r.children.set(n,i)),r=i}r.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:r,fullOnly:n}={}){let i=this._trie,o=[],s=!0;for(let a of t.split("/")){let c=i.children.get(a);if(!c){s=!1;break}n||o.push(...c.hooks),i=c}return n&&s&&o.push(...i.hooks),o.length===0?[]:o.length===1?[o[0].hook]:(r&&o.sort((a,c)=>a.insertedId-c.insertedId),o.map(({hook:a})=>a))}};var Pgl=["afterEach","after","beforeEach","before","describe","it"].every(e=>typeof global[e]=="function"),oWt=class e{_moduleNameTrie=new iWt;static _instance;constructor(){this._initialize()}_initialize(){new hAs.Hook(null,{internals:!0},(t,r,n)=>{let i=Rgl(r),o=this._moduleNameTrie.search(i,{maintainInsertionOrder:!0,fullOnly:n===void 0});for(let{onRequire:s}of o)t=s(t,r,n);return t})}register(t,r){let n={moduleName:t,onRequire:r};return this._moduleNameTrie.insert(n),n}static getInstance(){return Pgl?new e:this._instance=this._instance??new e}};function Rgl(e){return jci.sep!=="/"?e.split(jci.sep).join("/"):e}var yAs=ve(Pai());lo();var bAs=ve(eOe()),EAs=require("fs");function gAs(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var QOe=class extends rWt{_modules;_hooks=[];_requireInTheMiddleSingleton=oWt.getInstance();_enabled=!1;constructor(t,r,n){super(t,r,n);let i=this.init();i&&!Array.isArray(i)&&(i=[i]),this._modules=i||[],this._config.enabled&&this.enable()}_wrap=(t,r,n)=>{if(gAs(t[r])&&this._unwrap(t,r),Qci.types.isProxy(t)){let i=jOe(Object.assign({},t),r,n);return Object.defineProperty(t,r,{value:i}),i}else return jOe(t,r,n)};_unwrap=(t,r)=>Qci.types.isProxy(t)?Object.defineProperty(t,r,{value:t[r]}):X5e(t,r);_massWrap=(t,r,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Pi.error("must provide one or more modules to patch");return}if(!(r&&Array.isArray(r))){Pi.error("must provide one or more functions to wrap on modules");return}t.forEach(i=>{r.forEach(o=>{this._wrap(i,o,n)})})};_massUnwrap=(t,r)=>{if(t)Array.isArray(t)||(t=[t]);else{Pi.error("must provide one or more modules to patch");return}if(!(r&&Array.isArray(r))){Pi.error("must provide one or more functions to wrap on modules");return}t.forEach(n=>{r.forEach(i=>{this._unwrap(n,i)})})};_warnOnPreloadedModules(){this._modules.forEach(t=>{let{name:r}=t;try{let n=require.resolve(r);require.cache[n]&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(t){try{let r=(0,EAs.readFileSync)(koe.join(t,"package.json"),{encoding:"utf8"}),n=JSON.parse(r).version;return typeof n=="string"?n:void 0}catch{Pi.warn("Failed extracting version",t)}}_onRequire(t,r,n,i){if(!i)return typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:t.name}),t.patch(r)):r;let o=this._extractPackageVersion(i);if(t.moduleVersion=o,t.name===n)return AAs(t.supportedVersions,o,t.includePrerelease)&&typeof t.patch=="function"&&(t.moduleExports=r,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:t.name,version:t.moduleVersion,baseDir:i}),t.patch(r,t.moduleVersion)):r;let s=t.files??[],a=koe.normalize(n);return s.filter(u=>u.name===a).filter(u=>AAs(u.supportedVersions,o,t.includePrerelease)).reduce((u,l)=>(l.moduleExports=u,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:t.name,version:t.moduleVersion,fileName:l.name,baseDir:i}),l.patch(u,t.moduleVersion)):u),r)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let t of this._modules){typeof t.patch=="function"&&t.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:t.name,version:t.moduleVersion}),t.patch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.patch(r.moduleExports,t.moduleVersion))}return}this._warnOnPreloadedModules();for(let t of this._modules){let r=(s,a,c)=>{if(!c&&koe.isAbsolute(a)){let u=koe.parse(a);a=u.name,c=u.dir}return this._onRequire(t,s,a,c)},n=(s,a,c)=>this._onRequire(t,s,a,c),i=koe.isAbsolute(t.name)?new bAs.Hook([t.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(t.name,n);this._hooks.push(i);let o=new yAs.Hook([t.name],{internals:!1},r);this._hooks.push(o)}}}disable(){if(this._enabled){this._enabled=!1;for(let t of this._modules){typeof t.unpatch=="function"&&t.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:t.name,version:t.moduleVersion}),t.unpatch(t.moduleExports,t.moduleVersion));for(let r of t.files)r.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:t.name,version:t.moduleVersion,fileName:r.name}),r.unpatch(r.moduleExports,t.moduleVersion))}}}isEnabled(){return this._enabled}};function AAs(e,t,r){return typeof t>"u"?e.includes("*"):e.some(n=>lAs(t,n,{includePrerelease:r}))}var Gvt=class{name;supportedVersions;patch;unpatch;files;constructor(t,r,n,i,o){this.name=t,this.supportedVersions=r,this.patch=n,this.unpatch=i,this.files=o||[]}};lo();var Dgl={name:"@prisma/instrumentation-contract",version:"7.6.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},Fgl=Dgl.version.split(".")[0],Mci="PRISMA_INSTRUMENTATION",Lci=`V${Fgl}_PRISMA_INSTRUMENTATION`,Z5e=globalThis;function kgl(){let e=Z5e[Lci];return e?.helper?e.helper:Z5e[Mci]?.helper}function Ngl(e){let t={helper:e};Z5e[Lci]=t,Z5e[Mci]=t}function jgl(){delete Z5e[Lci],delete Z5e[Mci]}var Qgl=process.env.PRISMA_SHOW_ALL_TRACES==="true",Mgl="00-10-10-00";function Lgl(e){return e==="client"?Ng.CLIENT:Ng.INTERNAL}var Ugl=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:e,ignoreSpanTypes:t}){this.tracerProvider=e,this.ignoreSpanTypes=t}isEnabled(){return!0}getTraceParent(e){let t=rs.getSpanContext(e??Zi.active());return t?`00-${t.traceId}-${t.spanId}-0${t.traceFlags}`:Mgl}dispatchEngineSpans(e){let t=this.tracerProvider.getTracer("prisma"),r=new Map,n=e.filter(i=>i.parentId===null);for(let i of n)wAs(t,i,e,r,this.ignoreSpanTypes)}getActiveContext(){return Zi.active()}runInChildSpan(e,t){if(typeof e=="string"&&(e={name:e}),e.internal&&!Qgl)return t();let r=this.tracerProvider.getTracer("prisma"),n=e.context??this.getActiveContext(),i=`prisma:client:${e.name}`;if(xAs(i,this.ignoreSpanTypes))return t();if(e.active===!1){let o=r.startSpan(i,e,n);return vAs(o,t(o,n))}return r.startActiveSpan(i,e,o=>vAs(o,t(o,n)))}};function wAs(e,t,r,n,i){if(xAs(t.name,i))return;let o={attributes:t.attributes,kind:Lgl(t.kind),startTime:t.startTime};e.startActiveSpan(t.name,o,s=>{n.set(t.id,s.spanContext().spanId),t.links&&s.addLinks(t.links.flatMap(c=>{let u=n.get(c);return u?{context:{spanId:u,traceId:s.spanContext().traceId,traceFlags:s.spanContext().traceFlags}}:[]}));let a=r.filter(c=>c.parentId===t.id);for(let c of a)wAs(e,c,r,n,i);s.end(t.endTime)})}function vAs(e,t){return zgl(t)?t.then(r=>(e.end(),r),r=>{throw e.end(),r}):(e.end(),t)}function zgl(e){return e!=null&&typeof e.then=="function"}function xAs(e,t){return t.some(r=>typeof r=="string"?r===e:r.test(e))}var CAs={name:"@prisma/instrumentation",version:"7.6.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},IAs=CAs.version,Vgl=CAs.name,qgl="@prisma/client",_As=class extends QOe{tracerProvider;constructor(e={}){super(Vgl,IAs,e)}setTracerProvider(e){this.tracerProvider=e}init(){return[new Gvt(qgl,[IAs])]}enable(){let e=this._config;Ngl(new Ugl({tracerProvider:this.tracerProvider??rs.getTracerProvider(),ignoreSpanTypes:e.ignoreSpanTypes??[]}))}disable(){jgl()}isEnabled(){return kgl()!==void 0}};var SAs="Prisma";function Ggl(e){return!!e&&typeof e=="object"&&"dispatchEngineSpans"in e}function TAs(){let e=globalThis.PRISMA_INSTRUMENTATION;return e&&typeof e=="object"&&"helper"in e?e.helper:void 0}var Uci=class extends _As{constructor(t){super(t?.instrumentationConfig)}enable(){super.enable();let t=TAs();Ggl(t)&&(t.createEngineSpan=r=>{let n=rs.getTracer("prismaV5Compatibility"),i=n._idGenerator;if(!i){Rv(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{r.spans.forEach(o=>{let s=Wgl(o.kind),a=o.parent_span_id,c=o.span_id,u=o.trace_id,l=o.links?.map(d=>({context:{traceId:d.trace_id,spanId:d.span_id,traceFlags:Tb.SAMPLED}})),p=rs.setSpanContext(Zi.active(),{traceId:u,spanId:a,traceFlags:Tb.SAMPLED});Zi.with(p,()=>{let d={generateTraceId:()=>u,generateSpanId:()=>c};n._idGenerator=d,n.startSpan(o.name,{kind:s,links:l,startTime:o.start_time,attributes:o.attributes}).end(o.end_time),n._idGenerator=i})})}finally{n._idGenerator=i}})}};function Wgl(e){return e==="client"?Ng.CLIENT:Ng.INTERNAL}var $gl=ws(SAs,e=>new Uci(e)),OAs=e=>({name:SAs,setupOnce(){$gl(e)},setup(t){TAs()&&t.on("spanStart",r=>{let n=lc(r);n.description?.startsWith("prisma:")&&r.setAttribute(bc,"auto.db.otel.prisma"),n.description==="prisma:engine:db_query"&&n.data["db.query.text"]&&r.updateName(n.data["db.query.text"]),n.description==="prisma:engine:db_query"&&!n.data["db.system"]&&r.setAttribute("db.system","prisma")})}});var MAs=ve(QAs(),1);var LAs="Hapi",UAs=ws(LAs,()=>new MAs.HapiInstrumentation),sAl=(()=>({name:LAs,setupOnce(){UAs()}})),zAs=sAl;Cf();var $de={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Jvt={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};lo();Fu();var aAl="@sentry/instrumentation-hono",cAl="0.0.1",cWt=class extends yh{constructor(t={}){super(aAl,cAl,t)}init(){return[new bh("hono",[">=4.0.0 <5"],t=>this._patch(t))]}_patch(t){let r=this;class n extends t.Hono{constructor(...o){super(...o),r._wrap(this,"get",r._patchHandler()),r._wrap(this,"post",r._patchHandler()),r._wrap(this,"put",r._patchHandler()),r._wrap(this,"delete",r._patchHandler()),r._wrap(this,"options",r._patchHandler()),r._wrap(this,"patch",r._patchHandler()),r._wrap(this,"all",r._patchHandler()),r._wrap(this,"on",r._patchOnHandler()),r._wrap(this,"use",r._patchMiddlewareHandler())}}try{t.Hono=n}catch{return{...t,Hono:n}}return t}_patchHandler(){let t=this;return function(r){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return r.apply(this,[o]);let s=i.slice(1);return r.apply(this,[o,...s.map(a=>t._wrapHandler(a))])}return r.apply(this,i.map(o=>t._wrapHandler(o)))}}}_patchOnHandler(){let t=this;return function(r){return function(...i){let o=i.slice(2);return r.apply(this,[...i.slice(0,2),...o.map(s=>t._wrapHandler(s))])}}}_patchMiddlewareHandler(){let t=this;return function(r){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return r.apply(this,[o]);let s=i.slice(1);return r.apply(this,[o,...s.map(a=>t._wrapHandler(a))])}return r.apply(this,i.map(o=>t._wrapHandler(o)))}}}_wrapHandler(t){let r=this;return function(n,i){if(!r.isEnabled())return t.apply(this,[n,i]);let o=n.req.path,s=r.tracer.startSpan(o);return Zi.with(rs.setSpan(Zi.active(),s),()=>r._safeExecute(()=>{let a=t.apply(this,[n,i]);if(C1(a))return a.then(c=>{let u=r._determineHandlerType(c);return s.setAttributes({[$de.HONO_TYPE]:u,[$de.HONO_NAME]:u===Jvt.REQUEST_HANDLER?o:t.name||"anonymous"}),r.getConfig().responseHook?.(s),c});{let c=r._determineHandlerType(a);return s.setAttributes({[$de.HONO_TYPE]:c,[$de.HONO_NAME]:c===Jvt.REQUEST_HANDLER?o:t.name||"anonymous"}),r.getConfig().responseHook?.(s),a}},()=>s.end(),a=>{r._handleError(s,a),s.end()}))}}_safeExecute(t,r,n){try{let i=t();return C1(i)?i.then(()=>r(),o=>n(o)):r(),i}catch(i){throw n(i),i}}_determineHandlerType(t){return t===void 0?Jvt.MIDDLEWARE:Jvt.REQUEST_HANDLER}_handleError(t,r){r instanceof Error&&(t.setStatus({code:uA.ERROR,message:r.message}),t.recordException(r))}};var VAs="Hono";function uAl(e){let t=lc(e).data,r=t[$de.HONO_TYPE];if(t[Au]||!r)return;e.setAttributes({[bc]:"auto.http.otel.hono",[Au]:`${r}.hono`});let n=t[$de.HONO_NAME];if(typeof n=="string"&&e.updateName(n),Mp()===FU()){Bx&&Zt.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=t[doe],o=t[KTe];typeof i=="string"&&typeof o=="string"&&Mp().setTransactionName(`${o} ${i}`)}var qAs=ws(VAs,()=>new cWt({responseHook:e=>{uAl(e)}})),lAl=(()=>({name:VAs,setupOnce(){qAs()}})),GAs=lAl;var nys=ve(rys(),1);Cf();var iys="Koa",oys=ws(iys,nys.KoaInstrumentation,(e={})=>({ignoreLayersType:e.ignoreLayersType,requestHook(t,r){jg(t,"auto.http.otel.koa");let n=lc(t).data,i=n["koa.type"];i&&t.setAttribute(Au,`${i}.koa`);let o=n["koa.name"];if(typeof o=="string"&&t.updateName(o||"< unknown >"),Mp()===FU()){Bx&&Zt.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let s=n[doe],a=r.context?.request?.method?.toUpperCase()||"GET";s&&Mp().setTransactionName(`${a} ${s}`)}})),bAl=((e={})=>({name:iys,setupOnce(){oys(e)}})),sys=bAl;var hys=ve(mys(),1);var gys="Connect",Ays=ws(gys,()=>new hys.ConnectInstrumentation),OAl=(()=>({name:gys,setupOnce(){Ays()}})),yys=OAl;var Tys=ve(Sys(),1);var FAl=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),Oys="Tedious",Bys=ws(Oys,()=>new Tys.TediousInstrumentation({})),kAl=(()=>{let e;return{name:Oys,setupOnce(){let t=Bys();e=jEt(t)},setup(t){e?.(()=>t.on("spanStart",r=>{let{description:n,data:i}=lc(r);if(!n||i["db.system"]!=="mssql")return;let o=n.split(" ")[0]||"";FAl.has(o)&&r.setAttribute(bc,"auto.db.otel.tedious")}))}}}),Pys=kAl;var Nys=ve(kys(),1);var jys="GenericPool",Qys=ws(jys,()=>new Nys.GenericPoolInstrumentation({})),jAl=(()=>{let e;return{name:jys,setupOnce(){let t=Qys();e=jEt(t)},setup(t){e?.(()=>t.on("spanStart",r=>{let i=lc(r).description;(i==="generic-pool.aquire"||i==="generic-pool.acquire")&&r.setAttribute(bc,"auto.db.otel.generic_pool")}))}}}),Mys=jAl;var Kys=ve(Hys(),1);var Jys="Amqplib",HAl={consumeEndHook:e=>{jg(e,"auto.amqplib.otel.consumer")},publishHook:e=>{jg(e,"auto.amqplib.otel.publisher")}},Yys=ws(Jys,()=>new Kys.AmqplibInstrumentation(HAl)),KAl=(()=>({name:Jys,setupOnce(){Yys()}})),Xys=KAl;var tIt="VercelAI";Fu();var JAl=[">=3.0.0 <7"],Zys=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function YAl(e){if(typeof e!="object"||e===null)return!1;let t=e;return"type"in t&&"error"in t&&"toolName"in t&&"toolCallId"in t&&t.type==="tool-error"&&t.error instanceof Error}function XAl(e){if(typeof e!="object"||e===null||!("content"in e))return;let t=e;Array.isArray(t.content)&&(ZAl(t.content),eyl(t.content))}function ZAl(e){for(let t of e){if(!YAl(t))continue;let r=dsi(t.toolCallId);r?HQ(n=>{n.setContext("trace",{trace_id:r.traceId,span_id:r.spanId}),n.setTag("vercel.ai.tool.name",t.toolName),n.setTag("vercel.ai.tool.callId",t.toolCallId),n.setLevel("error"),fl(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):HQ(n=>{n.setTag("vercel.ai.tool.name",t.toolName),n.setTag("vercel.ai.tool.callId",t.toolCallId),n.setLevel("error"),fl(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function eyl(e){for(let t of e)typeof t=="object"&&t!==null&&"toolCallId"in t&&typeof t.toolCallId=="string"&&msi(t.toolCallId)}function tyl(e,t,r,n){let i=e?.recordInputs!==void 0?e.recordInputs:t.recordInputs!==void 0?t.recordInputs:r===!0?!0:n,o=e?.recordOutputs!==void 0?e.recordOutputs:t.recordOutputs!==void 0?t.recordOutputs:r===!0?!0:n;return{recordInputs:i,recordOutputs:o}}var xWt=class e extends yh{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(t={}){super("@sentry/instrumentation-vercel-ai",df,t),e.prototype.__init.call(this),e.prototype.__init2.call(this)}init(){return new bh("ai",JAl,this._patch.bind(this))}callWhenPatched(t){this._isPatched?t():this._callbacks.push(t)}_patch(t){this._isPatched=!0,this._callbacks.forEach(n=>n()),this._callbacks=[];let r=n=>new Proxy(n,{apply:(i,o,s)=>{let a=s[0].experimental_telemetry||{},c=a.isEnabled,u=La(),l=u?.getIntegrationByName(tIt),p=l?.options,d=l?!!u?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=tyl(p,a,c,d);return s[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},H6(()=>Reflect.apply(i,o,s),h=>{h&&typeof h=="object"&&ew(h,"_sentry_active_span",NU())},()=>{},h=>{XAl(h)})}});if(Object.prototype.toString.call(t)==="[object Module]"){for(let n of Zys)t[n]!=null&&(t[n]=r(t[n]));return t}else{let n=Zys.reduce((i,o)=>(t[o]!=null&&(i[o]=r(t[o])),i),{});return{...t,...n}}}};var ebs=ws(tIt,()=>new xWt({}));function ryl(e){return!!e.getIntegrationByName("Modules")?.getModules?.()?.ai}var nyl=((e={})=>{let t;return{name:tIt,options:e,setupOnce(){t=ebs()},afterAllSetup(r){e.force??ryl(r)?MGt(r):t?.callWhenPatched(()=>MGt(r))}}}),tbs=nyl;Fu();var iyl=[">=4.0.0 <7"],CWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-openai",df,t)}init(){return new bh("openai",iyl,this._patch.bind(this))}_patch(t){let r=t;return r=this._patchClient(r,"OpenAI"),r=this._patchClient(r,"AzureOpenAI"),r}_patchClient(t,r){let n=t[r];if(!n)return t;let i=this.getConfig(),o=function(...s){if(fOe(Ode))return Reflect.construct(n,s);let a=Reflect.construct(n,s);return UGt(a,i)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(o,s,a)}try{t[r]=o}catch{Object.defineProperty(t,r,{value:o,writable:!0,configurable:!0,enumerable:!0})}if(t.default===n)try{t.default=o}catch{Object.defineProperty(t,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return t}};var rbs=ws(Ode,e=>new CWt(e)),oyl=((e={})=>({name:Ode,setupOnce(){rbs(e)}})),nbs=oyl;Fu();var syl=[">=0.19.2 <1.0.0"],_Wt=class extends yh{constructor(t={}){super("@sentry/instrumentation-anthropic-ai",df,t)}init(){return new bh("@anthropic-ai/sdk",syl,this._patch.bind(this))}_patch(t){let r=t.Anthropic,n=this.getConfig(),i=function(...o){if(fOe(Bde))return Reflect.construct(r,o);let s=Reflect.construct(r,o);return zGt(s,n)};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.prototype,r.prototype);for(let o of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(i,o,s)}try{t.Anthropic=i}catch{Object.defineProperty(t,"Anthropic",{value:i,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=i}catch{Object.defineProperty(t,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return t}};var ibs=ws(Bde,e=>new _Wt(e)),ayl=((e={})=>({name:Bde,options:e,setupOnce(){ibs(e)}})),obs=ayl;Fu();var sbs=[">=0.10.0 <2"],SWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-google-genai",df,t)}init(){return new bh("@google/genai",sbs,r=>this._patch(r),r=>r,[new x1("@google/genai/dist/node/index.cjs",sbs,r=>this._patch(r),r=>r)])}_patch(t){let r=t.GoogleGenAI,n=this.getConfig();if(typeof r!="function")return t;let i=function(...o){if(fOe(Pde))return Reflect.construct(r,o);let s=Reflect.construct(r,o);return VGt(s,n)};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.prototype,r.prototype);for(let o of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(i,o,s)}return kEt(t,"GoogleGenAI",i),t}};var abs=ws(Pde,e=>new SWt(e)),cyl=((e={})=>({name:Pde,setupOnce(){abs(e)}})),cbs=cyl;Fu();var TWt=[">=0.1.0 <2.0.0"];function uyl(e,t){return e?Array.isArray(e)?e.includes(t)?e:[...e,t]:typeof e=="object"?[e,t]:e:[t]}function lyl(e,t,r){return new Proxy(e,{apply(n,i,o){let a=o[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},o[1]=a);let c=a.callbacks,u=uyl(c,t);return a.callbacks=u,Reflect.apply(n,i,o)}})}var OWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-langchain",df,t)}init(){let t=[],r=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let n of r)t.push(new bh(n,TWt,this._patch.bind(this),i=>i,[new x1(`${n}/dist/index.cjs`,TWt,this._patch.bind(this),i=>i)]));return t.push(new bh("langchain",TWt,this._patch.bind(this),n=>n,[new x1("langchain/dist/chat_models/universal.cjs",TWt,this._patch.bind(this),n=>n)])),t}_patch(t){Doi([Ode,Bde,Pde]);let r=GGt(this.getConfig());return this._patchRunnableMethods(t,r),t}_patchRunnableMethods(t,r){let n=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],i=t.universal_exports??t,o=Object.values(i).find(c=>typeof c=="function"&&n.includes(c.name));if(!o)return;let s=o.prototype;if(s.__sentry_patched__)return;s.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let u=s[c];typeof u=="function"&&(s[c]=lyl(u,r))}}};var ubs=ws(qGt,e=>new OWt(e)),pyl=((e={})=>({name:qGt,setupOnce(){ubs(e)}})),lbs=pyl;Fu();var pbs=[">=0.0.0 <2.0.0"],BWt=class extends yh{constructor(t={}){super("@sentry/instrumentation-langgraph",df,t)}init(){return new bh("@langchain/langgraph",pbs,this._patch.bind(this),r=>r,[new x1("@langchain/langgraph/dist/index.cjs",pbs,this._patch.bind(this),r=>r)])}_patch(t){return t.StateGraph&&typeof t.StateGraph=="function"&&$Gt(t.StateGraph.prototype,this.getConfig()),t}};var fbs=ws(WGt,e=>new BWt(e)),fyl=((e={})=>({name:WGt,setupOnce(){fbs(e)}})),dbs=fyl;Fu();var hbs=ve(require("net"),1);lo();Fu();Cf();function gbs(e,t,r,n,i){let s=()=>{},a=i.firestoreSpanCreationHook;typeof a=="function"&&(s=l=>{WQ(()=>a(l),p=>{p&&Pi.error(p?.message)},!0)});let c=new bh("@firebase/firestore",t,l=>mbs(l,r,n,e,s)),u=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let l of u)c.files.push(new x1(l,t,p=>mbs(p,r,n,e,s),p=>Abs(p,n)));return c}function mbs(e,t,r,n,i){return Abs(e,r),t(e,"addDoc",dyl(n,i)),t(e,"getDocs",hyl(n,i)),t(e,"setDoc",gyl(n,i)),t(e,"deleteDoc",myl(n,i)),e}function Abs(e,t){for(let r of["addDoc","getDocs","setDoc","deleteDoc"])ide(e[r])&&t(e,r);return e}function dyl(e,t){return function(n){return function(i,o){let s=RWt(e,"addDoc",i);return t(s),PWt(s,()=>n(i,o))}}}function myl(e,t){return function(n){return function(i){let o=RWt(e,"deleteDoc",i.parent||i);return t(o),PWt(o,()=>n(i))}}}function hyl(e,t){return function(n){return function(i){let o=RWt(e,"getDocs",i);return t(o),PWt(o,()=>n(i))}}}function gyl(e,t){return function(n){return function(i,o,s){let a=RWt(e,"setDoc",i.parent||i);return t(a),PWt(a,()=>typeof s<"u"?n(i,o,s):n(i,o))}}}function PWt(e,t){return Zi.with(rs.setSpan(Zi.active(),e),()=>WQ(()=>t(),r=>{r&&e.recordException(r),e.end()},!0))}function RWt(e,t,r){let n=e.startSpan(`${t} ${r.path}`,{kind:Ng.CLIENT});return yyl(n,r),n.setAttribute(bze,t),n}function Ayl(e){let t,r;if(typeof e.host=="string")if(e.host.startsWith("[")){if(e.host.endsWith("]"))t=e.host.replace(/^\[|\]$/g,"");else if(e.host.includes("]:")){let n=e.host.lastIndexOf(":");n!==-1&&(t=e.host.slice(1,n).replace(/^\[|\]$/g,""),r=e.host.slice(n+1))}}else if(hbs.isIPv6(e.host))t=e.host;else{let n=e.host.lastIndexOf(":");n!==-1?(t=e.host.slice(0,n),r=e.host.slice(n+1)):t=e.host}return{address:t,port:r?parseInt(r,10):void 0}}function yyl(e,t){let r=t.firestore.app,n=r.options,o=(t.firestore.toJSON()||{}).settings||{},s={[Pni]:t.path,[Rni]:r.name,[HTe]:"firebase.firestore","firebase.firestore.type":t.type,"firebase.firestore.options.projectId":n.projectId,"firebase.firestore.options.appId":n.appId,"firebase.firestore.options.messagingSenderId":n.messagingSenderId,"firebase.firestore.options.storageBucket":n.storageBucket},{address:a,port:c}=Ayl(o);a&&(s[Uni]=a),c&&(s[zni]=c),e.setAttributes(s)}lo();Fu();function ybs(e,t,r,n,i){let o=()=>{},s=()=>{},a=i.functions?.errorHook,c=i.functions?.requestHook,u=i.functions?.responseHook;typeof u=="function"&&(s=(d,f)=>{WQ(()=>u(d,f),m=>{m&&Pi.error(m?.message)},!0)}),typeof c=="function"&&(o=d=>{WQ(()=>c(d),f=>{f&&Pi.error(f?.message)},!0)});let l=new bh("firebase-functions",t);return[{name:"firebase-functions/lib/v2/providers/https.js",triggerType:"function"},{name:"firebase-functions/lib/v2/providers/firestore.js",triggerType:"firestore"},{name:"firebase-functions/lib/v2/providers/scheduler.js",triggerType:"scheduler"},{name:"firebase-functions/lib/v2/storage.js",triggerType:"storage"}].forEach(({name:d,triggerType:f})=>{l.files.push(new x1(d,t,m=>byl(m,r,n,e,{requestHook:o,responseHook:s,errorHook:a},f),m=>bbs(m,n)))}),l}function MR(e,t,r){return function(i){return function(...o){let s=typeof o[0]=="function"?o[0]:o[1],a=typeof o[0]=="function"?void 0:o[0];if(!s)return i.call(this,...o);let c=async function(...u){let l=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",p=e.startSpan(`firebase.function.${r}`,{kind:Ng.SERVER}),d={"faas.name":l,"faas.trigger":r,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(d["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(d["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),p.setAttributes(d),t?.requestHook?.(p),Zi.with(rs.setSpan(Zi.active(),p),async()=>{let f,m;try{m=await s.apply(this,u)}catch(h){f=h}if(t?.responseHook?.(p,f),f&&p.recordException(f),p.end(),f)throw await t?.errorHook?.(p,f),f;return m})};return a?i.call(this,a,c):i.call(this,c)}}}function byl(e,t,r,n,i,o){switch(bbs(e,r),o){case"function":t(e,"onRequest",MR(n,i,"http.request")),t(e,"onCall",MR(n,i,"http.call"));break;case"firestore":t(e,"onDocumentCreated",MR(n,i,"firestore.document.created")),t(e,"onDocumentUpdated",MR(n,i,"firestore.document.updated")),t(e,"onDocumentDeleted",MR(n,i,"firestore.document.deleted")),t(e,"onDocumentWritten",MR(n,i,"firestore.document.written")),t(e,"onDocumentCreatedWithAuthContext",MR(n,i,"firestore.document.created")),t(e,"onDocumentUpdatedWithAuthContext",MR(n,i,"firestore.document.updated")),t(e,"onDocumentDeletedWithAuthContext",MR(n,i,"firestore.document.deleted")),t(e,"onDocumentWrittenWithAuthContext",MR(n,i,"firestore.document.written"));break;case"scheduler":t(e,"onSchedule",MR(n,i,"scheduler.scheduled"));break;case"storage":t(e,"onObjectFinalized",MR(n,i,"storage.object.finalized")),t(e,"onObjectArchived",MR(n,i,"storage.object.archived")),t(e,"onObjectDeleted",MR(n,i,"storage.object.deleted")),t(e,"onObjectMetadataUpdated",MR(n,i,"storage.object.metadataUpdated"));break}return e}function bbs(e,t){let r=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let n of r)ide(e[n])&&t(e,n);return e}var Ebs={},Eyl=[">=3.0.0 <5"],vyl=[">=6.0.0 <7"],DWt=class extends yh{constructor(t=Ebs){super("@sentry/instrumentation-firebase",df,t)}setConfig(t={}){super.setConfig({...Ebs,...t})}init(){let t=[];return t.push(gbs(this.tracer,Eyl,this._wrap,this._unwrap,this.getConfig())),t.push(ybs(this.tracer,vyl,this._wrap,this._unwrap,this.getConfig())),t}};var vbs="Firebase",Iyl={firestoreSpanCreationHook:e=>{jg(e,"auto.firebase.otel.firestore"),e.setAttribute(Au,"db.query")},functions:{requestHook:e=>{jg(e,"auto.firebase.otel.functions"),e.setAttribute(Au,"http.request")},errorHook:async(e,t)=>{t&&(fl(t,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await gGt(2e3))}}},Ibs=ws(vbs,()=>new DWt(Iyl)),wyl=(()=>({name:vbs,setupOnce(){Ibs()}})),wbs=wyl;function xbs(){return[Bfs(),lms(),Nms(),GAs(),Ehs(),Fhs(),Ghs(),rgs(),Rgs(),Xgs(),OAs(),zAs(),sys(),yys(),Pys(),Mys(),Xms(),Xys(),chs(),lbs(),dbs(),tbs(),nbs(),obs(),cbs(),tAs(),wbs()]}lo();Cf();var sui=1e6;function Cbs(e,t={}){e.getOptions().debug&&Ysi();let[r,n]=xyl(e,t);e.traceProvider=r,e.asyncLocalStorageLookup=n}function xyl(e,t={}){let r=new qEt({sampler:new m9t(e),resource:zEt().merge(n9t({[F0t]:"node",[Bni]:"sentry",[Vni]:df})),forceFlushTimeoutMillis:500,spanProcessors:[new d9t({timeout:Cyl(e.getOptions().maxSpanWaitDuration)}),...t.spanProcessors||[]]});rs.setGlobalTracerProvider(r),_R.setGlobalPropagator(new f9t);let n=new Jsi;return Zi.setGlobalContextManager(n),[r,n.getAsyncLocalStorageLookup()]}function Cyl(e){if(e!=null){if(e>sui)return Bx&&Zt.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${sui}`),sui;if(e<=0||Number.isNaN(e)){Bx&&Zt.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function _bs(){return C9t().filter(t=>t.name!=="Http"&&t.name!=="NodeFetch").concat(cfs(),gfs())}function Sbs(e){return[..._bs(),...Dv(e)?xbs():[]]}function rIt(e={}){return _yl(e,Sbs)}function _yl(e={},t){dOe(e,"node");let r=aai({...e,defaultIntegrations:e.defaultIntegrations??t(e)});return r&&!e.skipOpenTelemetrySetup&&(Cbs(r,{spanProcessors:e.openTelemetrySpanProcessors}),cai()),r}function Tbs(){let e=Rri();e!=null&&yEt("fern_run_id",e)}function Obs(){process.env.GITHUB_RUN_ID!=null&&yEt("github_run_id",process.env.GITHUB_RUN_ID)}function nIt(){Tbs(),Obs()}qui();o$t();function kE(e,t,r,n){e.command(t,r,i=>{for(let o of n)o(i);return i.usage(r).demandCommand(1).fail((o,s,a)=>{s!=null&&(process.stderr.write(`${s.message}
|
|
1492
1492
|
`),process.exit(1)),o!=null&&process.stderr.write(`Error: ${o}
|
|
1493
1493
|
|
|
1494
1494
|
`),a.showHelp(),process.exit(1)})})}var Ae=class e extends Error{code;docsLink;constructor({message:t,code:r,docsLink:n}){super(t),Object.setPrototypeOf(this,e.prototype),this.code=r,this.docsLink=n}static authRequired(t){return new e({message:t??"Authentication required. Please run 'fern login' or set the FERN_TOKEN environment variable.",code:e.Code.AuthError})}static unauthorized(t){return new e({message:t??"Unauthorized. Please run 'fern auth login' or set the FERN_TOKEN environment variable.",code:e.Code.AuthError})}static notFound(t){return new e({message:t,code:e.Code.ConfigError})}static badRequest(t){return new e({message:t,code:e.Code.NetworkError})}static validationError(t){return new e({message:t,code:e.Code.ValidationError})}static internalError(t){return new e({message:t,code:e.Code.InternalError})}};(function(e){e.Code={InternalError:"INTERNAL_ERROR",ResolutionError:"RESOLUTION_ERROR",IrConversionError:"IR_CONVERSION_ERROR",ContainerError:"CONTAINER_ERROR",VersionError:"VERSION_ERROR",ParseError:"PARSE_ERROR",EnvironmentError:"ENVIRONMENT_ERROR",ReferenceError:"REFERENCE_ERROR",ValidationError:"VALIDATION_ERROR",NetworkError:"NETWORK_ERROR",AuthError:"AUTH_ERROR",ConfigError:"CONFIG_ERROR",Unclassified:"UNCLASSIFIED"}})(Ae||(Ae={}));var nbl={[Ae.Code.InternalError]:!0,[Ae.Code.ResolutionError]:!0,[Ae.Code.IrConversionError]:!0,[Ae.Code.ContainerError]:!0,[Ae.Code.VersionError]:!0,[Ae.Code.ParseError]:!1,[Ae.Code.EnvironmentError]:!1,[Ae.Code.ReferenceError]:!1,[Ae.Code.ValidationError]:!1,[Ae.Code.NetworkError]:!1,[Ae.Code.AuthError]:!1,[Ae.Code.ConfigError]:!1,[Ae.Code.Unclassified]:!1};function uIt(e){return nbl[e]}function ibl(e){return e instanceof Error&&(e.constructor.name==="ParseError"||e.constructor.name==="JsonError")}function obl(e){return e instanceof Error&&e.message.includes("globalThis")}function tBe(e,t){return t??(e instanceof Ae?e.code:ibl(e)?Ae.Code.ParseError:obl(e)?Ae.Code.EnvironmentError:Ae.Code.Unclassified)}var ri={Trace:"trace",Debug:"debug",Info:"info",Warn:"warn",Error:"error"},B1=Object.values(ri);var Gui=class{log;enabled;constructor(t,r=!0){this.log=t,this.enabled=r}disable(){this.enabled=!1}enable(){this.enabled=!0}debug(...t){this.enabled&&this.log(ri.Debug,...t)}info(...t){this.enabled&&this.log(ri.Info,...t)}warn(...t){this.enabled&&this.log(ri.Warn,...t)}error(...t){this.enabled&&this.log(ri.Error,...t)}trace(...t){this.enabled&&this.log(ri.Trace,...t)}};function P1(e){return new Gui(e)}var Wui=Object.freeze(P1(sbl));function sbl(e,...t){abl(e)(...t)}function abl(e){switch(e){case ri.Trace:return console.trace;case ri.Debug:return console.debug;case ri.Info:return console.info;case ri.Warn:return console.warn;case ri.Error:return console.error}}var Of=class{__brand="TaskAbortSignal"};var Bf;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Bf||(Bf={}));function Awt({logger:e=Wui}={}){let t={logger:e,takeOverTerminal:()=>{throw new Error("Not implemented")},failAndThrow:(r,n,i)=>{let o=[];throw r!=null&&o.push(r),n!=null&&o.push(JSON.stringify(n)),o.length>0&&t.logger.error(...o),new Of},failWithoutThrowing:(r,n,i)=>{t.failAndThrow(r,n)},captureException:()=>{},getResult:()=>Bf.Success,addInteractiveTask:()=>{throw new Error("Not implemented")},runInteractiveTask:()=>{throw new Error("Not implemented")},instrumentPostHogEvent:()=>{throw new Error("Not implemented")}};return t}var hBs=(e=0)=>t=>`\x1B[${t+e}m`,gBs=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ABs=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Db={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},p8g=Object.keys(Db.modifier),yFl=Object.keys(Db.color),bFl=Object.keys(Db.bgColor),f8g=[...yFl,...bFl];function EFl(){let e=new Map;for(let[t,r]of Object.entries(Db)){for(let[n,i]of Object.entries(r))Db[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Db[n],e.set(i[0],i[1]);Object.defineProperty(Db,t,{value:r,enumerable:!1})}return Object.defineProperty(Db,"codes",{value:e,enumerable:!1}),Db.color.close="\x1B[39m",Db.bgColor.close="\x1B[49m",Db.color.ansi=hBs(),Db.color.ansi256=gBs(),Db.color.ansi16m=ABs(),Db.bgColor.ansi=hBs(10),Db.bgColor.ansi256=gBs(10),Db.bgColor.ansi16m=ABs(10),Object.defineProperties(Db,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>Db.rgbToAnsi256(...Db.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>Db.ansi256ToAnsi(Db.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Db.ansi256ToAnsi(Db.hexToAnsi256(t)),enumerable:!1}}),Db}var vFl=EFl(),fq=vFl;var lKt=ve(require("process"),1),bBs=ve(require("os"),1),Adi=ve(require("tty"),1);function l4(e,t=globalThis.Deno?globalThis.Deno.args:lKt.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}var{env:Fb}=lKt.default,uKt;l4("no-color")||l4("no-colors")||l4("color=false")||l4("color=never")?uKt=0:(l4("color")||l4("colors")||l4("color=true")||l4("color=always"))&&(uKt=1);function IFl(){if("FORCE_COLOR"in Fb)return Fb.FORCE_COLOR==="true"?1:Fb.FORCE_COLOR==="false"?0:Fb.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Fb.FORCE_COLOR,10),3)}function wFl(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function xFl(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=IFl();n!==void 0&&(uKt=n);let i=r?uKt:n;if(i===0)return 0;if(r){if(l4("color=16m")||l4("color=full")||l4("color=truecolor"))return 3;if(l4("color=256"))return 2}if("TF_BUILD"in Fb&&"AGENT_NAME"in Fb)return 1;if(e&&!t&&i===void 0)return 0;let o=i||0;if(Fb.TERM==="dumb")return o;if(lKt.default.platform==="win32"){let s=bBs.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Fb)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in Fb)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in Fb)||Fb.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in Fb)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Fb.TEAMCITY_VERSION)?1:0;if(Fb.COLORTERM==="truecolor"||Fb.TERM==="xterm-kitty"||Fb.TERM==="xterm-ghostty"||Fb.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Fb){let s=Number.parseInt((Fb.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Fb.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Fb.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Fb.TERM)||"COLORTERM"in Fb?1:o}function yBs(e,t={}){let r=xFl(e,{streamIsTTY:e&&e.isTTY,...t});return wFl(r)}var CFl={stdout:yBs({isTTY:Adi.default.isatty(1)}),stderr:yBs({isTTY:Adi.default.isatty(2)})},EBs=CFl;function vBs(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let i=t.length,o=0,s="";do s+=e.slice(o,n)+t+r,o=n+i,n=e.indexOf(t,o);while(n!==-1);return s+=e.slice(o),s}function IBs(e,t,r,n){let i=0,o="";do{let s=e[n-1]==="\r";o+=e.slice(i,s?n-1:n)+t+(s?`\r
|
|
@@ -1539,7 +1539,7 @@ Url: ${CGt(e)}`),!0}return!1}function Jol(e,t){return t?.length?EGt(e).some(r=>l
|
|
|
1539
1539
|
|
|
1540
1540
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function _he(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s=>{let a=e.seen.get(s);if(a.ref===null)return;let c=a.def??a.schema,u={...c},l=a.ref;if(a.ref=null,l){n(l);let d=e.seen.get(l),f=d.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),s._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(f.$ref&&d.def)for(let h in c)h==="$ref"||h==="allOf"||h in d.def&&JSON.stringify(c[h])===JSON.stringify(d.def[h])&&delete c[h]}let p=s._zod.parent;if(p&&p!==l){n(p);let d=e.seen.get(p);if(d?.schema.$ref&&(c.$ref=d.schema.$ref,d.def))for(let f in c)f==="$ref"||f==="allOf"||f in d.def&&JSON.stringify(c[f])===JSON.stringify(d.def[f])&&delete c[f]}e.override({zodSchema:s,jsonSchema:c,path:a.path??[]})};for(let s of[...e.seen.entries()].reverse())n(s[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(s)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let s of e.seen.entries()){let a=s[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let s=JSON.parse(JSON.stringify(i));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:nqe(t,"input",e.processors),output:nqe(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function nD(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return nD(n.element,r);if(n.type==="set")return nD(n.valueType,r);if(n.type==="lazy")return nD(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return nD(n.innerType,r);if(n.type==="intersection")return nD(n.left,r)||nD(n.right,r);if(n.type==="record"||n.type==="map")return nD(n.keyType,r)||nD(n.valueType,r);if(n.type==="pipe")return nD(n.in,r)||nD(n.out,r);if(n.type==="object"){for(let i in n.shape)if(nD(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(nD(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(nD(i,r))return!0;return!!(n.rest&&nD(n.rest,r))}return!1}var cEi=(e,t={})=>r=>{let n=xhe({...r,processors:t});return Ih(e,n),Che(n,e),_he(n,e)},nqe=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=xhe({...i??{},target:o,io:t,processors:r});return Ih(e,s),Che(s,e),_he(s,e)};var m8l={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},uEi=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=m8l[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},lEi=(e,t,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l),typeof o=="number"&&(i.minimum=o,typeof l=="number"&&t.target!=="draft-04"&&(l>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof s=="number"&&(i.maximum=s,typeof u=="number"&&t.target!=="draft-04"&&(u<=s?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},pEi=(e,t,r,n)=>{r.type="boolean"},fEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},dEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},mEi=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},hEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},gEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},AEi=(e,t,r,n)=>{r.not={}},yEi=(e,t,r,n)=>{},bEi=(e,t,r,n)=>{},EEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},vEi=(e,t,r,n)=>{let i=e._zod.def,o=Vxt(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},IEi=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let s of i.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},wEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},xEi=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},CEi=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=e._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(i,o)},_Ei=(e,t,r,n)=>{r.type="boolean"},SEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},TEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},OEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},BEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},PEi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},REi=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=Ih(o.element,t,{...n,path:[...n.path,"items"]})},DEi=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let s=o.shape;for(let u in s)i.properties[u]=Ih(s[u],t,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(u=>{let l=o.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Ih(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},dar=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,c)=>Ih(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},FEi=(e,t,r,n)=>{let i=e._zod.def,o=Ih(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=Ih(i.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c},kEi=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((d,f)=>Ih(d,t,{...n,path:[...n.path,s,f]})),u=o.rest?Ih(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=c,u&&(i.items=u)):t.target==="openapi-3.0"?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));let{minimum:l,maximum:p}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof p=="number"&&(i.maxItems=p)},NEi=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let l=Ih(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let p of c)i.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Ih(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=Ih(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=s._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(i.required=l)}},jEi=(e,t,r,n)=>{let i=e._zod.def,o=Ih(i.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},QEi=(e,t,r,n)=>{let i=e._zod.def;Ih(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},MEi=(e,t,r,n)=>{let i=e._zod.def;Ih(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},LEi=(e,t,r,n)=>{let i=e._zod.def;Ih(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},UEi=(e,t,r,n)=>{let i=e._zod.def;Ih(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},zEi=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Ih(o,t,n);let s=t.seen.get(e);s.ref=o},VEi=(e,t,r,n)=>{let i=e._zod.def;Ih(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},qEi=(e,t,r,n)=>{let i=e._zod.def;Ih(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},mar=(e,t,r,n)=>{let i=e._zod.def;Ih(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},GEi=(e,t,r,n)=>{let i=e._zod.innerType;Ih(i,t,n);let o=t.seen.get(e);o.ref=i},far={string:uEi,number:lEi,boolean:pEi,bigint:fEi,symbol:dEi,null:mEi,undefined:hEi,void:gEi,never:AEi,any:yEi,unknown:bEi,date:EEi,enum:vEi,literal:IEi,nan:wEi,template_literal:xEi,file:CEi,success:_Ei,custom:SEi,function:TEi,transform:OEi,map:BEi,set:PEi,array:REi,object:DEi,union:dar,intersection:FEi,tuple:kEi,record:NEi,nullable:jEi,nonoptional:QEi,default:MEi,prefault:LEi,catch:UEi,pipe:zEi,readonly:VEi,promise:qEi,optional:mar,lazy:GEi};function har(e,t){if("_idmap"in e){let n=e,i=xhe({...t,processors:far}),o={};for(let c of n._idmap.entries()){let[u,l]=c;Ih(l,i)}let s={},a={registry:n,uri:t?.uri,defs:o};i.external=a;for(let c of n._idmap.entries()){let[u,l]=c;Che(i,l),s[u]=_he(i,l)}if(Object.keys(o).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=xhe({...t,processors:far});return Ih(e,r),Che(r,e),_he(r,e)}var gar=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=xhe({processors:far,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return Ih(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Che(this.ctx,t);let n=_he(this.ctx,t),{"~standard":i,...o}=n;return o}};var Z4s={};var aCt={};$(aCt,{ZodAny:()=>hvi,ZodArray:()=>bvi,ZodBase64:()=>Qar,ZodBase64URL:()=>Mar,ZodBigInt:()=>lqe,ZodBigIntFormat:()=>zar,ZodBoolean:()=>uqe,ZodCIDRv4:()=>Nar,ZodCIDRv6:()=>jar,ZodCUID:()=>Oar,ZodCUID2:()=>Bar,ZodCatch:()=>Uvi,ZodCodec:()=>Jar,ZodCustom:()=>yCt,ZodCustomStringFormat:()=>aqe,ZodDate:()=>dCt,ZodDefault:()=>kvi,ZodDiscriminatedUnion:()=>vvi,ZodE164:()=>Lar,ZodEmail:()=>_ar,ZodEmoji:()=>Sar,ZodEnum:()=>oqe,ZodExactOptional:()=>Rvi,ZodFile:()=>Bvi,ZodFunction:()=>Jvi,ZodGUID:()=>cCt,ZodIPv4:()=>Far,ZodIPv6:()=>kar,ZodIntersection:()=>Ivi,ZodJWT:()=>Uar,ZodKSUID:()=>Dar,ZodLazy:()=>$vi,ZodLiteral:()=>Ovi,ZodMAC:()=>cvi,ZodMap:()=>Svi,ZodNaN:()=>Vvi,ZodNanoID:()=>Tar,ZodNever:()=>Avi,ZodNonOptional:()=>Har,ZodNull:()=>dvi,ZodNullable:()=>Fvi,ZodNumber:()=>cqe,ZodNumberFormat:()=>gPe,ZodObject:()=>hCt,ZodOptional:()=>$ar,ZodPipe:()=>Kar,ZodPrefault:()=>jvi,ZodPromise:()=>Kvi,ZodReadonly:()=>qvi,ZodRecord:()=>ACt,ZodSet:()=>Tvi,ZodString:()=>sqe,ZodStringFormat:()=>Gg,ZodSuccess:()=>Lvi,ZodSymbol:()=>pvi,ZodTemplateLiteral:()=>Wvi,ZodTransform:()=>Pvi,ZodTuple:()=>xvi,ZodType:()=>Zl,ZodULID:()=>Par,ZodURL:()=>fCt,ZodUUID:()=>nH,ZodUndefined:()=>fvi,ZodUnion:()=>gCt,ZodUnknown:()=>gvi,ZodVoid:()=>yvi,ZodXID:()=>Rar,ZodXor:()=>Evi,_ZodString:()=>Car,_default:()=>Nvi,_function:()=>s5s,any:()=>Qzs,array:()=>mCt,base64:()=>vzs,base64url:()=>Izs,bigint:()=>Dzs,boolean:()=>lvi,catch:()=>zvi,check:()=>a5s,cidrv4:()=>bzs,cidrv6:()=>Ezs,codec:()=>n5s,cuid:()=>pzs,cuid2:()=>fzs,custom:()=>c5s,date:()=>Lzs,describe:()=>u5s,discriminatedUnion:()=>Wzs,e164:()=>wzs,email:()=>tzs,emoji:()=>uzs,enum:()=>Gar,exactOptional:()=>Dvi,file:()=>Zzs,float32:()=>Ozs,float64:()=>Bzs,function:()=>s5s,guid:()=>rzs,hash:()=>Tzs,hex:()=>Szs,hostname:()=>_zs,httpUrl:()=>czs,instanceof:()=>p5s,int:()=>xar,int32:()=>Pzs,int64:()=>Fzs,intersection:()=>wvi,ipv4:()=>gzs,ipv6:()=>yzs,json:()=>d5s,jwt:()=>xzs,keyof:()=>Uzs,ksuid:()=>hzs,lazy:()=>Hvi,literal:()=>Xzs,looseObject:()=>qzs,looseRecord:()=>Hzs,mac:()=>Azs,map:()=>Kzs,meta:()=>l5s,nan:()=>r5s,nanoid:()=>lzs,nativeEnum:()=>Yzs,never:()=>Var,nonoptional:()=>Mvi,null:()=>mvi,nullable:()=>lCt,nullish:()=>e5s,number:()=>uvi,object:()=>zzs,optional:()=>uCt,partialRecord:()=>$zs,pipe:()=>pCt,prefault:()=>Qvi,preprocess:()=>m5s,promise:()=>o5s,readonly:()=>Gvi,record:()=>_vi,refine:()=>Yvi,set:()=>Jzs,strictObject:()=>Vzs,string:()=>war,stringFormat:()=>Czs,stringbool:()=>f5s,success:()=>t5s,superRefine:()=>Xvi,symbol:()=>Nzs,templateLiteral:()=>i5s,transform:()=>War,tuple:()=>Cvi,uint32:()=>Rzs,uint64:()=>kzs,ulid:()=>dzs,undefined:()=>jzs,union:()=>qar,unknown:()=>hPe,url:()=>azs,uuid:()=>nzs,uuidv4:()=>izs,uuidv6:()=>ozs,uuidv7:()=>szs,void:()=>Mzs,xid:()=>mzs,xor:()=>Gzs});var Aar={};$(Aar,{endsWith:()=>K6e,gt:()=>tH,gte:()=>rD,includes:()=>$6e,length:()=>mPe,lowercase:()=>G6e,lt:()=>eH,lte:()=>xM,maxLength:()=>dPe,maxSize:()=>whe,mime:()=>J6e,minLength:()=>Ase,minSize:()=>rH,multipleOf:()=>Ihe,negative:()=>car,nonnegative:()=>lar,nonpositive:()=>uar,normalize:()=>Y6e,overwrite:()=>Dq,positive:()=>aar,property:()=>par,regex:()=>q6e,size:()=>fPe,slugify:()=>tqe,startsWith:()=>H6e,toLowerCase:()=>Z6e,toUpperCase:()=>eqe,trim:()=>X6e,uppercase:()=>W6e});var iqe={};$(iqe,{ZodISODate:()=>bar,ZodISODateTime:()=>yar,ZodISODuration:()=>Iar,ZodISOTime:()=>Ear,date:()=>$Ei,datetime:()=>WEi,duration:()=>KEi,time:()=>HEi});var yar=mr("ZodISODateTime",(e,t)=>{wbi.init(e,t),Gg.init(e,t)});function WEi(e){return S0i(yar,e)}var bar=mr("ZodISODate",(e,t)=>{xbi.init(e,t),Gg.init(e,t)});function $Ei(e){return T0i(bar,e)}var Ear=mr("ZodISOTime",(e,t)=>{Cbi.init(e,t),Gg.init(e,t)});function HEi(e){return O0i(Ear,e)}var Iar=mr("ZodISODuration",(e,t)=>{_bi.init(e,t),Gg.init(e,t)});function KEi(e){return B0i(Iar,e)}var ezs=(e,t)=>{Hxt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Jxt(e,r)},flatten:{value:r=>Kxt(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,k6e,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,k6e,2)}},isEmpty:{get(){return e.issues.length===0}}})},g8l=mr("ZodError",ezs),lN=mr("ZodError",ezs,{Parent:Error});var JEi=Q6e(lN),YEi=M6e(lN),XEi=L6e(lN),ZEi=U6e(lN),evi=hsr(lN),tvi=gsr(lN),rvi=Asr(lN),nvi=ysr(lN),ivi=bsr(lN),ovi=Esr(lN),svi=vsr(lN),avi=Isr(lN);var Zl=mr("ZodType",(e,t)=>(Lu.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:nqe(e,"input"),output:nqe(e,"output")}}),e.toJSONSchema=cEi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(yi.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>tD(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>JEi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>XEi(e,r,n),e.parseAsync=async(r,n)=>YEi(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ZEi(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>evi(e,r,n),e.decode=(r,n)=>tvi(e,r,n),e.encodeAsync=async(r,n)=>rvi(e,r,n),e.decodeAsync=async(r,n)=>nvi(e,r,n),e.safeEncode=(r,n)=>ivi(e,r,n),e.safeDecode=(r,n)=>ovi(e,r,n),e.safeEncodeAsync=async(r,n)=>svi(e,r,n),e.safeDecodeAsync=async(r,n)=>avi(e,r,n),e.refine=(r,n)=>e.check(Yvi(r,n)),e.superRefine=r=>e.check(Xvi(r)),e.overwrite=r=>e.check(Dq(r)),e.optional=()=>uCt(e),e.exactOptional=()=>Dvi(e),e.nullable=()=>lCt(e),e.nullish=()=>uCt(lCt(e)),e.nonoptional=r=>Mvi(e,r),e.array=()=>mCt(e),e.or=r=>qar([e,r]),e.and=r=>wvi(e,r),e.transform=r=>pCt(e,War(r)),e.default=r=>Nvi(e,r),e.prefault=r=>Qvi(e,r),e.catch=r=>zvi(e,r),e.pipe=r=>pCt(e,r),e.readonly=()=>Gvi(e),e.describe=r=>{let n=e.clone();return H1.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return H1.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return H1.get(e);let n=e.clone();return H1.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Car=mr("_ZodString",(e,t)=>{pPe.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>uEi(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(q6e(...n)),e.includes=(...n)=>e.check($6e(...n)),e.startsWith=(...n)=>e.check(H6e(...n)),e.endsWith=(...n)=>e.check(K6e(...n)),e.min=(...n)=>e.check(Ase(...n)),e.max=(...n)=>e.check(dPe(...n)),e.length=(...n)=>e.check(mPe(...n)),e.nonempty=(...n)=>e.check(Ase(1,...n)),e.lowercase=n=>e.check(G6e(n)),e.uppercase=n=>e.check(W6e(n)),e.trim=()=>e.check(X6e()),e.normalize=(...n)=>e.check(Y6e(...n)),e.toLowerCase=()=>e.check(Z6e()),e.toUpperCase=()=>e.check(eqe()),e.slugify=()=>e.check(tqe())}),sqe=mr("ZodString",(e,t)=>{pPe.init(e,t),Car.init(e,t),e.email=r=>e.check(Usr(_ar,r)),e.url=r=>e.check(sCt(fCt,r)),e.jwt=r=>e.check(sar(Uar,r)),e.emoji=r=>e.check(Wsr(Sar,r)),e.guid=r=>e.check(oCt(cCt,r)),e.uuid=r=>e.check(zsr(nH,r)),e.uuidv4=r=>e.check(Vsr(nH,r)),e.uuidv6=r=>e.check(qsr(nH,r)),e.uuidv7=r=>e.check(Gsr(nH,r)),e.nanoid=r=>e.check($sr(Tar,r)),e.guid=r=>e.check(oCt(cCt,r)),e.cuid=r=>e.check(Hsr(Oar,r)),e.cuid2=r=>e.check(Ksr(Bar,r)),e.ulid=r=>e.check(Jsr(Par,r)),e.base64=r=>e.check(nar(Qar,r)),e.base64url=r=>e.check(iar(Mar,r)),e.xid=r=>e.check(Ysr(Rar,r)),e.ksuid=r=>e.check(Xsr(Dar,r)),e.ipv4=r=>e.check(Zsr(Far,r)),e.ipv6=r=>e.check(ear(kar,r)),e.cidrv4=r=>e.check(tar(Nar,r)),e.cidrv6=r=>e.check(rar(jar,r)),e.e164=r=>e.check(oar(Lar,r)),e.datetime=r=>e.check(WEi(r)),e.date=r=>e.check($Ei(r)),e.time=r=>e.check(HEi(r)),e.duration=r=>e.check(KEi(r))});function war(e){return w0i(sqe,e)}var Gg=mr("ZodStringFormat",(e,t)=>{qg.init(e,t),Car.init(e,t)}),_ar=mr("ZodEmail",(e,t)=>{mbi.init(e,t),Gg.init(e,t)});function tzs(e){return Usr(_ar,e)}var cCt=mr("ZodGUID",(e,t)=>{fbi.init(e,t),Gg.init(e,t)});function rzs(e){return oCt(cCt,e)}var nH=mr("ZodUUID",(e,t)=>{dbi.init(e,t),Gg.init(e,t)});function nzs(e){return zsr(nH,e)}function izs(e){return Vsr(nH,e)}function ozs(e){return qsr(nH,e)}function szs(e){return Gsr(nH,e)}var fCt=mr("ZodURL",(e,t)=>{hbi.init(e,t),Gg.init(e,t)});function azs(e){return sCt(fCt,e)}function czs(e){return sCt(fCt,{protocol:/^https?$/,hostname:Q4.domain,...yi.normalizeParams(e)})}var Sar=mr("ZodEmoji",(e,t)=>{gbi.init(e,t),Gg.init(e,t)});function uzs(e){return Wsr(Sar,e)}var Tar=mr("ZodNanoID",(e,t)=>{Abi.init(e,t),Gg.init(e,t)});function lzs(e){return $sr(Tar,e)}var Oar=mr("ZodCUID",(e,t)=>{ybi.init(e,t),Gg.init(e,t)});function pzs(e){return Hsr(Oar,e)}var Bar=mr("ZodCUID2",(e,t)=>{bbi.init(e,t),Gg.init(e,t)});function fzs(e){return Ksr(Bar,e)}var Par=mr("ZodULID",(e,t)=>{Ebi.init(e,t),Gg.init(e,t)});function dzs(e){return Jsr(Par,e)}var Rar=mr("ZodXID",(e,t)=>{vbi.init(e,t),Gg.init(e,t)});function mzs(e){return Ysr(Rar,e)}var Dar=mr("ZodKSUID",(e,t)=>{Ibi.init(e,t),Gg.init(e,t)});function hzs(e){return Xsr(Dar,e)}var Far=mr("ZodIPv4",(e,t)=>{Sbi.init(e,t),Gg.init(e,t)});function gzs(e){return Zsr(Far,e)}var cvi=mr("ZodMAC",(e,t)=>{Obi.init(e,t),Gg.init(e,t)});function Azs(e){return C0i(cvi,e)}var kar=mr("ZodIPv6",(e,t)=>{Tbi.init(e,t),Gg.init(e,t)});function yzs(e){return ear(kar,e)}var Nar=mr("ZodCIDRv4",(e,t)=>{Bbi.init(e,t),Gg.init(e,t)});function bzs(e){return tar(Nar,e)}var jar=mr("ZodCIDRv6",(e,t)=>{Pbi.init(e,t),Gg.init(e,t)});function Ezs(e){return rar(jar,e)}var Qar=mr("ZodBase64",(e,t)=>{Dbi.init(e,t),Gg.init(e,t)});function vzs(e){return nar(Qar,e)}var Mar=mr("ZodBase64URL",(e,t)=>{Fbi.init(e,t),Gg.init(e,t)});function Izs(e){return iar(Mar,e)}var Lar=mr("ZodE164",(e,t)=>{kbi.init(e,t),Gg.init(e,t)});function wzs(e){return oar(Lar,e)}var Uar=mr("ZodJWT",(e,t)=>{Nbi.init(e,t),Gg.init(e,t)});function xzs(e){return sar(Uar,e)}var aqe=mr("ZodCustomStringFormat",(e,t)=>{jbi.init(e,t),Gg.init(e,t)});function Czs(e,t,r={}){return rqe(aqe,e,t,r)}function _zs(e){return rqe(aqe,"hostname",Q4.hostname,e)}function Szs(e){return rqe(aqe,"hex",Q4.hex,e)}function Tzs(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=Q4[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return rqe(aqe,n,i,t)}var cqe=mr("ZodNumber",(e,t)=>{Rsr.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>lEi(e,n,i,o),e.gt=(n,i)=>e.check(tH(n,i)),e.gte=(n,i)=>e.check(rD(n,i)),e.min=(n,i)=>e.check(rD(n,i)),e.lt=(n,i)=>e.check(eH(n,i)),e.lte=(n,i)=>e.check(xM(n,i)),e.max=(n,i)=>e.check(xM(n,i)),e.int=n=>e.check(xar(n)),e.safe=n=>e.check(xar(n)),e.positive=n=>e.check(tH(0,n)),e.nonnegative=n=>e.check(rD(0,n)),e.negative=n=>e.check(eH(0,n)),e.nonpositive=n=>e.check(xM(0,n)),e.multipleOf=(n,i)=>e.check(Ihe(n,i)),e.step=(n,i)=>e.check(Ihe(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function uvi(e){return P0i(cqe,e)}var gPe=mr("ZodNumberFormat",(e,t)=>{Qbi.init(e,t),cqe.init(e,t)});function xar(e){return D0i(gPe,e)}function Ozs(e){return F0i(gPe,e)}function Bzs(e){return k0i(gPe,e)}function Pzs(e){return N0i(gPe,e)}function Rzs(e){return j0i(gPe,e)}var uqe=mr("ZodBoolean",(e,t)=>{eCt.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>pEi(e,r,n,i)});function lvi(e){return Q0i(uqe,e)}var lqe=mr("ZodBigInt",(e,t)=>{Dsr.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>fEi(e,n,i,o),e.gte=(n,i)=>e.check(rD(n,i)),e.min=(n,i)=>e.check(rD(n,i)),e.gt=(n,i)=>e.check(tH(n,i)),e.gte=(n,i)=>e.check(rD(n,i)),e.min=(n,i)=>e.check(rD(n,i)),e.lt=(n,i)=>e.check(eH(n,i)),e.lte=(n,i)=>e.check(xM(n,i)),e.max=(n,i)=>e.check(xM(n,i)),e.positive=n=>e.check(tH(BigInt(0),n)),e.negative=n=>e.check(eH(BigInt(0),n)),e.nonpositive=n=>e.check(xM(BigInt(0),n)),e.nonnegative=n=>e.check(rD(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(Ihe(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Dzs(e){return L0i(lqe,e)}var zar=mr("ZodBigIntFormat",(e,t)=>{Mbi.init(e,t),lqe.init(e,t)});function Fzs(e){return z0i(zar,e)}function kzs(e){return V0i(zar,e)}var pvi=mr("ZodSymbol",(e,t)=>{Lbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dEi(e,r,n,i)});function Nzs(e){return q0i(pvi,e)}var fvi=mr("ZodUndefined",(e,t)=>{Ubi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hEi(e,r,n,i)});function jzs(e){return G0i(fvi,e)}var dvi=mr("ZodNull",(e,t)=>{zbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>mEi(e,r,n,i)});function mvi(e){return W0i(dvi,e)}var hvi=mr("ZodAny",(e,t)=>{Vbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yEi(e,r,n,i)});function Qzs(){return $0i(hvi)}var gvi=mr("ZodUnknown",(e,t)=>{qbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>bEi(e,r,n,i)});function hPe(){return H0i(gvi)}var Avi=mr("ZodNever",(e,t)=>{Gbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>AEi(e,r,n,i)});function Var(e){return K0i(Avi,e)}var yvi=mr("ZodVoid",(e,t)=>{Wbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gEi(e,r,n,i)});function Mzs(e){return J0i(yvi,e)}var dCt=mr("ZodDate",(e,t)=>{$bi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>EEi(e,n,i,o),e.min=(n,i)=>e.check(rD(n,i)),e.max=(n,i)=>e.check(xM(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Lzs(e){return Y0i(dCt,e)}var bvi=mr("ZodArray",(e,t)=>{Hbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>REi(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(Ase(r,n)),e.nonempty=r=>e.check(Ase(1,r)),e.max=(r,n)=>e.check(dPe(r,n)),e.length=(r,n)=>e.check(mPe(r,n)),e.unwrap=()=>e.element});function mCt(e,t){return eEi(bvi,e,t)}function Uzs(e){let t=e._zod.def.shape;return Gar(Object.keys(t))}var hCt=mr("ZodObject",(e,t)=>{Kbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>DEi(e,r,n,i),yi.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Gar(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:hPe()}),e.loose=()=>e.clone({...e._zod.def,catchall:hPe()}),e.strict=()=>e.clone({...e._zod.def,catchall:Var()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>yi.extend(e,r),e.safeExtend=r=>yi.safeExtend(e,r),e.merge=r=>yi.merge(e,r),e.pick=r=>yi.pick(e,r),e.omit=r=>yi.omit(e,r),e.partial=(...r)=>yi.partial($ar,e,r[0]),e.required=(...r)=>yi.required(Har,e,r[0])});function zzs(e,t){let r={type:"object",shape:e??{},...yi.normalizeParams(t)};return new hCt(r)}function Vzs(e,t){return new hCt({type:"object",shape:e,catchall:Var(),...yi.normalizeParams(t)})}function qzs(e,t){return new hCt({type:"object",shape:e,catchall:hPe(),...yi.normalizeParams(t)})}var gCt=mr("ZodUnion",(e,t)=>{tCt.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dar(e,r,n,i),e.options=t.options});function qar(e,t){return new gCt({type:"union",options:e,...yi.normalizeParams(t)})}var Evi=mr("ZodXor",(e,t)=>{gCt.init(e,t),Jbi.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dar(e,r,n,i),e.options=t.options});function Gzs(e,t){return new Evi({type:"union",options:e,inclusive:!1,...yi.normalizeParams(t)})}var vvi=mr("ZodDiscriminatedUnion",(e,t)=>{gCt.init(e,t),Ybi.init(e,t)});function Wzs(e,t,r){return new vvi({type:"union",options:t,discriminator:e,...yi.normalizeParams(r)})}var Ivi=mr("ZodIntersection",(e,t)=>{Xbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>FEi(e,r,n,i)});function wvi(e,t){return new Ivi({type:"intersection",left:e,right:t})}var xvi=mr("ZodTuple",(e,t)=>{Fsr.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kEi(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Cvi(e,t,r){let n=t instanceof Lu,i=n?r:t,o=n?t:null;return new xvi({type:"tuple",items:e,rest:o,...yi.normalizeParams(i)})}var ACt=mr("ZodRecord",(e,t)=>{Zbi.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>NEi(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function _vi(e,t,r){return new ACt({type:"record",keyType:e,valueType:t,...yi.normalizeParams(r)})}function $zs(e,t,r){let n=tD(e);return n._zod.values=void 0,new ACt({type:"record",keyType:n,valueType:t,...yi.normalizeParams(r)})}function Hzs(e,t,r){return new ACt({type:"record",keyType:e,valueType:t,mode:"loose",...yi.normalizeParams(r)})}var Svi=mr("ZodMap",(e,t)=>{e0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>BEi(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(rH(...r)),e.nonempty=r=>e.check(rH(1,r)),e.max=(...r)=>e.check(whe(...r)),e.size=(...r)=>e.check(fPe(...r))});function Kzs(e,t,r){return new Svi({type:"map",keyType:e,valueType:t,...yi.normalizeParams(r)})}var Tvi=mr("ZodSet",(e,t)=>{t0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>PEi(e,r,n,i),e.min=(...r)=>e.check(rH(...r)),e.nonempty=r=>e.check(rH(1,r)),e.max=(...r)=>e.check(whe(...r)),e.size=(...r)=>e.check(fPe(...r))});function Jzs(e,t){return new Tvi({type:"set",valueType:e,...yi.normalizeParams(t)})}var oqe=mr("ZodEnum",(e,t)=>{r0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>vEi(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new oqe({...t,checks:[],...yi.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new oqe({...t,checks:[],...yi.normalizeParams(i),entries:o})}});function Gar(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new oqe({type:"enum",entries:r,...yi.normalizeParams(t)})}function Yzs(e,t){return new oqe({type:"enum",entries:e,...yi.normalizeParams(t)})}var Ovi=mr("ZodLiteral",(e,t)=>{n0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>IEi(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Xzs(e,t){return new Ovi({type:"literal",values:Array.isArray(e)?e:[e],...yi.normalizeParams(t)})}var Bvi=mr("ZodFile",(e,t)=>{i0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>CEi(e,r,n,i),e.min=(r,n)=>e.check(rH(r,n)),e.max=(r,n)=>e.check(whe(r,n)),e.mime=(r,n)=>e.check(J6e(Array.isArray(r)?r:[r],n))});function Zzs(e){return tEi(Bvi,e)}var Pvi=mr("ZodTransform",(e,t)=>{o0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>OEi(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ahe(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(yi.issue(o,r.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(yi.issue(s))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function War(e){return new Pvi({type:"transform",transform:e})}var $ar=mr("ZodOptional",(e,t)=>{ksr.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>mar(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function uCt(e){return new $ar({type:"optional",innerType:e})}var Rvi=mr("ZodExactOptional",(e,t)=>{s0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>mar(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Dvi(e){return new Rvi({type:"optional",innerType:e})}var Fvi=mr("ZodNullable",(e,t)=>{a0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>jEi(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function lCt(e){return new Fvi({type:"nullable",innerType:e})}function e5s(e){return uCt(lCt(e))}var kvi=mr("ZodDefault",(e,t)=>{c0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>MEi(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Nvi(e,t){return new kvi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():yi.shallowClone(t)}})}var jvi=mr("ZodPrefault",(e,t)=>{u0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>LEi(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Qvi(e,t){return new jvi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():yi.shallowClone(t)}})}var Har=mr("ZodNonOptional",(e,t)=>{l0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>QEi(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Mvi(e,t){return new Har({type:"nonoptional",innerType:e,...yi.normalizeParams(t)})}var Lvi=mr("ZodSuccess",(e,t)=>{p0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>_Ei(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function t5s(e){return new Lvi({type:"success",innerType:e})}var Uvi=mr("ZodCatch",(e,t)=>{f0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>UEi(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zvi(e,t){return new Uvi({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Vvi=mr("ZodNaN",(e,t)=>{d0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>wEi(e,r,n,i)});function r5s(e){return Z0i(Vvi,e)}var Kar=mr("ZodPipe",(e,t)=>{m0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zEi(e,r,n,i),e.in=t.in,e.out=t.out});function pCt(e,t){return new Kar({type:"pipe",in:e,out:t})}var Jar=mr("ZodCodec",(e,t)=>{Kar.init(e,t),rCt.init(e,t)});function n5s(e,t,r){return new Jar({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var qvi=mr("ZodReadonly",(e,t)=>{h0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>VEi(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Gvi(e){return new qvi({type:"readonly",innerType:e})}var Wvi=mr("ZodTemplateLiteral",(e,t)=>{g0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xEi(e,r,n,i)});function i5s(e,t){return new Wvi({type:"template_literal",parts:e,...yi.normalizeParams(t)})}var $vi=mr("ZodLazy",(e,t)=>{b0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>GEi(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function Hvi(e){return new $vi({type:"lazy",getter:e})}var Kvi=mr("ZodPromise",(e,t)=>{y0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>qEi(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function o5s(e){return new Kvi({type:"promise",innerType:e})}var Jvi=mr("ZodFunction",(e,t)=>{A0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>TEi(e,r,n,i)});function s5s(e){return new Jvi({type:"function",input:Array.isArray(e?.input)?Cvi(e?.input):e?.input??mCt(hPe()),output:e?.output??hPe()})}var yCt=mr("ZodCustom",(e,t)=>{E0i.init(e,t),Zl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>SEi(e,r,n,i)});function a5s(e){let t=new yA({check:"custom"});return t._zod.check=e,t}function c5s(e,t){return rEi(yCt,e??(()=>!0),t)}function Yvi(e,t={}){return nEi(yCt,e,t)}function Xvi(e){return iEi(e)}var u5s=oEi,l5s=sEi;function p5s(e,t={}){let r=new yCt({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...yi.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var f5s=(...e)=>aEi({Codec:Jar,Boolean:uqe,String:sqe},...e);function d5s(e){let t=Hvi(()=>qar([war(e),uvi(),lvi(),mvi(),mCt(t),_vi(war(),t)]));return t}function m5s(e,t){return pCt(War(e),t)}var y8l={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function b8l(e){VE({customError:e})}function E8l(){return VE().customError}var Zvi;Zvi||(Zvi={});var jo={...aCt,...Aar,iso:iqe},v8l=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function I8l(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function w8l(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!t.defs[i])throw new Error(`Reference not found: ${e}`);return t.defs[i]}throw new Error(`Reference not found: ${e}`)}function h5s(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return jo.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let i=e.$ref;if(t.refs.has(i))return t.refs.get(i);if(t.processing.has(i))return jo.lazy(()=>{if(!t.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return t.refs.get(i)});t.processing.add(i);let o=w8l(i,t),s=XO(o,t);return t.refs.set(i,s),t.processing.delete(i),s}if(e.enum!==void 0){let i=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&i.length===1&&i[0]===null)return jo.null();if(i.length===0)return jo.never();if(i.length===1)return jo.literal(i[0]);if(i.every(s=>typeof s=="string"))return jo.enum(i);let o=i.map(s=>jo.literal(s));return o.length<2?o[0]:jo.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return jo.literal(e.const);let r=e.type;if(Array.isArray(r)){let i=r.map(o=>{let s={...e,type:o};return h5s(s,t)});return i.length===0?jo.never():i.length===1?i[0]:jo.union(i)}if(!r)return jo.any();let n;switch(r){case"string":{let i=jo.string();if(e.format){let o=e.format;o==="email"?i=i.check(jo.email()):o==="uri"||o==="uri-reference"?i=i.check(jo.url()):o==="uuid"||o==="guid"?i=i.check(jo.uuid()):o==="date-time"?i=i.check(jo.iso.datetime()):o==="date"?i=i.check(jo.iso.date()):o==="time"?i=i.check(jo.iso.time()):o==="duration"?i=i.check(jo.iso.duration()):o==="ipv4"?i=i.check(jo.ipv4()):o==="ipv6"?i=i.check(jo.ipv6()):o==="mac"?i=i.check(jo.mac()):o==="cidr"?i=i.check(jo.cidrv4()):o==="cidr-v6"?i=i.check(jo.cidrv6()):o==="base64"?i=i.check(jo.base64()):o==="base64url"?i=i.check(jo.base64url()):o==="e164"?i=i.check(jo.e164()):o==="jwt"?i=i.check(jo.jwt()):o==="emoji"?i=i.check(jo.emoji()):o==="nanoid"?i=i.check(jo.nanoid()):o==="cuid"?i=i.check(jo.cuid()):o==="cuid2"?i=i.check(jo.cuid2()):o==="ulid"?i=i.check(jo.ulid()):o==="xid"?i=i.check(jo.xid()):o==="ksuid"&&(i=i.check(jo.ksuid()))}typeof e.minLength=="number"&&(i=i.min(e.minLength)),typeof e.maxLength=="number"&&(i=i.max(e.maxLength)),e.pattern&&(i=i.regex(new RegExp(e.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?jo.number().int():jo.number();typeof e.minimum=="number"&&(i=i.min(e.minimum)),typeof e.maximum=="number"&&(i=i.max(e.maximum)),typeof e.exclusiveMinimum=="number"?i=i.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(i=i.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?i=i.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(i=i.lt(e.maximum)),typeof e.multipleOf=="number"&&(i=i.multipleOf(e.multipleOf)),n=i;break}case"boolean":{n=jo.boolean();break}case"null":{n=jo.null();break}case"object":{let i={},o=e.properties||{},s=new Set(e.required||[]);for(let[c,u]of Object.entries(o)){let l=XO(u,t);i[c]=s.has(c)?l:l.optional()}if(e.propertyNames){let c=XO(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?XO(e.additionalProperties,t):jo.any();if(Object.keys(i).length===0){n=jo.record(c,u);break}let l=jo.object(i).passthrough(),p=jo.looseRecord(c,u);n=jo.intersection(l,p);break}if(e.patternProperties){let c=e.patternProperties,u=Object.keys(c),l=[];for(let d of u){let f=XO(c[d],t),m=jo.string().regex(new RegExp(d));l.push(jo.looseRecord(m,f))}let p=[];if(Object.keys(i).length>0&&p.push(jo.object(i).passthrough()),p.push(...l),p.length===0)n=jo.object({}).passthrough();else if(p.length===1)n=p[0];else{let d=jo.intersection(p[0],p[1]);for(let f=2;f<p.length;f++)d=jo.intersection(d,p[f]);n=d}break}let a=jo.object(i);e.additionalProperties===!1?n=a.strict():typeof e.additionalProperties=="object"?n=a.catchall(XO(e.additionalProperties,t)):n=a.passthrough();break}case"array":{let i=e.prefixItems,o=e.items;if(i&&Array.isArray(i)){let s=i.map(c=>XO(c,t)),a=o&&typeof o=="object"&&!Array.isArray(o)?XO(o,t):void 0;a?n=jo.tuple(s).rest(a):n=jo.tuple(s),typeof e.minItems=="number"&&(n=n.check(jo.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(jo.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=o.map(c=>XO(c,t)),a=e.additionalItems&&typeof e.additionalItems=="object"?XO(e.additionalItems,t):void 0;a?n=jo.tuple(s).rest(a):n=jo.tuple(s),typeof e.minItems=="number"&&(n=n.check(jo.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(jo.maxLength(e.maxItems)))}else if(o!==void 0){let s=XO(o,t),a=jo.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=jo.array(jo.any());break}default:throw new Error(`Unsupported type: ${r}`)}return e.description&&(n=n.describe(e.description)),e.default!==void 0&&(n=n.default(e.default)),n}function XO(e,t){if(typeof e=="boolean")return e?jo.any():jo.never();let r=h5s(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>XO(u,t)),c=jo.union(a);r=n?jo.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>XO(u,t)),c=jo.xor(a);r=n?jo.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:jo.any();else{let a=n?r:XO(e.allOf[0],t),c=n?0:1;for(let u=c;u<e.allOf.length;u++)a=jo.intersection(a,XO(e.allOf[u],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=jo.nullable(r)),e.readOnly===!0&&(r=jo.readonly(r));let i={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(i[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(i[a]=e[a]);for(let a of Object.keys(e))v8l.has(a)||(i[a]=e[a]);return Object.keys(i).length>0&&t.registry.add(r,i),r}function g5s(e,t){if(typeof e=="boolean")return e?jo.any():jo.never();let r=I8l(e,t?.defaultTarget),n=e.$defs||e.definitions||{},i={version:r,defs:n,refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??H1};return XO(e,i)}var eIi={};$(eIi,{bigint:()=>S8l,boolean:()=>_8l,date:()=>T8l,number:()=>C8l,string:()=>x8l});function x8l(e){return x0i(sqe,e)}function C8l(e){return R0i(cqe,e)}function _8l(e){return M0i(uqe,e)}function S8l(e){return U0i(lqe,e)}function T8l(e){return X0i(dCt,e)}VE(Nsr());var c_={};$(c_,{DocsYmlSchemas:()=>gIi,RawSchemas:()=>iwi});var gIi={};$(gIi,{AIChatConfig:()=>nIi,AIChatDatasource:()=>rVs,AIChatLocation:()=>b5s,AIChatModel:()=>E5s,AIChatWebsiteDatasource:()=>tVs,AbsoluteProductPath:()=>c3s,AgentsConfig:()=>iVs,AiExamplesConfig:()=>eVs,AnalyticsConfig:()=>Z5s,AnnouncementConfig:()=>ecr,ApiReferenceConfiguration:()=>JVs,ApiReferenceEndpointConfiguration:()=>GVs,ApiReferenceLayoutItem:()=>ICt,ApiReferenceOperationConfiguration:()=>WVs,ApiReferencePackageConfiguration:()=>KVs,ApiReferencePackageConfigurationWithOptions:()=>HVs,ApiReferenceSectionConfiguration:()=>$Vs,Audience:()=>bCt,AudienceId:()=>tIi,Availability:()=>bse,BackgroundImageConfiguration:()=>V5s,BackgroundImageThemedConfig:()=>z5s,BodyThemeConfig:()=>F5s,ChangelogConfiguration:()=>zVs,ChangelogFolderRelativePath:()=>oIi,CheckConfig:()=>FVs,CheckRuleSeverity:()=>She,CheckRulesConfig:()=>DVs,CollapsedStringValue:()=>G5s,CollapsedValue:()=>ECt,ColorConfig:()=>mw,ColorThemedConfig:()=>M5s,ColorsConfiguration:()=>pVs,ContentAlignment:()=>T5s,CssConfig:()=>q5s,CustomDomain:()=>L5s,CustomPageAction:()=>fVs,DocsConfiguration:()=>R8l,DocsInstance:()=>AVs,DocsSettingsConfig:()=>lVs,DocsTypographyConfig:()=>aVs,EditThisPageConfig:()=>gVs,EditThisPageLaunch:()=>v5s,ExperimentalConfig:()=>NVs,ExternalProduct:()=>o3s,FeatureFlag:()=>rIi,FeatureFlagConfiguration:()=>W5s,FolderConfiguration:()=>qVs,FontConfig:()=>Yar,FontConfigPath:()=>sVs,FontConfigVariant:()=>oVs,FontDisplay:()=>x5s,FontStyle:()=>uIi,FontWeight:()=>pIi,FooterLinksConfig:()=>_Vs,FooterNavThemeConfig:()=>R5s,FullStoryAnalyticsConfig:()=>H5s,GTMConfig:()=>Y5s,GitLibraryInputSchema:()=>jVs,GithubEditThisPageConfig:()=>hVs,GoogleAnalytics4Config:()=>X5s,HeaderPosition:()=>O5s,HttpSnippetLanguage:()=>j5s,HttpSnippetsConfig:()=>U5s,IntegrationsConfig:()=>kVs,IntercomConfig:()=>K5s,InternalProduct:()=>i3s,JsConfig:()=>BVs,JsConfigOptions:()=>iIi,JsFileConfig:()=>TVs,JsFileConfigSettings:()=>SVs,JsRemoteConfig:()=>OVs,JsScriptStrategy:()=>lIi,Language:()=>aIi,LanguageSwitcherThemeConfig:()=>P5s,LayoutConfig:()=>uVs,LibraryConfiguration:()=>UVs,LibraryInputConfiguration:()=>MVs,LibraryLanguage:()=>w5s,LibraryName:()=>sIi,LibraryOutputConfiguration:()=>LVs,LibraryReferenceConfiguration:()=>VVs,LinkConfiguration:()=>dIi,LogoConfiguration:()=>yVs,MetadataConfig:()=>PVs,NavbarDropdownConfig:()=>xVs,NavbarGithubConfig:()=>wVs,NavbarGithubConfigWithOptions:()=>IVs,NavbarLink:()=>CVs,NavbarLinkConfig:()=>APe,NavigationConfig:()=>tcr,NavigationItem:()=>wCt,PageActionOption:()=>y5s,PageActionOptions:()=>dVs,PageActionsConfig:()=>mVs,PageActionsThemeConfig:()=>N5s,PageConfiguration:()=>dqe,PageDescriptionSource:()=>nVs,PathLibraryInputSchema:()=>QVs,PlaygroundButtonSettings:()=>vVs,PlaygroundSettings:()=>vCt,PostHogConfig:()=>J5s,ProductConfig:()=>s3s,ProductConfigBase:()=>hIi,ProductFileConfig:()=>P8l,ProductPath:()=>B8l,ProductSwitcherThemeConfig:()=>B5s,ProgrammingLanguage:()=>A5s,RedirectConfig:()=>RVs,RelativeProductPath:()=>a3s,Role:()=>fIi,RoleId:()=>Xar,SearchbarPlacement:()=>C5s,SectionConfiguration:()=>YVs,SegmentConfig:()=>$5s,SidebarThemeConfig:()=>k5s,SnippetLanguageConfiguration:()=>iH,SnippetsConfiguration:()=>EVs,SwitcherPlacement:()=>S5s,TabConfig:()=>rcr,TabId:()=>pqe,TabVariant:()=>ZVs,TabbedNavigationConfig:()=>n3s,TabbedNavigationItem:()=>r3s,TabbedNavigationItemWithLayout:()=>e3s,TabbedNavigationItemWithVariants:()=>t3s,TabsPlacement:()=>_5s,TabsThemeConfig:()=>D5s,Target:()=>fqe,ThemeConfig:()=>cVs,TitleSource:()=>cIi,TwitterCardSetting:()=>Q5s,UntabbedNavigationConfig:()=>XVs,VersionAvailability:()=>I5s,VersionConfig:()=>mIi,VersionFileConfig:()=>O8l,VersionedSnippetLanguageConfiguration:()=>bVs,WithFeatureFlags:()=>eB,WithPermissions:()=>ZO,WithViewers:()=>Zar});var pqe=se.string(),oIi=se.string(),tIi=se.string(),Xar=se.string(),sIi=se.string(),A5s=se.enum(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]),aIi=se.enum(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]),y5s=se.enum(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]),b5s=se.enum(["docs","slack","discord"]),E5s=se.enum(["claude-3.7","claude-4","command-a"]),v5s=se.enum(["github","dashboard"]),bse=se.enum(["stable","generally-available","in-development","pre-release","deprecated","beta"]),I5s=se.enum(["deprecated","ga","stable","beta"]),cIi=se.enum(["frontmatter","filename"]),w5s=se.enum(["python","cpp"]),uIi=se.enum(["normal","italic"]),x5s=se.enum(["auto","block","swap","fallback","optional"]),C5s=se.enum(["header","header-tabs","sidebar"]),_5s=se.enum(["header","sidebar"]),S5s=se.enum(["header","sidebar"]),T5s=se.enum(["center","left"]),O5s=se.enum(["fixed","static"]),B5s=se.enum(["default","toggle"]),P5s=se.enum(["default","minimal"]),R5s=se.enum(["default","minimal"]),D5s=se.enum(["default","bubble"]),F5s=se.enum(["default","canvas"]),k5s=se.enum(["default","minimal"]),N5s=se.enum(["default","toolbar"]),j5s=se.enum(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]),fqe=se.enum(["_blank","_self","_parent","_top"]),Q5s=se.enum(["summary","summary_large_image","app","player"]),lIi=se.enum(["beforeInteractive","afterInteractive","lazyOnload"]),pIi=se.union([se.string(),se.number().int()]),M5s=se.object({dark:se.string().optional(),light:se.string().optional()}),mw=se.union([se.string(),M5s]),bCt=se.union([tIi,se.array(tIi)]),fIi=se.union([Xar,se.array(Xar)]),L5s=se.union([se.string(),se.array(se.string())]),U5s=se.union([se.boolean(),se.array(j5s)]),z5s=se.object({dark:se.string().optional(),light:se.string().optional()}),V5s=se.union([se.string(),z5s]),q5s=se.union([se.string(),se.array(se.string())]),G5s=se.enum(["open-by-default"]),ECt=se.union([se.boolean(),G5s]),ZO=se.object({viewers:fIi.optional(),orphaned:se.boolean().optional()}),rIi=se.object({flag:se.string(),"fallback-value":se.unknown().optional(),match:se.unknown().optional()}),W5s=se.union([se.string(),rIi,se.array(rIi)]),eB=se.object({"feature-flag":W5s.optional()}),Zar=se.object({viewers:fIi.optional()}),$5s=se.object({"write-key":se.string()}),H5s=se.object({"org-id":se.string()}),K5s=se.object({"app-id":se.string(),"api-base":se.string().optional()}),J5s=se.object({"api-key":se.string(),endpoint:se.string().optional()}),Y5s=se.object({"container-id":se.string()}),X5s=se.object({"measurement-id":se.string()}),Z5s=se.object({segment:$5s.optional(),fullstory:H5s.optional(),intercom:K5s.optional(),posthog:J5s.optional(),gtm:Y5s.optional(),ga4:X5s.optional()}),eVs=se.object({enabled:se.boolean().optional(),style:se.string().optional()}),tVs=se.object({url:se.string(),title:se.string().optional()}),rVs=tVs,nVs=se.enum(["description","subtitle"]),iVs=se.object({"page-directive":se.string().optional(),"page-description-source":nVs.optional(),"llms-txt":se.string().optional(),"llms-full-txt":se.string().optional()}),nIi=se.object({model:E5s.optional(),"system-prompt":se.string().optional(),location:se.array(b5s).optional(),datasources:se.array(rVs).optional()}),oVs=se.object({path:se.string(),weight:pIi.optional(),style:uIi.optional()}),sVs=se.union([se.string(),oVs]),Yar=se.object({name:se.string().optional(),path:se.string().optional(),weight:pIi.optional(),style:uIi.optional(),paths:se.array(sVs).optional(),display:x5s.optional(),fallback:se.array(se.string()).optional(),"font-variation-settings":se.string().optional()}),aVs=se.object({headingsFont:Yar.optional(),bodyFont:Yar.optional(),codeFont:Yar.optional()}),cVs=se.object({sidebar:k5s.optional(),body:F5s.optional(),tabs:D5s.optional(),"page-actions":N5s.optional(),"footer-nav":R5s.optional(),"language-switcher":P5s.optional(),"product-switcher":B5s.optional()}),uVs=se.object({"page-width":se.string().optional(),"content-width":se.string().optional(),"sidebar-width":se.string().optional(),"header-height":se.string().optional(),"searchbar-placement":C5s.optional(),"tabs-placement":_5s.optional(),"switcher-placement":S5s.optional(),"content-alignment":T5s.optional(),"header-position":O5s.optional(),"disable-header":se.boolean().optional(),"hide-nav-links":se.boolean().optional(),"hide-feedback":se.boolean().optional()}),lVs=se.object({"search-text":se.string().optional(),"disable-search":se.boolean().optional(),"dark-mode-code":se.boolean().optional(),"default-search-filters":se.boolean().optional(),"http-snippets":U5s.optional(),"hide-404-page":se.boolean().optional(),"use-javascript-as-typescript":se.boolean().optional(),"disable-explorer-proxy":se.boolean().optional(),"disable-analytics":se.boolean().optional(),language:aIi.optional(),"folder-title-source":cIi.optional(),"substitute-env-vars":se.boolean().optional()}),pVs=se.object({"accent-primary":mw.optional(),accentPrimary:mw.optional(),background:mw.optional(),border:mw.optional(),"sidebar-background":mw.optional(),"header-background":mw.optional(),"card-background":mw.optional(),"accent-1":mw.optional(),"accent-2":mw.optional(),"accent-3":mw.optional(),"accent-4":mw.optional(),"accent-5":mw.optional(),"accent-6":mw.optional(),"accent-7":mw.optional(),"accent-8":mw.optional(),"accent-9":mw.optional(),"accent-10":mw.optional(),"accent-11":mw.optional(),"accent-12":mw.optional()}),fVs=se.object({title:se.string(),subtitle:se.string().optional(),url:se.string(),icon:se.string().optional(),default:se.boolean().optional()}),dVs=se.object({"copy-page":se.boolean().optional(),"view-as-markdown":se.boolean().optional(),"ask-ai":se.boolean().optional(),chatgpt:se.boolean().optional(),claude:se.boolean().optional(),cursor:se.boolean().optional(),vscode:se.boolean().optional(),custom:se.array(fVs).optional()}),mVs=se.object({default:y5s.optional(),options:dVs.optional()}),hVs=se.object({host:se.string().optional(),owner:se.string(),repo:se.string(),branch:se.string().optional()}),gVs=se.object({github:hVs.optional(),launch:v5s.optional()}),AVs=se.object({url:se.string(),"custom-domain":L5s.optional(),"edit-this-page":gVs.optional(),audiences:bCt.optional()}),yVs=se.object({dark:se.string().optional(),light:se.string().optional(),height:se.number().optional(),href:se.string().optional(),"right-text":se.string().optional()}),dIi=se.object({link:se.string(),href:se.string(),icon:se.string().optional(),target:fqe.optional()}),bVs=se.object({version:se.string(),package:se.string()}),iH=se.union([se.string(),bVs]),EVs=se.object({python:iH.optional(),typescript:iH.optional(),go:iH.optional(),java:iH.optional(),ruby:iH.optional(),csharp:iH.optional(),php:iH.optional(),swift:iH.optional(),rust:iH.optional()}),vVs=se.object({href:se.string().optional()}),vCt=se.object({hidden:se.boolean().optional(),environments:se.array(se.string()).optional(),button:vVs.optional(),oauth:se.boolean().optional(),"limit-websocket-messages-per-connection":se.number().int().optional()}),ecr=se.object({message:se.string()}),APe=Zar.merge(se.object({href:se.string().optional(),target:fqe.optional(),url:se.string().optional(),text:se.string().optional(),icon:se.string().optional(),rightIcon:se.string().optional(),rounded:se.boolean().optional()})),IVs=Zar.merge(se.object({url:se.string(),target:fqe.optional()})),wVs=se.union([se.string(),IVs]),xVs=Zar.merge(se.object({links:se.array(APe),text:se.string().optional(),icon:se.string().optional(),rightIcon:se.string().optional(),rounded:se.boolean().optional()})),CVs=se.union([APe.merge(se.object({type:se.literal("filled")})),APe.merge(se.object({type:se.literal("outlined")})),APe.merge(se.object({type:se.literal("minimal")})),se.object({type:se.literal("github"),value:wVs}),xVs.merge(se.object({type:se.literal("dropdown")})),APe.merge(se.object({type:se.literal("primary")})),APe.merge(se.object({type:se.literal("secondary")}))]),_Vs=se.object({github:se.string().optional(),twitter:se.string().optional(),x:se.string().optional(),linkedin:se.string().optional(),youtube:se.string().optional(),instagram:se.string().optional(),facebook:se.string().optional(),discord:se.string().optional(),slack:se.string().optional(),hackernews:se.string().optional(),medium:se.string().optional(),website:se.string().optional()}),SVs=se.object({path:se.string(),strategy:lIi.optional()}),TVs=se.union([se.string(),SVs]),OVs=se.object({url:se.string(),strategy:lIi.optional()}),iIi=se.union([OVs,TVs]),BVs=se.union([iIi,se.array(iIi)]),PVs=se.object({"og:site_name":se.string().optional(),"og:title":se.string().optional(),"og:description":se.string().optional(),"og:url":se.string().optional(),"og:image":se.string().optional(),"og:image:width":se.number().optional(),"og:image:height":se.number().optional(),"og:locale":se.string().optional(),"og:logo":se.string().optional(),"twitter:title":se.string().optional(),"twitter:description":se.string().optional(),"twitter:handle":se.string().optional(),"twitter:image":se.string().optional(),"twitter:site":se.string().optional(),"twitter:url":se.string().optional(),"twitter:card":Q5s.optional(),"canonical-host":se.string().optional()}),RVs=se.object({source:se.string(),destination:se.string(),permanent:se.boolean().optional()}),She=se.enum(["warn","error"]),DVs=se.object({"example-validation":She.optional(),"broken-links":She.optional(),"no-non-component-refs":She.optional(),"valid-local-references":She.optional(),"no-circular-redirects":She.optional(),"valid-docs-endpoints":She.optional(),"missing-redirects":She.optional()}),FVs=se.object({rules:DVs.optional()}),kVs=se.object({intercom:se.string().optional(),context7:se.string().optional()}),NVs=se.object({"mdx-components":se.array(se.string()).optional(),"disable-stream-toggle":se.boolean().optional(),"openapi-parser-v2":se.boolean().optional(),"openapi-parser-v3":se.boolean().optional(),"dynamic-snippets":se.boolean().optional(),"ai-examples":se.boolean().optional(),"ai-example-style-instructions":se.string().optional(),"exclude-apis":se.boolean().optional(),"basepath-aware":se.boolean().optional()}),jVs=se.object({git:se.string(),subpath:se.string().optional()}),QVs=se.object({path:se.string()}),MVs=se.union([jVs,QVs]),LVs=se.object({path:se.string()}),UVs=se.object({input:MVs,output:LVs,lang:w5s}),dqe=ZO.merge(eB).merge(se.object({page:se.string(),path:se.string(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),noindex:se.boolean().optional(),availability:bse.optional()})),zVs=ZO.merge(eB).merge(se.object({changelog:oIi,title:se.string().optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional()})),VVs=ZO.merge(eB).merge(se.object({library:sIi,title:se.string().optional(),slug:se.string().optional()})),qVs=ZO.merge(eB).merge(se.object({folder:se.string(),title:se.string().optional(),"title-source":cIi.optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),"skip-slug":se.boolean().optional(),collapsed:ECt.optional(),collapsible:se.boolean().optional(),"collapsed-by-default":se.boolean().optional(),availability:bse.optional()})),GVs=ZO.merge(eB).merge(se.object({endpoint:se.string(),title:se.string().optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),availability:bse.optional(),playground:vCt.optional()})),WVs=ZO.merge(eB).merge(se.object({operation:se.string(),title:se.string().optional(),slug:se.string().optional(),hidden:se.boolean().optional(),availability:bse.optional()})),ICt=se.lazy(()=>se.union([se.string(),se.record(se.string(),KVs),$Vs,GVs,WVs,dqe,dIi])),$Vs=ZO.merge(eB).merge(se.object({section:se.string(),"referenced-packages":se.array(se.string()).optional(),summary:se.string().optional(),contents:se.array(ICt).optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),"skip-slug":se.boolean().optional(),collapsed:ECt.optional(),collapsible:se.boolean().optional(),"collapsed-by-default":se.boolean().optional(),availability:bse.optional(),playground:vCt.optional()})),HVs=ZO.merge(eB).merge(se.object({title:se.string().optional(),summary:se.string().optional(),contents:se.array(ICt).optional(),availability:bse.optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),"skip-slug":se.boolean().optional(),playground:vCt.optional()})),KVs=se.lazy(()=>se.union([se.array(ICt),HVs])),JVs=ZO.merge(eB).merge(se.object({api:se.string(),"api-name":se.string().optional(),openrpc:se.string().optional(),audiences:bCt.optional(),"display-errors":se.boolean().optional(),"tag-description-pages":se.boolean().optional(),snippets:EVs.optional(),postman:se.string().optional(),summary:se.string().optional(),layout:se.array(ICt).optional(),collapsed:ECt.optional(),icon:se.string().optional(),slug:se.string().optional(),hidden:se.boolean().optional(),availability:bse.optional(),"skip-slug":se.boolean().optional(),alphabetized:se.boolean().optional(),flattened:se.boolean().optional(),paginated:se.boolean().optional(),playground:vCt.optional()})),wCt=se.lazy(()=>se.union([dqe,YVs,JVs,VVs,dIi,zVs,qVs])),YVs=ZO.merge(eB).merge(se.object({section:se.string(),path:se.string().optional(),contents:se.array(wCt),collapsed:ECt.optional(),collapsible:se.boolean().optional(),"collapsed-by-default":se.boolean().optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),"skip-slug":se.boolean().optional(),availability:bse.optional()})),XVs=se.array(wCt),ZVs=ZO.merge(eB).merge(se.object({title:se.string(),subtitle:se.string().optional(),icon:se.string().optional(),layout:se.array(wCt),slug:se.string().optional(),"skip-slug":se.boolean().optional(),hidden:se.boolean().optional(),default:se.boolean().optional()})),e3s=se.object({tab:pqe,layout:se.array(wCt).optional()}),t3s=se.object({tab:pqe,variants:se.array(ZVs)}),r3s=se.union([e3s,t3s]),n3s=se.array(r3s),tcr=se.union([XVs,n3s]),rcr=ZO.merge(eB).merge(se.object({"display-name":se.string(),icon:se.string().optional(),slug:se.string().optional(),"skip-slug":se.boolean().optional(),hidden:se.boolean().optional(),href:se.string().optional(),target:fqe.optional(),changelog:oIi.optional()})),mIi=ZO.merge(eB).merge(se.object({"display-name":se.string(),path:se.string(),slug:se.string().optional(),availability:I5s.optional(),audiences:bCt.optional(),hidden:se.boolean().optional(),announcement:ecr.optional()})),O8l=se.object({tabs:se.record(pqe,rcr).optional(),"landing-page":dqe.optional(),navigation:tcr}),hIi=ZO.merge(eB).merge(se.object({"display-name":se.string(),subtitle:se.string().optional(),icon:se.string().optional(),image:se.string().optional(),versions:se.array(mIi).optional(),audiences:bCt.optional()})),i3s=hIi.merge(se.object({path:se.string(),slug:se.string().optional(),announcement:ecr.optional()})),o3s=hIi.merge(se.object({href:se.string(),target:fqe.optional()})),s3s=se.union([i3s,o3s]),a3s=ZO.merge(eB).merge(se.object({"display-name":se.string(),path:se.string(),slug:se.string().optional()})),c3s=se.object({href:se.string()}),B8l=se.union([a3s,c3s]),P8l=se.object({tabs:se.record(pqe,rcr).optional(),"landing-page":dqe.optional(),navigation:tcr}),R8l=se.object({instances:se.array(AVs),title:se.string().optional(),libraries:se.record(sIi,UVs).optional(),analytics:Z5s.optional(),announcement:ecr.optional(),roles:se.array(Xar).optional(),tabs:se.record(pqe,rcr).optional(),versions:se.array(mIi).optional(),products:se.array(s3s).optional(),"landing-page":dqe.optional(),navigation:tcr.optional(),"navbar-links":se.array(CVs).optional(),"footer-links":_Vs.optional(),"page-actions":mVs.optional(),experimental:NVs.optional(),"default-language":A5s.optional(),languages:se.array(aIi).optional(),"ai-chat":nIi.optional(),"ai-search":nIi.optional(),"ai-examples":eVs.optional(),agents:iVs.optional(),metadata:PVs.optional(),redirects:se.array(RVs).optional(),check:FVs.optional(),logo:yVs.optional(),favicon:se.string().optional(),"background-image":V5s.optional(),colors:pVs.optional(),typography:aVs.optional(),layout:uVs.optional(),settings:lVs.optional(),theme:cVs.optional(),integrations:kVs.optional(),css:q5s.optional(),js:BVs.optional(),header:se.string().optional(),footer:se.string().optional()});var iwi={};$(iwi,{AiChatLocation:()=>AIi,AiChatModel:()=>yIi,Availability:()=>bIi,BodyThemeConfig:()=>EIi,CheckRuleSeverity:()=>vIi,CollapsedStringValue:()=>IIi,ContentAlignment:()=>wIi,EditThisPageLaunch:()=>xIi,FernDocsConfig:()=>KIi,FernDocsConfigError:()=>xCt,FernDocsConfigTimeoutError:()=>CCt,FontDisplay:()=>CIi,FontStyle:()=>_Ii,FooterNavThemeConfig:()=>SIi,HeaderPosition:()=>TIi,HttpSnippetLanguage:()=>OIi,JsScriptStrategy:()=>BIi,Language:()=>PIi,LanguageSwitcherThemeConfig:()=>RIi,LibraryLanguage:()=>DIi,PageActionOption:()=>FIi,PageActionsThemeConfig:()=>kIi,PageDescriptionSource:()=>NIi,ProductSwitcherThemeConfig:()=>jIi,ProgrammingLanguage:()=>QIi,SearchbarPlacement:()=>MIi,Serializer:()=>pN,SidebarThemeConfig:()=>LIi,SwitcherPlacement:()=>UIi,TabsAlignment:()=>zIi,TabsPlacement:()=>VIi,TabsThemeStyle:()=>qIi,Target:()=>GIi,TitleSource:()=>WIi,TwitterCardSetting:()=>$Ii,VersionAvailability:()=>HIi,docs:()=>ncr,logging:()=>YIi,serialization:()=>pN});var KIi={};$(KIi,{AiChatLocation:()=>AIi,AiChatModel:()=>yIi,Availability:()=>bIi,BodyThemeConfig:()=>EIi,CheckRuleSeverity:()=>vIi,CollapsedStringValue:()=>IIi,ContentAlignment:()=>wIi,EditThisPageLaunch:()=>xIi,FontDisplay:()=>CIi,FontStyle:()=>_Ii,FooterNavThemeConfig:()=>SIi,HeaderPosition:()=>TIi,HttpSnippetLanguage:()=>OIi,JsScriptStrategy:()=>BIi,Language:()=>PIi,LanguageSwitcherThemeConfig:()=>RIi,LibraryLanguage:()=>DIi,PageActionOption:()=>FIi,PageActionsThemeConfig:()=>kIi,PageDescriptionSource:()=>NIi,ProductSwitcherThemeConfig:()=>jIi,ProgrammingLanguage:()=>QIi,SearchbarPlacement:()=>MIi,SidebarThemeConfig:()=>LIi,SwitcherPlacement:()=>UIi,TabsAlignment:()=>zIi,TabsPlacement:()=>VIi,TabsThemeStyle:()=>qIi,Target:()=>GIi,TitleSource:()=>WIi,TwitterCardSetting:()=>$Ii,VersionAvailability:()=>HIi,docs:()=>ncr});var ncr={};$(ncr,{AiChatLocation:()=>AIi,AiChatModel:()=>yIi,Availability:()=>bIi,BodyThemeConfig:()=>EIi,CheckRuleSeverity:()=>vIi,CollapsedStringValue:()=>IIi,ContentAlignment:()=>wIi,EditThisPageLaunch:()=>xIi,FontDisplay:()=>CIi,FontStyle:()=>_Ii,FooterNavThemeConfig:()=>SIi,HeaderPosition:()=>TIi,HttpSnippetLanguage:()=>OIi,JsScriptStrategy:()=>BIi,Language:()=>PIi,LanguageSwitcherThemeConfig:()=>RIi,LibraryLanguage:()=>DIi,PageActionOption:()=>FIi,PageActionsThemeConfig:()=>kIi,PageDescriptionSource:()=>NIi,ProductSwitcherThemeConfig:()=>jIi,ProgrammingLanguage:()=>QIi,SearchbarPlacement:()=>MIi,SidebarThemeConfig:()=>LIi,SwitcherPlacement:()=>UIi,TabsAlignment:()=>zIi,TabsPlacement:()=>VIi,TabsThemeStyle:()=>qIi,Target:()=>GIi,TitleSource:()=>WIi,TwitterCardSetting:()=>$Ii,VersionAvailability:()=>HIi});var AIi={Docs:"docs",Slack:"slack",Discord:"discord"};var yIi={Claude37:"claude-3.7",Claude4:"claude-4",CommandA:"command-a"};var bIi={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",Beta:"beta"};var EIi={Default:"default",Canvas:"canvas"};var vIi={Warn:"warn",Error:"error"};var IIi={OpenByDefault:"open-by-default"};var wIi={Center:"center",Left:"left"};var xIi={Github:"github",Dashboard:"dashboard"};var CIi={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var _Ii={Normal:"normal",Italic:"italic"};var SIi={Default:"default",Minimal:"minimal"};var TIi={Fixed:"fixed",Static:"static"};var OIi={Curl:"curl",Csharp:"csharp",Go:"go",Java:"java",Javascript:"javascript",Php:"php",Python:"python",Ruby:"ruby",Swift:"swift",Typescript:"typescript"};var BIi={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var PIi={En:"en",Es:"es",Fr:"fr",De:"de",It:"it",Pt:"pt",Ja:"ja",Zh:"zh",Ko:"ko",El:"el",No:"no",Pl:"pl",Ru:"ru",Sv:"sv",Tr:"tr"};var RIi={Default:"default",Minimal:"minimal"};var DIi={Python:"python",Cpp:"cpp"};var FIi={CopyPage:"copy-page",ViewAsMarkdown:"view-as-markdown",AskAi:"ask-ai",Chatgpt:"chatgpt",Claude:"claude",Cursor:"cursor",Vscode:"vscode"};var kIi={Default:"default",Toolbar:"toolbar"};var NIi={Description:"description",Subtitle:"subtitle"};var jIi={Default:"default",Toggle:"toggle"};var QIi={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var MIi={Header:"header",HeaderTabs:"header-tabs",Sidebar:"sidebar"};var LIi={Default:"default",Minimal:"minimal"};var UIi={Header:"header",Sidebar:"sidebar"};var zIi={Left:"left",Center:"center"};var VIi={Header:"header",Sidebar:"sidebar"};var qIi={Default:"default",Bubble:"bubble"};var GIi={Blank:"_blank",Self:"_self",Parent:"_parent",Top:"_top"};var WIi={Frontmatter:"frontmatter",Filename:"filename"};var $Ii={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var HIi={Deprecated:"deprecated",Ga:"ga",Stable:"stable",Beta:"beta"};var u3s=(e,t,r)=>JSON.stringify(e,t,r);var xCt=class extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(D8l({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=r,this.body=n,this.rawResponse=i}};function D8l({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${u3s(r,void 0,2)}`),n.join(`
|
|
1541
1541
|
`)}var CCt=class extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Fq={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},l3s={[Fq.Debug]:1,[Fq.Info]:2,[Fq.Warn]:3,[Fq.Error]:4},_Ct=class{debug(t,...r){console.debug(t,...r)}info(t,...r){console.info(t,...r)}warn(t,...r){console.warn(t,...r)}error(t,...r){console.error(t,...r)}},JIi=class{level;logger;silent;constructor(t){this.level=l3s[t.level],this.logger=t.logger,this.silent=t.silent}shouldLog(t){return!this.silent&&this.level<=l3s[t]}isDebug(){return this.shouldLog(Fq.Debug)}debug(t,...r){this.isDebug()&&this.logger.debug(t,...r)}isInfo(){return this.shouldLog(Fq.Info)}info(t,...r){this.isInfo()&&this.logger.info(t,...r)}isWarn(){return this.shouldLog(Fq.Warn)}warn(t,...r){this.isWarn()&&this.logger.warn(t,...r)}isError(){return this.shouldLog(Fq.Error)}error(t,...r){this.isError()&&this.logger.error(t,...r)}};var iUA=new JIi({level:Fq.Info,logger:new _Ct,silent:!0});var YIi;(function(e){e.LogLevel=Fq,e.ConsoleLogger=_Ct})(YIi||(YIi={}));var pN={};$(pN,{AbsoluteProductPath:()=>ccr,AgentsConfig:()=>lcr,AiChatConfig:()=>OCt,AiChatDatasource:()=>fcr,AiChatLocation:()=>dcr,AiChatModel:()=>mcr,AiChatWebsiteDatasource:()=>pcr,AiExamplesConfig:()=>hcr,AnalyticsConfig:()=>Icr,AnnouncementConfig:()=>The,ApiReferenceConfiguration:()=>Tcr,ApiReferenceEndpointConfiguration:()=>Ocr,ApiReferenceLayoutItem:()=>cH,ApiReferenceOperationConfiguration:()=>Bcr,ApiReferencePackageConfiguration:()=>Pcr,ApiReferencePackageConfigurationWithOptions:()=>Dcr,ApiReferenceSectionConfiguration:()=>Rcr,Audience:()=>oH,AudienceId:()=>BCt,Availability:()=>a_,BackgroundImageConfiguration:()=>kcr,BackgroundImageThemedConfig:()=>Fcr,BodyThemeConfig:()=>Ncr,ChangelogConfiguration:()=>jcr,ChangelogFolderRelativePath:()=>bqe,CheckConfig:()=>Mcr,CheckRuleSeverity:()=>uH,CheckRulesConfig:()=>Qcr,CollapsedStringValue:()=>wcr,CollapsedValue:()=>sH,ColorConfig:()=>qE,ColorThemedConfig:()=>Lcr,ColorsConfiguration:()=>Ucr,ContentAlignment:()=>zcr,CssConfig:()=>Vcr,CustomDomain:()=>qcr,CustomPageAction:()=>Gcr,DocsConfiguration:()=>M3s,DocsInstance:()=>Kcr,DocsSettingsConfig:()=>Xcr,DocsTypographyConfig:()=>rur,EditThisPageConfig:()=>Hcr,EditThisPageLaunch:()=>Wcr,ExperimentalConfig:()=>nur,ExternalProduct:()=>Qur,FeatureFlag:()=>PCt,FeatureFlagConfiguration:()=>Scr,FolderConfiguration:()=>Yur,FontConfig:()=>xqe,FontConfigPath:()=>eur,FontConfigVariant:()=>Zcr,FontDisplay:()=>tur,FontStyle:()=>Iqe,FontWeight:()=>wqe,FooterLinksConfig:()=>iur,FooterNavThemeConfig:()=>Vur,FullStoryAnalyticsConfig:()=>gcr,GitLibraryInputSchema:()=>hur,GithubEditThisPageConfig:()=>$cr,GoogleAnalytics4Config:()=>Acr,GtmConfig:()=>ycr,HeaderPosition:()=>lur,HttpSnippetLanguage:()=>Jcr,HttpSnippetsConfig:()=>Ycr,IntegrationsConfig:()=>our,IntercomConfig:()=>bcr,InternalProduct:()=>Mur,JsConfig:()=>uur,JsConfigOptions:()=>RCt,JsFileConfig:()=>aur,JsFileConfigSettings:()=>sur,JsRemoteConfig:()=>cur,JsScriptStrategy:()=>Cqe,Language:()=>Eqe,LanguageSwitcherThemeConfig:()=>qur,LayoutConfig:()=>dur,LibraryConfig:()=>mur,LibraryConfiguration:()=>Eur,LibraryInputConfiguration:()=>Aur,LibraryLanguage:()=>yur,LibraryName:()=>Sqe,LibraryOutputConfiguration:()=>bur,LibraryReferenceConfiguration:()=>Xur,LinkConfiguration:()=>yqe,LogoConfiguration:()=>vur,MetadataConfig:()=>wur,NavbarDropdownConfig:()=>xur,NavbarGithubConfig:()=>_ur,NavbarGithubConfigWithOptions:()=>Cur,NavbarLink:()=>Sur,NavbarLinkConfig:()=>lH,NavigationConfig:()=>Bhe,NavigationItem:()=>pH,PageActionOption:()=>Fur,PageActionOptions:()=>kur,PageActionsConfig:()=>Nur,PageActionsThemeConfig:()=>Gur,PageConfiguration:()=>U4,PageDescriptionSource:()=>ucr,PathLibraryInputSchema:()=>gur,PlaygroundButtonSettings:()=>xcr,PlaygroundSettings:()=>aH,PostHogConfig:()=>Ecr,ProductConfig:()=>Lur,ProductConfigBase:()=>Oqe,ProductFileConfig:()=>L3s,ProductPath:()=>U3s,ProductSwitcherThemeConfig:()=>Wur,ProgrammingLanguage:()=>Uur,RedirectConfig:()=>zur,RelativeProductPath:()=>elr,Role:()=>Aqe,RoleId:()=>bPe,SearchbarPlacement:()=>pur,SectionConfiguration:()=>Zur,SegmentConfig:()=>vcr,SidebarThemeConfig:()=>$ur,SnippetLanguageConfiguration:()=>M4,SnippetsConfiguration:()=>_cr,SwitcherPlacement:()=>fur,TabConfig:()=>Phe,TabId:()=>z4,TabVariant:()=>Our,TabbedNavigationConfig:()=>Rur,TabbedNavigationItem:()=>Pur,TabbedNavigationItemWithLayout:()=>Tur,TabbedNavigationItemWithVariants:()=>Bur,TabsAlignment:()=>Hur,TabsPlacement:()=>_qe,TabsThemeConfig:()=>Kur,Target:()=>L4,ThemeConfig:()=>Jur,TitleSource:()=>vqe,TwitterCardSetting:()=>Iur,UntabbedNavigationConfig:()=>Dur,VersionAvailability:()=>jur,VersionConfig:()=>Tqe,VersionFileConfig:()=>z3s,VersionedSnippetLanguageConfiguration:()=>Ccr,WithFeatureFlags:()=>mm,WithPermissions:()=>hm,WithViewers:()=>Ohe,docs:()=>nwi});var nwi={};$(nwi,{AbsoluteProductPath:()=>ccr,AgentsConfig:()=>lcr,AiChatConfig:()=>OCt,AiChatDatasource:()=>fcr,AiChatLocation:()=>dcr,AiChatModel:()=>mcr,AiChatWebsiteDatasource:()=>pcr,AiExamplesConfig:()=>hcr,AnalyticsConfig:()=>Icr,AnnouncementConfig:()=>The,ApiReferenceConfiguration:()=>Tcr,ApiReferenceEndpointConfiguration:()=>Ocr,ApiReferenceLayoutItem:()=>cH,ApiReferenceOperationConfiguration:()=>Bcr,ApiReferencePackageConfiguration:()=>Pcr,ApiReferencePackageConfigurationWithOptions:()=>Dcr,ApiReferenceSectionConfiguration:()=>Rcr,Audience:()=>oH,AudienceId:()=>BCt,Availability:()=>a_,BackgroundImageConfiguration:()=>kcr,BackgroundImageThemedConfig:()=>Fcr,BodyThemeConfig:()=>Ncr,ChangelogConfiguration:()=>jcr,ChangelogFolderRelativePath:()=>bqe,CheckConfig:()=>Mcr,CheckRuleSeverity:()=>uH,CheckRulesConfig:()=>Qcr,CollapsedStringValue:()=>wcr,CollapsedValue:()=>sH,ColorConfig:()=>qE,ColorThemedConfig:()=>Lcr,ColorsConfiguration:()=>Ucr,ContentAlignment:()=>zcr,CssConfig:()=>Vcr,CustomDomain:()=>qcr,CustomPageAction:()=>Gcr,DocsConfiguration:()=>M3s,DocsInstance:()=>Kcr,DocsSettingsConfig:()=>Xcr,DocsTypographyConfig:()=>rur,EditThisPageConfig:()=>Hcr,EditThisPageLaunch:()=>Wcr,ExperimentalConfig:()=>nur,ExternalProduct:()=>Qur,FeatureFlag:()=>PCt,FeatureFlagConfiguration:()=>Scr,FolderConfiguration:()=>Yur,FontConfig:()=>xqe,FontConfigPath:()=>eur,FontConfigVariant:()=>Zcr,FontDisplay:()=>tur,FontStyle:()=>Iqe,FontWeight:()=>wqe,FooterLinksConfig:()=>iur,FooterNavThemeConfig:()=>Vur,FullStoryAnalyticsConfig:()=>gcr,GitLibraryInputSchema:()=>hur,GithubEditThisPageConfig:()=>$cr,GoogleAnalytics4Config:()=>Acr,GtmConfig:()=>ycr,HeaderPosition:()=>lur,HttpSnippetLanguage:()=>Jcr,HttpSnippetsConfig:()=>Ycr,IntegrationsConfig:()=>our,IntercomConfig:()=>bcr,InternalProduct:()=>Mur,JsConfig:()=>uur,JsConfigOptions:()=>RCt,JsFileConfig:()=>aur,JsFileConfigSettings:()=>sur,JsRemoteConfig:()=>cur,JsScriptStrategy:()=>Cqe,Language:()=>Eqe,LanguageSwitcherThemeConfig:()=>qur,LayoutConfig:()=>dur,LibraryConfig:()=>mur,LibraryConfiguration:()=>Eur,LibraryInputConfiguration:()=>Aur,LibraryLanguage:()=>yur,LibraryName:()=>Sqe,LibraryOutputConfiguration:()=>bur,LibraryReferenceConfiguration:()=>Xur,LinkConfiguration:()=>yqe,LogoConfiguration:()=>vur,MetadataConfig:()=>wur,NavbarDropdownConfig:()=>xur,NavbarGithubConfig:()=>_ur,NavbarGithubConfigWithOptions:()=>Cur,NavbarLink:()=>Sur,NavbarLinkConfig:()=>lH,NavigationConfig:()=>Bhe,NavigationItem:()=>pH,PageActionOption:()=>Fur,PageActionOptions:()=>kur,PageActionsConfig:()=>Nur,PageActionsThemeConfig:()=>Gur,PageConfiguration:()=>U4,PageDescriptionSource:()=>ucr,PathLibraryInputSchema:()=>gur,PlaygroundButtonSettings:()=>xcr,PlaygroundSettings:()=>aH,PostHogConfig:()=>Ecr,ProductConfig:()=>Lur,ProductConfigBase:()=>Oqe,ProductFileConfig:()=>L3s,ProductPath:()=>U3s,ProductSwitcherThemeConfig:()=>Wur,ProgrammingLanguage:()=>Uur,RedirectConfig:()=>zur,RelativeProductPath:()=>elr,Role:()=>Aqe,RoleId:()=>bPe,SearchbarPlacement:()=>pur,SectionConfiguration:()=>Zur,SegmentConfig:()=>vcr,SidebarThemeConfig:()=>$ur,SnippetLanguageConfiguration:()=>M4,SnippetsConfiguration:()=>_cr,SwitcherPlacement:()=>fur,TabConfig:()=>Phe,TabId:()=>z4,TabVariant:()=>Our,TabbedNavigationConfig:()=>Rur,TabbedNavigationItem:()=>Pur,TabbedNavigationItemWithLayout:()=>Tur,TabbedNavigationItemWithVariants:()=>Bur,TabsAlignment:()=>Hur,TabsPlacement:()=>_qe,TabsThemeConfig:()=>Kur,Target:()=>L4,ThemeConfig:()=>Jur,TitleSource:()=>vqe,TwitterCardSetting:()=>Iur,UntabbedNavigationConfig:()=>Dur,VersionAvailability:()=>jur,VersionConfig:()=>Tqe,VersionFileConfig:()=>z3s,VersionedSnippetLanguageConfiguration:()=>Ccr,WithFeatureFlags:()=>mm,WithPermissions:()=>hm,WithViewers:()=>Ohe});var ce={};$(ce,{JsonError:()=>mqe,ParseError:()=>hqe,any:()=>x3s,bigint:()=>f3s,boolean:()=>C3s,booleanLiteral:()=>I3s,date:()=>d3s,discriminant:()=>k3s,enum_:()=>ocr,getObjectLikeUtils:()=>kq,getObjectUtils:()=>yPe,getSchemaUtils:()=>dm,isProperty:()=>vse,lazy:()=>m3s,lazyObject:()=>E3s,list:()=>acr,never:()=>_3s,number:()=>S3s,object:()=>scr,objectWithoutOptionalProperties:()=>b3s,optional:()=>XIi,property:()=>g3s,record:()=>P3s,set:()=>R3s,string:()=>T3s,stringLiteral:()=>w3s,transform:()=>ZIi,undiscriminatedUnion:()=>F3s,union:()=>j3s,unknown:()=>O3s,withParsedProperties:()=>rwi});var Uu={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function kd(e,t){return`Expected ${t}. Received ${k8l(e)}.`}function k8l(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function o_(e){return{...e,json:p3s(e.json),parse:p3s(e.parse)}}function p3s(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1542
|
-
`)),{ok:!0,value:t}):n}}function icr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var mqe=class e extends Error{errors;constructor(t){super(t.map(icr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var hqe=class e extends Error{errors;constructor(t){super(t.map(icr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function dm(e){return{nullable:()=>N8l(e),optional:()=>XIi(e),optionalNullable:()=>j8l(e),transform:t=>ZIi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new hqe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new mqe(n.errors)}}}function N8l(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Uu.NULLABLE};return{...t,...dm(t)}}function XIi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Uu.OPTIONAL};return{...t,...dm(t)}}function j8l(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Uu.OPTIONAL_NULLABLE};return{...t,...dm(t)}}function ZIi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...dm(r)}}function f3s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:kd(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:kd(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Uu.BIGINT};return{...o_(e),...dm(e)}}var Q8l=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function d3s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:kd(t,"string")}]}:Q8l.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:kd(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:kd(t,"Date object")}]},getType:()=>Uu.DATE};return{...o_(e),...dm(e)}}function s_(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...o_(r),...dm(r)}}}function ocr(e){let t=new Set(e);return s_(Uu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:kd(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:kd(n,"enum")}]}:{ok:!0,value:n})()}function m3s(e){let t=ewi(e);return{...t,...dm(t)}}function ewi(e){return{parse:(t,r)=>gqe(e).parse(t,r),json:(t,r)=>gqe(e).json(t,r),getType:()=>gqe(e).getType()}}function gqe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function twi(e){return Object.entries(e)}function SCt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Ese(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function TCt(e){return Object.keys(e)}function h3s(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var M8l=Object.prototype.hasOwnProperty;function kq(e){return{withParsedProperties:t=>rwi(e,t)}}function rwi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(M8l.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Ese(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kd(n,"object")}]};let o=new Set(Object.keys(t)),s=SCt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...dm(r),...kq(r)}}function g3s(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function vse(e){return e.isProperty}var L8l=Object.prototype.hasOwnProperty;function scr(e){let t;function r(){if(t==null){t={};for(let[d,f]of twi(e)){let m=vse(f)?f.rawKey:d,h=vse(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of twi(e)){let m=vse(f)?f.rawKey:d,h=vse(f)?f.valueSchema:f;U8l(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>vse(f)?f.rawKey:d),_getParsedProperties:()=>TCt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return A3s({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return A3s({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return vse(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Uu.OBJECT};return{...o_(p),...dm(p),...kq(p),...yPe(p)}}function A3s({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Ese(e))return{ok:!1,errors:[{path:s,message:kd(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!L8l.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function yPe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>y3s({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>y3s({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Uu.OBJECT};return{...r,...dm(r),...kq(r),...yPe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Uu.OBJECT};return{...n,...dm(n),...kq(n),...yPe(n)}}}}function y3s({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Ese(t))return{ok:!1,errors:[{path:i,message:kd(t,"object")}]};let o=new Set(e),[s,a]=h3s(TCt(t),l=>o.has(l)),c=r(SCt(t,a)),u=n(SCt(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function U8l(e){return!z8l(e)}function z8l(e){switch(e.getType()){case Uu.ANY:case Uu.UNKNOWN:case Uu.OPTIONAL:case Uu.OPTIONAL_NULLABLE:return!0;default:return!1}}function b3s(e){return scr(e)}function E3s(e){let t={...ewi(e),_getRawProperties:()=>gqe(e)._getRawProperties(),_getParsedProperties:()=>gqe(e)._getParsedProperties()};return{...t,...dm(t),...kq(t),...yPe(t)}}function acr(e){let t={parse:(r,n)=>v3s(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>v3s(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Uu.LIST};return{...o_(t),...dm(t)}}function v3s(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:kd(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function I3s(e){return s_(Uu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kd(r,`${e.toString()}`)}]})()}function w3s(e){return s_(Uu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kd(r,`"${e}"`)}]})()}var x3s=s_(Uu.ANY,e=>({ok:!0,value:e}));var C3s=s_(Uu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"boolean")}]});var _3s=s_(Uu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var S3s=s_(Uu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"number")}]});var T3s=s_(Uu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"string")}]});var O3s=s_(Uu.UNKNOWN,e=>({ok:!0,value:e}));var V8l=Object.prototype.hasOwnProperty;function P3s(e,t){let r={parse:(n,i)=>B3s({value:n,isKeyNumeric:e.getType()===Uu.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>B3s({value:n,isKeyNumeric:e.getType()===Uu.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Uu.RECORD};return{...o_(r),...dm(r)}}function B3s({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Ese(e))return{ok:!1,errors:[{path:i,message:kd(e,"object")}]};let o={},s=[];for(let a in e){if(!V8l.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function R3s(e){let t=acr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kd(n,"Set")}]},getType:()=>Uu.SET};return{...o_(r),...dm(r)}}function F3s(e){let t={parse:(r,n)=>D3s((i,o)=>i.parse(r,o),e,n),json:(r,n)=>D3s((i,o)=>i.json(r,o),e,n),getType:()=>Uu.UNDISCRIMINATED_UNION};return{...o_(t),...dm(t)}}function D3s(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function k3s(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var q8l=Object.prototype.hasOwnProperty;function j3s(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=ocr(TCt(t)),o={parse:(s,a)=>N3s({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>N3s({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Uu.UNION};return{...o_(o),...dm(o),...kq(o)}}function N3s({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Ese(e))return{ok:!1,errors:[{path:a,message:kd(e,"object")}]};let c=e[t],u={};for(let f in e)q8l.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var ccr=ce.object({href:ce.string()});var ucr=ce.enum_(["description","subtitle"]);var lcr=ce.object({pageDirective:ce.property("page-directive",ce.string().optional()),pageDescriptionSource:ce.property("page-description-source",ucr.optional()),llmsTxt:ce.property("llms-txt",ce.string().optional()),llmsFullTxt:ce.property("llms-full-txt",ce.string().optional())});var pcr=ce.object({url:ce.string(),title:ce.string().optional()});var fcr=ce.undiscriminatedUnion([pcr]);var dcr=ce.enum_(["docs","slack","discord"]);var mcr=ce.enum_(["claude-3.7","claude-4","command-a"]);var OCt=ce.object({model:mcr.optional(),systemPrompt:ce.property("system-prompt",ce.string().optional()),location:ce.list(dcr).optional(),datasources:ce.list(fcr).optional()});var hcr=ce.object({enabled:ce.boolean().optional(),style:ce.string().optional()});var gcr=ce.object({orgId:ce.property("org-id",ce.string())});var Acr=ce.object({measurementId:ce.property("measurement-id",ce.string())});var ycr=ce.object({containerId:ce.property("container-id",ce.string())});var bcr=ce.object({appId:ce.property("app-id",ce.string()),apiBase:ce.property("api-base",ce.string().optional())});var Ecr=ce.object({apiKey:ce.property("api-key",ce.string()),endpoint:ce.string().optional()});var vcr=ce.object({writeKey:ce.property("write-key",ce.string())});var Icr=ce.object({segment:vcr.optional(),fullstory:gcr.optional(),intercom:bcr.optional(),posthog:Ecr.optional(),gtm:ycr.optional(),ga4:Acr.optional()});var The=ce.object({message:ce.string()});var BCt=ce.string();var oH=ce.undiscriminatedUnion([BCt,ce.list(BCt)]);var a_=ce.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var wcr=ce.enum_(["open-by-default"]);var sH=ce.undiscriminatedUnion([ce.boolean(),wcr]);var xcr=ce.object({href:ce.string().optional()});var aH=ce.object({hidden:ce.boolean().optional(),environments:ce.list(ce.string()).optional(),button:xcr.optional(),oauth:ce.boolean().optional(),limitWebsocketMessagesPerConnection:ce.property("limit-websocket-messages-per-connection",ce.number().optional())});var Ccr=ce.object({version:ce.string(),package:ce.string()});var M4=ce.undiscriminatedUnion([ce.string(),Ccr]);var _cr=ce.object({python:M4.optional(),typescript:M4.optional(),go:M4.optional(),java:M4.optional(),ruby:M4.optional(),csharp:M4.optional(),php:M4.optional(),swift:M4.optional(),rust:M4.optional()});var PCt=ce.object({flag:ce.string(),fallbackValue:ce.property("fallback-value",ce.unknown().optional()),match:ce.unknown().optional()});var Scr=ce.undiscriminatedUnion([ce.string(),PCt,ce.list(PCt)]);var mm=ce.object({featureFlag:ce.property("feature-flag",Scr.optional())});var bPe=ce.string();var Aqe=ce.undiscriminatedUnion([bPe,ce.list(bPe)]);var hm=ce.object({viewers:Aqe.optional(),orphaned:ce.boolean().optional()});var Tcr=ce.object({api:ce.string(),apiName:ce.property("api-name",ce.string().optional()),openrpc:ce.string().optional(),audiences:oH.optional(),displayErrors:ce.property("display-errors",ce.boolean().optional()),tagDescriptionPages:ce.property("tag-description-pages",ce.boolean().optional()),snippets:_cr.optional(),postman:ce.string().optional(),summary:ce.string().optional(),layout:ce.list(ce.lazy(()=>cH)).optional(),collapsed:sH.optional(),icon:ce.string().optional(),slug:ce.string().optional(),hidden:ce.boolean().optional(),availability:a_.optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),alphabetized:ce.boolean().optional(),flattened:ce.boolean().optional(),paginated:ce.boolean().optional(),playground:aH.optional()}).extend(hm).extend(mm);var Ocr=ce.object({endpoint:ce.string(),title:ce.string().optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),availability:a_.optional(),playground:aH.optional()}).extend(hm).extend(mm);var Bcr=ce.object({operation:ce.string(),title:ce.string().optional(),slug:ce.string().optional(),hidden:ce.boolean().optional(),availability:a_.optional()}).extend(hm).extend(mm);var L4=ce.enum_(["_blank","_self","_parent","_top"]);var yqe=ce.object({link:ce.string(),href:ce.string(),icon:ce.string().optional(),target:L4.optional()});var U4=ce.object({page:ce.string(),path:ce.string(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),noindex:ce.boolean().optional(),availability:a_.optional()}).extend(hm).extend(mm);var cH=ce.undiscriminatedUnion([ce.string(),ce.record(ce.string(),ce.lazy(()=>Pcr)),ce.lazyObject(()=>Rcr),Ocr,Bcr,U4,yqe]);var Pcr=ce.undiscriminatedUnion([ce.list(ce.lazy(()=>cH)),ce.lazyObject(()=>Dcr)]);var Dcr=ce.object({title:ce.string().optional(),summary:ce.string().optional(),contents:ce.list(ce.lazy(()=>cH)).optional(),availability:a_.optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),playground:aH.optional()}).extend(hm).extend(mm);var Rcr=ce.object({section:ce.string(),referencedPackages:ce.property("referenced-packages",ce.list(ce.string()).optional()),summary:ce.string().optional(),contents:ce.list(ce.lazy(()=>cH)).optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),collapsed:sH.optional(),collapsible:ce.boolean().optional(),collapsedByDefault:ce.property("collapsed-by-default",ce.boolean().optional()),availability:a_.optional(),playground:aH.optional()}).extend(hm).extend(mm);var Fcr=ce.object({dark:ce.string().optional(),light:ce.string().optional()});var kcr=ce.undiscriminatedUnion([ce.string(),Fcr]);var Ncr=ce.enum_(["default","canvas"]);var bqe=ce.string();var jcr=ce.object({changelog:bqe,title:ce.string().optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional()}).extend(hm).extend(mm);var uH=ce.enum_(["warn","error"]);var Qcr=ce.object({exampleValidation:ce.property("example-validation",uH.optional()),brokenLinks:ce.property("broken-links",uH.optional()),noNonComponentRefs:ce.property("no-non-component-refs",uH.optional()),validLocalReferences:ce.property("valid-local-references",uH.optional()),noCircularRedirects:ce.property("no-circular-redirects",uH.optional()),validDocsEndpoints:ce.property("valid-docs-endpoints",uH.optional()),missingRedirects:ce.property("missing-redirects",uH.optional())});var Mcr=ce.object({rules:Qcr.optional()});var Lcr=ce.object({dark:ce.string().optional(),light:ce.string().optional()});var qE=ce.undiscriminatedUnion([ce.string(),Lcr]);var Ucr=ce.object({accentPrimary:ce.property("accent-primary",qE.optional()),accentPrimaryDeprecated:ce.property("accentPrimary",qE.optional()),background:qE.optional(),border:qE.optional(),sidebarBackground:ce.property("sidebar-background",qE.optional()),headerBackground:ce.property("header-background",qE.optional()),cardBackground:ce.property("card-background",qE.optional()),accent1:ce.property("accent-1",qE.optional()),accent2:ce.property("accent-2",qE.optional()),accent3:ce.property("accent-3",qE.optional()),accent4:ce.property("accent-4",qE.optional()),accent5:ce.property("accent-5",qE.optional()),accent6:ce.property("accent-6",qE.optional()),accent7:ce.property("accent-7",qE.optional()),accent8:ce.property("accent-8",qE.optional()),accent9:ce.property("accent-9",qE.optional()),accent10:ce.property("accent-10",qE.optional()),accent11:ce.property("accent-11",qE.optional()),accent12:ce.property("accent-12",qE.optional())});var zcr=ce.enum_(["center","left"]);var Vcr=ce.undiscriminatedUnion([ce.string(),ce.list(ce.string())]);var qcr=ce.undiscriminatedUnion([ce.string(),ce.list(ce.string())]);var Gcr=ce.object({title:ce.string(),subtitle:ce.string().optional(),url:ce.string(),icon:ce.string().optional(),default:ce.boolean().optional()});var Wcr=ce.enum_(["github","dashboard"]);var $cr=ce.object({host:ce.string().optional(),owner:ce.string(),repo:ce.string(),branch:ce.string().optional()});var Hcr=ce.object({github:$cr.optional(),launch:Wcr.optional()});var Kcr=ce.object({url:ce.string(),customDomain:ce.property("custom-domain",qcr.optional()),editThisPage:ce.property("edit-this-page",Hcr.optional()),audiences:oH.optional()});var Jcr=ce.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var Ycr=ce.undiscriminatedUnion([ce.boolean(),ce.list(Jcr)]);var Eqe=ce.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var vqe=ce.enum_(["frontmatter","filename"]);var Xcr=ce.object({searchText:ce.property("search-text",ce.string().optional()),disableSearch:ce.property("disable-search",ce.boolean().optional()),darkModeCode:ce.property("dark-mode-code",ce.boolean().optional()),defaultSearchFilters:ce.property("default-search-filters",ce.boolean().optional()),httpSnippets:ce.property("http-snippets",Ycr.optional()),hide404Page:ce.property("hide-404-page",ce.boolean().optional()),useJavascriptAsTypescript:ce.property("use-javascript-as-typescript",ce.boolean().optional()),disableExplorerProxy:ce.property("disable-explorer-proxy",ce.boolean().optional()),disableAnalytics:ce.property("disable-analytics",ce.boolean().optional()),language:Eqe.optional(),folderTitleSource:ce.property("folder-title-source",vqe.optional()),substituteEnvVars:ce.property("substitute-env-vars",ce.boolean().optional())});var Iqe=ce.enum_(["normal","italic"]);var wqe=ce.undiscriminatedUnion([ce.string(),ce.number()]);var Zcr=ce.object({path:ce.string(),weight:wqe.optional(),style:Iqe.optional()});var eur=ce.undiscriminatedUnion([ce.string(),Zcr]);var tur=ce.enum_(["auto","block","swap","fallback","optional"]);var xqe=ce.object({name:ce.string().optional(),path:ce.string().optional(),weight:wqe.optional(),style:Iqe.optional(),paths:ce.list(eur).optional(),display:tur.optional(),fallback:ce.list(ce.string()).optional(),fontVariationSettings:ce.property("font-variation-settings",ce.string().optional())});var rur=ce.object({headingsFont:xqe.optional(),bodyFont:xqe.optional(),codeFont:xqe.optional()});var nur=ce.object({mdxComponents:ce.property("mdx-components",ce.list(ce.string()).optional()),disableStreamToggle:ce.property("disable-stream-toggle",ce.boolean().optional()),openapiParserV2:ce.property("openapi-parser-v2",ce.boolean().optional()),openapiParserV3:ce.property("openapi-parser-v3",ce.boolean().optional()),dynamicSnippets:ce.property("dynamic-snippets",ce.boolean().optional()),aiExamples:ce.property("ai-examples",ce.boolean().optional()),aiExampleStyleInstructions:ce.property("ai-example-style-instructions",ce.string().optional()),excludeApis:ce.property("exclude-apis",ce.boolean().optional()),basepathAware:ce.property("basepath-aware",ce.boolean().optional())});var iur=ce.object({github:ce.string().optional(),twitter:ce.string().optional(),x:ce.string().optional(),linkedin:ce.string().optional(),youtube:ce.string().optional(),instagram:ce.string().optional(),facebook:ce.string().optional(),discord:ce.string().optional(),slack:ce.string().optional(),hackernews:ce.string().optional(),medium:ce.string().optional(),website:ce.string().optional()});var our=ce.object({intercom:ce.string().optional(),context7:ce.string().optional()});var Cqe=ce.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var sur=ce.object({path:ce.string(),strategy:Cqe.optional()});var aur=ce.undiscriminatedUnion([ce.string(),sur]);var cur=ce.object({url:ce.string(),strategy:Cqe.optional()});var RCt=ce.undiscriminatedUnion([cur,aur]);var uur=ce.undiscriminatedUnion([RCt,ce.list(RCt)]);var lur=ce.enum_(["fixed","static"]);var pur=ce.enum_(["header","header-tabs","sidebar"]);var fur=ce.enum_(["header","sidebar"]);var _qe=ce.enum_(["header","sidebar"]);var dur=ce.object({pageWidth:ce.property("page-width",ce.string().optional()),contentWidth:ce.property("content-width",ce.string().optional()),sidebarWidth:ce.property("sidebar-width",ce.string().optional()),headerHeight:ce.property("header-height",ce.string().optional()),searchbarPlacement:ce.property("searchbar-placement",pur.optional()),tabsPlacement:ce.property("tabs-placement",_qe.optional()),switcherPlacement:ce.property("switcher-placement",fur.optional()),contentAlignment:ce.property("content-alignment",zcr.optional()),headerPosition:ce.property("header-position",lur.optional()),disableHeader:ce.property("disable-header",ce.boolean().optional()),hideNavLinks:ce.property("hide-nav-links",ce.boolean().optional()),hideFeedback:ce.property("hide-feedback",ce.boolean().optional())});var mur=ce.object({doxyfile:ce.string().optional()});var hur=ce.object({git:ce.string(),subpath:ce.string().optional()});var gur=ce.object({path:ce.string()});var Aur=ce.undiscriminatedUnion([hur,gur]);var yur=ce.enum_(["python","cpp"]);var bur=ce.object({path:ce.string()});var Eur=ce.object({input:Aur,output:bur,lang:yur,config:mur.optional()});var Sqe=ce.string();var vur=ce.object({dark:ce.string().optional(),light:ce.string().optional(),height:ce.number().optional(),href:ce.string().optional(),rightText:ce.property("right-text",ce.string().optional())});var Iur=ce.enum_(["summary","summary_large_image","app","player"]);var wur=ce.object({ogSiteName:ce.property("og:site_name",ce.string().optional()),ogTitle:ce.property("og:title",ce.string().optional()),ogDescription:ce.property("og:description",ce.string().optional()),ogUrl:ce.property("og:url",ce.string().optional()),ogImage:ce.property("og:image",ce.string().optional()),ogImageWidth:ce.property("og:image:width",ce.number().optional()),ogImageHeight:ce.property("og:image:height",ce.number().optional()),ogLocale:ce.property("og:locale",ce.string().optional()),ogLogo:ce.property("og:logo",ce.string().optional()),twitterTitle:ce.property("twitter:title",ce.string().optional()),twitterDescription:ce.property("twitter:description",ce.string().optional()),twitterHandle:ce.property("twitter:handle",ce.string().optional()),twitterImage:ce.property("twitter:image",ce.string().optional()),twitterSite:ce.property("twitter:site",ce.string().optional()),twitterUrl:ce.property("twitter:url",ce.string().optional()),twitterCard:ce.property("twitter:card",Iur.optional()),ogDynamic:ce.property("og:dynamic",ce.boolean().optional()),ogBackgroundImage:ce.property("og:background-image",ce.string().optional()),canonicalHost:ce.property("canonical-host",ce.string().optional())});var Ohe=ce.object({viewers:Aqe.optional()});var lH=ce.object({href:ce.string().optional(),target:L4.optional(),url:ce.string().optional(),text:ce.string().optional(),icon:ce.string().optional(),rightIcon:ce.string().optional(),rounded:ce.boolean().optional()}).extend(Ohe);var xur=ce.object({links:ce.list(lH),text:ce.string().optional(),icon:ce.string().optional(),rightIcon:ce.string().optional(),rounded:ce.boolean().optional()}).extend(Ohe);var Cur=ce.object({url:ce.string(),target:L4.optional()}).extend(Ohe);var _ur=ce.undiscriminatedUnion([ce.string(),Cur]);var Sur=ce.union("type",{filled:lH,outlined:lH,minimal:lH,github:ce.object({value:_ur}),dropdown:xur,primary:lH,secondary:lH}).transform({transform:e=>e,untransform:e=>e});var z4=ce.string();var Tur=ce.object({tab:z4,layout:ce.list(ce.lazy(()=>pH)).optional()});var Our=ce.object({title:ce.string(),subtitle:ce.string().optional(),icon:ce.string().optional(),layout:ce.list(ce.lazy(()=>pH)),slug:ce.string().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),hidden:ce.boolean().optional(),default:ce.boolean().optional()}).extend(hm).extend(mm);var Bur=ce.object({tab:z4,variants:ce.list(Our)});var Pur=ce.undiscriminatedUnion([Tur,Bur]);var Rur=ce.list(Pur);var Dur=ce.list(ce.lazy(()=>pH));var Bhe=ce.undiscriminatedUnion([Dur,Rur]);var Fur=ce.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var kur=ce.object({copyPage:ce.property("copy-page",ce.boolean().optional()),viewAsMarkdown:ce.property("view-as-markdown",ce.boolean().optional()),askAi:ce.property("ask-ai",ce.boolean().optional()),chatgpt:ce.boolean().optional(),claude:ce.boolean().optional(),cursor:ce.boolean().optional(),vscode:ce.boolean().optional(),custom:ce.list(Gcr).optional()});var Nur=ce.object({default:Fur.optional(),options:kur.optional()});var jur=ce.enum_(["deprecated","ga","stable","beta"]);var Tqe=ce.object({displayName:ce.property("display-name",ce.string()),path:ce.string(),slug:ce.string().optional(),availability:jur.optional(),audiences:oH.optional(),hidden:ce.boolean().optional(),announcement:The.optional()}).extend(hm).extend(mm);var Oqe=ce.object({displayName:ce.property("display-name",ce.string()),subtitle:ce.string().optional(),icon:ce.string().optional(),image:ce.string().optional(),versions:ce.list(Tqe).optional(),audiences:oH.optional()}).extend(hm).extend(mm);var Qur=ce.object({href:ce.string(),target:L4.optional()}).extend(Oqe);var Mur=ce.object({path:ce.string(),slug:ce.string().optional(),announcement:The.optional()}).extend(Oqe);var Lur=ce.undiscriminatedUnion([Mur,Qur]);var Uur=ce.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var zur=ce.object({source:ce.string(),destination:ce.string(),permanent:ce.boolean().optional()});var Phe=ce.object({displayName:ce.property("display-name",ce.string()),icon:ce.string().optional(),slug:ce.string().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),hidden:ce.boolean().optional(),href:ce.string().optional(),target:L4.optional(),changelog:bqe.optional()}).extend(hm).extend(mm);var Vur=ce.enum_(["default","minimal"]);var qur=ce.enum_(["default","minimal"]);var Gur=ce.enum_(["default","toolbar"]);var Wur=ce.enum_(["default","toggle"]);var $ur=ce.enum_(["default","minimal"]);var Hur=ce.enum_(["left","center"]);var Q3s=ce.enum_(["default","bubble"]),G8l=ce.object({style:Q3s.optional(),alignment:Hur.optional(),placement:_qe.optional()}),Kur=ce.undiscriminatedUnion([Q3s,G8l]);var Jur=ce.object({sidebar:$ur.optional(),body:Ncr.optional(),tabs:Kur.optional(),pageActions:ce.property("page-actions",Gur.optional()),footerNav:ce.property("footer-nav",Vur.optional()),languageSwitcher:ce.property("language-switcher",qur.optional()),productSwitcher:ce.property("product-switcher",Wur.optional())});var M3s=ce.object({instances:ce.list(Kcr),title:ce.string().optional(),libraries:ce.record(Sqe,Eur).optional(),analytics:Icr.optional(),announcement:The.optional(),roles:ce.list(bPe).optional(),tabs:ce.record(z4,Phe).optional(),versions:ce.list(Tqe).optional(),products:ce.list(Lur).optional(),landingPage:ce.property("landing-page",U4.optional()),navigation:Bhe.optional(),navbarLinks:ce.property("navbar-links",ce.list(Sur).optional()),footerLinks:ce.property("footer-links",iur.optional()),pageActions:ce.property("page-actions",Nur.optional()),experimental:nur.optional(),defaultLanguage:ce.property("default-language",Uur.optional()),languages:ce.list(Eqe).optional(),aiChat:ce.property("ai-chat",OCt.optional()),aiSearch:ce.property("ai-search",OCt.optional()),aiExamples:ce.property("ai-examples",hcr.optional()),agents:lcr.optional(),metadata:wur.optional(),redirects:ce.list(zur).optional(),check:Mcr.optional(),logo:vur.optional(),favicon:ce.string().optional(),backgroundImage:ce.property("background-image",kcr.optional()),colors:Ucr.optional(),typography:rur.optional(),layout:dur.optional(),settings:Xcr.optional(),theme:Jur.optional(),integrations:our.optional(),css:Vcr.optional(),js:uur.optional(),header:ce.string().optional(),footer:ce.string().optional()});var Yur=ce.object({folder:ce.string(),title:ce.string().optional(),titleSource:ce.property("title-source",vqe.optional()),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),collapsed:sH.optional(),collapsible:ce.boolean().optional(),collapsedByDefault:ce.property("collapsed-by-default",ce.boolean().optional()),availability:a_.optional()}).extend(hm).extend(mm);var Xur=ce.object({library:Sqe,title:ce.string().optional(),slug:ce.string().optional()}).extend(hm).extend(mm);var pH=ce.undiscriminatedUnion([U4,ce.lazyObject(()=>Zur),Tcr,Xur,yqe,jcr,Yur]);var L3s=ce.object({tabs:ce.record(z4,Phe).optional(),landingPage:ce.property("landing-page",U4.optional()),navigation:Bhe});var elr=ce.object({displayName:ce.property("display-name",ce.string()),path:ce.string(),slug:ce.string().optional()}).extend(hm).extend(mm);var U3s=ce.undiscriminatedUnion([elr,ccr]);var Zur=ce.object({section:ce.string(),path:ce.string().optional(),contents:ce.list(ce.lazy(()=>pH)),collapsed:sH.optional(),collapsible:ce.boolean().optional(),collapsedByDefault:ce.property("collapsed-by-default",ce.boolean().optional()),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),availability:a_.optional()}).extend(hm).extend(mm);var z3s=ce.object({tabs:ce.record(z4,Phe).optional(),landingPage:ce.property("landing-page",U4.optional()),navigation:Bhe});var V3s=require("fs/promises");var W8l=/\r?\n/;async function Rhe({absolutePathToFernignore:e}){let t=(await(0,V3s.readFile)(e)).toString();return q3s(t)}function q3s(e){return[YO,...e.trim().split(W8l).map(t=>{let r=t.indexOf("#");return r!==-1?t.slice(0,r).trim():t.trim()}).filter(t=>t.length>0)]}var kn={};$(kn,{API_ORIGIN_LOCATION_KEY:()=>wUs,API_SETTINGS_KEY:()=>SUs,ASYNC_API_LOCATION_KEY:()=>xUs,CoerceConstsTo:()=>s8s,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>ghe,DEFAULT_GROUP_NAME:()=>Lxt,DefaultIntegerFormat:()=>a8s,ExampleStyle:()=>c8s,FormParameterEncoding:()=>u8s,GenerationLanguage:()=>G3s,GithubCommitAndReleaseMode:()=>h8s,GithubLicenseType:()=>A8s,GithubSelfhostedMode:()=>g8s,Language:()=>l8s,MessageNamingSettingsSchema:()=>p8s,ModelProvider:()=>K3s,OPENAPI_LOCATION_KEY:()=>CUs,OPENAPI_OVERRIDES_LOCATION_KEY:()=>_Us,PathParameterOrder:()=>f8s,RemoveDiscriminantsFromSchemas:()=>d8s,UnionSettingsSchema:()=>m8s,ai:()=>owi,automation:()=>J3s,fernDefinition:()=>awi,generators:()=>cwi,getPackageName:()=>W3s,group:()=>uwi,isApiConfigurationV2Schema:()=>H8s,isAsyncApiSpecSchema:()=>K8s,isConjureSchema:()=>J8s,isGraphQLSpecSchema:()=>Y8s,isNamespacedApiConfiguration:()=>X8s,isOpenApiSpecSchema:()=>Z8s,isOpenRpcSpecSchema:()=>e6s,isProtoSpecSchema:()=>t6s,isRawProtobufAPIDefinitionSchema:()=>$3s,license:()=>lwi,replay:()=>y8s,resolveAutomationConfig:()=>H3s,reviewers:()=>b8s,serialization:()=>Dwi});var G3s={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function W3s({generatorInvocation:e}){return e.language==="go"?$8l(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function $8l(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function $3s(e){return typeof e!="string"&&"proto"in e}var tlr={generate:!0,upgrade:!0,preview:!0,verify:!0};function H3s({rootAutomation:e,groupAutomation:t,generatorAutomation:r}){return{generate:r?.generate??t?.generate??e?.generate??tlr.generate,upgrade:r?.upgrade??t?.upgrade??e?.upgrade??tlr.upgrade,preview:r?.preview??t?.preview??e?.preview??tlr.preview,verify:r?.verify??t?.verify??e?.verify??tlr.verify}}var owi={};$(owi,{ModelProvider:()=>K3s});var K3s={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var J3s={};var awi={};$(awi,{AvailabilityStatusSchema:()=>X3s,auth:()=>Y3s,availability:()=>swi,commons:()=>Z3s,encoding:()=>e8s,environments:()=>t8s,file:()=>r8s,service:()=>n8s,types:()=>i8s,validation:()=>o8s});var Y3s={};var swi={};$(swi,{AvailabilityStatusSchema:()=>X3s});var X3s={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var Z3s={};var e8s={};var t8s={};var r8s={};var n8s={};var i8s={};var o8s={};var cwi={};$(cwi,{CoerceConstsTo:()=>s8s,DefaultIntegerFormat:()=>a8s,ExampleStyle:()=>c8s,FormParameterEncoding:()=>u8s,Language:()=>l8s,MessageNamingSettingsSchema:()=>p8s,PathParameterOrder:()=>f8s,RemoveDiscriminantsFromSchemas:()=>d8s,UnionSettingsSchema:()=>m8s});var s8s={Literals:"literals",Enums:"enums",EnumsCoerceableToLiterals:"enums-coerceable-to-literals"};var a8s={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};var c8s={Minimal:"minimal",Comprehensive:"comprehensive"};var u8s={Form:"form",Json:"json"};var l8s={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var p8s={V1:"v1",V2:"v2"};var f8s={UrlOrder:"url-order",SpecOrder:"spec-order"};var d8s={Always:"always",Never:"never"};var m8s={V1:"v1"};var uwi={};$(uwi,{GithubCommitAndReleaseMode:()=>h8s,GithubSelfhostedMode:()=>g8s});var h8s={Commit:"commit",Release:"release"};var g8s={PullRequest:"pull-request",Push:"push"};var lwi={};$(lwi,{GithubLicenseType:()=>A8s});var A8s={Mit:"MIT",Apache:"Apache-2.0"};var y8s={};var b8s={};var Dwi={};$(Dwi,{AiServicesSchema:()=>clr,ApiConfigurationSchema:()=>dpr,ApiConfigurationSchemaInternal:()=>Wqe,ApiConfigurationV2Schema:()=>ppr,ApiConfigurationV2SettingsSchema:()=>Kqe,ApiConfigurationV2SpecsSchema:()=>Jqe,ApiDefinitionList:()=>Jlr,ApiDefinitionPathSchema:()=>jhe,ApiDefinitionSchema:()=>Klr,ApiDefinitionSettingsSchema:()=>zqe,ApiDefinitionWithOverridesSchema:()=>Vqe,AsyncApiSettingsSchema:()=>Hqe,AsyncApiSpecSchema:()=>opr,AutomationSchema:()=>Dhe,BaseApiSettingsSchema:()=>$qe,BaseGeneratorInvocationSchema:()=>Yqe,CoerceConstsTo:()=>Ylr,ConjureSchema:()=>ipr,CratesOutputLocationSchema:()=>ypr,CustomGeneratorInvocationSchema:()=>Mpr,DefaultGeneratorInvocationSchema:()=>Lpr,DefaultIntegerFormat:()=>Xlr,ExampleStyle:()=>mpr,FormParameterEncoding:()=>Zlr,GeneratorApiSettingsSchema:()=>Apr,GeneratorGroupSchema:()=>zpr,GeneratorImageObjectSchema:()=>hpr,GeneratorInvocationSchema:()=>Upr,GeneratorOutputSchema:()=>Tpr,GeneratorPublishMetadataSchema:()=>jCt,GeneratorSnippetsSchema:()=>Ppr,GeneratorsConfigurationSchema:()=>$8s,GeneratorsOpenApiObjectSchema:()=>qpr,GeneratorsOpenApiSchema:()=>Gpr,GithubCommitAndReleaseMode:()=>Rpr,GithubCommitAndReleaseSchema:()=>Dpr,GithubConfigurationSchema:()=>Qpr,GithubLicenseCustomSchema:()=>Opr,GithubLicenseSchema:()=>q4,GithubLicenseType:()=>Bpr,GithubPullRequestSchema:()=>Fpr,GithubPushSchema:()=>kpr,GithubSelfhostedMode:()=>Npr,GithubSelfhostedSchema:()=>jpr,GraphQlSpecSchema:()=>spr,Language:()=>Wpr,LocalFileSystemOutputLocationSchema:()=>bpr,MavenOutputLocationSchema:()=>vpr,MavenOutputSignatureSchema:()=>Epr,MessageNamingSettingsSchema:()=>Mqe,ModelName:()=>slr,ModelProvider:()=>alr,NamespacedApiConfigurationSchema:()=>fpr,NpmOutputLocationSchema:()=>Ipr,NugetOutputLocationSchema:()=>wpr,OpenApiExampleGenerationSchema:()=>epr,OpenApiFilterSchema:()=>tpr,OpenApiSettingsSchema:()=>Qhe,OpenApiSpecSchema:()=>apr,OpenRpcSpecSchema:()=>cpr,OutputMetadataAuthor:()=>gpr,OutputMetadataSchema:()=>Mhe,OverridesSchema:()=>V4,PathParameterOrder:()=>Lqe,PostmanOutputLocationSchema:()=>xpr,ProtobufApiDefinitionSchema:()=>Gqe,ProtobufDefinitionSchema:()=>qqe,ProtobufSpecSchema:()=>upr,PypiOutputLocationSchema:()=>_pr,PypiOutputMetadataSchema:()=>Cpr,ReadmeCustomSectionSchema:()=>$pr,ReadmeEndpointObjectSchema:()=>Hpr,ReadmeEndpointSchema:()=>QCt,ReadmeSchema:()=>Kpr,RemoveDiscriminantsFromSchemas:()=>Uqe,ReplayConfigSchema:()=>Vpr,RequestOrResponseExampleGenerationSchema:()=>kCt,ResolveAliases:()=>npr,ResolveAliasesSchema:()=>rpr,ReviewerSchema:()=>NCt,ReviewersSchema:()=>Lhe,RubyGemsOutputLocationSchema:()=>Spr,SpecSchema:()=>lpr,UnionSettingsSchema:()=>Hlr,WhitelabelConfigurationSchema:()=>Ypr,WhitelabelGithubConfigurationSchema:()=>Jpr,ai:()=>gwi,automation:()=>Awi,fernDefinition:()=>Swi,generators:()=>Twi,group:()=>Owi,license:()=>Bwi,replay:()=>Pwi,reviewers:()=>Rwi});var gwi={};$(gwi,{AiServicesSchema:()=>clr,ModelName:()=>slr,ModelProvider:()=>alr});var _e={};$(_e,{JsonError:()=>Bqe,ParseError:()=>Pqe,any:()=>D8s,bigint:()=>v8s,boolean:()=>F8s,booleanLiteral:()=>P8s,date:()=>I8s,discriminant:()=>q8s,enum_:()=>nlr,getObjectLikeUtils:()=>Nq,getObjectUtils:()=>EPe,getSchemaUtils:()=>gm,isProperty:()=>wse,lazy:()=>w8s,lazyObject:()=>O8s,list:()=>olr,never:()=>k8s,number:()=>N8s,object:()=>ilr,objectWithoutOptionalProperties:()=>T8s,optional:()=>pwi,property:()=>C8s,record:()=>L8s,set:()=>U8s,string:()=>j8s,stringLiteral:()=>R8s,transform:()=>fwi,undiscriminatedUnion:()=>V8s,union:()=>W8s,unknown:()=>Q8s,withParsedProperties:()=>hwi});var zu={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Nd(e,t){return`Expected ${t}. Received ${H8l(e)}.`}function H8l(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function u_(e){return{...e,json:E8s(e.json),parse:E8s(e.parse)}}function E8s(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1542
|
+
`)),{ok:!0,value:t}):n}}function icr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var mqe=class e extends Error{errors;constructor(t){super(t.map(icr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var hqe=class e extends Error{errors;constructor(t){super(t.map(icr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function dm(e){return{nullable:()=>N8l(e),optional:()=>XIi(e),optionalNullable:()=>j8l(e),transform:t=>ZIi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new hqe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new mqe(n.errors)}}}function N8l(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Uu.NULLABLE};return{...t,...dm(t)}}function XIi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Uu.OPTIONAL};return{...t,...dm(t)}}function j8l(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Uu.OPTIONAL_NULLABLE};return{...t,...dm(t)}}function ZIi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...dm(r)}}function f3s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:kd(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:kd(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Uu.BIGINT};return{...o_(e),...dm(e)}}var Q8l=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function d3s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:kd(t,"string")}]}:Q8l.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:kd(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:kd(t,"Date object")}]},getType:()=>Uu.DATE};return{...o_(e),...dm(e)}}function s_(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...o_(r),...dm(r)}}}function ocr(e){let t=new Set(e);return s_(Uu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:kd(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:kd(n,"enum")}]}:{ok:!0,value:n})()}function m3s(e){let t=ewi(e);return{...t,...dm(t)}}function ewi(e){return{parse:(t,r)=>gqe(e).parse(t,r),json:(t,r)=>gqe(e).json(t,r),getType:()=>gqe(e).getType()}}function gqe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function twi(e){return Object.entries(e)}function SCt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Ese(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function TCt(e){return Object.keys(e)}function h3s(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var M8l=Object.prototype.hasOwnProperty;function kq(e){return{withParsedProperties:t=>rwi(e,t)}}function rwi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(M8l.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Ese(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kd(n,"object")}]};let o=new Set(Object.keys(t)),s=SCt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...dm(r),...kq(r)}}function g3s(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function vse(e){return e.isProperty}var L8l=Object.prototype.hasOwnProperty;function scr(e){let t;function r(){if(t==null){t={};for(let[d,f]of twi(e)){let m=vse(f)?f.rawKey:d,h=vse(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of twi(e)){let m=vse(f)?f.rawKey:d,h=vse(f)?f.valueSchema:f;U8l(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>vse(f)?f.rawKey:d),_getParsedProperties:()=>TCt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return A3s({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return A3s({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return vse(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Uu.OBJECT};return{...o_(p),...dm(p),...kq(p),...yPe(p)}}function A3s({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Ese(e))return{ok:!1,errors:[{path:s,message:kd(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!L8l.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function yPe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>y3s({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>y3s({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Uu.OBJECT};return{...r,...dm(r),...kq(r),...yPe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Uu.OBJECT};return{...n,...dm(n),...kq(n),...yPe(n)}}}}function y3s({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Ese(t))return{ok:!1,errors:[{path:i,message:kd(t,"object")}]};let o=new Set(e),[s,a]=h3s(TCt(t),l=>o.has(l)),c=r(SCt(t,a)),u=n(SCt(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function U8l(e){return!z8l(e)}function z8l(e){switch(e.getType()){case Uu.ANY:case Uu.UNKNOWN:case Uu.OPTIONAL:case Uu.OPTIONAL_NULLABLE:return!0;default:return!1}}function b3s(e){return scr(e)}function E3s(e){let t={...ewi(e),_getRawProperties:()=>gqe(e)._getRawProperties(),_getParsedProperties:()=>gqe(e)._getParsedProperties()};return{...t,...dm(t),...kq(t),...yPe(t)}}function acr(e){let t={parse:(r,n)=>v3s(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>v3s(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Uu.LIST};return{...o_(t),...dm(t)}}function v3s(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:kd(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function I3s(e){return s_(Uu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kd(r,`${e.toString()}`)}]})()}function w3s(e){return s_(Uu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kd(r,`"${e}"`)}]})()}var x3s=s_(Uu.ANY,e=>({ok:!0,value:e}));var C3s=s_(Uu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"boolean")}]});var _3s=s_(Uu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var S3s=s_(Uu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"number")}]});var T3s=s_(Uu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kd(e,"string")}]});var O3s=s_(Uu.UNKNOWN,e=>({ok:!0,value:e}));var V8l=Object.prototype.hasOwnProperty;function P3s(e,t){let r={parse:(n,i)=>B3s({value:n,isKeyNumeric:e.getType()===Uu.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>B3s({value:n,isKeyNumeric:e.getType()===Uu.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Uu.RECORD};return{...o_(r),...dm(r)}}function B3s({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Ese(e))return{ok:!1,errors:[{path:i,message:kd(e,"object")}]};let o={},s=[];for(let a in e){if(!V8l.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function R3s(e){let t=acr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kd(n,"Set")}]},getType:()=>Uu.SET};return{...o_(r),...dm(r)}}function F3s(e){let t={parse:(r,n)=>D3s((i,o)=>i.parse(r,o),e,n),json:(r,n)=>D3s((i,o)=>i.json(r,o),e,n),getType:()=>Uu.UNDISCRIMINATED_UNION};return{...o_(t),...dm(t)}}function D3s(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function k3s(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var q8l=Object.prototype.hasOwnProperty;function j3s(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=ocr(TCt(t)),o={parse:(s,a)=>N3s({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>N3s({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Uu.UNION};return{...o_(o),...dm(o),...kq(o)}}function N3s({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Ese(e))return{ok:!1,errors:[{path:a,message:kd(e,"object")}]};let c=e[t],u={};for(let f in e)q8l.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var ccr=ce.object({href:ce.string()});var ucr=ce.enum_(["description","subtitle"]);var lcr=ce.object({pageDirective:ce.property("page-directive",ce.string().optional()),pageDescriptionSource:ce.property("page-description-source",ucr.optional()),llmsTxt:ce.property("llms-txt",ce.string().optional()),llmsFullTxt:ce.property("llms-full-txt",ce.string().optional())});var pcr=ce.object({url:ce.string(),title:ce.string().optional()});var fcr=ce.undiscriminatedUnion([pcr]);var dcr=ce.enum_(["docs","slack","discord"]);var mcr=ce.enum_(["claude-3.7","claude-4","command-a"]);var OCt=ce.object({model:mcr.optional(),systemPrompt:ce.property("system-prompt",ce.string().optional()),location:ce.list(dcr).optional(),datasources:ce.list(fcr).optional()});var hcr=ce.object({enabled:ce.boolean().optional(),style:ce.string().optional()});var gcr=ce.object({orgId:ce.property("org-id",ce.string())});var Acr=ce.object({measurementId:ce.property("measurement-id",ce.string())});var ycr=ce.object({containerId:ce.property("container-id",ce.string())});var bcr=ce.object({appId:ce.property("app-id",ce.string()),apiBase:ce.property("api-base",ce.string().optional())});var Ecr=ce.object({apiKey:ce.property("api-key",ce.string()),endpoint:ce.string().optional()});var vcr=ce.object({writeKey:ce.property("write-key",ce.string())});var Icr=ce.object({segment:vcr.optional(),fullstory:gcr.optional(),intercom:bcr.optional(),posthog:Ecr.optional(),gtm:ycr.optional(),ga4:Acr.optional()});var The=ce.object({message:ce.string()});var BCt=ce.string();var oH=ce.undiscriminatedUnion([BCt,ce.list(BCt)]);var a_=ce.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var wcr=ce.enum_(["open-by-default"]);var sH=ce.undiscriminatedUnion([ce.boolean(),wcr]);var xcr=ce.object({href:ce.string().optional()});var aH=ce.object({hidden:ce.boolean().optional(),environments:ce.list(ce.string()).optional(),button:xcr.optional(),oauth:ce.boolean().optional(),limitWebsocketMessagesPerConnection:ce.property("limit-websocket-messages-per-connection",ce.number().optional())});var Ccr=ce.object({version:ce.string(),package:ce.string()});var M4=ce.undiscriminatedUnion([ce.string(),Ccr]);var _cr=ce.object({python:M4.optional(),typescript:M4.optional(),go:M4.optional(),java:M4.optional(),ruby:M4.optional(),csharp:M4.optional(),php:M4.optional(),swift:M4.optional(),rust:M4.optional()});var PCt=ce.object({flag:ce.string(),fallbackValue:ce.property("fallback-value",ce.unknown().optional()),match:ce.unknown().optional()});var Scr=ce.undiscriminatedUnion([ce.string(),PCt,ce.list(PCt)]);var mm=ce.object({featureFlag:ce.property("feature-flag",Scr.optional())});var bPe=ce.string();var Aqe=ce.undiscriminatedUnion([bPe,ce.list(bPe)]);var hm=ce.object({viewers:Aqe.optional(),orphaned:ce.boolean().optional()});var Tcr=ce.object({api:ce.string(),apiName:ce.property("api-name",ce.string().optional()),openrpc:ce.string().optional(),audiences:oH.optional(),displayErrors:ce.property("display-errors",ce.boolean().optional()),tagDescriptionPages:ce.property("tag-description-pages",ce.boolean().optional()),snippets:_cr.optional(),postman:ce.string().optional(),summary:ce.string().optional(),layout:ce.list(ce.lazy(()=>cH)).optional(),collapsed:sH.optional(),icon:ce.string().optional(),slug:ce.string().optional(),hidden:ce.boolean().optional(),availability:a_.optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),alphabetized:ce.boolean().optional(),flattened:ce.boolean().optional(),paginated:ce.boolean().optional(),playground:aH.optional()}).extend(hm).extend(mm);var Ocr=ce.object({endpoint:ce.string(),title:ce.string().optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),availability:a_.optional(),playground:aH.optional()}).extend(hm).extend(mm);var Bcr=ce.object({operation:ce.string(),title:ce.string().optional(),slug:ce.string().optional(),hidden:ce.boolean().optional(),availability:a_.optional()}).extend(hm).extend(mm);var L4=ce.enum_(["_blank","_self","_parent","_top"]);var yqe=ce.object({link:ce.string(),href:ce.string(),icon:ce.string().optional(),target:L4.optional()});var U4=ce.object({page:ce.string(),path:ce.string(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),noindex:ce.boolean().optional(),availability:a_.optional()}).extend(hm).extend(mm);var cH=ce.undiscriminatedUnion([ce.string(),ce.record(ce.string(),ce.lazy(()=>Pcr)),ce.lazyObject(()=>Rcr),Ocr,Bcr,U4,yqe]);var Pcr=ce.undiscriminatedUnion([ce.list(ce.lazy(()=>cH)),ce.lazyObject(()=>Dcr)]);var Dcr=ce.object({title:ce.string().optional(),summary:ce.string().optional(),contents:ce.list(ce.lazy(()=>cH)).optional(),availability:a_.optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),playground:aH.optional()}).extend(hm).extend(mm);var Rcr=ce.object({section:ce.string(),referencedPackages:ce.property("referenced-packages",ce.list(ce.string()).optional()),summary:ce.string().optional(),contents:ce.list(ce.lazy(()=>cH)).optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),collapsed:sH.optional(),collapsible:ce.boolean().optional(),collapsedByDefault:ce.property("collapsed-by-default",ce.boolean().optional()),availability:a_.optional(),playground:aH.optional()}).extend(hm).extend(mm);var Fcr=ce.object({dark:ce.string().optional(),light:ce.string().optional()});var kcr=ce.undiscriminatedUnion([ce.string(),Fcr]);var Ncr=ce.enum_(["default","canvas"]);var bqe=ce.string();var jcr=ce.object({changelog:bqe,title:ce.string().optional(),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional()}).extend(hm).extend(mm);var uH=ce.enum_(["warn","error"]);var Qcr=ce.object({exampleValidation:ce.property("example-validation",uH.optional()),brokenLinks:ce.property("broken-links",uH.optional()),noNonComponentRefs:ce.property("no-non-component-refs",uH.optional()),validLocalReferences:ce.property("valid-local-references",uH.optional()),noCircularRedirects:ce.property("no-circular-redirects",uH.optional()),validDocsEndpoints:ce.property("valid-docs-endpoints",uH.optional()),missingRedirects:ce.property("missing-redirects",uH.optional())});var Mcr=ce.object({rules:Qcr.optional()});var Lcr=ce.object({dark:ce.string().optional(),light:ce.string().optional()});var qE=ce.undiscriminatedUnion([ce.string(),Lcr]);var Ucr=ce.object({accentPrimary:ce.property("accent-primary",qE.optional()),accentPrimaryDeprecated:ce.property("accentPrimary",qE.optional()),background:qE.optional(),border:qE.optional(),sidebarBackground:ce.property("sidebar-background",qE.optional()),headerBackground:ce.property("header-background",qE.optional()),cardBackground:ce.property("card-background",qE.optional()),accent1:ce.property("accent-1",qE.optional()),accent2:ce.property("accent-2",qE.optional()),accent3:ce.property("accent-3",qE.optional()),accent4:ce.property("accent-4",qE.optional()),accent5:ce.property("accent-5",qE.optional()),accent6:ce.property("accent-6",qE.optional()),accent7:ce.property("accent-7",qE.optional()),accent8:ce.property("accent-8",qE.optional()),accent9:ce.property("accent-9",qE.optional()),accent10:ce.property("accent-10",qE.optional()),accent11:ce.property("accent-11",qE.optional()),accent12:ce.property("accent-12",qE.optional())});var zcr=ce.enum_(["center","left"]);var Vcr=ce.undiscriminatedUnion([ce.string(),ce.list(ce.string())]);var qcr=ce.undiscriminatedUnion([ce.string(),ce.list(ce.string())]);var Gcr=ce.object({title:ce.string(),subtitle:ce.string().optional(),url:ce.string(),icon:ce.string().optional(),default:ce.boolean().optional()});var Wcr=ce.enum_(["github","dashboard"]);var $cr=ce.object({host:ce.string().optional(),owner:ce.string(),repo:ce.string(),branch:ce.string().optional()});var Hcr=ce.object({github:$cr.optional(),launch:Wcr.optional()});var Kcr=ce.object({url:ce.string(),customDomain:ce.property("custom-domain",qcr.optional()),editThisPage:ce.property("edit-this-page",Hcr.optional()),audiences:oH.optional()});var Jcr=ce.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var Ycr=ce.undiscriminatedUnion([ce.boolean(),ce.list(Jcr)]);var Eqe=ce.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var vqe=ce.enum_(["frontmatter","filename"]);var Xcr=ce.object({searchText:ce.property("search-text",ce.string().optional()),disableSearch:ce.property("disable-search",ce.boolean().optional()),darkModeCode:ce.property("dark-mode-code",ce.boolean().optional()),defaultSearchFilters:ce.property("default-search-filters",ce.boolean().optional()),httpSnippets:ce.property("http-snippets",Ycr.optional()),hide404Page:ce.property("hide-404-page",ce.boolean().optional()),useJavascriptAsTypescript:ce.property("use-javascript-as-typescript",ce.boolean().optional()),disableExplorerProxy:ce.property("disable-explorer-proxy",ce.boolean().optional()),disableEnvironmentEditing:ce.property("disable-environment-editing",ce.boolean().optional()),disableAnalytics:ce.property("disable-analytics",ce.boolean().optional()),language:Eqe.optional(),folderTitleSource:ce.property("folder-title-source",vqe.optional()),substituteEnvVars:ce.property("substitute-env-vars",ce.boolean().optional())});var Iqe=ce.enum_(["normal","italic"]);var wqe=ce.undiscriminatedUnion([ce.string(),ce.number()]);var Zcr=ce.object({path:ce.string(),weight:wqe.optional(),style:Iqe.optional()});var eur=ce.undiscriminatedUnion([ce.string(),Zcr]);var tur=ce.enum_(["auto","block","swap","fallback","optional"]);var xqe=ce.object({name:ce.string().optional(),path:ce.string().optional(),weight:wqe.optional(),style:Iqe.optional(),paths:ce.list(eur).optional(),display:tur.optional(),fallback:ce.list(ce.string()).optional(),fontVariationSettings:ce.property("font-variation-settings",ce.string().optional())});var rur=ce.object({headingsFont:xqe.optional(),bodyFont:xqe.optional(),codeFont:xqe.optional()});var nur=ce.object({mdxComponents:ce.property("mdx-components",ce.list(ce.string()).optional()),disableStreamToggle:ce.property("disable-stream-toggle",ce.boolean().optional()),openapiParserV2:ce.property("openapi-parser-v2",ce.boolean().optional()),openapiParserV3:ce.property("openapi-parser-v3",ce.boolean().optional()),dynamicSnippets:ce.property("dynamic-snippets",ce.boolean().optional()),aiExamples:ce.property("ai-examples",ce.boolean().optional()),aiExampleStyleInstructions:ce.property("ai-example-style-instructions",ce.string().optional()),excludeApis:ce.property("exclude-apis",ce.boolean().optional()),basepathAware:ce.property("basepath-aware",ce.boolean().optional())});var iur=ce.object({github:ce.string().optional(),twitter:ce.string().optional(),x:ce.string().optional(),linkedin:ce.string().optional(),youtube:ce.string().optional(),instagram:ce.string().optional(),facebook:ce.string().optional(),discord:ce.string().optional(),slack:ce.string().optional(),hackernews:ce.string().optional(),medium:ce.string().optional(),website:ce.string().optional()});var our=ce.object({intercom:ce.string().optional(),context7:ce.string().optional()});var Cqe=ce.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var sur=ce.object({path:ce.string(),strategy:Cqe.optional()});var aur=ce.undiscriminatedUnion([ce.string(),sur]);var cur=ce.object({url:ce.string(),strategy:Cqe.optional()});var RCt=ce.undiscriminatedUnion([cur,aur]);var uur=ce.undiscriminatedUnion([RCt,ce.list(RCt)]);var lur=ce.enum_(["fixed","static"]);var pur=ce.enum_(["header","header-tabs","sidebar"]);var fur=ce.enum_(["header","sidebar"]);var _qe=ce.enum_(["header","sidebar"]);var dur=ce.object({pageWidth:ce.property("page-width",ce.string().optional()),contentWidth:ce.property("content-width",ce.string().optional()),sidebarWidth:ce.property("sidebar-width",ce.string().optional()),headerHeight:ce.property("header-height",ce.string().optional()),searchbarPlacement:ce.property("searchbar-placement",pur.optional()),tabsPlacement:ce.property("tabs-placement",_qe.optional()),switcherPlacement:ce.property("switcher-placement",fur.optional()),contentAlignment:ce.property("content-alignment",zcr.optional()),headerPosition:ce.property("header-position",lur.optional()),disableHeader:ce.property("disable-header",ce.boolean().optional()),hideNavLinks:ce.property("hide-nav-links",ce.boolean().optional()),hideFeedback:ce.property("hide-feedback",ce.boolean().optional())});var mur=ce.object({doxyfile:ce.string().optional()});var hur=ce.object({git:ce.string(),subpath:ce.string().optional()});var gur=ce.object({path:ce.string()});var Aur=ce.undiscriminatedUnion([hur,gur]);var yur=ce.enum_(["python","cpp"]);var bur=ce.object({path:ce.string()});var Eur=ce.object({input:Aur,output:bur,lang:yur,config:mur.optional()});var Sqe=ce.string();var vur=ce.object({dark:ce.string().optional(),light:ce.string().optional(),height:ce.number().optional(),href:ce.string().optional(),rightText:ce.property("right-text",ce.string().optional())});var Iur=ce.enum_(["summary","summary_large_image","app","player"]);var wur=ce.object({ogSiteName:ce.property("og:site_name",ce.string().optional()),ogTitle:ce.property("og:title",ce.string().optional()),ogDescription:ce.property("og:description",ce.string().optional()),ogUrl:ce.property("og:url",ce.string().optional()),ogImage:ce.property("og:image",ce.string().optional()),ogImageWidth:ce.property("og:image:width",ce.number().optional()),ogImageHeight:ce.property("og:image:height",ce.number().optional()),ogLocale:ce.property("og:locale",ce.string().optional()),ogLogo:ce.property("og:logo",ce.string().optional()),twitterTitle:ce.property("twitter:title",ce.string().optional()),twitterDescription:ce.property("twitter:description",ce.string().optional()),twitterHandle:ce.property("twitter:handle",ce.string().optional()),twitterImage:ce.property("twitter:image",ce.string().optional()),twitterSite:ce.property("twitter:site",ce.string().optional()),twitterUrl:ce.property("twitter:url",ce.string().optional()),twitterCard:ce.property("twitter:card",Iur.optional()),ogDynamic:ce.property("og:dynamic",ce.boolean().optional()),ogBackgroundImage:ce.property("og:background-image",ce.string().optional()),canonicalHost:ce.property("canonical-host",ce.string().optional())});var Ohe=ce.object({viewers:Aqe.optional()});var lH=ce.object({href:ce.string().optional(),target:L4.optional(),url:ce.string().optional(),text:ce.string().optional(),icon:ce.string().optional(),rightIcon:ce.string().optional(),rounded:ce.boolean().optional()}).extend(Ohe);var xur=ce.object({links:ce.list(lH),text:ce.string().optional(),icon:ce.string().optional(),rightIcon:ce.string().optional(),rounded:ce.boolean().optional()}).extend(Ohe);var Cur=ce.object({url:ce.string(),target:L4.optional()}).extend(Ohe);var _ur=ce.undiscriminatedUnion([ce.string(),Cur]);var Sur=ce.union("type",{filled:lH,outlined:lH,minimal:lH,github:ce.object({value:_ur}),dropdown:xur,primary:lH,secondary:lH}).transform({transform:e=>e,untransform:e=>e});var z4=ce.string();var Tur=ce.object({tab:z4,layout:ce.list(ce.lazy(()=>pH)).optional()});var Our=ce.object({title:ce.string(),subtitle:ce.string().optional(),icon:ce.string().optional(),layout:ce.list(ce.lazy(()=>pH)),slug:ce.string().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),hidden:ce.boolean().optional(),default:ce.boolean().optional()}).extend(hm).extend(mm);var Bur=ce.object({tab:z4,variants:ce.list(Our)});var Pur=ce.undiscriminatedUnion([Tur,Bur]);var Rur=ce.list(Pur);var Dur=ce.list(ce.lazy(()=>pH));var Bhe=ce.undiscriminatedUnion([Dur,Rur]);var Fur=ce.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var kur=ce.object({copyPage:ce.property("copy-page",ce.boolean().optional()),viewAsMarkdown:ce.property("view-as-markdown",ce.boolean().optional()),askAi:ce.property("ask-ai",ce.boolean().optional()),chatgpt:ce.boolean().optional(),claude:ce.boolean().optional(),cursor:ce.boolean().optional(),vscode:ce.boolean().optional(),custom:ce.list(Gcr).optional()});var Nur=ce.object({default:Fur.optional(),options:kur.optional()});var jur=ce.enum_(["deprecated","ga","stable","beta"]);var Tqe=ce.object({displayName:ce.property("display-name",ce.string()),path:ce.string(),slug:ce.string().optional(),availability:jur.optional(),audiences:oH.optional(),hidden:ce.boolean().optional(),announcement:The.optional()}).extend(hm).extend(mm);var Oqe=ce.object({displayName:ce.property("display-name",ce.string()),subtitle:ce.string().optional(),icon:ce.string().optional(),image:ce.string().optional(),versions:ce.list(Tqe).optional(),audiences:oH.optional()}).extend(hm).extend(mm);var Qur=ce.object({href:ce.string(),target:L4.optional()}).extend(Oqe);var Mur=ce.object({path:ce.string(),slug:ce.string().optional(),announcement:The.optional()}).extend(Oqe);var Lur=ce.undiscriminatedUnion([Mur,Qur]);var Uur=ce.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var zur=ce.object({source:ce.string(),destination:ce.string(),permanent:ce.boolean().optional()});var Phe=ce.object({displayName:ce.property("display-name",ce.string()),icon:ce.string().optional(),slug:ce.string().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),hidden:ce.boolean().optional(),href:ce.string().optional(),target:L4.optional(),changelog:bqe.optional()}).extend(hm).extend(mm);var Vur=ce.enum_(["default","minimal"]);var qur=ce.enum_(["default","minimal"]);var Gur=ce.enum_(["default","toolbar"]);var Wur=ce.enum_(["default","toggle"]);var $ur=ce.enum_(["default","minimal"]);var Hur=ce.enum_(["left","center"]);var Q3s=ce.enum_(["default","bubble"]),G8l=ce.object({style:Q3s.optional(),alignment:Hur.optional(),placement:_qe.optional()}),Kur=ce.undiscriminatedUnion([Q3s,G8l]);var Jur=ce.object({sidebar:$ur.optional(),body:Ncr.optional(),tabs:Kur.optional(),pageActions:ce.property("page-actions",Gur.optional()),footerNav:ce.property("footer-nav",Vur.optional()),languageSwitcher:ce.property("language-switcher",qur.optional()),productSwitcher:ce.property("product-switcher",Wur.optional())});var M3s=ce.object({instances:ce.list(Kcr),title:ce.string().optional(),libraries:ce.record(Sqe,Eur).optional(),analytics:Icr.optional(),announcement:The.optional(),roles:ce.list(bPe).optional(),tabs:ce.record(z4,Phe).optional(),versions:ce.list(Tqe).optional(),products:ce.list(Lur).optional(),landingPage:ce.property("landing-page",U4.optional()),navigation:Bhe.optional(),navbarLinks:ce.property("navbar-links",ce.list(Sur).optional()),footerLinks:ce.property("footer-links",iur.optional()),pageActions:ce.property("page-actions",Nur.optional()),experimental:nur.optional(),defaultLanguage:ce.property("default-language",Uur.optional()),languages:ce.list(Eqe).optional(),aiChat:ce.property("ai-chat",OCt.optional()),aiSearch:ce.property("ai-search",OCt.optional()),aiExamples:ce.property("ai-examples",hcr.optional()),agents:lcr.optional(),metadata:wur.optional(),redirects:ce.list(zur).optional(),check:Mcr.optional(),logo:vur.optional(),favicon:ce.string().optional(),backgroundImage:ce.property("background-image",kcr.optional()),colors:Ucr.optional(),typography:rur.optional(),layout:dur.optional(),settings:Xcr.optional(),theme:Jur.optional(),integrations:our.optional(),css:Vcr.optional(),js:uur.optional(),header:ce.string().optional(),footer:ce.string().optional()});var Yur=ce.object({folder:ce.string(),title:ce.string().optional(),titleSource:ce.property("title-source",vqe.optional()),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),collapsed:sH.optional(),collapsible:ce.boolean().optional(),collapsedByDefault:ce.property("collapsed-by-default",ce.boolean().optional()),availability:a_.optional()}).extend(hm).extend(mm);var Xur=ce.object({library:Sqe,title:ce.string().optional(),slug:ce.string().optional()}).extend(hm).extend(mm);var pH=ce.undiscriminatedUnion([U4,ce.lazyObject(()=>Zur),Tcr,Xur,yqe,jcr,Yur]);var L3s=ce.object({tabs:ce.record(z4,Phe).optional(),landingPage:ce.property("landing-page",U4.optional()),navigation:Bhe});var elr=ce.object({displayName:ce.property("display-name",ce.string()),path:ce.string(),slug:ce.string().optional()}).extend(hm).extend(mm);var U3s=ce.undiscriminatedUnion([elr,ccr]);var Zur=ce.object({section:ce.string(),path:ce.string().optional(),contents:ce.list(ce.lazy(()=>pH)),collapsed:sH.optional(),collapsible:ce.boolean().optional(),collapsedByDefault:ce.property("collapsed-by-default",ce.boolean().optional()),slug:ce.string().optional(),icon:ce.string().optional(),hidden:ce.boolean().optional(),skipSlug:ce.property("skip-slug",ce.boolean().optional()),availability:a_.optional()}).extend(hm).extend(mm);var z3s=ce.object({tabs:ce.record(z4,Phe).optional(),landingPage:ce.property("landing-page",U4.optional()),navigation:Bhe});var V3s=require("fs/promises");var W8l=/\r?\n/;async function Rhe({absolutePathToFernignore:e}){let t=(await(0,V3s.readFile)(e)).toString();return q3s(t)}function q3s(e){return[YO,...e.trim().split(W8l).map(t=>{let r=t.indexOf("#");return r!==-1?t.slice(0,r).trim():t.trim()}).filter(t=>t.length>0)]}var kn={};$(kn,{API_ORIGIN_LOCATION_KEY:()=>wUs,API_SETTINGS_KEY:()=>SUs,ASYNC_API_LOCATION_KEY:()=>xUs,CoerceConstsTo:()=>s8s,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>ghe,DEFAULT_GROUP_NAME:()=>Lxt,DefaultIntegerFormat:()=>a8s,ExampleStyle:()=>c8s,FormParameterEncoding:()=>u8s,GenerationLanguage:()=>G3s,GithubCommitAndReleaseMode:()=>h8s,GithubLicenseType:()=>A8s,GithubSelfhostedMode:()=>g8s,Language:()=>l8s,MessageNamingSettingsSchema:()=>p8s,ModelProvider:()=>K3s,OPENAPI_LOCATION_KEY:()=>CUs,OPENAPI_OVERRIDES_LOCATION_KEY:()=>_Us,PathParameterOrder:()=>f8s,RemoveDiscriminantsFromSchemas:()=>d8s,UnionSettingsSchema:()=>m8s,ai:()=>owi,automation:()=>J3s,fernDefinition:()=>awi,generators:()=>cwi,getPackageName:()=>W3s,group:()=>uwi,isApiConfigurationV2Schema:()=>H8s,isAsyncApiSpecSchema:()=>K8s,isConjureSchema:()=>J8s,isGraphQLSpecSchema:()=>Y8s,isNamespacedApiConfiguration:()=>X8s,isOpenApiSpecSchema:()=>Z8s,isOpenRpcSpecSchema:()=>e6s,isProtoSpecSchema:()=>t6s,isRawProtobufAPIDefinitionSchema:()=>$3s,license:()=>lwi,replay:()=>y8s,resolveAutomationConfig:()=>H3s,reviewers:()=>b8s,serialization:()=>Dwi});var G3s={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function W3s({generatorInvocation:e}){return e.language==="go"?$8l(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function $8l(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function $3s(e){return typeof e!="string"&&"proto"in e}var tlr={generate:!0,upgrade:!0,preview:!0,verify:!0};function H3s({rootAutomation:e,groupAutomation:t,generatorAutomation:r}){return{generate:r?.generate??t?.generate??e?.generate??tlr.generate,upgrade:r?.upgrade??t?.upgrade??e?.upgrade??tlr.upgrade,preview:r?.preview??t?.preview??e?.preview??tlr.preview,verify:r?.verify??t?.verify??e?.verify??tlr.verify}}var owi={};$(owi,{ModelProvider:()=>K3s});var K3s={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var J3s={};var awi={};$(awi,{AvailabilityStatusSchema:()=>X3s,auth:()=>Y3s,availability:()=>swi,commons:()=>Z3s,encoding:()=>e8s,environments:()=>t8s,file:()=>r8s,service:()=>n8s,types:()=>i8s,validation:()=>o8s});var Y3s={};var swi={};$(swi,{AvailabilityStatusSchema:()=>X3s});var X3s={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var Z3s={};var e8s={};var t8s={};var r8s={};var n8s={};var i8s={};var o8s={};var cwi={};$(cwi,{CoerceConstsTo:()=>s8s,DefaultIntegerFormat:()=>a8s,ExampleStyle:()=>c8s,FormParameterEncoding:()=>u8s,Language:()=>l8s,MessageNamingSettingsSchema:()=>p8s,PathParameterOrder:()=>f8s,RemoveDiscriminantsFromSchemas:()=>d8s,UnionSettingsSchema:()=>m8s});var s8s={Literals:"literals",Enums:"enums",EnumsCoerceableToLiterals:"enums-coerceable-to-literals"};var a8s={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};var c8s={Minimal:"minimal",Comprehensive:"comprehensive"};var u8s={Form:"form",Json:"json"};var l8s={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var p8s={V1:"v1",V2:"v2"};var f8s={UrlOrder:"url-order",SpecOrder:"spec-order"};var d8s={Always:"always",Never:"never"};var m8s={V1:"v1"};var uwi={};$(uwi,{GithubCommitAndReleaseMode:()=>h8s,GithubSelfhostedMode:()=>g8s});var h8s={Commit:"commit",Release:"release"};var g8s={PullRequest:"pull-request",Push:"push"};var lwi={};$(lwi,{GithubLicenseType:()=>A8s});var A8s={Mit:"MIT",Apache:"Apache-2.0"};var y8s={};var b8s={};var Dwi={};$(Dwi,{AiServicesSchema:()=>clr,ApiConfigurationSchema:()=>dpr,ApiConfigurationSchemaInternal:()=>Wqe,ApiConfigurationV2Schema:()=>ppr,ApiConfigurationV2SettingsSchema:()=>Kqe,ApiConfigurationV2SpecsSchema:()=>Jqe,ApiDefinitionList:()=>Jlr,ApiDefinitionPathSchema:()=>jhe,ApiDefinitionSchema:()=>Klr,ApiDefinitionSettingsSchema:()=>zqe,ApiDefinitionWithOverridesSchema:()=>Vqe,AsyncApiSettingsSchema:()=>Hqe,AsyncApiSpecSchema:()=>opr,AutomationSchema:()=>Dhe,BaseApiSettingsSchema:()=>$qe,BaseGeneratorInvocationSchema:()=>Yqe,CoerceConstsTo:()=>Ylr,ConjureSchema:()=>ipr,CratesOutputLocationSchema:()=>ypr,CustomGeneratorInvocationSchema:()=>Mpr,DefaultGeneratorInvocationSchema:()=>Lpr,DefaultIntegerFormat:()=>Xlr,ExampleStyle:()=>mpr,FormParameterEncoding:()=>Zlr,GeneratorApiSettingsSchema:()=>Apr,GeneratorGroupSchema:()=>zpr,GeneratorImageObjectSchema:()=>hpr,GeneratorInvocationSchema:()=>Upr,GeneratorOutputSchema:()=>Tpr,GeneratorPublishMetadataSchema:()=>jCt,GeneratorSnippetsSchema:()=>Ppr,GeneratorsConfigurationSchema:()=>$8s,GeneratorsOpenApiObjectSchema:()=>qpr,GeneratorsOpenApiSchema:()=>Gpr,GithubCommitAndReleaseMode:()=>Rpr,GithubCommitAndReleaseSchema:()=>Dpr,GithubConfigurationSchema:()=>Qpr,GithubLicenseCustomSchema:()=>Opr,GithubLicenseSchema:()=>q4,GithubLicenseType:()=>Bpr,GithubPullRequestSchema:()=>Fpr,GithubPushSchema:()=>kpr,GithubSelfhostedMode:()=>Npr,GithubSelfhostedSchema:()=>jpr,GraphQlSpecSchema:()=>spr,Language:()=>Wpr,LocalFileSystemOutputLocationSchema:()=>bpr,MavenOutputLocationSchema:()=>vpr,MavenOutputSignatureSchema:()=>Epr,MessageNamingSettingsSchema:()=>Mqe,ModelName:()=>slr,ModelProvider:()=>alr,NamespacedApiConfigurationSchema:()=>fpr,NpmOutputLocationSchema:()=>Ipr,NugetOutputLocationSchema:()=>wpr,OpenApiExampleGenerationSchema:()=>epr,OpenApiFilterSchema:()=>tpr,OpenApiSettingsSchema:()=>Qhe,OpenApiSpecSchema:()=>apr,OpenRpcSpecSchema:()=>cpr,OutputMetadataAuthor:()=>gpr,OutputMetadataSchema:()=>Mhe,OverridesSchema:()=>V4,PathParameterOrder:()=>Lqe,PostmanOutputLocationSchema:()=>xpr,ProtobufApiDefinitionSchema:()=>Gqe,ProtobufDefinitionSchema:()=>qqe,ProtobufSpecSchema:()=>upr,PypiOutputLocationSchema:()=>_pr,PypiOutputMetadataSchema:()=>Cpr,ReadmeCustomSectionSchema:()=>$pr,ReadmeEndpointObjectSchema:()=>Hpr,ReadmeEndpointSchema:()=>QCt,ReadmeSchema:()=>Kpr,RemoveDiscriminantsFromSchemas:()=>Uqe,ReplayConfigSchema:()=>Vpr,RequestOrResponseExampleGenerationSchema:()=>kCt,ResolveAliases:()=>npr,ResolveAliasesSchema:()=>rpr,ReviewerSchema:()=>NCt,ReviewersSchema:()=>Lhe,RubyGemsOutputLocationSchema:()=>Spr,SpecSchema:()=>lpr,UnionSettingsSchema:()=>Hlr,WhitelabelConfigurationSchema:()=>Ypr,WhitelabelGithubConfigurationSchema:()=>Jpr,ai:()=>gwi,automation:()=>Awi,fernDefinition:()=>Swi,generators:()=>Twi,group:()=>Owi,license:()=>Bwi,replay:()=>Pwi,reviewers:()=>Rwi});var gwi={};$(gwi,{AiServicesSchema:()=>clr,ModelName:()=>slr,ModelProvider:()=>alr});var _e={};$(_e,{JsonError:()=>Bqe,ParseError:()=>Pqe,any:()=>D8s,bigint:()=>v8s,boolean:()=>F8s,booleanLiteral:()=>P8s,date:()=>I8s,discriminant:()=>q8s,enum_:()=>nlr,getObjectLikeUtils:()=>Nq,getObjectUtils:()=>EPe,getSchemaUtils:()=>gm,isProperty:()=>wse,lazy:()=>w8s,lazyObject:()=>O8s,list:()=>olr,never:()=>k8s,number:()=>N8s,object:()=>ilr,objectWithoutOptionalProperties:()=>T8s,optional:()=>pwi,property:()=>C8s,record:()=>L8s,set:()=>U8s,string:()=>j8s,stringLiteral:()=>R8s,transform:()=>fwi,undiscriminatedUnion:()=>V8s,union:()=>W8s,unknown:()=>Q8s,withParsedProperties:()=>hwi});var zu={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Nd(e,t){return`Expected ${t}. Received ${H8l(e)}.`}function H8l(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function u_(e){return{...e,json:E8s(e.json),parse:E8s(e.parse)}}function E8s(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1543
1543
|
`)),{ok:!0,value:t}):n}}function rlr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Bqe=class e extends Error{errors;constructor(t){super(t.map(rlr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var Pqe=class e extends Error{errors;constructor(t){super(t.map(rlr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function gm(e){return{nullable:()=>K8l(e),optional:()=>pwi(e),optionalNullable:()=>J8l(e),transform:t=>fwi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new Pqe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Bqe(n.errors)}}}function K8l(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>zu.NULLABLE};return{...t,...gm(t)}}function pwi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>zu.OPTIONAL};return{...t,...gm(t)}}function J8l(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>zu.OPTIONAL_NULLABLE};return{...t,...gm(t)}}function fwi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...gm(r)}}function v8s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:Nd(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Nd(t,"bigint")}]}:{ok:!0,value:t},getType:()=>zu.BIGINT};return{...u_(e),...gm(e)}}var Y8l=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function I8s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Nd(t,"string")}]}:Y8l.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Nd(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Nd(t,"Date object")}]},getType:()=>zu.DATE};return{...u_(e),...gm(e)}}function l_(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...u_(r),...gm(r)}}}function nlr(e){let t=new Set(e);return l_(zu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Nd(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Nd(n,"enum")}]}:{ok:!0,value:n})()}function w8s(e){let t=dwi(e);return{...t,...gm(t)}}function dwi(e){return{parse:(t,r)=>Rqe(e).parse(t,r),json:(t,r)=>Rqe(e).json(t,r),getType:()=>Rqe(e).getType()}}function Rqe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function mwi(e){return Object.entries(e)}function DCt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Ise(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function FCt(e){return Object.keys(e)}function x8s(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var X8l=Object.prototype.hasOwnProperty;function Nq(e){return{withParsedProperties:t=>hwi(e,t)}}function hwi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(X8l.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Ise(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nd(n,"object")}]};let o=new Set(Object.keys(t)),s=DCt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...gm(r),...Nq(r)}}function C8s(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function wse(e){return e.isProperty}var Z8l=Object.prototype.hasOwnProperty;function ilr(e){let t;function r(){if(t==null){t={};for(let[d,f]of mwi(e)){let m=wse(f)?f.rawKey:d,h=wse(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of mwi(e)){let m=wse(f)?f.rawKey:d,h=wse(f)?f.valueSchema:f;e6l(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>wse(f)?f.rawKey:d),_getParsedProperties:()=>FCt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return _8s({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return _8s({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return wse(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>zu.OBJECT};return{...u_(p),...gm(p),...Nq(p),...EPe(p)}}function _8s({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Ise(e))return{ok:!1,errors:[{path:s,message:Nd(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!Z8l.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function EPe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>S8s({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>S8s({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>zu.OBJECT};return{...r,...gm(r),...Nq(r),...EPe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>zu.OBJECT};return{...n,...gm(n),...Nq(n),...EPe(n)}}}}function S8s({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Ise(t))return{ok:!1,errors:[{path:i,message:Nd(t,"object")}]};let o=new Set(e),[s,a]=x8s(FCt(t),l=>o.has(l)),c=r(DCt(t,a)),u=n(DCt(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function e6l(e){return!t6l(e)}function t6l(e){switch(e.getType()){case zu.ANY:case zu.UNKNOWN:case zu.OPTIONAL:case zu.OPTIONAL_NULLABLE:return!0;default:return!1}}function T8s(e){return ilr(e)}function O8s(e){let t={...dwi(e),_getRawProperties:()=>Rqe(e)._getRawProperties(),_getParsedProperties:()=>Rqe(e)._getParsedProperties()};return{...t,...gm(t),...Nq(t),...EPe(t)}}function olr(e){let t={parse:(r,n)=>B8s(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>B8s(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>zu.LIST};return{...u_(t),...gm(t)}}function B8s(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Nd(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function P8s(e){return l_(zu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nd(r,`${e.toString()}`)}]})()}function R8s(e){return l_(zu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nd(r,`"${e}"`)}]})()}var D8s=l_(zu.ANY,e=>({ok:!0,value:e}));var F8s=l_(zu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nd(e,"boolean")}]});var k8s=l_(zu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var N8s=l_(zu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nd(e,"number")}]});var j8s=l_(zu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nd(e,"string")}]});var Q8s=l_(zu.UNKNOWN,e=>({ok:!0,value:e}));var r6l=Object.prototype.hasOwnProperty;function L8s(e,t){let r={parse:(n,i)=>M8s({value:n,isKeyNumeric:e.getType()===zu.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>M8s({value:n,isKeyNumeric:e.getType()===zu.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>zu.RECORD};return{...u_(r),...gm(r)}}function M8s({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Ise(e))return{ok:!1,errors:[{path:i,message:Nd(e,"object")}]};let o={},s=[];for(let a in e){if(!r6l.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function U8s(e){let t=olr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nd(n,"Set")}]},getType:()=>zu.SET};return{...u_(r),...gm(r)}}function V8s(e){let t={parse:(r,n)=>z8s((i,o)=>i.parse(r,o),e,n),json:(r,n)=>z8s((i,o)=>i.json(r,o),e,n),getType:()=>zu.UNDISCRIMINATED_UNION};return{...u_(t),...gm(t)}}function z8s(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function q8s(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var n6l=Object.prototype.hasOwnProperty;function W8s(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=nlr(FCt(t)),o={parse:(s,a)=>G8s({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>G8s({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>zu.UNION};return{...u_(o),...gm(o),...Nq(o)}}function G8s({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Ise(e))return{ok:!1,errors:[{path:a,message:Nd(e,"object")}]};let c=e[t],u={};for(let f in e)n6l.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var slr=_e.string();var alr=_e.enum_(["openai","anthropic","bedrock"]);var clr=_e.object({provider:alr,model:slr});var Awi={};$(Awi,{AutomationSchema:()=>Dhe});var Dhe=_e.object({generate:_e.boolean().optional(),upgrade:_e.boolean().optional(),preview:_e.boolean().optional(),verify:_e.boolean().optional()});var Swi={};$(Swi,{AnyAuthItem:()=>ulr,AnyAuthSchemesSchema:()=>llr,ApiAuthSchema:()=>Fqe,AuthSchemeDeclarationSchema:()=>khe,AuthSchemeReferenceSchema:()=>Dqe,AuthScope:()=>vlr,AuthVariable:()=>vPe,AvailabilitySchema:()=>Olr,AvailabilityStatusSchema:()=>Nqe,AvailabilityUnionSchema:()=>Blr,BaseTypeReferenceSchema:()=>Vlr,BasicAuthSchemeSchema:()=>dlr,BearerAuthSchemeSchema:()=>blr,EncodingSchema:()=>Dlr,EndpointSecuritySchema:()=>flr,EndpointSecuritySchemaDetails:()=>plr,EnvironmentSchema:()=>Nlr,HeaderAuthSchemeSchema:()=>Elr,HttpHeaderSchema:()=>Qqe,InferredAuthenticatedRequestHeader:()=>mlr,InferredBearerAuthSchema:()=>Alr,InferredGetTokenEndpointSchema:()=>glr,InferredGetTokenEndpointSchemaObject:()=>hlr,ListValidationSchema:()=>Qlr,MapValidationSchema:()=>Mlr,MultipleBaseUrlsEnvironmentSchema:()=>Flr,NumberValidationSchema:()=>Llr,OAuthAccessTokenRequestPropertiesSchema:()=>Ilr,OAuthAccessTokenResponsePropertiesSchema:()=>wlr,OAuthGetTokenEndpointSchema:()=>xlr,OAuthRefreshTokenEndpointSchema:()=>Slr,OAuthRefreshTokenRequestPropertiesSchema:()=>Clr,OAuthRefreshTokenResponsePropertiesSchema:()=>_lr,OAuthSchemeSchema:()=>Tlr,ProtobufTypeSchema:()=>Rlr,ServerVariableSchema:()=>jqe,SingleBaseUrlEnvironmentSchema:()=>klr,StringValidationSchema:()=>Ulr,TokenBearerAuthSchema:()=>ylr,TypeReferenceDeclarationWithEnvOverride:()=>Wlr,TypeReferenceDeclarationWithEnvOverrideSchema:()=>Glr,TypeReferenceDeclarationWithName:()=>qlr,ValidationSchema:()=>zlr,WithAudiences:()=>Nhe,WithAvailability:()=>Plr,WithDocsSchema:()=>Ub,WithEnvironmentVariable:()=>kqe,WithEnvironmentsSchema:()=>jlr,WithHeadersSchema:()=>$lr,WithName:()=>Fhe,auth:()=>ywi,availability:()=>bwi,commons:()=>Ewi,encoding:()=>vwi,environments:()=>Iwi,file:()=>wwi,service:()=>xwi,types:()=>Cwi,validation:()=>_wi});var ywi={};$(ywi,{AnyAuthItem:()=>ulr,AnyAuthSchemesSchema:()=>llr,ApiAuthSchema:()=>Fqe,AuthSchemeDeclarationSchema:()=>khe,AuthSchemeReferenceSchema:()=>Dqe,AuthScope:()=>vlr,AuthVariable:()=>vPe,BasicAuthSchemeSchema:()=>dlr,BearerAuthSchemeSchema:()=>blr,EndpointSecuritySchema:()=>flr,EndpointSecuritySchemaDetails:()=>plr,HeaderAuthSchemeSchema:()=>Elr,InferredAuthenticatedRequestHeader:()=>mlr,InferredBearerAuthSchema:()=>Alr,InferredGetTokenEndpointSchema:()=>glr,InferredGetTokenEndpointSchemaObject:()=>hlr,OAuthAccessTokenRequestPropertiesSchema:()=>Ilr,OAuthAccessTokenResponsePropertiesSchema:()=>wlr,OAuthGetTokenEndpointSchema:()=>xlr,OAuthRefreshTokenEndpointSchema:()=>Slr,OAuthRefreshTokenRequestPropertiesSchema:()=>Clr,OAuthRefreshTokenResponsePropertiesSchema:()=>_lr,OAuthSchemeSchema:()=>Tlr,TokenBearerAuthSchema:()=>ylr,WithEnvironmentVariable:()=>kqe});var Ub=_e.object({docs:_e.string().optional()});var Dqe=_e.object({scheme:_e.string()}).extend(Ub);var ulr=_e.undiscriminatedUnion([_e.string(),Dqe]);var llr=_e.object({any:_e.list(ulr)}).extend(Ub);var plr=_e.object({});var flr=_e.object({"endpoint-security":plr}).extend(Ub);var Fqe=_e.undiscriminatedUnion([_e.string(),Dqe,llr,flr]);var Fhe=_e.object({name:_e.string().optional()});var kqe=_e.object({env:_e.string().optional()});var vPe=_e.object({omit:_e.boolean().optional()}).extend(kqe).extend(Fhe);var dlr=_e.object({scheme:_e.stringLiteral("basic"),username:vPe.optional(),password:vPe.optional()}).extend(Ub);var mlr=_e.object({"response-property":_e.string(),"header-name":_e.string(),"value-prefix":_e.string().optional()});var hlr=_e.object({endpoint:_e.string(),"expiry-response-property":_e.string().optional(),"authenticated-request-headers":_e.list(mlr).optional()});var glr=_e.undiscriminatedUnion([_e.string(),hlr]);var Alr=_e.object({scheme:_e.stringLiteral("bearer"),"get-token":glr}).extend(Ub);var ylr=_e.object({scheme:_e.stringLiteral("bearer"),token:vPe.optional()}).extend(Ub);var blr=_e.undiscriminatedUnion([ylr,Alr]);var Elr=_e.object({header:_e.string(),type:_e.string().optional(),prefix:_e.string().optional()}).extend(kqe).extend(Fhe).extend(Ub);var vlr=_e.string();var Ilr=_e.object({"client-id":_e.string().optional(),"client-secret":_e.string().optional(),scopes:_e.string().optional()});var wlr=_e.object({"access-token":_e.string().optional(),"expires-in":_e.string().optional(),"refresh-token":_e.string().optional()});var xlr=_e.object({endpoint:_e.string(),"request-properties":Ilr.optional(),"response-properties":wlr.optional()});var Clr=_e.object({"refresh-token":_e.string()});var _lr=_e.object({"access-token":_e.string().optional(),"expires-in":_e.string().optional(),"refresh-token":_e.string().optional()});var Slr=_e.object({endpoint:_e.string(),"request-properties":Clr.optional(),"response-properties":_lr.optional()});var Tlr=_e.object({scheme:_e.stringLiteral("oauth"),type:_e.stringLiteral("client-credentials"),scopes:_e.list(vlr).optional(),"client-id-env":_e.string().optional(),"client-secret-env":_e.string().optional(),"token-prefix":_e.string().optional(),"token-header":_e.string().optional(),"get-token":xlr,"refresh-token":Slr.optional()}).extend(Ub);var khe=_e.undiscriminatedUnion([Tlr,Elr,dlr,blr]);var bwi={};$(bwi,{AvailabilitySchema:()=>Olr,AvailabilityStatusSchema:()=>Nqe,AvailabilityUnionSchema:()=>Blr});var Nqe=_e.enum_(["in-development","pre-release","deprecated","generally-available"]);var Olr=_e.object({status:Nqe,message:_e.string().optional()});var Blr=_e.undiscriminatedUnion([Nqe,Olr]);var Ewi={};$(Ewi,{WithAudiences:()=>Nhe,WithAvailability:()=>Plr,WithDocsSchema:()=>Ub,WithName:()=>Fhe});var Nhe=_e.object({audiences:_e.list(_e.string()).optional()});var Plr=_e.object({availability:Blr.optional()});var vwi={};$(vwi,{EncodingSchema:()=>Dlr,ProtobufTypeSchema:()=>Rlr});var Rlr=_e.object({type:_e.string()});var Dlr=_e.object({proto:Rlr.optional()});var Iwi={};$(Iwi,{EnvironmentSchema:()=>Nlr,MultipleBaseUrlsEnvironmentSchema:()=>Flr,ServerVariableSchema:()=>jqe,SingleBaseUrlEnvironmentSchema:()=>klr,WithEnvironmentsSchema:()=>jlr});var jqe=_e.object({id:_e.string(),default:_e.string().optional(),values:_e.list(_e.string()).optional()});var Flr=_e.object({urls:_e.record(_e.string(),_e.string()),"url-templates":_e.record(_e.string(),_e.string()).optional(),"default-urls":_e.record(_e.string(),_e.string()).optional(),variables:_e.record(_e.string(),_e.list(jqe)).optional()}).extend(Nhe).extend(Ub);var klr=_e.object({url:_e.string(),"default-url":_e.string().optional(),"url-template":_e.string().optional(),variables:_e.list(jqe).optional()}).extend(Nhe).extend(Ub);var Nlr=_e.undiscriminatedUnion([_e.string(),klr,Flr]);var jlr=_e.object({"default-url":_e.string().optional(),"default-environment":_e.string().optional(),environments:_e.record(_e.string(),Nlr).optional()});var wwi={};$(wwi,{WithHeadersSchema:()=>$lr});var Qlr=_e.object({minItems:_e.number().optional(),maxItems:_e.number().optional()});var Mlr=_e.object({minProperties:_e.number().optional(),maxProperties:_e.number().optional()});var Llr=_e.object({min:_e.number().optional(),max:_e.number().optional(),exclusiveMin:_e.boolean().optional(),exclusiveMax:_e.boolean().optional(),multipleOf:_e.number().optional()});var Ulr=_e.object({minLength:_e.number().optional(),maxLength:_e.number().optional(),pattern:_e.string().optional(),format:_e.string().optional()});var zlr=_e.undiscriminatedUnion([Ulr,Llr,Qlr,Mlr]);var Vlr=_e.object({default:_e.unknown().optional(),encoding:Dlr.optional(),validation:zlr.optional()}).extend(Ub).extend(Plr);var qlr=_e.object({type:_e.string()}).extend(Vlr).extend(Fhe).extend(Nhe);var Glr=_e.object({env:_e.string().optional()}).extend(qlr);var Wlr=_e.undiscriminatedUnion([_e.string(),Glr]);var Qqe=Wlr;var $lr=_e.object({headers:_e.record(_e.string(),Qqe).optional()});var xwi={};$(xwi,{HttpHeaderSchema:()=>Qqe,TypeReferenceDeclarationWithEnvOverride:()=>Wlr,TypeReferenceDeclarationWithEnvOverrideSchema:()=>Glr});var Cwi={};$(Cwi,{BaseTypeReferenceSchema:()=>Vlr,TypeReferenceDeclarationWithName:()=>qlr});var _wi={};$(_wi,{ListValidationSchema:()=>Qlr,MapValidationSchema:()=>Mlr,NumberValidationSchema:()=>Llr,StringValidationSchema:()=>Ulr,ValidationSchema:()=>zlr});var Twi={};$(Twi,{ApiConfigurationSchema:()=>dpr,ApiConfigurationSchemaInternal:()=>Wqe,ApiConfigurationV2Schema:()=>ppr,ApiConfigurationV2SettingsSchema:()=>Kqe,ApiConfigurationV2SpecsSchema:()=>Jqe,ApiDefinitionList:()=>Jlr,ApiDefinitionPathSchema:()=>jhe,ApiDefinitionSchema:()=>Klr,ApiDefinitionSettingsSchema:()=>zqe,ApiDefinitionWithOverridesSchema:()=>Vqe,AsyncApiSettingsSchema:()=>Hqe,AsyncApiSpecSchema:()=>opr,BaseApiSettingsSchema:()=>$qe,CoerceConstsTo:()=>Ylr,ConjureSchema:()=>ipr,DefaultIntegerFormat:()=>Xlr,ExampleStyle:()=>mpr,FormParameterEncoding:()=>Zlr,GeneratorImageObjectSchema:()=>hpr,GeneratorsConfigurationSchema:()=>$8s,GeneratorsOpenApiObjectSchema:()=>qpr,GeneratorsOpenApiSchema:()=>Gpr,GraphQlSpecSchema:()=>spr,Language:()=>Wpr,MessageNamingSettingsSchema:()=>Mqe,NamespacedApiConfigurationSchema:()=>fpr,OpenApiExampleGenerationSchema:()=>epr,OpenApiFilterSchema:()=>tpr,OpenApiSettingsSchema:()=>Qhe,OpenApiSpecSchema:()=>apr,OpenRpcSpecSchema:()=>cpr,OutputMetadataAuthor:()=>gpr,OutputMetadataSchema:()=>Mhe,OverridesSchema:()=>V4,PathParameterOrder:()=>Lqe,ProtobufApiDefinitionSchema:()=>Gqe,ProtobufDefinitionSchema:()=>qqe,ProtobufSpecSchema:()=>upr,ReadmeCustomSectionSchema:()=>$pr,ReadmeEndpointObjectSchema:()=>Hpr,ReadmeEndpointSchema:()=>QCt,ReadmeSchema:()=>Kpr,RemoveDiscriminantsFromSchemas:()=>Uqe,RequestOrResponseExampleGenerationSchema:()=>kCt,ResolveAliases:()=>npr,ResolveAliasesSchema:()=>rpr,SpecSchema:()=>lpr,UnionSettingsSchema:()=>Hlr,WhitelabelConfigurationSchema:()=>Ypr,WhitelabelGithubConfigurationSchema:()=>Jpr});var jhe=_e.string();var Mqe=_e.enum_(["v1","v2"]);var Lqe=_e.enum_(["url-order","spec-order"]);var Uqe=_e.enum_(["always","never"]);var Hlr=_e.enum_(["v1"]);var zqe=_e.object({"use-title":_e.boolean().optional(),unions:Hlr.optional(),"message-naming":Mqe.optional(),"respect-nullable-schemas":_e.boolean().optional(),"only-include-referenced-schemas":_e.boolean().optional(),"inline-path-parameters":_e.boolean().optional(),"idiomatic-request-names":_e.boolean().optional(),"wrap-references-to-nullable-in-optional":_e.boolean().optional(),"coerce-optional-schemas-to-nullable":_e.boolean().optional(),"group-environments-by-host":_e.boolean().optional(),"remove-discriminants-from-schemas":Uqe.optional(),"path-parameter-order":Lqe.optional()});var V4=_e.undiscriminatedUnion([_e.string(),_e.list(_e.string())]);var Vqe=_e.object({path:jhe,origin:_e.string().optional(),overrides:V4.optional(),audiences:_e.list(_e.string()).optional(),settings:zqe.optional()});var qqe=_e.object({target:_e.string().optional(),root:_e.string(),overrides:V4.optional(),"local-generation":_e.boolean().optional(),"from-openapi":_e.boolean().optional(),dependencies:_e.list(_e.string()).optional()});var Gqe=_e.object({proto:qqe});var Klr=_e.undiscriminatedUnion([jhe,Vqe,Gqe]);var Jlr=_e.list(Klr);var Wqe=_e.undiscriminatedUnion([jhe,Vqe,Jlr,Gqe]);var Ylr=_e.enum_(["literals","enums","enums-coerceable-to-literals"]);var $qe=_e.object({"respect-nullable-schemas":_e.boolean().optional(),"title-as-schema-name":_e.boolean().optional(),"optional-additional-properties":_e.boolean().optional(),"coerce-enums-to-literals":_e.boolean().optional(),"idiomatic-request-names":_e.boolean().optional(),"wrap-references-to-nullable-in-optional":_e.boolean().optional(),"coerce-optional-schemas-to-nullable":_e.boolean().optional(),"group-environments-by-host":_e.boolean().optional(),"remove-discriminants-from-schemas":Uqe.optional(),"path-parameter-order":Lqe.optional(),"resolve-schema-collisions":_e.boolean().optional(),"infer-forward-compatible":_e.boolean().optional(),"infer-default-environment":_e.boolean().optional(),"coerce-consts-to":Ylr.optional()});var Hqe=_e.object({"message-naming":Mqe.optional()}).extend($qe);var Xlr=_e.enum_(["int32","int64","uint32","uint64"]);var Zlr=_e.enum_(["form","json"]);var kCt=_e.object({"max-depth":_e.number().optional()});var epr=_e.object({request:kCt.optional(),response:kCt.optional()});var tpr=_e.object({endpoints:_e.list(_e.string()).optional()});var rpr=_e.object({except:_e.list(_e.string()).optional()});var npr=_e.undiscriminatedUnion([_e.boolean(),rpr]);var Qhe=_e.object({"only-include-referenced-schemas":_e.boolean().optional(),"inline-path-parameters":_e.boolean().optional(),"prefer-undiscriminated-unions-with-literals":_e.boolean().optional(),"object-query-parameters":_e.boolean().optional(),"respect-readonly-schemas":_e.boolean().optional(),"respect-forward-compatible-enums":_e.boolean().optional(),"use-bytes-for-binary-response":_e.boolean().optional(),"default-form-parameter-encoding":Zlr.optional(),filter:tpr.optional(),"example-generation":epr.optional(),"additional-properties-defaults-to":_e.boolean().optional(),"type-dates-as-strings":_e.boolean().optional(),"preserve-single-schema-oneof":_e.boolean().optional(),"inline-all-of-schemas":_e.boolean().optional(),"resolve-aliases":npr.optional(),"group-multi-api-environments":_e.boolean().optional(),"default-integer-format":Xlr.optional()}).extend($qe);var Kqe=_e.object({}).extend(Qhe).extend(Hqe);var ipr=_e.object({conjure:_e.string()});var opr=_e.object({asyncapi:_e.string(),origin:_e.string().optional(),overrides:V4.optional(),namespace:_e.string().optional(),settings:Hqe.optional()});var spr=_e.object({graphql:_e.string(),origin:_e.string().optional(),overrides:_e.string().optional(),name:_e.string().optional()});var apr=_e.object({openapi:_e.string(),origin:_e.string().optional(),overrides:V4.optional(),overlays:_e.string().optional(),namespace:_e.string().optional(),settings:Qhe.optional()});var cpr=_e.object({openrpc:_e.string(),overrides:V4.optional(),namespace:_e.string().optional()});var upr=_e.object({proto:qqe});var lpr=_e.undiscriminatedUnion([apr,opr,upr,cpr,spr]);var Jqe=_e.undiscriminatedUnion([_e.list(lpr),ipr]);var ppr=_e.object({auth:Fqe.optional(),"auth-schemes":_e.record(_e.string(),khe).optional(),specs:Jqe,settings:Kqe.optional()}).extend($lr).extend(jlr);var fpr=_e.object({namespaces:_e.record(_e.string(),Wqe)});var dpr=_e.undiscriminatedUnion([Wqe,fpr,ppr]);var mpr=_e.enum_(["minimal","comprehensive"]);var hpr=_e.object({name:_e.string(),registry:_e.string()});var gpr=_e.object({name:_e.string(),email:_e.string()});var Mhe=_e.object({description:_e.string().optional(),authors:_e.list(gpr).optional()});var NCt=_e.object({name:_e.string()});var Lhe=_e.object({teams:_e.list(NCt).optional(),users:_e.list(NCt).optional()});var Apr=_e.object({auth:Fqe.optional(),"auth-schemes":_e.record(_e.string(),khe).optional(),headers:_e.record(_e.string(),Qqe).optional(),settings:Kqe.optional(),specs:Jqe.optional()});var ypr=_e.object({url:_e.string().optional(),"package-name":_e.string(),token:_e.string().optional()});var bpr=_e.object({path:_e.string()});var Epr=_e.object({keyId:_e.string(),password:_e.string(),secretKey:_e.string()});var vpr=_e.object({url:_e.string().optional(),coordinate:_e.string(),username:_e.string().optional(),password:_e.string().optional(),signature:Epr.optional()});var Ipr=_e.object({url:_e.string().optional(),"package-name":_e.string(),token:_e.string().optional()});var wpr=_e.object({url:_e.string().optional(),"package-name":_e.string(),"api-key":_e.string().optional()});var xpr=_e.object({"api-key":_e.string(),"workspace-id":_e.string(),"collection-id":_e.string().optional()});var Cpr=_e.object({keywords:_e.list(_e.string()).optional(),"documentation-link":_e.string().optional(),"homepage-link":_e.string().optional()}).extend(Mhe);var _pr=_e.object({url:_e.string().optional(),"package-name":_e.string(),token:_e.string().optional(),username:_e.string().optional(),password:_e.string().optional(),metadata:Cpr.optional()});var Spr=_e.object({url:_e.string().optional(),"package-name":_e.string(),"api-key":_e.string().optional()});var Tpr=_e.union("location",{npm:Ipr,maven:vpr,pypi:_pr,postman:xpr,"local-file-system":bpr,nuget:wpr,rubygems:Spr,crates:ypr}).transform({transform:e=>e,untransform:e=>e});var Opr=_e.object({custom:_e.string()});var Bpr=_e.enum_(["MIT","Apache-2.0"]);var q4=_e.undiscriminatedUnion([Bpr,Opr]);var jCt=_e.object({"package-description":_e.string().optional(),email:_e.string().optional(),"reference-url":_e.string().optional(),author:_e.string().optional(),license:q4.optional()});var Ppr=_e.object({path:_e.string()});var Rpr=_e.enum_(["commit","release"]);var Dpr=_e.object({repository:_e.string(),license:q4.optional(),mode:Rpr.optional()});var Fpr=_e.object({repository:_e.string(),branch:_e.string().optional(),license:q4.optional(),mode:_e.stringLiteral("pull-request"),reviewers:Lhe.optional()});var kpr=_e.object({repository:_e.string(),license:q4.optional(),mode:_e.stringLiteral("push"),branch:_e.string().optional()});var Npr=_e.enum_(["pull-request","push"]);var jpr=_e.object({uri:_e.string(),token:_e.string(),mode:Npr.optional(),branch:_e.string().optional(),license:q4.optional()});var Qpr=_e.undiscriminatedUnion([jpr,Dpr,Fpr,kpr]);var Yqe=_e.object({version:_e.string(),output:Tpr.optional(),github:Qpr.optional(),config:_e.unknown().optional(),metadata:jCt.optional(),keywords:_e.list(_e.string()).optional(),snippets:Ppr.optional(),"ir-version":_e.string().optional(),"smart-casing":_e.boolean().optional(),api:Apr.optional(),"disable-examples":_e.boolean().optional(),"publish-metadata":jCt.optional(),autorelease:_e.boolean().optional(),automation:Dhe.optional()});var Mpr=_e.object({image:hpr}).extend(Yqe);var Lpr=_e.object({name:_e.string()}).extend(Yqe);var Upr=_e.undiscriminatedUnion([Lpr,Mpr]);var zpr=_e.object({audiences:_e.list(_e.string()).optional(),generators:_e.list(Upr),metadata:Mhe.optional(),reviewers:Lhe.optional(),automation:Dhe.optional()});var Vpr=_e.object({enabled:_e.boolean()});var qpr=_e.object({path:_e.string(),origin:_e.string().optional(),overrides:_e.string().optional(),"disable-examples":_e.boolean().optional(),settings:Qhe});var Gpr=_e.undiscriminatedUnion([qpr,_e.string()]);var Wpr=_e.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var $pr=_e.object({title:_e.string(),language:Wpr,content:_e.string()});var Hpr=_e.object({method:_e.string(),path:_e.string(),stream:_e.boolean().optional()});var QCt=_e.undiscriminatedUnion([_e.string(),Hpr]);var Kpr=_e.object({bannerLink:_e.string().optional(),introduction:_e.string().optional(),apiReferenceLink:_e.string().optional(),apiName:_e.string().optional(),disabledSections:_e.list(_e.string()).optional(),defaultEndpoint:QCt.optional(),features:_e.record(_e.string(),_e.list(QCt)).optional(),customSections:_e.list($pr).optional(),exampleStyle:mpr.optional()});var Jpr=_e.object({username:_e.string(),email:_e.string(),token:_e.string()});var Ypr=_e.object({github:Jpr.optional()});var $8s=_e.object({"auth-schemes":_e.record(_e.string(),khe).optional(),api:dpr.optional(),whitelabel:Ypr.optional(),metadata:Mhe.optional(),readme:Kpr.optional(),"default-group":_e.string().optional(),aliases:_e.record(_e.string(),_e.list(_e.string())).optional(),groups:_e.record(_e.string(),zpr).optional(),reviewers:Lhe.optional(),replay:Vpr.optional(),ai:clr.optional(),autorelease:_e.boolean().optional(),automation:Dhe.optional(),openapi:Gpr.optional(),"openapi-overrides":_e.string().optional(),"spec-origin":_e.string().optional(),"async-api":_e.string().optional(),"api-settings":zqe.optional()});var Owi={};$(Owi,{BaseGeneratorInvocationSchema:()=>Yqe,CratesOutputLocationSchema:()=>ypr,CustomGeneratorInvocationSchema:()=>Mpr,DefaultGeneratorInvocationSchema:()=>Lpr,GeneratorApiSettingsSchema:()=>Apr,GeneratorGroupSchema:()=>zpr,GeneratorInvocationSchema:()=>Upr,GeneratorOutputSchema:()=>Tpr,GeneratorPublishMetadataSchema:()=>jCt,GeneratorSnippetsSchema:()=>Ppr,GithubCommitAndReleaseMode:()=>Rpr,GithubCommitAndReleaseSchema:()=>Dpr,GithubConfigurationSchema:()=>Qpr,GithubPullRequestSchema:()=>Fpr,GithubPushSchema:()=>kpr,GithubSelfhostedMode:()=>Npr,GithubSelfhostedSchema:()=>jpr,LocalFileSystemOutputLocationSchema:()=>bpr,MavenOutputLocationSchema:()=>vpr,MavenOutputSignatureSchema:()=>Epr,NpmOutputLocationSchema:()=>Ipr,NugetOutputLocationSchema:()=>wpr,PostmanOutputLocationSchema:()=>xpr,PypiOutputLocationSchema:()=>_pr,PypiOutputMetadataSchema:()=>Cpr,RubyGemsOutputLocationSchema:()=>Spr});var Bwi={};$(Bwi,{GithubLicenseCustomSchema:()=>Opr,GithubLicenseSchema:()=>q4,GithubLicenseType:()=>Bpr});var Pwi={};$(Pwi,{ReplayConfigSchema:()=>Vpr});var Rwi={};$(Rwi,{ReviewerSchema:()=>NCt,ReviewersSchema:()=>Lhe});function H8s(e){return e?.specs!=null}function K8s(e){return e?.asyncapi!=null}function J8s(e){return e?.conjure!=null}function Y8s(e){return e?.graphql!=null}function X8s(e){return e?.namespaces!=null}function Z8s(e){return e?.openapi!=null}function e6s(e){return e?.openrpc!=null}function t6s(e){return e?.proto!=null}var i6l={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:kn.RemoveDiscriminantsFromSchemas.Always,inferDefaultEnvironment:!0};function o6l(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function IPe({options:e,overrides:t}){return o6l({defaults:i6l,options:e,overrides:t})}GA();GA();Pt();var Xqe={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Xqe._visit(this,t)}}),_visit:(e,t)=>e.type==="protobuf"?t.protobuf(e):t._other(e)};var p_={basic:e=>({...e,type:"basic",_visit:function(t){return p_._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return p_._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return p_._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return p_._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return p_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var tB={openapi:e=>({...e,type:"openapi",_visit:function(t){return tB._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return tB._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var xc={primitive:e=>({value:e,type:"primitive",_visit:function(t){return xc._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return xc._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return xc._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return xc._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return xc._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return xc._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return xc._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return xc._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return xc._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var Uhe={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return Uhe._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return Uhe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var zhe={boolean:e=>({value:e,type:"boolean",_visit:function(t){return zhe._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return zhe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var _s={int:e=>({value:e,type:"int",_visit:function(t){return _s._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return _s._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return _s._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return _s._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return _s._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return _s._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return _s._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return _s._visit(this,t)}}),datetimeRfc2822:e=>({value:e,type:"datetimeRfc2822",_visit:function(t){return _s._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return _s._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return _s._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return _s._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"datetimeRfc2822":return t.datetimeRfc2822(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var Wg={};$(Wg,{AsymmetricAlgorithm:()=>Vhe,Availability:()=>f_,CustomCodeSample:()=>fH,DiscriminatorContext:()=>Fwi,EndpointExample:()=>G4,EndpointResponseExample:()=>W4,HttpMethod:()=>d_,LiteralSchemaValue:()=>JA,MultipartRequestPropertyEncoding:()=>kwi,MultipartSchema:()=>dH,OneOfSchema:()=>mH,Pagination:()=>Qx,PrimitiveSchemaValue:()=>Sl,Request:()=>jq,Response:()=>K1,RetriesConfiguration:()=>MCt,Schema:()=>Ra,SupportedSdkLanguage:()=>m_,WebhookHttpMethod:()=>Nwi,WebhookPayloadBodySort:()=>r6s,WebhookPayloadComponent:()=>LCt,WebhookSignatureAlgorithm:()=>UCt,WebhookSignatureEncoding:()=>jwi,WebhookSignatureVerification:()=>wPe,WebhookTimestampFormat:()=>Xpr,WebsocketMessageOrigin:()=>Qwi});var s6l={RsaSha256:"rsa-sha256",RsaSha384:"rsa-sha384",RsaSha512:"rsa-sha512",EcdsaSha256:"ecdsa-sha256",EcdsaSha384:"ecdsa-sha384",EcdsaSha512:"ecdsa-sha512",Ed25519:"ed25519"},Vhe={...s6l,_visit:(e,t)=>{switch(e){case Vhe.RsaSha256:return t.rsaSha256();case Vhe.RsaSha384:return t.rsaSha384();case Vhe.RsaSha512:return t.rsaSha512();case Vhe.EcdsaSha256:return t.ecdsaSha256();case Vhe.EcdsaSha384:return t.ecdsaSha384();case Vhe.EcdsaSha512:return t.ecdsaSha512();case Vhe.Ed25519:return t.ed25519();default:return t._other()}}};var a6l={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated"},f_={...a6l,_visit:(e,t)=>{switch(e){case f_.GenerallyAvailable:return t.generallyAvailable();case f_.Beta:return t.beta();case f_.Deprecated:return t.deprecated();default:return t._other()}}};var fH={language:e=>({...e,type:"language",_visit:function(t){return fH._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return fH._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var c6l={Data:"data",Protocol:"protocol"},Fwi={...c6l,_visit:(e,t)=>{switch(e){case Fwi.Data:return t.data();case Fwi.Protocol:return t.protocol();default:return t._other()}}};var G4={unknown:e=>({value:e,type:"unknown",_visit:function(t){return G4._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return G4._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var W4={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return W4._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return W4._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var u6l={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},d_={...u6l,_visit:(e,t)=>{switch(e){case d_.Get:return t.get();case d_.Post:return t.post();case d_.Put:return t.put();case d_.Patch:return t.patch();case d_.Delete:return t.delete();case d_.Head:return t.head();case d_.Options:return t.options();case d_.Trace:return t.trace();default:return t._other()}}};var JA={boolean:e=>({value:e,type:"boolean",_visit:function(t){return JA._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return JA._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var l6l={Json:"json",Form:"form"},kwi={...l6l,_visit:(e,t)=>{switch(e){case kwi.Json:return t.json();case kwi.Form:return t.form();default:return t._other()}}};var dH={file:e=>({...e,type:"file",_visit:function(t){return dH._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return dH._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var mH={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return mH._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return mH._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Qx={cursor:e=>({...e,type:"cursor",_visit:function(t){return Qx._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return Qx._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return Qx._visit(this,t)}}),uri:e=>({...e,type:"uri",_visit:function(t){return Qx._visit(this,t)}}),path:e=>({...e,type:"path",_visit:function(t){return Qx._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);case"uri":return t.uri(e);case"path":return t.path(e);default:return t._other(e)}}};var Sl={int:e=>({...e,type:"int",_visit:function(t){return Sl._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Sl._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Sl._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Sl._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Sl._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Sl._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Sl._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Sl._visit(this,e)}}),datetimeRfc2822:()=>({type:"datetimeRfc2822",_visit:function(e){return Sl._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Sl._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Sl._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Sl._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"datetimeRfc2822":return t.datetimeRfc2822();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var jq={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return jq._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return jq._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return jq._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return jq._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var K1={file:e=>({...e,type:"file",_visit:function(t){return K1._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return K1._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return K1._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return K1._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return K1._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return K1._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return K1._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var MCt={disabled:e=>({value:e,type:"disabled",_visit:function(t){return MCt._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)};var Ra={primitive:e=>({...e,type:"primitive",_visit:function(t){return Ra._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ra._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Ra._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Ra._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Ra._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Ra._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Ra._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Ra._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ra._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Ra._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Ra._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var p6l={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm"},m_={...p6l,_visit:(e,t)=>{switch(e){case m_.Curl:return t.curl();case m_.Python:return t.python();case m_.Javascript:return t.javascript();case m_.Typescript:return t.typescript();case m_.Go:return t.go();case m_.Ruby:return t.ruby();case m_.Csharp:return t.csharp();case m_.Java:return t.java();case m_.Js:return t.js();case m_.Node:return t.node();case m_.Ts:return t.ts();case m_.Nodets:return t.nodets();case m_.Golang:return t.golang();case m_.Dotnet:return t.dotnet();case m_.Jvm:return t.jvm();default:return t._other()}}};var f6l={Get:"GET",Post:"POST"},Nwi={...f6l,_visit:(e,t)=>{switch(e){case Nwi.Get:return t.get();case Nwi.Post:return t.post();default:return t._other()}}};var d6l={Alphabetical:"alphabetical"},r6s={...d6l,_visit:(e,t)=>e===r6s.Alphabetical?t.alphabetical():t._other()};var m6l={Body:"body",Timestamp:"timestamp",NotificationUrl:"notification-url",MessageId:"message-id"},LCt={...m6l,_visit:(e,t)=>{switch(e){case LCt.Body:return t.body();case LCt.Timestamp:return t.timestamp();case LCt.NotificationUrl:return t.notificationUrl();case LCt.MessageId:return t.messageId();default:return t._other()}}};var h6l={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"},UCt={...h6l,_visit:(e,t)=>{switch(e){case UCt.Sha256:return t.sha256();case UCt.Sha1:return t.sha1();case UCt.Sha384:return t.sha384();case UCt.Sha512:return t.sha512();default:return t._other()}}};var g6l={Base64:"base64",Hex:"hex"},jwi={...g6l,_visit:(e,t)=>{switch(e){case jwi.Base64:return t.base64();case jwi.Hex:return t.hex();default:return t._other()}}};var wPe={hmac:e=>({...e,type:"hmac",_visit:function(t){return wPe._visit(this,t)}}),asymmetric:e=>({...e,type:"asymmetric",_visit:function(t){return wPe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"hmac":return t.hmac(e);case"asymmetric":return t.asymmetric(e);default:return t._other(e)}}};var A6l={UnixSeconds:"unix-seconds",UnixMillis:"unix-millis",Iso8601:"iso8601"},Xpr={...A6l,_visit:(e,t)=>{switch(e){case Xpr.UnixSeconds:return t.unixSeconds();case Xpr.UnixMillis:return t.unixMillis();case Xpr.Iso8601:return t.iso8601();default:return t._other()}}};var y6l={Client:"client",Server:"server"},Qwi={...y6l,_visit:(e,t)=>{switch(e){case Qwi.Client:return t.client();case Qwi.Server:return t.server();default:return t._other()}}};var CM={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return CM._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return CM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Qi={int:e=>({...e,type:"int",_visit:function(t){return Qi._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Qi._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Qi._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Qi._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Qi._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Qi._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Qi._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Qi._visit(this,t)}}),datetimeRfc2822:e=>({...e,type:"datetimeRfc2822",_visit:function(t){return Qi._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Qi._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Qi._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Qi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"datetimeRfc2822":return t.datetimeRfc2822(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var iD={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return iD._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return iD._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return iD._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return iD._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var fg={file:e=>({...e,type:"file",_visit:function(t){return fg._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return fg._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return fg._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return fg._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return fg._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return fg._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return fg._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var kr={primitive:e=>({...e,type:"primitive",_visit:function(t){return kr._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return kr._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return kr._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return kr._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return kr._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return kr._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return kr._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return kr._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return kr._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return kr._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return kr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var Da={};$(Da,{AllOfPropertyConflict:()=>oGe,ArraySchema:()=>_fr,ArraySchemaWithExample:()=>Ndr,AsymmetricAlgorithm:()=>Sfr,AsymmetricWebhookSignatureVerification:()=>Ofr,Availability:()=>lfr,Base64WithExample:()=>jdr,BasicSecurityScheme:()=>nfr,BearerSecurityScheme:()=>ifr,BooleanSchema:()=>Bfr,BooleanWithExample:()=>Qdr,BytesResponse:()=>cGe,CasingOverrides:()=>hfr,CommonProperty:()=>Pfr,CommonPropertyWithExample:()=>Mdr,CursorPagination:()=>Rfr,CustomCodeSample:()=>Nfr,CustomCodeSampleLanguage:()=>Dfr,CustomCodeSampleSdk:()=>kfr,CustomPagination:()=>jfr,DateWithExample:()=>Ldr,DatetimeWithExample:()=>GCt,DiscriminatedOneOfSchema:()=>Qfr,DiscriminatedOneOfSchemaWithExample:()=>Udr,DiscriminatorContext:()=>uGe,DoubleSchema:()=>Mfr,DoubleWithExample:()=>zdr,Encoding:()=>sfr,Endpoint:()=>rdr,EndpointExample:()=>fGe,EndpointResponseExample:()=>zfr,EndpointSdkName:()=>AH,EndpointSecurity:()=>dGe,EndpointWithExample:()=>P6s,EnumSchema:()=>rGe,EnumSchemaWithExample:()=>Jdr,EnumValue:()=>Ghe,ErrorExample:()=>Gfr,FernExample:()=>Lfr,FileResponse:()=>vGe,FileSchema:()=>Zfr,FloatWithExample:()=>Ydr,FormUrlEncodedRequest:()=>Jfr,FullEndpointExample:()=>qfr,FullExample:()=>wh,FullObjectExample:()=>wfr,FullOneOfExample:()=>xfr,GlobalHeader:()=>ndr,GlobalSecurity:()=>idr,Header:()=>$he,HeaderExample:()=>lGe,HeaderSecurityScheme:()=>afr,HeaderWithExample:()=>Yhe,HmacWebhookSignatureVerification:()=>udr,HttpEndpointServer:()=>mGe,HttpError:()=>Wfr,HttpErrorWithExample:()=>Vdr,HttpMethod:()=>hGe,IdempotencyHeader:()=>ldr,Int64WithExample:()=>Xdr,IntSchema:()=>pdr,IntWithExample:()=>Zdr,JsonRequest:()=>Yfr,JsonRequestWithExample:()=>Gdr,JsonResponse:()=>IGe,JsonResponseWithExample:()=>PGe,KeyValuePair:()=>Cfr,LiteralExample:()=>vfr,LiteralSchema:()=>CGe,LiteralSchemaValue:()=>fdr,LongSchema:()=>ddr,MapSchema:()=>gdr,MapSchemaWithExample:()=>imr,MultipartFormDataWebhookPayload:()=>Adr,MultipartFormDataWebhookPayloadWithExample:()=>omr,MultipartRequest:()=>bGe,MultipartRequestProperty:()=>Hhe,MultipartRequestPropertyEncoding:()=>Xfr,MultipartSchema:()=>edr,NamedFullExample:()=>fN,Namespace:()=>cfr,NamespaceId:()=>ufr,NullExample:()=>Ifr,NullableSchema:()=>ydr,NullableSchemaWithExample:()=>smr,OauthSecurityScheme:()=>gfr,ObjectProperty:()=>bdr,ObjectPropertyConflictInfo:()=>_Ge,ObjectPropertyWithExample:()=>amr,ObjectSchema:()=>Edr,ObjectSchemaWithExample:()=>cmr,OctetStreamRequest:()=>EGe,OffsetPagination:()=>$fr,OneOfSchema:()=>vdr,OneOfSchemaWithExample:()=>umr,OpenApiIntermediateRepresentation:()=>B6s,OpenApiSource:()=>ffr,OptionalSchema:()=>Fdr,OptionalSchemaWithExample:()=>pmr,Pagination:()=>gGe,ParseFormUrlEncodedRequest:()=>Wdr,ParseMultipartRequest:()=>$dr,ParseOctetStreamRequest:()=>Hdr,PathPagination:()=>Hfr,PathParameter:()=>AGe,PathParameterExample:()=>Vfr,PathParameterWithExample:()=>qdr,PrimitiveExample:()=>nGe,PrimitiveSchema:()=>Jhe,PrimitiveSchemaValue:()=>hdr,PrimitiveSchemaValueWithExample:()=>nmr,PrimitiveSchemaWithExample:()=>DGe,PropertyKey:()=>iGe,ProtobufEncoding:()=>ofr,ProtobufSource:()=>dfr,QueryParameter:()=>yGe,QueryParameterExample:()=>pGe,QueryParameterWithExample:()=>BGe,QuerySecurityScheme:()=>Afr,ReferencedSchema:()=>yH,Request:()=>tdr,RequestWithExample:()=>Kdr,Response:()=>wGe,ResponseWithExample:()=>RGe,RetriesConfiguration:()=>xGe,Schema:()=>gl,SchemaId:()=>oD,SchemaWithExample:()=>ld,Schemas:()=>wdr,SdkGroup:()=>pfr,SdkGroupInfo:()=>xdr,SdkGroupName:()=>qhe,SecurityScheme:()=>yfr,SecuritySchemeId:()=>Whe,Server:()=>qCt,ServerVariable:()=>bfr,Source:()=>mfr,StatusCode:()=>hH,StreamingResponseExample:()=>Ufr,StringSchema:()=>mdr,StringSchemaWithExample:()=>emr,SupportedSdkLanguage:()=>Ffr,Tag:()=>Efr,TagId:()=>sD,Tags:()=>Cdr,TextResponse:()=>Khe,Uint64WithExample:()=>tmr,UintWithExample:()=>rmr,UnDiscriminatedOneOfSchema:()=>Idr,UnDiscriminatedOneOfSchemaWithExample:()=>lmr,UnknownSchema:()=>kdr,UnknownSchemaWithExample:()=>fmr,UriPagination:()=>Kfr,Webhook:()=>_dr,WebhookExampleCall:()=>SGe,WebhookHttpMethod:()=>TGe,WebhookPayloadBodySort:()=>odr,WebhookPayloadComponent:()=>sdr,WebhookPayloadFormat:()=>adr,WebhookSignatureAlgorithm:()=>cdr,WebhookSignatureEncoding:()=>sGe,WebhookSignatureVerification:()=>OGe,WebhookTimestamp:()=>aGe,WebhookTimestampFormat:()=>Tfr,WebhookWithExample:()=>R6s,WebsocketChannel:()=>Ddr,WebsocketHandshake:()=>Sdr,WebsocketHandshakeWithExample:()=>D6s,WebsocketMessageExample:()=>Pdr,WebsocketMessageOrigin:()=>Tdr,WebsocketMessageSchema:()=>Odr,WebsocketServer:()=>Bdr,WebsocketSessionExample:()=>Rdr,WithAvailability:()=>bs,WithDescription:()=>wn,WithEncoding:()=>A_,WithInline:()=>ud,WithName:()=>Jc,WithNamespace:()=>Ec,WithSdkGroupName:()=>qu,WithSdkMethodName:()=>gH,WithSource:()=>ns,WithStatusCode:()=>$4,WithTitle:()=>Gu,commons:()=>qwi,example:()=>Gwi,finalIr:()=>Wwi,parseIr:()=>$wi});var qwi={};$(qwi,{BasicSecurityScheme:()=>nfr,BearerSecurityScheme:()=>ifr,Encoding:()=>sfr,HeaderSecurityScheme:()=>afr,Namespace:()=>cfr,NamespaceId:()=>ufr,OauthSecurityScheme:()=>gfr,OpenApiSource:()=>ffr,ProtobufEncoding:()=>ofr,ProtobufSource:()=>dfr,QuerySecurityScheme:()=>Afr,SchemaId:()=>oD,SdkGroup:()=>pfr,SdkGroupName:()=>qhe,SecurityScheme:()=>yfr,SecuritySchemeId:()=>Whe,Server:()=>qCt,ServerVariable:()=>bfr,Source:()=>mfr,StatusCode:()=>hH,Tag:()=>Efr,TagId:()=>sD,WithAvailability:()=>bs,WithDescription:()=>wn,WithEncoding:()=>A_,WithInline:()=>ud,WithName:()=>Jc,WithNamespace:()=>Ec,WithSdkGroupName:()=>qu,WithSdkMethodName:()=>gH,WithSource:()=>ns,WithStatusCode:()=>$4,WithTitle:()=>Gu});var J={};$(J,{JsonError:()=>Zqe,ParseError:()=>eGe,any:()=>g6s,bigint:()=>i6s,boolean:()=>A6s,booleanLiteral:()=>m6s,date:()=>o6s,discriminant:()=>S6s,enum_:()=>efr,getObjectLikeUtils:()=>Qq,getObjectUtils:()=>xPe,getSchemaUtils:()=>Am,isProperty:()=>Cse,lazy:()=>s6s,lazyObject:()=>f6s,list:()=>rfr,never:()=>y6s,number:()=>b6s,object:()=>tfr,objectWithoutOptionalProperties:()=>p6s,optional:()=>Mwi,property:()=>c6s,record:()=>w6s,set:()=>x6s,string:()=>E6s,stringLiteral:()=>h6s,transform:()=>Lwi,undiscriminatedUnion:()=>_6s,union:()=>O6s,unknown:()=>v6s,withParsedProperties:()=>Vwi});var Vu={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function jd(e,t){return`Expected ${t}. Received ${b6l(e)}.`}function b6l(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function h_(e){return{...e,json:n6s(e.json),parse:n6s(e.parse)}}function n6s(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1544
1544
|
`)),{ok:!0,value:t}):n}}function Zpr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Zqe=class e extends Error{errors;constructor(t){super(t.map(Zpr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var eGe=class e extends Error{errors;constructor(t){super(t.map(Zpr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Am(e){return{nullable:()=>E6l(e),optional:()=>Mwi(e),optionalNullable:()=>v6l(e),transform:t=>Lwi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new eGe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Zqe(n.errors)}}}function E6l(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Vu.NULLABLE};return{...t,...Am(t)}}function Mwi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Vu.OPTIONAL};return{...t,...Am(t)}}function v6l(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Vu.OPTIONAL_NULLABLE};return{...t,...Am(t)}}function Lwi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...Am(r)}}function i6s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:jd(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:jd(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Vu.BIGINT};return{...h_(e),...Am(e)}}var I6l=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function o6s(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:jd(t,"string")}]}:I6l.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:jd(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:jd(t,"Date object")}]},getType:()=>Vu.DATE};return{...h_(e),...Am(e)}}function g_(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...h_(r),...Am(r)}}}function efr(e){let t=new Set(e);return g_(Vu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:jd(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:jd(n,"enum")}]}:{ok:!0,value:n})()}function s6s(e){let t=Uwi(e);return{...t,...Am(t)}}function Uwi(e){return{parse:(t,r)=>tGe(e).parse(t,r),json:(t,r)=>tGe(e).json(t,r),getType:()=>tGe(e).getType()}}function tGe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function zwi(e){return Object.entries(e)}function zCt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function xse(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function VCt(e){return Object.keys(e)}function a6s(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var w6l=Object.prototype.hasOwnProperty;function Qq(e){return{withParsedProperties:t=>Vwi(e,t)}}function Vwi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(w6l.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!xse(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:jd(n,"object")}]};let o=new Set(Object.keys(t)),s=zCt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...Am(r),...Qq(r)}}function c6s(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Cse(e){return e.isProperty}var x6l=Object.prototype.hasOwnProperty;function tfr(e){let t;function r(){if(t==null){t={};for(let[d,f]of zwi(e)){let m=Cse(f)?f.rawKey:d,h=Cse(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of zwi(e)){let m=Cse(f)?f.rawKey:d,h=Cse(f)?f.valueSchema:f;C6l(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Cse(f)?f.rawKey:d),_getParsedProperties:()=>VCt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return u6s({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return u6s({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return Cse(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Vu.OBJECT};return{...h_(p),...Am(p),...Qq(p),...xPe(p)}}function u6s({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!xse(e))return{ok:!1,errors:[{path:s,message:jd(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!x6l.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function xPe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>l6s({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>l6s({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Vu.OBJECT};return{...r,...Am(r),...Qq(r),...xPe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Vu.OBJECT};return{...n,...Am(n),...Qq(n),...xPe(n)}}}}function l6s({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!xse(t))return{ok:!1,errors:[{path:i,message:jd(t,"object")}]};let o=new Set(e),[s,a]=a6s(VCt(t),l=>o.has(l)),c=r(zCt(t,a)),u=n(zCt(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function C6l(e){return!_6l(e)}function _6l(e){switch(e.getType()){case Vu.ANY:case Vu.UNKNOWN:case Vu.OPTIONAL:case Vu.OPTIONAL_NULLABLE:return!0;default:return!1}}function p6s(e){return tfr(e)}function f6s(e){let t={...Uwi(e),_getRawProperties:()=>tGe(e)._getRawProperties(),_getParsedProperties:()=>tGe(e)._getParsedProperties()};return{...t,...Am(t),...Qq(t),...xPe(t)}}function rfr(e){let t={parse:(r,n)=>d6s(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>d6s(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Vu.LIST};return{...h_(t),...Am(t)}}function d6s(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:jd(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function m6s(e){return g_(Vu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:jd(r,`${e.toString()}`)}]})()}function h6s(e){return g_(Vu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:jd(r,`"${e}"`)}]})()}var g6s=g_(Vu.ANY,e=>({ok:!0,value:e}));var A6s=g_(Vu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:jd(e,"boolean")}]});var y6s=g_(Vu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var b6s=g_(Vu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:jd(e,"number")}]});var E6s=g_(Vu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:jd(e,"string")}]});var v6s=g_(Vu.UNKNOWN,e=>({ok:!0,value:e}));var S6l=Object.prototype.hasOwnProperty;function w6s(e,t){let r={parse:(n,i)=>I6s({value:n,isKeyNumeric:e.getType()===Vu.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>I6s({value:n,isKeyNumeric:e.getType()===Vu.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Vu.RECORD};return{...h_(r),...Am(r)}}function I6s({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!xse(e))return{ok:!1,errors:[{path:i,message:jd(e,"object")}]};let o={},s=[];for(let a in e){if(!S6l.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function x6s(e){let t=rfr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:jd(n,"Set")}]},getType:()=>Vu.SET};return{...h_(r),...Am(r)}}function _6s(e){let t={parse:(r,n)=>C6s((i,o)=>i.parse(r,o),e,n),json:(r,n)=>C6s((i,o)=>i.json(r,o),e,n),getType:()=>Vu.UNDISCRIMINATED_UNION};return{...h_(t),...Am(t)}}function C6s(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function S6s(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var T6l=Object.prototype.hasOwnProperty;function O6s(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=efr(VCt(t)),o={parse:(s,a)=>T6s({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>T6s({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Vu.UNION};return{...h_(o),...Am(o),...Qq(o)}}function T6s({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!xse(e))return{ok:!1,errors:[{path:a,message:jd(e,"object")}]};let c=e[t],u={};for(let f in e)T6l.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var nfr=J.objectWithoutOptionalProperties({usernameVariableName:J.string().optional(),usernameEnvVar:J.string().optional(),passwordVariableName:J.string().optional(),passwordEnvVar:J.string().optional()});var ifr=J.objectWithoutOptionalProperties({tokenVariableName:J.string().optional(),tokenEnvVar:J.string().optional()});var ofr=J.objectWithoutOptionalProperties({typeName:J.string()});var sfr=J.union("type",{protobuf:ofr}).transform({transform:e=>e.type==="protobuf"?Xqe.protobuf(e):e,untransform:({_visit:e,...t})=>t});var afr=J.objectWithoutOptionalProperties({headerName:J.string(),prefix:J.string().optional(),headerVariableName:J.string().optional(),headerEnvVar:J.string().optional()});var cfr=J.objectWithoutOptionalProperties({type:J.stringLiteral("namespace"),name:J.string()});var ufr=J.string();var lfr=J.enum_(["GenerallyAvailable","Beta","Deprecated"]);var bs=J.objectWithoutOptionalProperties({availability:lfr.optional()});var wn=J.objectWithoutOptionalProperties({description:J.string().optional()});var ud=J.objectWithoutOptionalProperties({inline:J.boolean().optional()});var Jc=J.objectWithoutOptionalProperties({nameOverride:J.string().optional(),generatedName:J.string()});var Ec=J.objectWithoutOptionalProperties({namespace:J.string().optional()});var pfr=J.undiscriminatedUnion([J.string(),cfr]);var qhe=J.list(pfr);var qu=J.objectWithoutOptionalProperties({groupName:qhe.optional()});var ffr=J.objectWithoutOptionalProperties({file:J.string()});var dfr=J.objectWithoutOptionalProperties({file:J.string()});var mfr=J.union("type",{openapi:ffr,protobuf:dfr}).transform({transform:e=>{switch(e.type){case"openapi":return tB.openapi(e);case"protobuf":return tB.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var ns=J.objectWithoutOptionalProperties({source:mfr.optional()});var Gu=J.objectWithoutOptionalProperties({title:J.string().optional()});var hfr=J.objectWithoutOptionalProperties({snake:J.string().optional(),camel:J.string().optional(),screamingSnake:J.string().optional(),pascal:J.string().optional()});var Ghe=J.objectWithoutOptionalProperties({nameOverride:J.string().optional(),generatedName:J.string(),value:J.string(),casing:hfr.optional()}).extend(wn).extend(bs);var rGe=J.objectWithoutOptionalProperties({default:Ghe.optional(),values:J.list(Ghe)}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(ns).extend(Gu).extend(ud);var gfr=J.objectWithoutOptionalProperties({scopesEnum:rGe.optional()});var Afr=J.objectWithoutOptionalProperties({queryParameterName:J.string()});var oD=J.string();var yfr=J.union("type",{basic:nfr,bearer:ifr,header:afr,query:Afr,oauth:gfr}).transform({transform:e=>{switch(e.type){case"basic":return p_.basic(e);case"bearer":return p_.bearer(e);case"header":return p_.header(e);case"query":return p_.query(e);case"oauth":return p_.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var Whe=J.string();var bfr=J.objectWithoutOptionalProperties({id:J.string(),default:J.string().optional(),values:J.list(J.string()).optional()});var qCt=J.objectWithoutOptionalProperties({name:J.string().optional(),url:J.string(),audiences:J.list(J.string()).optional(),defaultUrl:J.string().optional(),urlTemplate:J.string().optional(),variables:J.list(bfr).optional()}).extend(wn);var hH=J.number();var sD=J.string();var Efr=J.objectWithoutOptionalProperties({id:sD}).extend(wn);var A_=J.objectWithoutOptionalProperties({encoding:sfr.optional()});var gH=J.objectWithoutOptionalProperties({sdkMethodName:J.string().optional()});var $4=J.objectWithoutOptionalProperties({statusCode:hH.optional()});var Gwi={};$(Gwi,{FullExample:()=>wh,FullObjectExample:()=>wfr,FullOneOfExample:()=>xfr,KeyValuePair:()=>Cfr,LiteralExample:()=>vfr,NullExample:()=>Ifr,PrimitiveExample:()=>nGe,PropertyKey:()=>iGe});var vfr=J.union("type",{boolean:J.object({value:J.boolean()}),string:J.object({value:J.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return zhe.boolean(e.value);case"string":return zhe.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Ifr=J.objectWithoutOptionalProperties({});var nGe=J.union("type",{int:J.object({value:J.number()}),int64:J.object({value:J.number()}),uint:J.object({value:J.number()}),uint64:J.object({value:J.number()}),float:J.object({value:J.number()}),double:J.object({value:J.number()}),string:J.object({value:J.string()}),datetime:J.object({value:J.string()}),datetimeRfc2822:J.object({value:J.string()}),date:J.object({value:J.string()}),base64:J.object({value:J.string()}),boolean:J.object({value:J.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return _s.int(e.value);case"int64":return _s.int64(e.value);case"uint":return _s.uint(e.value);case"uint64":return _s.uint64(e.value);case"float":return _s.float(e.value);case"double":return _s.double(e.value);case"string":return _s.string(e.value);case"datetime":return _s.datetime(e.value);case"datetimeRfc2822":return _s.datetimeRfc2822(e.value);case"date":return _s.date(e.value);case"base64":return _s.base64(e.value);case"boolean":return _s.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var wh=J.union("type",{primitive:J.object({value:nGe}),object:J.lazyObject(()=>wfr),array:J.object({value:J.list(J.lazy(()=>wh))}),map:J.object({value:J.list(J.lazyObject(()=>Cfr))}),enum:J.object({value:J.string()}),literal:J.object({value:vfr}),oneOf:J.object({value:J.lazy(()=>xfr)}),null:Ifr,unknown:J.object({value:J.lazy(()=>wh)})}).transform({transform:e=>{switch(e.type){case"primitive":return xc.primitive(e.value);case"object":return xc.object(e);case"array":return xc.array(e.value);case"map":return xc.map(e.value);case"enum":return xc.enum(e.value);case"literal":return xc.literal(e.value);case"oneOf":return xc.oneOf(e.value);case"null":return xc.null(e);case"unknown":return xc.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var iGe=J.string();var wfr=J.objectWithoutOptionalProperties({properties:J.record(iGe,J.lazy(()=>wh))});var xfr=J.union("type",{discriminated:J.object({value:J.record(iGe,J.lazy(()=>wh))}),undiscriminated:J.object({value:J.lazy(()=>wh)})}).transform({transform:e=>{switch(e.type){case"discriminated":return Uhe.discriminated(e.value);case"undiscriminated":return Uhe.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Cfr=J.objectWithoutOptionalProperties({key:nGe,value:J.lazy(()=>wh)});var Wwi={};$(Wwi,{AllOfPropertyConflict:()=>oGe,ArraySchema:()=>_fr,AsymmetricAlgorithm:()=>Sfr,AsymmetricWebhookSignatureVerification:()=>Ofr,Availability:()=>lfr,BooleanSchema:()=>Bfr,BytesResponse:()=>cGe,CasingOverrides:()=>hfr,CommonProperty:()=>Pfr,CursorPagination:()=>Rfr,CustomCodeSample:()=>Nfr,CustomCodeSampleLanguage:()=>Dfr,CustomCodeSampleSdk:()=>kfr,CustomPagination:()=>jfr,DiscriminatedOneOfSchema:()=>Qfr,DiscriminatorContext:()=>uGe,DoubleSchema:()=>Mfr,Endpoint:()=>rdr,EndpointExample:()=>fGe,EndpointResponseExample:()=>zfr,EndpointSdkName:()=>AH,EndpointSecurity:()=>dGe,EnumSchema:()=>rGe,EnumValue:()=>Ghe,ErrorExample:()=>Gfr,FernExample:()=>Lfr,FileResponse:()=>vGe,FileSchema:()=>Zfr,FormUrlEncodedRequest:()=>Jfr,FullEndpointExample:()=>qfr,GlobalHeader:()=>ndr,GlobalSecurity:()=>idr,Header:()=>$he,HeaderExample:()=>lGe,HmacWebhookSignatureVerification:()=>udr,HttpEndpointServer:()=>mGe,HttpError:()=>Wfr,HttpMethod:()=>hGe,IdempotencyHeader:()=>ldr,IntSchema:()=>pdr,JsonRequest:()=>Yfr,JsonResponse:()=>IGe,LiteralSchema:()=>CGe,LiteralSchemaValue:()=>fdr,LongSchema:()=>ddr,MapSchema:()=>gdr,MultipartFormDataWebhookPayload:()=>Adr,MultipartRequest:()=>bGe,MultipartRequestProperty:()=>Hhe,MultipartRequestPropertyEncoding:()=>Xfr,MultipartSchema:()=>edr,NullableSchema:()=>ydr,ObjectProperty:()=>bdr,ObjectPropertyConflictInfo:()=>_Ge,ObjectSchema:()=>Edr,OctetStreamRequest:()=>EGe,OffsetPagination:()=>$fr,OneOfSchema:()=>vdr,OpenApiIntermediateRepresentation:()=>B6s,OptionalSchema:()=>Fdr,Pagination:()=>gGe,PathPagination:()=>Hfr,PathParameter:()=>AGe,PathParameterExample:()=>Vfr,PrimitiveSchema:()=>Jhe,PrimitiveSchemaValue:()=>hdr,QueryParameter:()=>yGe,QueryParameterExample:()=>pGe,ReferencedSchema:()=>yH,Request:()=>tdr,Response:()=>wGe,RetriesConfiguration:()=>xGe,Schema:()=>gl,Schemas:()=>wdr,SdkGroupInfo:()=>xdr,StreamingResponseExample:()=>Ufr,StringSchema:()=>mdr,SupportedSdkLanguage:()=>Ffr,Tags:()=>Cdr,TextResponse:()=>Khe,UnDiscriminatedOneOfSchema:()=>Idr,UnknownSchema:()=>kdr,UriPagination:()=>Kfr,Webhook:()=>_dr,WebhookExampleCall:()=>SGe,WebhookHttpMethod:()=>TGe,WebhookPayloadBodySort:()=>odr,WebhookPayloadComponent:()=>sdr,WebhookPayloadFormat:()=>adr,WebhookSignatureAlgorithm:()=>cdr,WebhookSignatureEncoding:()=>sGe,WebhookSignatureVerification:()=>OGe,WebhookTimestamp:()=>aGe,WebhookTimestampFormat:()=>Tfr,WebsocketChannel:()=>Ddr,WebsocketHandshake:()=>Sdr,WebsocketMessageExample:()=>Pdr,WebsocketMessageOrigin:()=>Tdr,WebsocketMessageSchema:()=>Odr,WebsocketServer:()=>Bdr,WebsocketSessionExample:()=>Rdr});var oGe=J.objectWithoutOptionalProperties({propertyKey:J.string(),allOfSchemaIds:J.list(oD),conflictingTypeSignatures:J.boolean()});var _fr=J.objectWithoutOptionalProperties({value:J.lazy(()=>gl),minItems:J.number().optional(),maxItems:J.number().optional()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu).extend(ud);var Sfr=J.enum_(["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]);var sGe=J.enum_(["base64","hex"]);var Tfr=J.enum_(["unix-seconds","unix-millis","iso8601"]);var aGe=J.objectWithoutOptionalProperties({header:J.string(),format:Tfr.optional(),tolerance:J.number().optional()});var Ofr=J.objectWithoutOptionalProperties({header:J.string(),asymmetricAlgorithm:Sfr,encoding:sGe.optional(),signaturePrefix:J.string().optional(),jwksUrl:J.string().optional(),keyIdHeader:J.string().optional(),timestamp:aGe.optional()});var Bfr=J.objectWithoutOptionalProperties({default:J.boolean().optional()});var cGe=J.objectWithoutOptionalProperties({}).extend(wn).extend(ns).extend($4);var Pfr=J.objectWithoutOptionalProperties({key:J.string(),schema:J.lazy(()=>gl)});var Rfr=J.objectWithoutOptionalProperties({cursor:J.string(),nextCursor:J.property("next_cursor",J.string()),results:J.string()});var Dfr=J.objectWithoutOptionalProperties({name:J.string().optional(),language:J.string(),code:J.string(),install:J.string().optional()}).extend(wn);var Ffr=J.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var kfr=J.objectWithoutOptionalProperties({name:J.string().optional(),sdk:Ffr,code:J.string()}).extend(wn);var Nfr=J.union("type",{language:Dfr,sdk:kfr}).transform({transform:e=>{switch(e.type){case"language":return fH.language(e);case"sdk":return fH.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var jfr=J.objectWithoutOptionalProperties({results:J.string()});var uGe=J.enum_(["data","protocol"]);var Qfr=J.objectWithoutOptionalProperties({discriminantProperty:J.string(),discriminantPropertyNameOverride:J.string().optional(),discriminatorContext:uGe.optional(),defaultDiscriminantValue:J.string().optional(),commonProperties:J.list(J.lazyObject(()=>Pfr)),schemas:J.record(J.string(),J.lazy(()=>gl))}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(ns).extend(Gu).extend(ud);var Mfr=J.objectWithoutOptionalProperties({default:J.number().optional(),minimum:J.number().optional(),maximum:J.number().optional(),exclusiveMinimum:J.boolean().optional(),exclusiveMaximum:J.boolean().optional(),multipleOf:J.number().optional()});var Lfr=J.unknown();var Ufr=J.objectWithoutOptionalProperties({sse:J.boolean(),events:J.list(J.lazy(()=>wh))});var zfr=J.union("type",{withStreaming:Ufr,withoutStreaming:J.object({value:J.lazy(()=>wh)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return W4.withStreaming(e);case"withoutStreaming":return W4.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var lGe=J.objectWithoutOptionalProperties({name:J.string(),value:J.lazy(()=>wh)});var Vfr=J.objectWithoutOptionalProperties({name:J.string(),parameterNameOverride:J.string().optional(),value:J.lazy(()=>wh)});var pGe=J.objectWithoutOptionalProperties({name:J.string(),value:J.lazy(()=>wh)});var qfr=J.objectWithoutOptionalProperties({name:J.string().optional(),pathParameters:J.list(Vfr).optional(),queryParameters:J.list(pGe).optional(),headers:J.list(lGe).optional(),request:J.lazy(()=>wh).optional(),response:zfr.optional(),codeSamples:J.list(Nfr)}).extend(wn);var fGe=J.union("type",{unknown:J.object({value:Lfr}),full:qfr}).transform({transform:e=>{switch(e.type){case"unknown":return G4.unknown(e.value);case"full":return G4.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var AH=J.objectWithoutOptionalProperties({groupName:qhe,methodName:J.string()});var dGe=J.list(J.record(Whe,J.list(J.string())));var $he=J.objectWithoutOptionalProperties({name:J.string(),schema:J.lazy(()=>gl),env:J.string().optional(),parameterNameOverride:J.string().optional(),clientDefault:J.unknown().optional()}).extend(wn).extend(bs).extend(ns);var mGe=J.objectWithoutOptionalProperties({name:J.string().optional(),url:J.string().optional(),audiences:J.list(J.string()).optional()});var Gfr=J.objectWithoutOptionalProperties({name:J.string().optional(),description:J.string().optional(),example:J.lazy(()=>wh)});var Wfr=J.objectWithoutOptionalProperties({schema:J.lazy(()=>gl).optional(),examples:J.list(Gfr).optional()}).extend(wn).extend(Jc).extend(ns);var hGe=J.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var $fr=J.objectWithoutOptionalProperties({offset:J.string(),results:J.string(),step:J.string().optional(),hasNextPage:J.string().optional()});var Hfr=J.objectWithoutOptionalProperties({nextPath:J.string(),results:J.string()});var Kfr=J.objectWithoutOptionalProperties({nextUri:J.string(),results:J.string()});var gGe=J.union("type",{cursor:Rfr,offset:$fr,custom:jfr,uri:Kfr,path:Hfr}).transform({transform:e=>{switch(e.type){case"cursor":return Qx.cursor(e);case"offset":return Qx.offset(e);case"custom":return Qx.custom(e);case"uri":return Qx.uri(e);case"path":return Qx.path(e);default:return e}},untransform:({_visit:e,...t})=>t});var AGe=J.objectWithoutOptionalProperties({name:J.string(),schema:J.lazy(()=>gl),variableReference:J.string().optional(),parameterNameOverride:J.string().optional(),clientDefault:J.unknown().optional()}).extend(wn).extend(bs).extend(ns);var yGe=J.objectWithoutOptionalProperties({name:J.string(),schema:J.lazy(()=>gl),parameterNameOverride:J.string().optional(),explode:J.boolean().optional(),clientDefault:J.unknown().optional()}).extend(wn).extend(bs).extend(ns);var Jfr=J.objectWithoutOptionalProperties({schema:J.lazy(()=>gl),contentType:J.string().optional(),additionalProperties:J.boolean()}).extend(wn).extend(ns);var Yfr=J.objectWithoutOptionalProperties({schema:J.lazy(()=>gl),contentType:J.string().optional(),additionalProperties:J.boolean()}).extend(wn).extend(ns);var Xfr=J.enum_(["json","form"]);var Zfr=J.objectWithoutOptionalProperties({isOptional:J.boolean(),isArray:J.boolean()}).extend(wn);var edr=J.union("type",{file:Zfr,json:J.object({value:J.lazy(()=>gl)})}).transform({transform:e=>{switch(e.type){case"file":return dH.file(e);case"json":return dH.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Hhe=J.objectWithoutOptionalProperties({key:J.string(),schema:edr,contentType:J.string().optional(),exploded:J.boolean().optional(),encoding:Xfr.optional()}).extend(wn);var bGe=J.objectWithoutOptionalProperties({name:J.string().optional(),properties:J.list(Hhe)}).extend(wn).extend(ns);var EGe=J.objectWithoutOptionalProperties({contentType:J.string().optional()}).extend(wn).extend(ns);var tdr=J.union("type",{octetStream:EGe,multipart:bGe,json:Yfr,formUrlEncoded:Jfr}).transform({transform:e=>{switch(e.type){case"octetStream":return jq.octetStream(e);case"multipart":return jq.multipart(e);case"json":return jq.json(e);case"formUrlEncoded":return jq.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var vGe=J.objectWithoutOptionalProperties({}).extend(wn).extend(ns).extend($4);var IGe=J.objectWithoutOptionalProperties({schema:J.lazy(()=>gl),responseProperty:J.string().optional(),terminator:J.string().optional()}).extend(wn).extend(ns).extend($4);var Khe=J.objectWithoutOptionalProperties({}).extend(wn).extend(ns).extend($4);var wGe=J.union("type",{file:vGe,json:IGe,text:Khe,bytes:cGe,streamingSse:IGe,streamingText:Khe,streamingJson:IGe}).transform({transform:e=>{switch(e.type){case"file":return K1.file(e);case"json":return K1.json(e);case"text":return K1.text(e);case"bytes":return K1.bytes(e);case"streamingSse":return K1.streamingSse(e);case"streamingText":return K1.streamingText(e);case"streamingJson":return K1.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var xGe=J.union("type",{disabled:J.object({value:J.boolean().optional()})}).transform({transform:e=>e.type==="disabled"?MCt.disabled(e.value):e,untransform:({_visit:e,...t})=>t});var rdr=J.objectWithoutOptionalProperties({authed:J.boolean(),security:dGe.optional(),internal:J.boolean().optional(),idempotent:J.boolean().optional(),method:hGe,audiences:J.list(J.string()),path:J.string(),summary:J.string().optional(),operationId:J.string().optional(),tags:J.list(sD),pathParameters:J.list(AGe),queryParameters:J.list(yGe),headers:J.list($he),sdkName:AH.optional(),generatedRequestName:J.string(),requestNameOverride:J.string().optional(),request:tdr.optional(),response:wGe.optional(),errors:J.record(hH,Wfr),servers:J.list(mGe),examples:J.list(fGe),pagination:gGe.optional(),retries:xGe.optional()}).extend(wn).extend(bs).extend(ns).extend(Ec);var ndr=J.objectWithoutOptionalProperties({header:J.string(),name:J.string().optional(),optional:J.boolean().optional(),env:J.string().optional(),schema:J.lazy(()=>gl).optional(),clientDefault:J.unknown().optional()});var idr=J.list(J.record(Whe,J.list(J.string())));var odr=J.enum_(["alphabetical"]);var sdr=J.enum_(["body","timestamp","notification-url","message-id"]);var adr=J.objectWithoutOptionalProperties({components:J.list(sdr),delimiter:J.string().optional(),bodySort:odr.optional()});var cdr=J.enum_(["sha256","sha1","sha384","sha512"]);var udr=J.objectWithoutOptionalProperties({header:J.string(),algorithm:cdr.optional(),encoding:sGe.optional(),signaturePrefix:J.string().optional(),payloadFormat:adr.optional(),timestamp:aGe.optional()});var ldr=J.objectWithoutOptionalProperties({header:J.string(),name:J.string().optional(),env:J.string().optional(),schema:J.lazy(()=>gl).optional()});var pdr=J.objectWithoutOptionalProperties({default:J.number().optional(),minimum:J.number().optional(),maximum:J.number().optional(),exclusiveMinimum:J.boolean().optional(),exclusiveMaximum:J.boolean().optional(),multipleOf:J.number().optional()});var fdr=J.union("type",{boolean:J.object({value:J.boolean()}),string:J.object({value:J.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return JA.boolean(e.value);case"string":return JA.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var CGe=J.objectWithoutOptionalProperties({value:fdr}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu);var ddr=J.objectWithoutOptionalProperties({default:J.number().optional()});var mdr=J.objectWithoutOptionalProperties({default:J.string().optional(),pattern:J.string().optional(),format:J.string().optional(),minLength:J.number().optional(),maxLength:J.number().optional()});var hdr=J.union("type",{int:pdr,int64:ddr,uint:J.object({}),uint64:J.object({}),float:J.object({}),double:Mfr,string:mdr,datetime:J.object({}),datetimeRfc2822:J.object({}),date:J.object({}),base64:J.object({}),boolean:Bfr}).transform({transform:e=>{switch(e.type){case"int":return Sl.int(e);case"int64":return Sl.int64(e);case"uint":return Sl.uint();case"uint64":return Sl.uint64();case"float":return Sl.float();case"double":return Sl.double(e);case"string":return Sl.string(e);case"datetime":return Sl.datetime();case"datetimeRfc2822":return Sl.datetimeRfc2822();case"date":return Sl.date();case"base64":return Sl.base64();case"boolean":return Sl.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var Jhe=J.objectWithoutOptionalProperties({schema:hdr}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu);var gdr=J.objectWithoutOptionalProperties({key:Jhe,value:J.lazy(()=>gl),minProperties:J.number().optional(),maxProperties:J.number().optional()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(Gu).extend(ud);var Adr=J.objectWithoutOptionalProperties({name:J.string().optional(),properties:J.list(Hhe)}).extend(wn).extend(ns);var ydr=J.objectWithoutOptionalProperties({value:J.lazy(()=>gl)}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu).extend(ud);var _Ge=J.objectWithoutOptionalProperties({differentSchema:J.boolean()});var bdr=J.objectWithoutOptionalProperties({key:J.string(),schema:J.lazy(()=>gl),readonly:J.boolean().optional(),writeonly:J.boolean().optional(),conflict:J.record(oD,_Ge),generatedName:J.string(),nameOverride:J.string().optional(),audiences:J.list(J.string())}).extend(bs);var yH=J.objectWithoutOptionalProperties({schema:oD}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(ns).extend(Gu);var Edr=J.objectWithoutOptionalProperties({allOf:J.list(yH),properties:J.list(J.lazyObject(()=>bdr)),allOfPropertyConflicts:J.list(oGe),additionalProperties:J.boolean(),minProperties:J.number().optional(),maxProperties:J.number().optional()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(ns).extend(Gu).extend(ud);var vdr=J.union("type",{discriminated:J.lazyObject(()=>Qfr),undiscriminated:J.lazyObject(()=>Idr)}).transform({transform:e=>{switch(e.type){case"discriminated":return mH.discriminated(e);case"undiscriminated":return mH.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var wdr=J.objectWithoutOptionalProperties({rootSchemas:J.record(oD,J.lazy(()=>gl)),namespacedSchemas:J.record(ufr,J.record(oD,J.lazy(()=>gl)))});var xdr=J.objectWithoutOptionalProperties({summary:J.string().optional(),description:J.string().optional()});var Cdr=J.objectWithoutOptionalProperties({tagsById:J.record(sD,Efr),orderedTagIds:J.list(sD).optional()});var SGe=J.objectWithoutOptionalProperties({name:J.string().optional(),payload:J.lazy(()=>wh)}).extend(wn);var TGe=J.enum_(["GET","POST"]);var OGe=J.union("type",{hmac:udr,asymmetric:Ofr}).transform({transform:e=>{switch(e.type){case"hmac":return wPe.hmac(e);case"asymmetric":return wPe.asymmetric(e);default:return e}},untransform:({_visit:e,...t})=>t});var _dr=J.objectWithoutOptionalProperties({audiences:J.list(J.string()),sdkName:AH.optional(),method:TGe,summary:J.string().optional(),operationId:J.string(),tags:J.list(sD),headers:J.list($he),generatedPayloadName:J.string(),payload:J.lazy(()=>gl),multipartFormData:Adr.optional(),response:wGe.optional(),signatureVerification:OGe.optional(),examples:J.list(SGe)}).extend(wn).extend(ns).extend(Ec);var Sdr=J.objectWithoutOptionalProperties({queryParameters:J.list(yGe),headers:J.list($he),pathParameters:J.list(AGe)});var Tdr=J.enum_(["client","server"]);var Odr=J.objectWithoutOptionalProperties({name:J.string(),displayName:J.string().optional(),origin:Tdr,body:J.lazy(()=>gl),methodName:J.string().optional()});var Bdr=J.objectWithoutOptionalProperties({name:J.string(),url:J.string()});var Pdr=J.objectWithoutOptionalProperties({messageType:J.string(),payload:J.lazy(()=>wh)}).extend(wn);var Rdr=J.objectWithoutOptionalProperties({name:J.string().optional(),queryParameters:J.list(pGe).optional(),headers:J.list(lGe).optional(),messages:J.list(Pdr)}).extend(wn);var Ddr=J.objectWithoutOptionalProperties({audiences:J.list(J.string()),path:J.string(),groupName:qhe,summary:J.string().optional(),connectMethodName:J.string().optional(),handshake:Sdr,messages:J.list(Odr),servers:J.list(Bdr),examples:J.list(Rdr)}).extend(wn).extend(ns);var B6s=J.objectWithoutOptionalProperties({apiVersion:J.unknown().optional(),title:J.string().optional(),description:J.string().optional(),basePath:J.string().optional(),servers:J.list(qCt),websocketServers:J.list(qCt),groups:J.record(J.string(),xdr),tags:Cdr,hasEndpointsMarkedInternal:J.boolean(),endpoints:J.list(rdr),webhooks:J.list(_dr),channels:J.record(J.string(),Ddr),groupedSchemas:wdr,variables:J.record(J.string(),Jhe),nonRequestReferencedSchemas:J.set(oD),securitySchemes:J.record(Whe,yfr),security:idr.optional(),globalHeaders:J.list(ndr).optional(),idempotencyHeaders:J.list(ldr).optional()});var Fdr=J.objectWithoutOptionalProperties({value:J.lazy(()=>gl)}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu).extend(ud);var kdr=J.objectWithoutOptionalProperties({}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu);var gl=J.union("type",{primitive:Jhe,object:J.lazyObject(()=>Edr),array:J.lazyObject(()=>_fr),map:J.lazyObject(()=>gdr),optional:J.lazyObject(()=>Fdr),enum:rGe,reference:yH,literal:CGe,oneOf:J.object({value:J.lazy(()=>vdr)}),nullable:J.lazyObject(()=>ydr),unknown:kdr}).transform({transform:e=>{switch(e.type){case"primitive":return Ra.primitive(e);case"object":return Ra.object(e);case"array":return Ra.array(e);case"map":return Ra.map(e);case"optional":return Ra.optional(e);case"enum":return Ra.enum(e);case"reference":return Ra.reference(e);case"literal":return Ra.literal(e);case"oneOf":return Ra.oneOf(e.value);case"nullable":return Ra.nullable(e);case"unknown":return Ra.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var Idr=J.objectWithoutOptionalProperties({schemas:J.list(J.lazy(()=>gl))}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(ns).extend(Gu).extend(ud);var $wi={};$($wi,{ArraySchemaWithExample:()=>Ndr,Base64WithExample:()=>jdr,BooleanWithExample:()=>Qdr,CommonPropertyWithExample:()=>Mdr,DateWithExample:()=>Ldr,DatetimeWithExample:()=>GCt,DiscriminatedOneOfSchemaWithExample:()=>Udr,DoubleWithExample:()=>zdr,EndpointWithExample:()=>P6s,EnumSchemaWithExample:()=>Jdr,FloatWithExample:()=>Ydr,HeaderWithExample:()=>Yhe,HttpErrorWithExample:()=>Vdr,Int64WithExample:()=>Xdr,IntWithExample:()=>Zdr,JsonRequestWithExample:()=>Gdr,JsonResponseWithExample:()=>PGe,MapSchemaWithExample:()=>imr,MultipartFormDataWebhookPayloadWithExample:()=>omr,NamedFullExample:()=>fN,NullableSchemaWithExample:()=>smr,ObjectPropertyWithExample:()=>amr,ObjectSchemaWithExample:()=>cmr,OneOfSchemaWithExample:()=>umr,OptionalSchemaWithExample:()=>pmr,ParseFormUrlEncodedRequest:()=>Wdr,ParseMultipartRequest:()=>$dr,ParseOctetStreamRequest:()=>Hdr,PathParameterWithExample:()=>qdr,PrimitiveSchemaValueWithExample:()=>nmr,PrimitiveSchemaWithExample:()=>DGe,QueryParameterWithExample:()=>BGe,RequestWithExample:()=>Kdr,ResponseWithExample:()=>RGe,SchemaWithExample:()=>ld,StringSchemaWithExample:()=>emr,Uint64WithExample:()=>tmr,UintWithExample:()=>rmr,UnDiscriminatedOneOfSchemaWithExample:()=>lmr,UnknownSchemaWithExample:()=>fmr,WebhookWithExample:()=>R6s,WebsocketHandshakeWithExample:()=>D6s});var Ndr=J.objectWithoutOptionalProperties({value:J.lazy(()=>ld),minItems:J.number().optional(),maxItems:J.number().optional(),example:J.list(J.unknown()).optional()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu).extend(ud);var jdr=J.objectWithoutOptionalProperties({example:J.string().optional()});var Qdr=J.objectWithoutOptionalProperties({default:J.boolean().optional(),example:J.boolean().optional()});var Mdr=J.objectWithoutOptionalProperties({key:J.string(),schema:J.lazy(()=>ld)});var GCt=J.objectWithoutOptionalProperties({example:J.string().optional()});var Ldr=J.objectWithoutOptionalProperties({example:J.string().optional()});var Udr=J.objectWithoutOptionalProperties({discriminantProperty:J.string(),discriminantPropertyNameOverride:J.string().optional(),discriminatorContext:uGe.optional(),defaultDiscriminantValue:J.string().optional(),commonProperties:J.list(J.lazyObject(()=>Mdr)),schemas:J.record(J.string(),J.lazy(()=>ld))}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(ns).extend(Gu).extend(ud);var zdr=J.objectWithoutOptionalProperties({default:J.number().optional(),minimum:J.number().optional(),maximum:J.number().optional(),exclusiveMinimum:J.boolean().optional(),exclusiveMaximum:J.boolean().optional(),multipleOf:J.number().optional(),example:J.number().optional()});var Yhe=J.objectWithoutOptionalProperties({name:J.string(),schema:J.lazy(()=>ld),env:J.string().optional(),parameterNameOverride:J.string().optional(),clientDefault:J.unknown().optional()}).extend(wn).extend(bs).extend(ns);var fN=J.objectWithoutOptionalProperties({name:J.string().optional(),value:J.unknown()}).extend(wn);var Vdr=J.objectWithoutOptionalProperties({statusCode:hH,schema:J.lazy(()=>ld),fullExamples:J.list(fN).optional()}).extend(wn).extend(Jc).extend(ns);var qdr=J.objectWithoutOptionalProperties({name:J.string(),schema:J.lazy(()=>ld),variableReference:J.string().optional(),parameterNameOverride:J.string().optional(),explode:J.boolean().optional(),clientDefault:J.unknown().optional()}).extend(wn).extend(bs).extend(ns);var BGe=J.objectWithoutOptionalProperties({name:J.string(),schema:J.lazy(()=>ld),parameterNameOverride:J.string().optional(),explode:J.boolean().optional(),clientDefault:J.unknown().optional()}).extend(wn).extend(bs).extend(ns);var Gdr=J.objectWithoutOptionalProperties({schema:J.lazy(()=>ld),contentType:J.string().optional(),fullExamples:J.list(fN).optional(),additionalProperties:J.boolean()}).extend(wn).extend(ns).extend(gH);var Wdr=J.objectWithoutOptionalProperties({schema:J.lazy(()=>ld),contentType:J.string().optional(),fullExamples:J.list(fN).optional(),additionalProperties:J.boolean()}).extend(wn).extend(ns).extend(gH);var $dr=J.objectWithoutOptionalProperties({fullExamples:J.list(fN).optional()}).extend(bGe).extend(gH);var Hdr=J.objectWithoutOptionalProperties({}).extend(EGe).extend(gH);var Kdr=J.union("type",{octetStream:Hdr,multipart:$dr,json:Gdr,formUrlEncoded:Wdr}).transform({transform:e=>{switch(e.type){case"octetStream":return iD.octetStream(e);case"multipart":return iD.multipart(e);case"json":return iD.json(e);case"formUrlEncoded":return iD.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var PGe=J.objectWithoutOptionalProperties({schema:J.lazy(()=>ld),responseProperty:J.string().optional(),terminator:J.string().optional(),fullExamples:J.list(fN).optional()}).extend(wn).extend(ns).extend($4);var RGe=J.union("type",{file:vGe,json:PGe,text:Khe,bytes:cGe,streamingSse:PGe,streamingText:Khe,streamingJson:PGe}).transform({transform:e=>{switch(e.type){case"file":return fg.file(e);case"json":return fg.json(e);case"text":return fg.text(e);case"bytes":return fg.bytes(e);case"streamingSse":return fg.streamingSse(e);case"streamingText":return fg.streamingText(e);case"streamingJson":return fg.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var P6s=J.objectWithoutOptionalProperties({authed:J.boolean(),security:dGe.optional(),internal:J.boolean().optional(),idempotent:J.boolean().optional(),method:hGe,audiences:J.list(J.string()),path:J.string(),summary:J.string().optional(),operationId:J.string().optional(),tags:J.list(sD),pathParameters:J.list(qdr),queryParameters:J.list(BGe),headers:J.list(Yhe),sdkName:AH.optional(),generatedRequestName:J.string(),requestNameOverride:J.string().optional(),request:Kdr.optional(),response:RGe.optional(),errors:J.record(hH,Vdr),servers:J.list(mGe),examples:J.list(fGe),pagination:gGe.optional(),retries:xGe.optional()}).extend(wn).extend(bs).extend(ns).extend(Ec);var Jdr=J.objectWithoutOptionalProperties({default:Ghe.optional(),values:J.list(Ghe),example:J.string().optional()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(ns).extend(Gu).extend(ud);var Ydr=J.objectWithoutOptionalProperties({example:J.number().optional()});var Xdr=J.objectWithoutOptionalProperties({default:J.number().optional(),example:J.number().optional()});var Zdr=J.objectWithoutOptionalProperties({default:J.number().optional(),minimum:J.number().optional(),maximum:J.number().optional(),exclusiveMinimum:J.boolean().optional(),exclusiveMaximum:J.boolean().optional(),multipleOf:J.number().optional(),example:J.number().optional()});var emr=J.objectWithoutOptionalProperties({default:J.string().optional(),pattern:J.string().optional(),format:J.string().optional(),minLength:J.number().optional(),maxLength:J.number().optional(),example:J.string().optional()});var tmr=J.objectWithoutOptionalProperties({default:J.number().optional(),example:J.number().optional()});var rmr=J.objectWithoutOptionalProperties({default:J.number().optional(),example:J.number().optional()});var nmr=J.union("type",{int:Zdr,int64:Xdr,uint:rmr,uint64:tmr,float:Ydr,double:zdr,string:emr,datetime:GCt,datetimeRfc2822:GCt,date:Ldr,base64:jdr,boolean:Qdr}).transform({transform:e=>{switch(e.type){case"int":return Qi.int(e);case"int64":return Qi.int64(e);case"uint":return Qi.uint(e);case"uint64":return Qi.uint64(e);case"float":return Qi.float(e);case"double":return Qi.double(e);case"string":return Qi.string(e);case"datetime":return Qi.datetime(e);case"datetimeRfc2822":return Qi.datetimeRfc2822(e);case"date":return Qi.date(e);case"base64":return Qi.base64(e);case"boolean":return Qi.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var DGe=J.objectWithoutOptionalProperties({schema:nmr}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu);var imr=J.objectWithoutOptionalProperties({key:DGe,value:J.lazy(()=>ld),minProperties:J.number().optional(),maxProperties:J.number().optional(),example:J.unknown().optional()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(Gu).extend(ud);var omr=J.objectWithoutOptionalProperties({name:J.string().optional(),properties:J.list(Hhe)}).extend(wn).extend(ns);var smr=J.objectWithoutOptionalProperties({value:J.lazy(()=>ld)}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu).extend(ud);var amr=J.objectWithoutOptionalProperties({key:J.string(),schema:J.lazy(()=>ld),readonly:J.boolean().optional(),writeonly:J.boolean().optional(),audiences:J.list(J.string()),conflict:J.record(oD,_Ge),nameOverride:J.string().optional(),generatedName:J.string()}).extend(bs);var cmr=J.objectWithoutOptionalProperties({allOf:J.list(yH),properties:J.list(J.lazyObject(()=>amr)),allOfPropertyConflicts:J.list(oGe),fullExamples:J.list(fN).optional(),additionalProperties:J.boolean(),minProperties:J.number().optional(),maxProperties:J.number().optional()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(ns).extend(Gu).extend(ud);var umr=J.union("type",{discriminated:J.lazyObject(()=>Udr),undiscriminated:J.lazyObject(()=>lmr)}).transform({transform:e=>{switch(e.type){case"discriminated":return CM.discriminated(e);case"undiscriminated":return CM.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var pmr=J.objectWithoutOptionalProperties({value:J.lazy(()=>ld)}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu).extend(ud);var fmr=J.objectWithoutOptionalProperties({example:J.unknown()}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(Gu);var ld=J.union("type",{primitive:DGe,object:J.lazyObject(()=>cmr),array:J.lazyObject(()=>Ndr),map:J.lazyObject(()=>imr),optional:J.lazyObject(()=>pmr),enum:Jdr,reference:yH,literal:CGe,oneOf:J.object({value:J.lazy(()=>umr)}),nullable:J.lazyObject(()=>smr),unknown:fmr}).transform({transform:e=>{switch(e.type){case"primitive":return kr.primitive(e);case"object":return kr.object(e);case"array":return kr.array(e);case"map":return kr.map(e);case"optional":return kr.optional(e);case"enum":return kr.enum(e);case"reference":return kr.reference(e);case"literal":return kr.literal(e);case"oneOf":return kr.oneOf(e.value);case"nullable":return kr.nullable(e);case"unknown":return kr.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var lmr=J.objectWithoutOptionalProperties({schemas:J.list(J.lazy(()=>ld))}).extend(qu).extend(Ec).extend(Jc).extend(wn).extend(bs).extend(A_).extend(ns).extend(Gu).extend(ud);var R6s=J.objectWithoutOptionalProperties({audiences:J.list(J.string()),sdkName:AH.optional(),method:TGe,summary:J.string().optional(),operationId:J.string(),tags:J.list(sD),headers:J.list(Yhe),generatedPayloadName:J.string(),payload:J.lazy(()=>ld),multipartFormData:omr.optional(),response:RGe.optional(),signatureVerification:OGe.optional(),examples:J.list(SGe)}).extend(wn).extend(ns).extend(Ec);var D6s=J.objectWithoutOptionalProperties({queryParameters:J.list(BGe),headers:J.list(Yhe)});var F6s=/^(\d+)/,FGe=/^[a-zA-Z][a-zA-Z0-9_]*$/,k6s={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"};function CPe(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let s=Math.floor(e/10),a=e%10;return a===0?n[s]:`${n[s]}_${t[a]}`}if(e<1e3){let s=Math.floor(e/100),a=e%100;return a===0?`${t[s]}_hundred`:`${t[s]}_hundred_${CPe(a)}`}let i=Math.floor(e/1e3),o=e%1e3;return o===0?`${t[i]}_thousand`:`${t[i]}_thousand_${CPe(o)}`}Li();function WCt(e){let t=e.match(F6s);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let o=CPe(i);return n.length>0?`${o}_${n}`:o}}}function kGe(e){let t=WCt(e),r=k6s[e];return t!=null?ku(Zn(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":ku(Zn(e)))}Li();function dN(e,t){return e.type==="primitive"&&t.type==="primitive"?N6s(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?O6l(e.values,t.values):e.type==="array"&&t.type==="array"?dN(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"?dN(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?B6l(e.value,t.value):e.type==="object"&&t.type==="object"?P6l(e,t):e.type==="map"&&t.type==="map"?N6s(e.key.schema,t.key.schema)&&dN(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function N6s(e,t){return e.type===t.type}function O6l(e,t){let r=new Set(e.map(i=>i.value)),n=new Set(t.map(i=>i.value));return jE(r,n)}function B6l(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:dN(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:dN(r,i)}):!1}function P6l(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let o=r[n];return o==null?!1:dN(o,i.schema)})}Pt();function zb(e){switch(e){case f_.Deprecated:return"deprecated";case f_.Beta:return"pre-release";case f_.GenerallyAvailable:return"generally-available";default:return}}Pt();function $Ct(e){if(e.type==="protobuf")return{proto:{type:e.typeName}};Ie(e.type)}Pt();Pt();GA();Li();function j6s(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),n=t?.[1]??"",i=r?.[1]??"";if(n===""&&i==="")return Zn(e);if(n.length+i.length>=e.length)return e;let o=e.slice(n.length,e.length-i.length||void 0);return`${n}${Zn(o)}${i}`}function R6l(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function Q6s(e){let t=e?R6l(e):void 0;if(t==null||t.length===0)return cPe;let r=[];for(let[n,i]of t.entries())typeof i=="string"?r.push(j6s(i)):typeof i=="object"?i.type==="namespace"?n<t.length-1?r.push(j6s(i.name)):r.push(i.name,cPe):Ie(i.type):Ie(i);return r.join("/")}function _se(e){return Ks.of(`${Q6s(e)}.yml`)}function Hwi({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?cPe:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,Q6s(r))}function M6s({sdkName:e,namespaceOverride:t}){return Ks.of(`${Hwi({sdkName:e,namespaceOverride:t})}.yml`)}function L6s({location:e,namespaceOverride:t}){return t!=null?QE(Ks.of(t),e):e}function U6s(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"unknown":return dmr({namespace:e.namespace,groupName:e.groupName});case"oneOf":return dmr({namespace:e.value.namespace,groupName:e.value.groupName});default:Ie(e)}}function dmr({namespace:e,groupName:t}){return e!=null&&t!=null?_se([{type:"namespace",name:e},...t]):e!=null?_se([{type:"namespace",name:e}]):_se(t)}Pt();function Sse(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":case"unknown":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;default:Ie(e)}}function Vp(e){return typeof e=="string"?e:e.type}function NGe(e){if(typeof e!="string")return e.docs}function HCt(e){if(typeof e!="string")return e.default}function Kwi(e){if(typeof e!="string")return e.validation}function jGe(e){let t=e.match(/^optional<\s*nullable<\s*(.+)\s*>\s*>$/);if(t!=null&&t[1]!=null)return t[1].trim();let r=e.match(/^nullable<\s*(.+)\s*>$/);return r!=null&&r[1]!=null?r[1].trim():e}function V6s(e){let t=Vp(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?z6s(e):{...e,type:z6s(e.type)}}function z6s(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function _Pe(e){return Vp(e).startsWith("optional<")?e:typeof e=="string"?q6s(e):{...e,type:q6s(e.type)}}function q6s(e){return e.startsWith("optional<")?e:`optional<${e}>`}var D6l=-2147483648,F6l=2147483647,k6l=-17976931348623157e292,N6l=17976931348623157e292;function Cc({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:o,variant:s}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return mmr(e);case"array":return Xwi({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"map":return Zwi({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"reference":return Ywi({schema:e,fileContainingReference:t,context:n,namespace:i,variant:s});case"unknown":return txi();case"optional":return hmr({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"nullable":return exi({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"enum":return G6l({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:o});case"literal":return e.value,rxi(e);case"object":return W6l({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"oneOf":return $6l({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});default:Ie(e)}}function mmr(e){switch(e.schema.type){case"string":return M6l({description:e.description,schema:e.schema});case"int":return L6l({description:e.description,schema:e.schema});case"float":return U6l({description:e.description,schema:e.schema});case"double":return z6l({description:e.description,schema:e.schema});case"boolean":return j6l({description:e.description,schema:e.schema});case"int64":return Q6l({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",datetimeRfc2822:()=>"datetime-rfc-2822",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zb(e.availability)}:{}}}function j6l({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function Q6l({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function M6l({description:e,schema:t}){let r="string",n=V6l(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function L6l({description:e,schema:t}){let r="integer",n=G6s(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function U6l({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function z6l({description:e,schema:t}){let r="double",n=G6s(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function V6l(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,o=q6l(t);if(!(o==null&&r==null&&n==null&&i==null))return{format:o,pattern:r,minLength:n,maxLength:i}}function q6l(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function G6s(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:o,exclusiveMaximum:s}=e;if(r=Jwi(r,t),n=Jwi(n,t),i=Jwi(i,t),!(r==null&&n==null&&o==null&&s==null&&i==null))return{min:r,max:n,exclusiveMin:o,exclusiveMax:s,multipleOf:i}}function Jwi(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[D6l,F6l]:[k6l,N6l];return e<r||e>n?void 0:e}function Ywi({schema:e,fileContainingReference:t,context:r,variant:n}){let i=r.getSchema(e.schema,e.namespace);if(i==null)return"unknown";let o=H6l(i)??e.schema,s=r.options.respectReadonlySchemas&&n!=null?r.getSchemaFinalName(o,n):o,a=Sse(i),c=K6l(i),l=gmr({context:r,fileContainingReference:t,declarationFile:dmr({namespace:e.namespace,groupName:a}),type:s});return i.type==="nullable"&&(l=r.options.wrapReferencesToNullableInOptional?`optional<${l}>`:`nullable<${l}>`),i.type==="optional"&&!l.startsWith("optional<")&&(l=`optional<${l}>`),e.description==null&&c==null?l:{type:l,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zb(e.availability)}:{}}}function Xwi({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Cc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=`list<${Vp(a)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zb(e.availability)}:{},type:c}}function Zwi({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=mmr(e.key),c=Cc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=e.encoding!=null?$Ct(e.encoding):void 0,l=`map<${Vp(a)}, ${Vp(c)}>`;if(e.description==null&&u==null&&e.title==null)return l;let p={type:l};return e.description!=null&&(p.docs=e.description),e.encoding!=null&&(p.encoding=u),e.availability!=null&&(p.availability=zb(e.availability)),p}function exi({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){if(!n.options.respectNullableSchemas)return hmr({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});let a=Cc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=Vp(a),u=NGe(a),l=HCt(a),p=Kwi(a),d=V6s(c);if(n.options.wrapReferencesToNullableInOptional&&(d=_Pe(d)),e.availability==null&&e.description==null&&u==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||u!=null)&&(f.docs=e.description??u),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=zb(e.availability)),f}function hmr({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Cc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=Vp(a),u=NGe(a),l=HCt(a),p=Kwi(a),d=_Pe(c);if(e.availability==null&&e.description==null&&u==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||u!=null)&&(f.docs=e.description??u),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=zb(e.availability)),f}function txi(){return"unknown"}function rxi(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ie(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zb(e.availability)}:{}}}function G6l({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let o=KCt(e,i),s=e.nameOverride??e.generatedName;n.builder.addType(r,{name:s,schema:o.schema});let a=gmr({type:s,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return a;let c={type:a};return e.description!=null&&(c.docs=e.description),e.default!=null&&(c.default=e.default.value),e.availability!=null&&(c.availability=zb(e.availability)),c}function W6l({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=SPe({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:a.schema});let u=gmr({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?u:{type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zb(e.availability)}:{}}}function $6l({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=nxi({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:a.schema});let u=gmr({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?u:{...e.title!=null?{"display-name":e.title}:{},type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zb(e.availability)}:{}}}function gmr({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function H6l(e){return Ra._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function K6l(e){return Ra._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}Pt();function Tse(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ie(e)}}function $6s({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s;switch(e.type){case"primitive":s=X6l(e);break;case"array":s=J6l({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":s=Y6l({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":s=Z6l({schema:e,context:t,declarationFile:r,namespace:n,variant:o});break;case"unknown":s=tql(e.nameOverride,e.generatedName,e.description);break;case"optional":s=K6s({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":s=eql({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":s=KCt(e,i);break;case"literal":s=rql(e,e.nameOverride,e.generatedName);break;case"object":s=SPe({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;case"oneOf":s=nxi({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;default:Ie(e)}return s}function SPe({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,skipReadonlyProperties:o,variant:s}){let a=o===!0||s==="write",c=!1,u={},l=new Set;for(let g of e.properties){if(g.readonly&&(c=!0),a&&g.readonly)continue;if(Object.keys(g.conflict).length>0){if(Object.entries(g.conflict).every(([C,_])=>!_.differentSchema))continue;Object.entries(g.conflict).forEach(([C])=>{ixi({property:g.key,schemaId:C,context:t,namespace:n}).forEach(w=>{l.add(w)})})}let A=Cc({schema:g.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s}),b=g.audiences,v=g.nameOverride,E=zb(g.availability),I=sql(g);u[g.key]=oql({typeReference:A,audiences:b,name:v,availability:E,propertyAccess:I})}let p=new Set;for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(A=>l.add(A)),g.conflictingTypeSignatures&&p.add(g.propertyKey);let d=[];for(let g of e.allOf){let A=Amr({schema:g.schema,context:t,namespace:n});if(A==null||l.has(g.schema)||l.has(A))continue;let b=Cc({schema:Ra.reference(g),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});d.push(jGe(Vp(b)))}for(let g of l){let A=QGe(t,g,n);for(let b of A.properties)u[b.key]==null&&(p.has(b.key)&&(u[b.key]="unknown"),u[b.key]=Cc({schema:b.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s}));for(let b of A.allOf){if(l.has(b.schema))continue;let v=Cc({schema:Ra.reference(b),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});d.push(jGe(Vp(v)))}}let f={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(u).map(([g,A])=>iql(g)?[g,typeof A=="string"?{type:A,name:`_${g}`}:{...A,name:`_${g}`}]:[g,A]))};d.length>0&&(f.extends=d),e.additionalProperties&&(f["extra-properties"]=!0),e.availability!=null&&(f.availability=zb(e.availability)),e.source!=null&&(f.source=Tse(e.source)),e.encoding!=null&&(f.encoding=$Ct(e.encoding)),f.inline=oxi(e,i);let m=e.nameOverride??e.generatedName;return{name:s==="read"&&c&&t.options.respectReadonlySchemas&&t.hasReadVariant(m)?`${m}Read`:m,schema:f}}function ixi({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return ixi({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:o,allOf:s}=QGe(r,t,n),a=o.some(u=>u.key===e),c=[...s.flatMap(u=>ixi({property:e,context:r,schemaId:u.schema,namespace:n}))];if(a||c.length>0)return[t,...c]}return[]}function H6s(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?QGe(e,t.schema,r):t.type==="nullable"?H6s(e,t.value,r):{properties:[],allOf:[]}}function QGe(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:H6s(e,n,r)}function J6l({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:Xwi({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function Y6l({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:Zwi({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function X6l(e){let t=mmr(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function W6s(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function KCt(e,t){let r={enum:e.values.map(o=>{let s=o.nameOverride??o.generatedName,a=o.value;if(s===a&&o.description==null&&(o.casing==null||W6s(o.casing)))return s;let c={value:o.value};if(s!==a&&(c.name=s),o.description!=null&&(c.docs=o.description),o.casing!=null&&!W6s(o.casing)){let u={},l=!1;o.casing.camel!=null&&(u.camel=o.casing.camel,l=!0),o.casing.screamingSnake!=null&&(u["screaming-snake"]=o.casing.screamingSnake,l=!0),o.casing.snake!=null&&(u.snake=o.casing.snake,l=!0),o.casing.pascal!=null&&(u.pascal=o.casing.pascal,l=!0),l&&(c.casing=u)}return c})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=oxi(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?Tse(e.source):void 0};for(let o of r.enum){let s=typeof o=="string"?o:o.name??o.value;n.has(s.toLowerCase())||(i.enum.push(o),n.add(s.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function Z6l({schema:e,context:t,declarationFile:r,namespace:n,variant:i}){return{name:e.nameOverride??e.generatedName,schema:Ywi({schema:e,context:t,fileContainingReference:r,namespace:n,variant:i})}}function eql({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:exi({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:K6s({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function K6s({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:hmr({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function tql(e,t,r){return r!=null?{name:e??t,schema:{type:"unknown",docs:r}}:{name:e??t,schema:txi()}}function rql(e,t,r){return{name:t??r,schema:rxi(e)}}function nxi({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s=e.encoding!=null?$Ct(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let l of e.commonProperties)c[l.key]=Cc({schema:l.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o});let u={};for(let[l,p]of Object.entries(e.schemas))u[l]=Cc({schema:p,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:o});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantPropertyNameOverride!=null||e.discriminatorContext!=null?{...e.discriminantPropertyNameOverride!=null&&{name:e.discriminantPropertyNameOverride},value:e.discriminantProperty,...e.discriminatorContext!=null&&{context:e.discriminatorContext}}:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?zb(e.availability):void 0,union:u,"default-variant":e.defaultDiscriminantValue??void 0,encoding:s,source:e.source!=null?Tse(e.source):void 0}}}let a=[];for(let c of e.schemas)a.push(Cc({schema:c,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:a,encoding:s,source:e.source!=null?Tse(e.source):void 0,inline:oxi(e,i)}}}var nql=/^[0-9]/;function iql(e){return nql.test(e)}function Amr({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?Amr({context:t,schema:n.schema,namespace:r}):e}function oql({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{}}}function oxi(e,t){return e.inline===!0||t>0?!0:void 0}function sql(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return th.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return th.ObjectPropertyAccess.WriteOnly}}Li();function J6s(e){let t=e.replace(/^x-|^X-/,"");return Zn(t)}function Y6s(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??J6s(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(Ks.of("__package__.yml"),{name:"OauthScope",schema:KCt(n.scopesEnum,0).schema})}}Li();function bH({header:e,context:t,fileContainingReference:r,namespace:n}){let i=Cc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),o=Vp(i),s=e.name.replace(/^x-|^X-/,""),a=e.parameterNameOverride!=null?e.parameterNameOverride:Zn(s);if(e.description==null&&e.name===a&&e.env==null&&e.availability==null&&e.clientDefault==null)return o;let c={type:o};return a!==e.name&&(c.name=a),e.description!=null&&(c.docs=e.description),e.env!=null&&(c.env=e.env),e.availability!=null&&(c.availability=zb(e.availability)),e.clientDefault!=null&&(c.default=e.clientDefault),c}function ymr({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=Cc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null&&e.clientDefault==null)return Vp(i);let o=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:Vp(i)};return e.description!=null&&(o.docs=e.description),e.availability!=null&&(o.availability=zb(e.availability)),e.clientDefault!=null&&"type"in o&&(o.default=e.clientDefault),o}GA();function Emr({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=sxi({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let o=Vp(i.value),s=HCt(i.value);o==="unknown"?o="string":o==="optional<unknown>"&&(o="optional<string>");let a={type:o};return e.clientDefault!=null?a.default=e.clientDefault:s!=null&&(a.default=s),i.allowMultiple&&(a["allow-multiple"]=!0),e.explode!=null&&(a.explode=e.explode),e.description!=null&&(a.docs=e.description),e.parameterNameOverride!=null&&(a.name=e.parameterNameOverride),e.availability!=null&&(a.availability=zb(e.availability)),aql(i.value)&&i.value.validation!==void 0&&(a.validation=i.value.validation),a.default==null&&a["allow-multiple"]==null&&a.docs==null&&a.name==null&&a.availability==null&&a.validation==null&&a.explode==null?o:a}function sxi({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:Cc({schema:Ra.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:Ks.of(Pf),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,c]of Object.entries(i.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(s=!0),c.type==="literal"&&c.value.type==="string"&&(FGe.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:kGe(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[a,c]=i.value.schemas;if(a!=null&&c!=null&&bmr({array:a,primitive:c}))return{value:Cc({schema:Ra.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&c!=null&&bmr({array:c,primitive:a}))return{value:Cc({schema:Ra.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[a,c]of Object.entries(i.value.schemas))return sxi({schema:c,context:t,fileContainingReference:r,namespace:n})}else if(t.options.objectQueryParameters)return{value:Cc({schema:e,context:t,fileContainingReference:r,declarationFile:Ks.of(Pf),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?Ra.optional:Ra.nullable;if(e.value.type==="reference"){let o=t.getSchema(e.value.schema,n);if(o==null)return;if(o.type==="array")return{value:Cc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:o.value,description:e.description??o.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:Ks.of(Pf),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:Cc({schema:e,context:t,fileContainingReference:r,declarationFile:Ks.of(Pf),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Cc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(s=!0),c.type==="literal"&&c.value.type==="string"&&(FGe.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:kGe(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,c]=e.value.value.schemas;if(a!=null&&c!=null&&bmr({array:a,primitive:c}))return{value:Cc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&c!=null&&bmr({array:c,primitive:a}))return{value:Cc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.options.objectQueryParameters)return{value:Cc({schema:e,context:t,fileContainingReference:r,declarationFile:Ks.of(Pf),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[a,c]of Object.entries(e.value.value.schemas))return sxi({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.options.objectQueryParameters?{value:Cc({schema:e,context:t,fileContainingReference:r,declarationFile:Ks.of(Pf),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Cc({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Cc({schema:Ra.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:Cc({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function bmr({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function aql(e){return typeof e=="object"&&e!==null&&"type"in e}Pt();function X6s({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=cql(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=uql({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=Xhe(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function cql(e){let t={};return e.forEach(r=>{let n=Xhe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function uql({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let o=Xhe(i.value);r.has(i.name)||o!=null&&(n[i.name]=o)}),n}function Xhe(e){switch(e.type){case"primitive":return Z6s(e.value);case"object":return eqs(e.properties);case"array":return lql(e.value);case"map":return pql(e.value);case"oneOf":return fql(e.value);case"enum":return e.value;case"literal":return dql(e.value);case"unknown":return Xhe(e.value);case"null":return null;default:Ie(e)}}function Z6s(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Ie(e)}}function eqs(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Xhe(r)]))}function lql(e){return e.map(t=>Xhe(t))}function pql(e){return Object.fromEntries(e.map(t=>[Z6s(t.key),Xhe(t.value)]))}function fql(e){return e.type==="discriminated"?eqs(e.value):Xhe(e.value)}function dql(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ie(e)}}function JCt(e){try{let r=new URL(e).pathname.split("/").filter(n=>n.length>0);if(r.length>0)return r[r.length-1]}catch{}}function vmr(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function Imr(e,t,r=!1){let n=JCt(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}function Ose(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function wmr(e,t){return t??(e?.groupName!=null?Ose(e.groupName):void 0)}function tqs({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=t.ir.servers.length===0&&t.ir.websocketServers.length<=1,o=n!=null&&!i?t.options.groupEnvironmentsByHost?t.getUrlId(n.url)??Imr(n.name,n.url,!0):n.name:void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${n?.name}", server url="${n?.url}", resolved urlId="${o}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let s=e.path;for(let f of e.handshake.pathParameters)f.parameterNameOverride!=null&&(s=s.replace(`{${f.name}}`,`{${f.parameterNameOverride}}`));let a=t.authOverrides?.auth!=null,c={path:s,url:o,auth:a};e.audiences!=null&&e.audiences.length>0&&(c.audiences=e.audiences),e.summary!=null&&(c["display-name"]=e.summary),e.connectMethodName!=null&&(c["connect-method-name"]=e.connectMethodName),e.description!=null&&(c.docs=e.description);let u=Ose(e.groupName),l={};if(e.handshake.pathParameters.length>0)for(let f of e.handshake.pathParameters){let m=f.parameterNameOverride??f.name;l[m]=ymr({pathParameter:f,context:t,fileContainingReference:r,namespace:u})}Object.keys(l).length>0&&(c["path-parameters"]=l);let p={};if(e.handshake.queryParameters.length>0)for(let f of e.handshake.queryParameters){let m=Emr({queryParameter:f,context:t,fileContainingReference:r,namespace:u});m!=null&&(p[f.name]=m)}Object.keys(p).length>0&&(c["query-parameters"]=p);let d={};if(e.handshake.headers.length>0)for(let f of e.handshake.headers){let m=bH({header:f,context:t,fileContainingReference:r,namespace:u});d[f.name]=m}Object.keys(d).length>0&&(c.headers=d),t.builder.addChannel(r,{channel:c});for(let f of e.messages){let m={origin:f.origin,body:Cc({schema:f.body,context:t,fileContainingReference:r,namespace:u,declarationDepth:0})};f.displayName!=null&&(m["display-name"]=f.displayName),f.methodName!=null&&(m["method-name"]=f.methodName),t.builder.addChannelMessage(r,{messageId:f.name,message:m})}for(let f of e.examples){let m=X6s({context:t,websocketExample:f});t.builder.addChannelExample(r,{example:m})}}function axi(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var j0="Base",iqs="Default";function rqs(e){try{return new URL(e).hostname}catch{return}}function nqs(e){return e??iqs}function mql(e,t){let r=new Map;for(let n of e){if(axi(n)||!("url"in n)||!n.url)continue;let i=rqs(n.url)??n.url;r.has(i)||r.set(i,{environmentName:nqs(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.httpServers.push({name:n.name,url:n.url,audiences:n.audiences})}for(let n of t){let i=rqs(n.url)??n.url;r.has(i)||r.set(i,{environmentName:nqs(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function Zhe(e){return Object.entries(e).reduce((t,[r,n])=>($O(n)?Object.entries(n.urls).forEach(([i,o])=>{t[i]=o}):t[r]=typeof n=="string"?n:n.url,t),{})}function oqs(e){if(e.environmentOverrides!=null){for(let[E,I]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:E,schema:I});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],n=e.ir.servers.some(E=>axi(E)),i=e.ir.servers;for(let E of i)if(axi(E)){let I={urls:{}},x={},C={},_={};for(let[P,z]of Object.entries(E.urls))I.urls[P]=z.defaultUrl??z.url,z.urlTemplate&&(x[P]=z.urlTemplate),z.defaultUrl&&(C[P]=z.defaultUrl),z.variables&&z.variables.length>0&&(_[P]=z.variables);(Object.keys(x).length>0||Object.keys(_).length>0)&&(I["url-templates"]=x,I["default-urls"]=C,I.variables=_),E.name&&(t[E.name]=I)}else if("url"in E&&E.url){let x=E.urlTemplate!=null&&E.variables!=null&&E.variables.length>0?{url:E.url,audiences:E.audiences,"default-url":E.defaultUrl,"url-template":E.urlTemplate,variables:E.variables?.map(C=>({id:C.id,default:C.default,values:C.values}))}:E.audiences?{url:E.url,audiences:E.audiences}:E.url;if(E.name==null){r.push(x);continue}t[E.name]=x}let o={},s={},a=[],c={},u={},l={};for(let E of e.ir.endpoints)for(let I of E.servers){if(I.url==null&&I.name!=null){o[I.name]||(o[I.name]=[]);continue}if(I.url==null)continue;let x=I,C="defaultUrl"in I&&typeof x.defaultUrl=="string"?x.defaultUrl:void 0,_="urlTemplate"in I&&typeof x.urlTemplate=="string"?x.urlTemplate:void 0,w="variables"in I&&Array.isArray(x.variables)?x.variables:void 0,P=C??I.url,z=I.audiences?{url:P,audiences:I.audiences}:P;if(I.name==null){a.push(z);continue}o[I.name]||(o[I.name]=[]),o[I.name]?.push({url:P,audiences:I.audiences}),s[I.name]=z,_&&I.name&&(c[I.name]=_),C&&I.name&&(u[I.name]=C),w&&w.length>0&&I.name&&(l[I.name]=w)}let p={},d=[];for(let E of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${E.name}", url="${E.url}"`);let I=E.audiences?{url:E.url,audiences:E.audiences}:E.url;if(E.name==null){d.push(I);continue}p[E.name]=I}let f=Object.keys(t).length,m=f>0,h=Object.keys(s).length>0,g=Object.keys(o).some(E=>o[E]?.length===0),A=Object.keys(p).length>0;if(e.options.groupEnvironmentsByHost&&A&&(m||e.ir.servers.length>0)){let E=Object.entries(p).map(([x,C])=>({name:x,url:typeof C=="string"?C:C.url,audiences:typeof C=="string"?void 0:C.audiences})),I=mql(i,E);if(I.size>0){let x=!0;for(let[C,_]of I.entries()){let w={},P=[..._.httpServers.map(q=>({...q,isHttp:!0})),..._.websocketServers.map(q=>({...q,isHttp:!1}))],z=new Map;for(let q of P){let V=JCt(q.url),X=vmr(q.url);V&&X&&(z.has(V)||z.set(V,new Set),z.get(V)?.add(X))}if(_.httpServers.length>0){let q=_.httpServers[0];q!=null&&(w[j0]=q.url,e.setUrlId(q.url,j0));for(let V=1;V<_.httpServers.length;V++){let X=_.httpServers[V];if(X!=null){let ae=JCt(X.url),G=vmr(X.url),Y=ae?z.get(ae):void 0,Ce=Y&&Y.size>1,te=Ce&&G!=="https"?`${ae}_${G}`:ae||`Http${V+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${X.url}", pathSegment="${ae}", protocol="${G}", hasCollision=${Ce}, urlId="${te}"`),w[te]=X.url,e.setUrlId(X.url,te)}}}for(let q of _.websocketServers){let V=JCt(q.url),X=vmr(q.url),ae=V?z.get(V):void 0,G=ae&&ae.size>1,Y=G?`${V}_${X}`:Imr(q.name,q.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${q.name}", url="${q.url}", pathSegment="${V}", protocol="${X}", hasCollision=${G}, urlId="${Y}"`),w[Y]=q.url,e.setUrlId(q.url,Y)}if(Object.keys(w).length>1)e.builder.addEnvironment({name:_.environmentName,schema:{urls:w}});else if(Object.keys(w).length===1){let q=Object.values(w)[0];q!=null&&e.builder.addEnvironment({name:_.environmentName,schema:q})}x&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(_.environmentName),Object.keys(w).length>1&&e.builder.setDefaultUrl(j0),x=!1)}return}}if(!m&&!h&&A&&e.ir.servers.length===0){for(let[E,I]of Object.entries(p))e.builder.addEnvironment({name:E,schema:I});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(Object.keys(p)[0]),e.builder.setDefaultUrl(j0);return}if(a.length>0&&e.logger.debug(`Skipping endpoint level servers ${a.map(E=>typeof E=="string"?E:E.url).join(", ")} because x-fern-server-name was not provided.`),!m){let E=e.ir.servers[0],I=E?.url,x=E?.audiences,C=E?.defaultUrl,_=E?.urlTemplate,w=E?.variables;if(I!=null){let z=_!=null&&w!=null&&w.length>0?{url:I,audiences:x,"default-url":C,"url-template":_,variables:w?.map(q=>({id:q.id,default:q.default,values:q.values}))}:x?{url:I,audiences:x}:I;t[iqs]=z}}let b=Object.values(t).map(E=>typeof E=="string"?E:$O(E)?Object.values(E.urls)[0]:E.url),v=r.filter(E=>{let I=typeof E=="string"?E:E.url;return!b.includes(I)});if(v.length>0&&e.logger.debug(`Skipping top level servers ${v.map(E=>typeof E=="string"?E:E.url).join(", ")} because x-fern-server-name was not provided.`),n){let E=!0;for(let[I,x]of Object.entries(t))if(e.builder.addEnvironment({name:I,schema:x}),E){if(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(I),$O(x)){let C=Object.keys(x.urls)[0];C&&e.builder.setDefaultUrl(C)}E=!1}return}if(!h&&!g){let E=!0;for(let[I,x]of Object.entries(t))if(E){if(A){let C=typeof x=="string"?x:$O(x)?Object.values(x.urls)[0]:x["default-url"]??x.url;C!=null&&e.setUrlId(C,j0),e.builder.addEnvironment({name:I,schema:{urls:{[j0]:C??"",...Zhe(p)}}})}else e.builder.addEnvironment({name:I,schema:x});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(I),E=!1}else if(A){let C=typeof x=="string"?x:$O(x)?Object.values(x.urls)[0]:x["default-url"]??x.url;C!=null&&e.setUrlId(C,j0),e.builder.addEnvironment({name:I,schema:{urls:{[j0]:C??"",...Zhe(p)}}})}else e.builder.addEnvironment({name:I,schema:x});A&&e.builder.setDefaultUrl(j0)}else if(f===1){let E=Object.keys(t)[0],I=Object.values(t)[0],x=typeof I=="string"?I:$O(I)?Object.values(I.urls)[0]:I["default-url"]??I.url,C={},_={},w={};typeof I!="string"&&!$O(I)&&(I["url-template"]&&(C[j0]=I["url-template"]),I["default-url"]&&(_[j0]=I["default-url"]),I.variables&&I.variables.length>0&&(w[j0]=I.variables)),Object.assign(C,c),Object.assign(_,u),Object.assign(w,l);let P=Object.keys(C).length>0||Object.keys(w).length>0;x!=null&&e.setUrlId(x,j0);let z={urls:{[j0]:x??"",...Zhe(s),...Zhe(p)},...P?{"url-templates":C,"default-urls":_,variables:w}:{}};e.builder.addEnvironment({name:E,schema:z}),e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(E),e.builder.setDefaultUrl(j0)}else{let E=new Map;for(let _ of e.ir.endpoints)for(let w of _.servers)if(w.url!=null&&w.name!=null){E.has(w.name)||E.set(w.name,new Map);let P=w.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",z=E.get(w.name);z&&z.set(P,w.url)}let I=new Set(E.keys()),x=new Set(Object.keys(t)),C=I.size>0&&[...I].every(_=>x.has(_));if(E.size>0&&C){let _=Object.entries(t),w=_[0];if(w){let[P,z]=w,q=typeof z=="string"?z:$O(z)?Object.values(z.urls)[0]:z["default-url"]??z.url,V={};q!=null&&(V[j0]=q,e.setUrlId(q,j0));for(let X=1;X<_.length;X++){let ae=_[X];if(ae==null)continue;let[G,Y]=ae,Ce=typeof Y=="string"?Y:$O(Y)?Object.values(Y.urls)[0]:Y["default-url"]??Y.url;Ce!=null&&(V[G]=Ce,e.setUrlId(Ce,G))}A&&Object.assign(V,Zhe(p)),e.builder.addEnvironment({name:P,schema:{urls:V}}),e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(P),e.builder.setDefaultUrl(j0)}}else if(E.size>0){let _=!0;for(let[w,P]of Object.entries(t)){let z=typeof P=="string"?P:$O(P)?Object.values(P.urls)[0]:P["default-url"]??P.url;if(!z)continue;e.setUrlId(z,j0);let q=z.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",V={[j0]:z};for(let[X,ae]of E.entries()){let G=ae.get(q)||ae.get("production")||ae.values().next().value;G&&(V[X]=G)}A&&Object.assign(V,Zhe(p)),Object.keys(V).length>1?e.builder.addEnvironment({name:w,schema:{urls:V}}):e.builder.addEnvironment({name:w,schema:z}),_&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(w),_=!1)}E.size>0&&e.builder.setDefaultUrl(j0)}else{let _=!0;for(let[w,P]of Object.entries(t)){if(A||Object.keys(s).length>0){let z=typeof P=="string"?P:$O(P)?Object.values(P.urls)[0]:P["default-url"]??P.url;z!=null&&e.setUrlId(z,j0),e.builder.addEnvironment({name:w,schema:{urls:{[j0]:z??"",...Zhe(s),...Zhe(p)}}})}else e.builder.addEnvironment({name:w,schema:P});_&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(w),_=!1)}}}}GA();Li();var cxi=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},hql=.75,gql=new Set(["authorization"]);function sqs(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let o=n.optional===!0?"optional<string>":"string",s=o;if(n.name==null&&n.env==null&&n.clientDefault==null&&typeof n.schema=="string")s=n.schema;else if(n!=null){let a=n.schema?Sse(n.schema):void 0,c=a!=null?Ose(a):void 0,u=Ks.of("api.yml");s={name:n.name,env:n.env,type:n.schema!=null?Vp(Cc({schema:n.schema,context:e,fileContainingReference:c?QE(Ks.of(Zn(c)),u):u,namespace:c,declarationDepth:0}))??o:o},(typeof n.clientDefault=="string"||typeof n.clientDefault=="boolean")&&(s.default=n.clientDefault)}e.builder.addGlobalHeader({name:r,schema:s})}if(e.options.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let o of i.headers){if(gql.has(o.name.toLowerCase()))continue;let s=r[o.name];if(s==null){let a=t[o.name],c=bH({header:{...o,schema:a?.schema??o.schema,name:a?.name??o.name},fileContainingReference:Ks.of(UE),context:e,namespace:void 0});s=new cxi(c),r[o.name]=s}s.increment()}let n=e.ir.endpoints.length*hql;for(let[i,o]of Object.entries(r)){let s=t[i],a=o.count===e.ir.endpoints.length,c=o.count>=n;s==null&&(a?e.builder.addGlobalHeader({name:i,schema:o.schema}):c&&e.builder.addGlobalHeader({name:i,schema:_Pe(o.schema)}))}}}GA();function aqs(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?Sse(t.schema):void 0,n=r!=null?Ose(r):void 0,i=bH({header:{...t,schema:t.schema??Ra.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:Sl.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0,clientDefault:void 0},fileContainingReference:Ks.of(UE),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:_Pe(i)})}}Pt();GA();Pt();Pt();function rB(e){switch(e.type){case"primitive":return uqs(e.value);case"object":return lqs(e.properties);case"array":return pqs(e.value);case"map":return yql(e.value);case"oneOf":return bql(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return Eql(e.value);case"unknown":return rB(e.value);case"null":return null;default:Ie(e)}}function cqs(e){switch(e.type){case"withStreaming":return e.sse?{stream:Aql(e.events)}:{stream:pqs(e.events)};case"withoutStreaming":return{body:rB(e.value)};default:Ie(e)}}function uqs(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Ie(e)}}function lqs(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,rB(r)]))}function Aql(e){return e.map(t=>({event:"",data:rB(t)}))}function pqs(e){return e.map(t=>rB(t))}function yql(e){return Object.fromEntries(e.map(t=>[uqs(t.key),rB(t.value)]))}function bql(e){return e.type==="discriminated"?lqs(e.value):rB(e.value)}function Eql(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:Ie(e)}}function fqs({endpointExample:e,context:t}){let r={};if(e.type!=="full")return e.value;e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=vql(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=Iql(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),o=Object.keys(i).length>0,s=new Set(e.headers?.map(a=>a.name)??[]);if(n||o){let a=[];if(e.headers!=null)for(let c of e.headers)c.name!==t.builder.getAuthHeaderName()&&a.push(c);for(let[c,u]of Object.entries(i)){if(u!=null&&typeof u=="object"&&u.type!=null){let l=zv({type:u.type,_default:void 0,validation:void 0,visitor:{primitive:At,map:At,list:At,optional:p=>p,nullable:p=>p,set:At,named:At,literal:p=>{if(p.type==="string")return p.string;if(p.type==="boolean")return p.boolean.toString()},unknown:At}});if(l!=null){let p=a.findIndex(f=>f.name===c),d={name:c,value:xc.literal(zhe.string(l))};p>=0?a[p]=d:a.push(d);continue}}s.has(c)||a.push({name:c,value:xc.primitive(_s.string(c))})}r.headers=wql({context:t,namedFullExamples:a})}return e.request!=null&&(r.request=rB(e.request)),e.response!=null&&(r.response=cqs(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(a=>a.type==="language"?{name:a.name??void 0,docs:a.description??void 0,language:a.language,code:a.code,install:a.install??void 0}:{name:a.name??void 0,docs:a.description??void 0,sdk:a.sdk,code:a.code}).filter(Pa)),r}function vql(e){let t={};return e.forEach(r=>{let n=rB(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function Iql(e){let t={};return e.forEach(r=>{let n=rB(r.value);n!=null&&(t[r.name]=n)}),t}function wql({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=rB(n.value);i!=null&&(r[n.name]=i)}),r}var J1;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(J1||(J1={}));function dqs(e){return d_._visit(e,{get:()=>th.HttpMethodSchema.Get,post:()=>th.HttpMethodSchema.Post,put:()=>th.HttpMethodSchema.Put,patch:()=>th.HttpMethodSchema.Patch,delete:()=>th.HttpMethodSchema.Delete,head:()=>th.HttpMethodSchema.Head,options:()=>{throw new Error("OPTIONS is unsupported")},trace:()=>{throw new Error("TRACE is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function uxi(e){return e==="POST"||e==="PUT"||e==="PATCH"}function mqs({endpoint:e,declarationFile:t,context:r}){let n=[],i=new Set,o=e.path,s=wmr(e.sdkName,e.namespace),a={};for(let h of e.pathParameters)h.parameterNameOverride&&(o=o.replace(h.name,h.parameterNameOverride)),a[h.parameterNameOverride??h.name]=ymr({pathParameter:h,context:r,fileContainingReference:t,namespace:s}),i.add(h.name);let c={};for(let h of e.queryParameters){let g=Emr({queryParameter:h,context:r,fileContainingReference:t,namespace:s});g!=null&&(c[h.name]=g,i.add(h.name))}let u;if(e.pagination!=null)switch(e.pagination.type){case"cursor":u={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":u={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":u={type:"custom",results:e.pagination.results};break;case"uri":u={next_uri:e.pagination.nextUri,results:e.pagination.results};break;case"path":u={next_path:e.pagination.nextPath,results:e.pagination.results};break;default:Ie(e.pagination)}let l={path:o,method:dqs(e.method),auth:xql({endpoint:e,context:r}),docs:e.description??void 0,pagination:u,source:e.source!=null?Tse(e.source):void 0};!Tql({context:r,request:e.request})&&Object.keys(a).length>0&&(l["path-parameters"]=a),e.summary!=null&&(l["display-name"]=e.summary);let p={},d=r.builder.getGlobalHeaderNames(),f=r.builder.getAuthHeaderName();f!=null&&d.add(f);let m=e.headers.filter(h=>!d.has(h.name));for(let h of m){let g=bH({header:h,context:r,fileContainingReference:t,namespace:s});p[h.name]=g,i.add(typeof g=="string"?h.name:g.name??h.name)}if(e.request!=null){r.setInState(J1.Request);let h=Sql({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(a).length>0?a:void 0,queryParameters:Object.keys(c).length>0?c:void 0,headers:Object.keys(p).length>0?p:void 0,usedNames:i,namespace:s});l.request=h.value,n=[...n,...h.schemaIdsToExclude??[]],r.unsetInState(J1.Request)}else{let h=r.options.inlinePathParameters&&Object.keys(a).length>0,g=Object.keys(c).length>0,A=Object.keys(p).length>0,b={};(h||g||A)&&(b.name=e.requestNameOverride??e.generatedRequestName),h&&(b["path-parameters"]=a),g&&(b["query-parameters"]=c),A&&(b.headers=p),Object.keys(b).length>0&&(l.request=b)}if(e.response!=null&&e.response._visit({json:h=>{let g=Cc({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l.response={docs:h.description??void 0,type:Vp(g)},h.statusCode!=null&&(l.response["status-code"]=h.statusCode),h.responseProperty!=null&&(l.response.property=h.responseProperty)},streamingJson:h=>{let g=Cc({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l["response-stream"]={docs:h.description??void 0,type:Vp(g),format:"json",terminator:h.terminator??void 0}},streamingSse:h=>{let g=Cc({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l["response-stream"]={docs:h.description??void 0,type:Vp(g),format:"sse",terminator:h.terminator??void 0}},file:h=>{l.response={docs:h.description??void 0,type:"file","status-code":h.statusCode}},bytes:h=>{l.response={docs:h.description??void 0,type:"bytes","status-code":h.statusCode}},streamingText:h=>{l["response-stream"]={docs:h.description??void 0,type:"text"}},text:h=>{l.response={docs:h.description??void 0,type:"text","status-code":h.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let h=r.getDefaultServerName(),g=e.servers[0];if(g==null)h!=null&&(l.url=h);else{let A=g.url!=null?r.getUrlId(g.url):void 0;l.url=A??g.name??void 0}}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=zb(e.availability)),Object.entries(e.errors).forEach(([h,g])=>{let A=g.generatedName,b=Ks.of(Pf);r.builder.enableUniqueErrorsPerEndpoint&&(A=`${e.generatedRequestName}${g.generatedName}`,g.schema!=null&&(g.schema.type!=="reference"&&g.schema.type!=="oneOf"?g.schema.generatedName=`${e.generatedRequestName}${g.schema.generatedName}`:g.schema.type==="oneOf"&&(g.schema.value.generatedName=`${e.generatedRequestName}${g.schema.value.generatedName}`)));let v={"status-code":parseInt(h)},E=L6s({location:hqs,namespaceOverride:s});if(g.schema!=null){let C=Cc({schema:g.schema,context:r,fileContainingReference:E,declarationFile:E,namespace:s,declarationDepth:0});v.type=Vp(C),v.docs=g.description}r.builder.addError(E,{name:A,schema:r.isErrorUnknownSchema(parseInt(h))?{...v,type:"unknown"}:v}),l.errors==null&&(l.errors=[]);let I=r.builder.addImport({file:t,fileToImport:E});l.errors.push(I!=null?`${I}.${A}`:A),v.type!=null&&g.examples?.forEach(C=>{let _={value:rB(C.example),name:C.name,docs:C.description};r.builder.addErrorExample(E,{name:A,example:_})})}),e.examples.length>0&&(l.examples=Cql({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=_ql({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[lxi,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:n}}function xql({endpoint:e,context:t}){return e.security==null?t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0:e.security.length===0?!1:JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function Cql({endpointExamples:e,context:t}){return e.map(r=>{try{return fqs({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function _ql({retries:e}){if(e!=null){if(e.type==="disabled")return{disabled:e.value??void 0};Ie(e)}}function Sql({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:o,pathParameters:s,queryParameters:a,headers:c,usedNames:u,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let p=n.schema.type==="reference"?n.schema.schema:void 0,d=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(d?.type!=="object"||p!=null&&r.isResponseReachable(p)){let I=r.options.respectReadonlySchemas&&uxi(e.method)?"write":void 0,x=Cc({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0,variant:I}),C={schemaIdsToExclude:[],value:{body:x}},_=Object.keys(s??{}).length>0,w=Object.keys(a??{}).length>0,P=Object.keys(c??{}).length>0;return _&&(C.value["path-parameters"]=s),w&&(C.value["query-parameters"]=a),P&&(C.value.headers=c),(_||w||P)&&(C.value.name=i??o),n.contentType!=null&&(C.value["content-type"]=n.contentType),n.description!=null&&(C.value.docs=n.description),C}let f=new Map;for(let E of d.allOf){let I=r.getSchema(E.schema,l);if(I==null)continue;let x=Sse(I),C=_se(x),{properties:_}=QGe(r,E.schema,l);for(let w of _)f.set(w.key,C)}let m=Object.fromEntries(d.properties.filter(E=>E.readonly==null?!0:!(uxi(e.method)&&E.readonly)).map(E=>{let I=f.get(E.key)??t,x=Cc({schema:E.schema,fileContainingReference:t,declarationFile:I,context:r,namespace:l,declarationDepth:1}),C=E.nameOverride??E.key,_=zb(E.availability);if(!u.has(C)&&E.audiences.length<=0)return u.add(C),E.nameOverride!=null?[E.key,{type:Vp(x),docs:NGe(x),name:E.nameOverride,availability:_}]:[E.key,_?{...typeof x=="string"?{type:x}:x,availability:_}:x];let w={type:Vp(x),docs:NGe(x)};return u.has(C)&&(w.name=E.generatedName),E.audiences.length>0&&(w.audiences=E.audiences),_!=null&&(w.availability=_),u.add(C),[E.key,w]})),h=new Set,g=new Set;for(let E of d.allOfPropertyConflicts)E.allOfSchemaIds.forEach(I=>h.add(I)),E.conflictingTypeSignatures&&g.add(E.propertyKey);let A=[];for(let E of d.allOf){let I=Amr({schema:E.schema,context:r,namespace:l});if(I==null||h.has(E.schema)||h.has(I))continue;let x=Cc({schema:Ra.reference(E),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),C=jGe(Vp(x));C!=="unknown"&&A.push(C)}for(let E of h){let I=QGe(r,E,l),x=r.getSchema(E,l),C=x!=null?_se(Sse(x)):t;for(let _ of I.properties)m[_.key]==null&&(g.has(_.key)?m[_.key]="unknown":m[_.key]=Cc({schema:_.schema,fileContainingReference:t,declarationFile:C,context:r,namespace:l,declarationDepth:1}));for(let _ of I.allOf){if(h.has(_.schema))continue;let w=Cc({schema:Ra.reference(_),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),P=jGe(Vp(w));P!=="unknown"&&!A.includes(P)&&A.push(P)}}let b={properties:m};A.length>0&&(b.extends=A),n.additionalProperties&&(b["extra-properties"]=!0);let v={name:i??d.nameOverride??d.generatedName,"path-parameters":s,"query-parameters":a,headers:c,body:b};return n.contentType!=null&&(v["content-type"]=n.contentType),n.description!=null&&(v.docs=n.description),{schemaIdsToExclude:p!=null?[p]:[],value:v}}else if(n.type==="octetStream"){let p={body:"bytes","content-type":n.contentType??Vf.APPLICATION_OCTET_STREAM,"query-parameters":a};return a!=null&&(p.name=i??o),n.description!=null&&(p.docs=n.description),{schemaIdsToExclude:[],value:p}}else if(n.type==="multipart"){let p=Object.fromEntries(n.properties.map(d=>{if(d.schema.type==="file"){let f=d.schema.isArray?"list<file>":"file";if(f=d.schema.isOptional?`optional<${f}>`:f,d.description!=null||d.contentType!=null){let m={type:f};if(d.description!=null&&(m.docs=d.description),d.contentType!=null){let h=d.contentType.split(",")[0];m["content-type"]=h}return[d.key,m]}return[d.key,f]}else{let f=Cc({schema:d.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(d.contentType||d.exploded||d.encoding){let m=typeof f=="string"?{type:f}:f;d.contentType!=null&&(m["content-type"]=d.contentType),d.encoding==="form"?m.style="form":d.encoding==="json"?m.style="json":d.exploded&&(m.style="exploded"),f=m}return[d.key,f]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??o,"path-parameters":s,"query-parameters":a,headers:c,body:{properties:p},"content-type":Vf.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else Ie(n)}function Tql({context:e,request:t}){if(!e.options.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:Ie(t)}}GA();Li();function Oql({location:e,namespaceOverride:t}){return t!=null?{...e,file:QE(Ks.of(t),e.file)}:e}function Bql(e){let t=e.namespace,r=e.tags.filter(c=>c!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:Ks.of(`${Zn(r)}.yml`),endpointId:e.summary!=null?Zn(e.summary):Zn(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:Ks.of(Pf),endpointId:Zn(e.summary)}:{file:Ks.of(Pf),endpointId:Zn(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:Ks.of(Pf),endpointId:n};let i=YCt(r),o=YCt(n);if(jE(i,o))return{file:Ks.of("__package__.yml"),endpointId:r};let s=Dql({operationId:n,tag:r,path:e.path,method:e.method});if(s!=null)return s;let a=[];for(let c=0;c<i.length;++c){let u=i[c];if(u!=null&&u===o[c])a.push(u);else{let l=Zn(r);return{file:Ks.of(`${l}.yml`),endpointId:n,tag:r}}}if(a.length>=o.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:Ks.of(Zn(a.join("_"))+".yml"),endpointId:Zn(o.slice(a.length).join("_")),tag:r}}function XCt(e){let t=e.tags[0];if(e.sdkName!=null){let r=Hwi({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:Ks.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return Oql({namespaceOverride:e.namespace,location:Bql(e)})}function YCt(e){let t;return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)?t=e.split(/(?=[A-Z])/):t=e.split(/[^a-zA-Z0-9]+/),t=t.map(r=>r.toLowerCase()),t=e4(t),t}var Pql=new RegExp("[^a-zA-Z0-9{}]+"),Rql=new RegExp("[{}]","g");function Dql({operationId:e,tag:t,path:r,method:n}){let o=`${r.split(Pql).join("_").replaceAll(Rql,"_")}_${n.toLowerCase()}`;if(e.endsWith(o))return{file:Ks.of(Zn(t)+".yml"),endpointId:Zn(e.slice(0,-1*o.length)),tag:t}}function gqs(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let o of r){let{endpointId:s,file:a,tag:c}=XCt(o),u=a.split(".")[0];u!=null&&t.add(u);let l;if(o.sdkName!=null){let f=e.ir.groups;for(let m of o.sdkName.groupName){let h=typeof m=="string"?m:m.name,g=f[h];if(g==null)break;if(g.summary!=null||g.description!=null){l=f[h];break}}}let p=c==null?void 0:n.tagsById[c];e.setInState(J1.Endpoint),e.setEndpointMethod(o.method);let d=mqs({context:e,endpoint:o,declarationFile:a});e.unsetEndpointMethod(),e.unsetInState(J1.Endpoint),i=[...i,...d.schemaIdsToExclude],e.builder.addEndpoint(a,{name:s,schema:d.value,source:o.source!=null?Tse(o.source):void 0}),(p?.id!=null||p?.description!=null)&&e.builder.setServiceInfo(a,{"display-name":l?.summary??p?.id,docs:l?.description??p?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}GA();function Aqs(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?Ose(r.groupName):void 0,i=Cc({schema:Ra.primitive(r),context:e,fileContainingReference:Ks.of(Pf),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:Vp(i),docs:r.description??void 0}})}}GA();Li();function Eqs(e){for(let t of e.ir.webhooks){let r=Nql({webhook:t,context:e});if(r==null)continue;let n=wmr(t.sdkName,t.namespace),i={};for(let s of t.headers)i[s.name]=bH({header:s,context:e,fileContainingReference:r.file,namespace:n});let o={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:Cc({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),signature:jql(t.signatureVerification),examples:t.examples!=null?t.examples.map(s=>({docs:s.description,name:s.name,payload:rB(s.payload)})):void 0};t.response!=null&&t.response._visit({json:s=>{let a=Cc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o.response={docs:s.description??void 0,type:Vp(a)},s.statusCode!=null&&(o.response["status-code"]=s.statusCode)},file:s=>{o.response={docs:s.description??void 0,type:"file","status-code":s.statusCode}},bytes:s=>{o.response={docs:s.description??void 0,type:"bytes","status-code":s.statusCode}},text:s=>{o.response={docs:s.description??void 0,type:"text","status-code":s.statusCode}},streamingJson:s=>{let a=Cc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:Vp(a),format:"json"}},streamingSse:s=>{let a=Cc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:Vp(a),format:"sse"}},streamingText:s=>{o["response-stream"]={docs:s.description??void 0,type:"text"}},_other:()=>{throw new Error("Unrecognized Response type: "+t.response?.type)}}),e.builder.addWebhook(r.file,{name:r.endpointId,schema:o}),t.description!=null&&(o.docs=t.description)}}function Fql({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:QE(Ks.of(t),e.file)}:e}function kql({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:Ks.of(Pf),endpointId:n};let i=YCt(r),o=YCt(n);if(jE(i,o))return{file:Ks.of("__package__.yml"),endpointId:r};let s=[];for(let a=0;a<i.length;++a){let c=i[a];if(c!=null&&c===o[a])s.push(c);else{let u=Zn(r);return{file:Ks.of(`${u}.yml`),endpointId:n,tag:r}}}if(s.length>=o.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:Ks.of(Zn(s.join("_"))+".yml"),endpointId:Zn(o.slice(s.length).join("_")),tag:r}}function Nql({webhook:e,context:t}){return e.sdkName!=null?{file:M6s({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:Fql({namespaceOverride:e.namespace,location:kql({webhook:e,context:t})})}function jql(e){if(e!=null)switch(e.type){case"hmac":return{type:"hmac",header:e.header,algorithm:Qql(e.algorithm),encoding:yqs(e.encoding),"signature-prefix":e.signaturePrefix,"payload-format":Lql(e.payloadFormat),timestamp:bqs(e.timestamp)};case"asymmetric":return{type:"asymmetric",header:e.header,"asymmetric-algorithm":Mql(e.asymmetricAlgorithm),encoding:yqs(e.encoding),"signature-prefix":e.signaturePrefix,"jwks-url":e.jwksUrl,"key-id-header":e.keyIdHeader,timestamp:bqs(e.timestamp)};default:return}}function Qql(e){if(e!=null)switch(e){case"sha256":return"sha256";case"sha1":return"sha1";case"sha384":return"sha384";case"sha512":return"sha512";default:return}}function yqs(e){if(e!=null)switch(e){case"base64":return"base64";case"hex":return"hex";default:return}}function Mql(e){switch(e){case"rsa-sha256":return"rsa-sha256";case"rsa-sha384":return"rsa-sha384";case"rsa-sha512":return"rsa-sha512";case"ecdsa-sha256":return"ecdsa-sha256";case"ecdsa-sha384":return"ecdsa-sha384";case"ecdsa-sha512":return"ecdsa-sha512";case"ed25519":return"ed25519";default:return"rsa-sha256"}}function Lql(e){if(e!=null)return{components:e.components.map(zql),delimiter:e.delimiter,"body-sort":Uql(e.bodySort)}}function Uql(e){if(e!=null&&e==="alphabetical")return"alphabetical"}function zql(e){switch(e){case"body":return"body";case"timestamp":return"timestamp";case"notification-url":return"notification-url";case"message-id":return"message-id";default:return"body"}}function Vql(e){switch(e){case"unix-seconds":return"unix-seconds";case"unix-millis":return"unix-millis";case"iso8601":return"iso8601";default:return}}function bqs(e){if(e!=null)return{header:e.header,format:e.format!=null?Vql(e.format):void 0,tolerance:e.tolerance}}Pt();function ege(e,t,r){switch(e.type){case"primitive":case"enum":case"literal":case"unknown":return;case"reference":{let n=e.schema;if(r.has(n))return;r.add(n);let i=vqs(n,e.namespace,t);i!=null&&ege(i,t,r);return}case"object":for(let n of e.allOf)if(!r.has(n.schema)){r.add(n.schema);let i=vqs(n.schema,n.namespace,t);i!=null&&ege(i,t,r)}for(let n of e.properties)ege(n.schema,t,r);return;case"array":case"map":case"optional":case"nullable":ege(e.value,t,r);return;case"oneOf":qql(e.value,t,r);return;default:Ie(e)}}function qql(e,t,r){switch(e.type){case"discriminated":for(let n of Object.values(e.schemas))ege(n,t,r);for(let n of e.commonProperties)ege(n.schema,t,r);return;case"undiscriminated":for(let n of e.schemas)ege(n,t,r);return;default:Ie(e)}}function vqs(e,t,r){return t==null?r.rootSchemas[e]:r.namespacedSchemas[t]?.[e]}function H4(e,t,r){ege(e,t,r)}function Iqs(e){let t=new Set,r=new Set,{groupedSchemas:n}=e;for(let i of e.endpoints){if(i.request!=null)switch(i.request.type){case"json":case"formUrlEncoded":H4(i.request.schema,n,t);break;case"multipart":for(let o of i.request.properties)o.schema.type==="json"&&H4(o.schema.value,n,t);break;case"octetStream":break;default:Ie(i.request)}if(i.response!=null)switch(i.response.type){case"json":case"streamingJson":case"streamingSse":H4(i.response.schema,n,r);break;case"file":case"text":case"bytes":case"streamingText":break;default:Ie(i.response)}for(let o of Object.values(i.errors))o.schema!=null&&H4(o.schema,n,r);for(let o of i.pathParameters)H4(o.schema,n,r);for(let o of i.queryParameters)H4(o.schema,n,r);for(let o of i.headers)H4(o.schema,n,r)}for(let i of e.webhooks)H4(i.payload,n,r);for(let i of Object.values(e.channels)){for(let o of i.messages)H4(o.body,n,r);for(let o of i.handshake.queryParameters)H4(o.schema,n,r);for(let o of i.handshake.headers)H4(o.schema,n,r);for(let o of i.handshake.pathParameters)H4(o.schema,n,r)}return{requestReachable:t,responseReachable:r}}function Gql(e){return e.type!=="object"?!1:e.properties.some(t=>t.readonly===!0)}function wqs(e,t){let r=new Set,n=new Set,i=new Set;function o(s){for(let[a,c]of Object.entries(s)){if(!Gql(c))continue;let u=t.requestReachable.has(a),l=t.responseReachable.has(a);u&&l?r.add(a):u&&!l?n.add(a):!u&&l&&i.add(a)}}o(e.groupedSchemas.rootSchemas);for(let s of Object.values(e.groupedSchemas.namespacedSchemas))o(s);return{needsBothVariants:r,requestOnlyWithReadonly:n,responseOnlyWithReadonly:i}}var lxi="external",hqs=Ks.of(Pf);function xqs({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,o]of Object.entries(e)){if(t.has(i))continue;let s=U6s(o);if(n.options.respectReadonlySchemas&&n.needsBothVariants(i)&&o.type==="object"){let u=SPe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:"read"});n.builder.addType(s,{name:u.name??i,schema:u.schema});let l=SPe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:l.name??i,schema:l.schema});continue}if(n.options.respectReadonlySchemas&&n.isRequestOnlyWithReadonly(i)&&o.type==="object"){let u=SPe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:u.name??i,schema:u.schema});continue}let a;n.options.respectReadonlySchemas&&(a=n.isRequestOnly(i)?"write":"read");let c=$6s({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:a});if(che(c.schema)){let u=Vp(c.schema);if(u===(c.name??i)||u===`optional<${c.name??i}>`||u===`nullable<${c.name??i}>`||u===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(s,{name:c.name??i,schema:c.schema})}}function Cqs(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),oqs(e),sqs(e),aqs(e),Y6s(e),Aqs(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(lxi);let t=gqs(e),r=t.sdkGroups;e.setInState(J1.Webhook),Eqs(e),e.unsetInState(J1.Webhook),e.setInState(J1.Channel);for(let i of Object.values(e.ir.channels)){let o=_se(i.groupName);tqs({channel:i,context:e,declarationFile:o})}e.unsetInState(J1.Channel);let n=Wql({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});if(e.options.respectReadonlySchemas){let i=Iqs(e.ir),o=wqs(e.ir,i);e.setVariantPlan(o,i)}xqs({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,o]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))xqs({schemas:o,schemaIdsToExclude:n,namespace:i,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(o=>r.has(o))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.optimizeServiceAuth(),e.builder.build()}function Wql({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return new Set(t);let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(o=>Object.keys(o))]),i=new Set(t);for(let o of n)r.includes(o)||i.add(o);return i}Pt();var ZCt=class{context;constructor(t){this.context=t}};GA();Li();GA();var xmr=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[s,a]of Object.entries(n.files)){let c=i!=null?Ks.of(`${i}${"/"}${s}`):Ks.of(s);t[c]=a}let o=Object.keys(n.directories).sort();for(let s of o){let a=i!=null?`${i}${"/"}${s}`:s,c=n.directories[s];r(c,a)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Ks.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var TPe=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new xmr,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:o}){let s=this.getOrCreateFile(t);s.service==null&&(s.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(s.service.auth=r),n!=null&&(s.service["base-path"]=n),i!=null&&(s.service["display-name"]=i),o!=null&&(s.docs=o)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return W$(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))_qs(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(_qs(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??Zn((p4(r)+"/"+kO(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Ks.of(UE))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=x3e(p4(w3e.of(`/${t}`)),w3e.of(`/${r}`)),i;let o=this.getOrCreateFile(t);return o.imports==null&&(o.imports={}),o.imports[i]=x3e(p4(w3e.of(`/${t}`)),w3e.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===Ks.of(UE))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let o=i.types[r];o!=null&&(typeof o=="string"?i.types[r]={type:o,examples:[n]}:(o.examples==null&&(o.examples=[]),o.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let o=i.errors[r];if(o==null)return;o.examples==null&&(o.examples=[]),(o.examples.some(a=>jE(a,n))??!1)||o.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(o.service.source=i),o.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=QE(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}optimizeServiceAuth(){let t=[this.packageMarkerFile,...Object.values(this.root.getAllFiles())];for(let r of t){if(r.service==null)continue;let n=Object.values(r.service.endpoints);if(n.length===0)continue;if(n.every(o=>o.auth===!0)){r.service.auth=!0;for(let o of Object.values(r.service.endpoints))delete o.auth}}}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,o])=>[i,{...o,path:QE(r,o.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([o,s])=>[o,{...s,path:QE(r,s.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===Pf?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function _qs(e){return e?.header!=null}var Cmr=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;schemaNameMapping=new Map;variantPlan;reachability;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:o,authOverrides:s}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=s,this.globalHeaderOverrides=o,this.options=IPe({options:n}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new TPe(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let a={};if(!this.enableUniqueErrorsPerEndpoint)for(let c of r.endpoints)for(let[u,l]of Object.entries(c.errors)){let p=parseInt(u),d=a[p];d==null&&l.schema!=null?a[p]=l.schema:d!=null&&l.schema!=null&&dN(d,l.schema)||this.unknownSchema.add(p)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.options.onlyIncludeReferencedSchemas&&this.isInAnyState(J1.Channel,J1.Endpoint,J1.Webhook)}markSchemaAsReferenced(t,r){switch(t.type){case"primitive":return;case"object":this.markObjectSchemaAsReferenced(t,r);return;case"array":this.markSchemaAsReferenced(t.value,r);return;case"map":this.markSchemaAsReferenced(t.value,r);return;case"optional":this.markSchemaAsReferenced(t.value,r);return;case"reference":this.markSchemaIdAsReferenced(t.schema,r);return;case"oneOf":this.markOneofSchemaAsReferenced(t.value,r);return;case"nullable":this.markSchemaAsReferenced(t.value,r);return;case"enum":return;case"literal":return;case"unknown":return;default:Ie(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:Ie(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}setSchemaFinalName(t,r){this.schemaNameMapping.set(t,r)}hasReadVariant(t){return this.schemaNameMapping.has(t)}setVariantPlan(t,r){this.variantPlan=t,this.reachability=r;let n=[this.ir.groupedSchemas.rootSchemas,...Object.values(this.ir.groupedSchemas.namespacedSchemas)];for(let i of n)for(let[o,s]of Object.entries(i))if(t.needsBothVariants.has(o)&&s.type==="object"){let a=s.nameOverride??s.generatedName;this.schemaNameMapping.set(a,`${a}Read`)}}needsBothVariants(t){return this.variantPlan?.needsBothVariants.has(t)??!1}isRequestOnlyWithReadonly(t){return this.variantPlan?.requestOnlyWithReadonly.has(t)??!1}isResponseReachable(t){return this.reachability==null?this.ir.nonRequestReferencedSchemas.has(t):this.reachability.responseReachable.has(t)}isRequestOnly(t){return this.reachability==null?!this.ir.nonRequestReferencedSchemas.has(t):this.reachability.requestReachable.has(t)&&!this.reachability.responseReachable.has(t)}getSchemaFinalName(t,r){return!this.options.respectReadonlySchemas||r==="write"?t:this.schemaNameMapping.get(t)??t}};function pxi(e){let t=new Cmr(e);return Cqs(t)}GA();function zqs(e){return typeof e>"u"||e===null}function $ql(e){return typeof e=="object"&&e!==null}function Hql(e){return Array.isArray(e)?e:zqs(e)?[]:[e]}function Kql(e,t){var r,n,i,o;if(t)for(o=Object.keys(t),r=0,n=o.length;r<n;r+=1)i=o[r],e[i]=t[i];return e}function Jql(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function Yql(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Xql=zqs,Zql=$ql,eGl=Hql,tGl=Jql,rGl=Yql,nGl=Kql,Mx={isNothing:Xql,isObject:Zql,toArray:eGl,repeat:tGl,isNegativeZero:rGl,extend:nGl};function Vqs(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
|
|
1545
1545
|
|
|
@@ -1578,7 +1578,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
1578
1578
|
`);s.push(c)}return s.push(""),s}),""].join(`
|
|
1579
1579
|
`);try{KGe.writeFileSync(n,i,"utf8"),this.logger.info(`Missing examples report written to: ${n}`)}catch(o){this.logger.warn(`Failed to write missing examples report to ${n}:`,String(o))}}finalize(){}convertExampleToJson(t){switch(t.type){case"primitive":return t.value;case"array":return t.value.map(r=>this.convertExampleToJson(r));case"object":{let r={};return Object.entries(t.properties).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"map":{let r={};return t.value.forEach(n=>{r[String(n.key)]=this.convertExampleToJson(n.value)}),r}case"oneOf":if(t.value.type==="undiscriminated")return this.convertExampleToJson(t.value.value);{let r={};return Object.entries(t.value.value).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"enum":return t.value;case"literal":return t.value;case"null":return null;case"unknown":return this.convertExampleToJson(t.value);default:return t}}getSchemaDescription(t){if("description"in t)return t.description}getSchemaTypeName(t){switch(t.type){case"primitive":return`primitive (${t.schema.type})`;case"object":return t.generatedName||"object";case"array":return"array";case"map":return"map";case"optional":return`optional (${this.getSchemaTypeName(t.value)})`;case"nullable":return`nullable (${this.getSchemaTypeName(t.value)})`;case"reference":return t.generatedName||"reference";case"enum":return t.generatedName||"enum";case"literal":return"literal";case"oneOf":return"oneOf";case"unknown":return"unknown";default:return"unknown"}}buildEndpointExample(t){let r=K7l(t.request),n=J7l(t.response);if(r?.type==="unsupported"||n?.type==="unsupported")return[];let i=[];if(r!=null&&r.type==="present"){let p=this.isSchemaRequired(r.schema);if(r.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:Fxi(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});d!=null?(i.push([void 0,d]),this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(r.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(r.schema)})}else for(let{name:d,value:f}of r.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:Fxi(t.method),schema:r.schema,exampleId:d,example:f,options:{isParameter:!1,ignoreOptionals:!0}});m!=null?i.push([d,m]):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(r.schema)})}if(p&&i.length===0)return this.logger.trace(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let o=[];if(n!=null&&n.type==="present"){let p=this.isSchemaRequired(n.schema);if(n.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:void 0,example:void 0,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});d!=null?(t.response?.type==="json"?o.push([void 0,W4.withoutStreaming(d)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,W4.withStreaming({sse:t.response?.type==="streamingSse",events:[d]})]),this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(n.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(n.schema)})}else for(let{name:d,value:f}of n.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:d,example:f,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});m!=null?t.response?.type==="json"?o.push([d,W4.withoutStreaming(m)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,W4.withStreaming({sse:t.response?.type==="streamingSse",events:[m]})]):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(n.schema)})}if(p&&o.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let s=[];for(let p of t.pathParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!Lq(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for path parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&s.push({name:p.name,parameterNameOverride:p.parameterNameOverride,value:f})}let a=[];for(let p of t.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!Lq(f)&&f.type!=="array"&&(this.logger.debug(`Expected a primitive or array example but got ${f.type} for query parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&a.push({name:p.name,value:f})}let c=[];for(let p of t.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!Lq(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for header ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&c.push({name:p.name,value:f})}for(let p of this.globalHeaders){let d=p.schema!=null?Mq(p.schema):kr.primitive({nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,schema:Qi.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})}),f=this.exampleTypeFactory.buildExample({schema:d,exampleId:void 0,example:void 0,options:{name:p.header,isParameter:!0,ignoreOptionals:!0}});f!=null&&!Lq(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for global header ${p.header} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),f!=null&&c.push({name:p.header,value:f})}let u=[];t.request!=null&&t.response!=null?u=H7l(i,o):t.request!=null?u=i.map(([p,d])=>({id:p,request:d,response:void 0})):t.response!=null&&(u=o.map(([p,d])=>({id:p,request:void 0,response:d})));let l=t.examples.filter(p=>f_t(p)).flatMap(p=>{if(p.type==="unknown"){if(p.value!=null){let d=p.value["code-samples"];if(d!=null)return this.convertCodeSamples(d)}return}else return p.codeSamples}).filter(p=>Pa(p));return u.length===0?[G4.full({name:void 0,description:void 0,pathParameters:s,queryParameters:a,headers:c,request:void 0,response:void 0,codeSamples:l})]:u.map(({id:p,request:d,response:f})=>G4.full({name:p,description:void 0,pathParameters:s,queryParameters:a,headers:c,request:d,response:f,codeSamples:l}))}convertCodeSamples(t){return t.map(r=>"language"in r?fH.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):fH.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?m_.Csharp:r.sdk,code:r.code})).filter(Pa)}isSchemaRequired(t){return zmr(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function H7l(e,t){let r=[];if(e.length<=1){let[i,o]=e[0]??[];if(t.length===0)return r.push({id:i,request:o,response:void 0}),r;for(let[s,a]of t)r.push({id:s??i,request:o,response:a});return r}if(t.length<=1){let[i,o]=t[0]??[];if(t.length===0)return r.push({id:i,request:void 0,response:o}),r;for(let[s,a]of e)r.push({id:s??i,request:a,response:o});return r}let n=new Set;for(let[i,o]of e){let s=t.find(([c])=>c==null)?.[1]??t[0]?.[1];if(i==null){if(s==null)continue;r.push({id:void 0,request:o,response:s});continue}let a=!1;for(let c=0;c<t.length;c++){let[u,l]=t[c];u==null||n.has(c)||i===u&&(r.push({id:i,request:o,response:l}),u!=null&&n.add(c),a=!0)}!a&&s!=null&&r.push({id:i,request:o,response:s})}for(let i=0;i<t.length;i++){if(n.has(i))continue;let[o,s]=t[i],a=e.find(([c])=>c==null)?.[1]??e[0]?.[1];a!=null&&r.push({id:o,request:a,response:s})}return r}function K7l(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:Y7l(e),examples:[]}:e.type==="json"||e.type==="formUrlEncoded"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function J7l(e){if(e!=null)return e.type!=="json"&&e.type!=="streamingJson"&&e.type!=="streamingSse"?{type:"unsupported"}:{type:"present",schema:e.schema,examples:e.fullExamples??[]}}function Lq(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return Lq(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undiscriminated":return Lq(e.value.value);default:return!1}case"null":return!0;default:Ie(e)}}function Y7l(e){return kr.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:Mq(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0,readonly:void 0,writeonly:void 0,inline:void 0}).filter(Pa),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,encoding:void 0,source:e.source,inline:void 0,minProperties:void 0,maxProperties:void 0})}var JGe=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new age(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,handshake:n,source:i,namespace:o}){let s=[];for(let a of r){let c=[];for(let p of n.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.queryParameters?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!Lq(f)&&(f=void 0),!(d&&f==null)&&f!=null&&c.push({name:p.name,value:f})}let u=[];for(let p of n.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.headers?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!Lq(f)&&(f=void 0),!(d&&f==null)&&f!=null&&u.push({name:p.name,value:f})}let l=[];for(let p of a.messages){let d=t.getExampleMessageReference(p),f=t.resolveMessageReference({$ref:d}),m=Qn(f.payload)?t.resolveSchemaReference(f.payload):f.payload,h=this.exampleTypeFactory.buildExample({schema:oc(m,!1,!1,t,[p.messageId],i,o),exampleId:void 0,example:p.value,options:{isParameter:!1,ignoreOptionals:!0}});h!=null&&l.push({messageType:p.type,payload:h,description:void 0})}s.push({name:a.summary,queryParameters:c,headers:u,description:a.description,messages:l})}return s}buildWebsocketSessionExample({handshake:t,messages:r}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},i=[];for(let s of t.queryParameters){let a=this.isSchemaRequired(s.schema),c=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!Lq(c)&&(c=void 0),a&&c==null)return;c!=null&&i.push({name:s.name,value:c})}let o=[];for(let s of t.headers){let a=this.isSchemaRequired(s.schema),c=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!Lq(c)&&(c=void 0),a&&c==null)return;c!=null&&o.push({name:s.name,value:c})}for(let s of r){let a=this.exampleTypeFactory.buildExample({schema:s.payload,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});a!=null&&n.messages.push({messageType:s.type,payload:a,description:void 0})}return n}isSchemaRequired(t){return zmr(this.getResolvedSchema(t))}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}};var YA={FERN_PARAMETER_OPTIONAL:"x-fern-optional",FERN_CHANNEL_ADDRESS:"x-fern-address",FERN_DISPLAY_NAME:"x-fern-display-name",FERN_SDK_GROUP_NAME:"x-fern-sdk-group-name",FERN_SDK_METHOD_NAME:"x-fern-sdk-method-name",FERN_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path",FERN_ENUM:"x-fern-enum",IGNORE:"x-fern-ignore",FERN_PARAMETER_NAME:"x-fern-parameter-name",FERN_SERVER_NAME:"x-fern-server-name"};function qmr(e){return jr(e,YA.FERN_EXAMPLES)??[]}function Gmr(e,t){return t.includes("://")?t:`${e}://${t}`}function Wmr(e){return e.startsWith("/")?e:"/"+e}function p9s({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let o={},s={};for(let[u,l]of Object.entries(i.components?.schemas??{})){let p=oc(l,!1,!1,e,[u],r,e.namespace);o[u]=p}let a=new JGe(o,e),c={};for(let[u,l]of Object.entries(i.servers??{})){let p=jr(l,YA.FERN_SERVER_NAME);c[u]={name:p??u,url:Gmr(l.protocol,l.url)}}for(let[u,l]of Object.entries(i.channels??{})){let p=jr(l,YA.IGNORE);if(p!=null&&p){e.logger.debug(`Channel ${u} is marked with x-fern-ignore. Skipping.`);continue}let d=[];if(l.parameters!=null)for(let[A,b]of Object.entries(l.parameters??{})){let v=jr(b,YA.FERN_PARAMETER_NAME);d.push({name:A,description:b.description,parameterNameOverride:v,schema:b.schema!=null?oc(b.schema,!1,!1,e,t,r,e.namespace):kr.primitive({schema:Qi.string({default:void 0,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:void 0}),description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:gw(b),source:r,explode:void 0,clientDefault:void 0})}let f=[],m=[];if(l.bindings?.ws!=null){if(l.bindings.ws.headers!=null){let A=l.bindings.ws.headers.required??[];for(let[b,v]of Object.entries(l.bindings.ws.headers.properties??{})){if(Qn(v)){let C=e.resolveSchemaReference(v),_=A.includes(b),[w,P]=e.options.coerceOptionalSchemasToNullable?[!1,!_]:[!_,!1];f.push({name:b,schema:_M(v,w,P,e,t,void 0,r,e.namespace),description:C.description,parameterNameOverride:void 0,env:void 0,availability:gw(C),source:r,clientDefault:void 0});continue}let E=A.includes(b),[I,x]=e.options.coerceOptionalSchemasToNullable?[!1,!E]:[!E,!1];f.push({name:b,schema:oc(v,I,x,e,[...t,b],r,e.namespace),description:v.description,parameterNameOverride:void 0,env:void 0,availability:gw(v),source:r,clientDefault:void 0})}}if(l.bindings.ws.query!=null){let A=l.bindings.ws.query.required??[];for(let[b,v]of Object.entries(l.bindings.ws.query.properties??{})){if(Qn(v)){let C=e.resolveSchemaReference(v),_=A.includes(b),[w,P]=e.options.coerceOptionalSchemasToNullable?[!1,!_]:[!_,!1];m.push({name:b,schema:_M(v,w,P,e,t,void 0,r,e.namespace),description:C.description,parameterNameOverride:void 0,availability:gw(C),source:r,explode:void 0,clientDefault:void 0});continue}let E=A.includes(b),[I,x]=e.options.coerceOptionalSchemasToNullable?[!1,!E]:[!E,!1];m.push({name:b,schema:oc(v,I,x,e,[...t,b],r,e.namespace),description:v.description,parameterNameOverride:void 0,availability:gw(v),source:r,explode:void 0,clientDefault:void 0})}}}let h;l.publish!=null&&("oneOf"in l.publish.message?h=u9s({generatedName:l.publish.operationId??"PublishEvent",event:l.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):h=l9s({action:"Publish",channelPath:u,message:l.publish.message,context:e,source:r}));let g;if(l.subscribe!=null&&("oneOf"in l.subscribe.message?g=u9s({generatedName:l.subscribe.operationId??"SubscribeEvent",event:l.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):g=l9s({action:"Subscribe",channelPath:u,message:l.subscribe.message,context:e,source:r})),f.length>0||m.length>0||h!=null||g!=null){let A=qmr(l),b=[];if(A.length>0)b=a.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:A,handshake:{headers:f,queryParameters:m},source:r,namespace:e.namespace});else{let x=[];h!=null&&x.push({type:"publish",payload:h}),g!=null&&x.push({type:"subscribe",payload:g});let C=a.buildWebsocketSessionExample({handshake:{headers:f,queryParameters:m},messages:x});C!=null&&b.push(C)}let v=jr(l,YA.FERN_CHANNEL_ADDRESS),E=v??Wmr(u),I=[];h!=null&&I.push({origin:"client",name:"publish",displayName:l.publish!=null?jr(l.publish,YA.FERN_DISPLAY_NAME):void 0,body:pd(h),methodName:l.publish!=null?jr(l.publish,YA.FERN_SDK_METHOD_NAME):void 0}),g!=null&&I.push({origin:"server",name:"subscribe",displayName:l.subscribe!=null?jr(l.subscribe,YA.FERN_DISPLAY_NAME):void 0,body:pd(g),methodName:l.subscribe!=null?jr(l.subscribe,YA.FERN_SDK_METHOD_NAME):void 0}),s[u]={audiences:jr(l,Rn.AUDIENCES)??[],handshake:{headers:f.map(x=>({...x,schema:pd(x.schema),env:x.env})),queryParameters:m.map(x=>({...x,schema:pd(x.schema)})),pathParameters:d.map(x=>({...x,schema:pd(x.schema)}))},groupName:e.resolveGroupName([jr(l,YA.FERN_SDK_GROUP_NAME)??u]),messages:I,servers:(l.servers?.map(x=>c[x])??Object.values(c)).filter(x=>x!=null&&x.name!=null).map(x=>({...x,name:x.name})),summary:jr(l,YA.FERN_DISPLAY_NAME),connectMethodName:jr(l,YA.FERN_SDK_METHOD_NAME),path:E,description:l.description,examples:b,source:r}}}return{groupedSchemas:HGe(e.namespace,o),channels:s??void 0,servers:Object.values(c).map(u=>({...u,name:u.name})),basePath:jr(i,YA.BASE_PATH)}}function u9s({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:o,asyncApiOptions:s}){if("oneOf"in t.message&&t.message.oneOf!=null){let a=[],c=[];for(let u of t.message.oneOf){let l,p={type:"notFound"};if(Qn(u)){let d=r.resolveMessageReference(u);!Qn(d.payload)&&s.naming==="v2"?(p=d.name?{type:"name",name:d.name}:p,l={...d.payload,title:d.name??d.payload.title,description:d.name??d.payload.description}):l=d.payload}else l=u;c.push(p),a.push(l)}return oge({description:t.description??t.message.description,availability:gw(t.message),subtypes:a,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsOptional:!1,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypeSuffixOverrides:s.naming==="v2"?c:[]})}}function l9s({action:e,channelPath:t,message:r,context:n,source:i}){if(r.payload!=null){let o=r.payload;return Qn(r.payload)&&(o=n.resolveSchemaReference(r.payload)),oc(o,!1,!1,n,[t,e],i,n.namespace)}}var $mr=class extends $Ge{getExampleMessageReference(t){let r=t.channelId??this.getDefaultChannelId();if(r==null)throw new Error("Cannot resolve example message reference: no channelId provided and no channels found in document");return`#/channels/${r}/messages/${t.messageId}`}getDefaultChannelId(){return Object.keys(this.document.channels??{})[0]}resolveParameterReference(t){let r="#/components/parameters/";if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve ${t.$ref}`);let n=t.$ref.substring(r.length),i=this.document.components.parameters[n];if(i==null)throw new Error(`${t.$ref} is undefined`);return"$ref"in i?this.resolveParameterReference(i):i}resolveMessageReference(t,r=!1){let n="#/channels/",i="#/components/messages/";if(t==null)throw new Error("Cannot resolve message reference: message is null or undefined");if(!t.$ref)throw new Error("Cannot resolve message reference: message.$ref is undefined or empty");if(t.$ref.startsWith(n)){let c=t.$ref.split("/"),u=c[2],l=c[4],p=u?.replace(/~1/g,"/").replace(/~0/g,"~");if(p==null||l==null||!this.document.channels?.[p])throw new Error(`Failed to resolve message reference ${t.$ref} in channel ${p}`);let f=this.document.channels[p].messages?.[l];if(f==null)throw new Error(`${t.$ref} is undefined`);return"$ref"in f&&!r?this.resolveMessageReference(f):{...f,name:l}}let o=this.document.components;if(!t.$ref.startsWith(i)||!o?.messages)throw new Error(`Failed to resolve message reference: ${t.$ref} in v3 components`);let s=t.$ref.substring(i.length),a=o.messages[s];if(a==null)throw new Error(`${t.$ref} is undefined`);return{...a,name:s}}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}};Pt();Li();var f9s="#/channels/",d9s="#/servers/",kxi="$message.";function h9s({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){Lmr();let o={},s={},a={},c=[],u={};e.logger.debug("Parsing V3 AsyncAPI...");let l=vH();for(let[C,_]of Object.entries(i.components?.schemas??{})){let w=l.getUniqueSchemaId(C,e.logger,e.options.resolveSchemaCollisions);o[w]=oc(_,!1,!1,e,[w],r,e.namespace)}for(let[C,_]of Object.entries(i.channels??{}))if(s[C]||(s[C]={}),_.messages)for(let[w,P]of Object.entries(_.messages))if(a[w]||(a[w]=[]),e.isReferenceObject(P)){let z=e.resolveMessageReference(P);a[w].push({channelId:C,payload:z.payload})}else e.isMessageWithPayload(P)&&a[w].push({channelId:C,payload:P.payload});for(let[C,_]of Object.entries(a))if(_.length===1){let w=_[0],P=w.channelId;s[P]=s[P]||{},s[P][C]=oc(w.payload,!1,!1,e,[C],r,e.namespace)}else{c.push(C);for(let{channelId:w,payload:P}of _){let z=`${w}_${C}`;s[w]||(s[w]={}),s[w][z]=oc(P,!1,!1,e,[z],r,e.namespace)}}let p={},d=vH();for(let[C,_]of Object.entries(s))for(let[w,P]of Object.entries(_)){let z=d.getUniqueSchemaId(w,e.logger,e.options.resolveSchemaCollisions);p[z]=P}let f=new JGe({...o,...p},e),m={};for(let[C,_]of Object.entries(i.servers??{})){let w=jr(_,YA.FERN_SERVER_NAME);m[C]={name:w??C,url:Gmr(_.protocol,_.host)}}let h={},g=Object.keys(i.channels??{});for(let[C,_]of Object.entries(i.operations??{})){if(jr(_,YA.IGNORE))continue;let w;if(_.channel==null||!("$ref"in _.channel)||_.channel.$ref==null)if(g.length===1&&g[0]!=null)w=g[0];else continue;else w=Z7l(_);h[w]||(h[w]={subscribe:[],publish:[],__parsedMessages:[]});let P=jr(_,YA.FERN_SDK_METHOD_NAME),z=jr(_,YA.FERN_DISPLAY_NAME);if(!_.messages||!Array.isArray(_.messages))continue;let q=_.messages.filter(X=>X!=null&&X.$ref!=null).map(X=>({ref:X,methodName:P,displayName:z})),V=h[w];if(V==null)throw new Error(`Internal error: channelEvents["${w}"] is unexpectedly undefined for operation ${C}`);if(_.action==="receive")V.subscribe.push(...q);else if(_.action==="send")V.publish.push(...q);else throw new Error(`Operation ${C} has an invalid action: ${_.action}`)}for(let[C,_]of Object.entries(h)){let w=[];w.push(...m9s({messages:_.subscribe,channelPath:C,origin:"server",messageSchemas:s[C]??{},duplicatedMessageIds:c,context:e})),w.push(...m9s({messages:_.publish,channelPath:C,origin:"client",messageSchemas:s[C]??{},duplicatedMessageIds:c,context:e})),h[C]!=null&&(h[C].__parsedMessages=w)}for(let[C,_]of Object.entries(i.channels??{})){if(jr(_,YA.IGNORE))continue;let w=[],P=[],z=[];if(_.parameters!=null)for(let[q,V]of Object.entries(_.parameters)){let X=e.isReferenceObject(V)?e.resolveParameterReference(V):V,{type:ae,parameterKey:G}=X.location!=null?eWl(X.location):{type:_.address?.includes(`={${q}}`)?"query":"path",parameterKey:q},Y=jr(X,YA.FERN_PARAMETER_OPTIONAL),Ce=ku(Zn(C))+ku(Zn(q)),Te=X.schema!=null?Qn(X.schema)?_M(X.schema,!1,!1,e,[G],void 0,r,e.namespace):oc(X.schema,!1,!1,e,[G],r,e.namespace):oc({...X,type:"string",title:Ce,example:X.examples?.[0],default:X.default,enum:X.enum,required:void 0},!1,!1,e,[G],r,e.namespace),te=Y?kr.optional({value:Te,description:void 0,availability:void 0,generatedName:"",title:Ce,namespace:void 0,groupName:void 0,nameOverride:void 0,inline:void 0}):Te,Z={name:G,description:X.description,parameterNameOverride:void 0,schema:te,variableReference:void 0,availability:gw(V),source:r,explode:void 0,clientDefault:void 0};ae==="header"?w.push({...Z,env:void 0}):ae==="path"?P.push(Z):(ae==="payload"||ae==="query")&&z.push(Z)}if(_.bindings?.ws?.query!=null){let q=new Set(z.map(X=>X.name)),V=new Set(_.bindings.ws.query.required??[]);for(let[X,ae]of Object.entries(_.bindings.ws.query.properties??{})){if(q.has(X))continue;if(Qn(ae)){let Te=e.resolveSchemaReference(ae),te=V.has(X),[Z,Ee]=e.options.coerceOptionalSchemasToNullable?[!1,!te]:[!te,!1];z.push({name:X,schema:_M(ae,Z,Ee,e,[C,X],void 0,r,e.namespace),description:Te.description,parameterNameOverride:void 0,availability:gw(Te),source:r,explode:void 0,clientDefault:void 0});continue}let G=V.has(X),[Y,Ce]=e.options.coerceOptionalSchemasToNullable?[!1,!G]:[!G,!1];z.push({name:X,schema:oc(ae,Y,Ce,e,[C,X],r,e.namespace),description:ae.description,parameterNameOverride:void 0,availability:gw(ae),source:r,explode:void 0,clientDefault:void 0})}}if(_.bindings?.ws?.headers!=null){let q=new Set(w.map(X=>X.name)),V=new Set(_.bindings.ws.headers.required??[]);for(let[X,ae]of Object.entries(_.bindings.ws.headers.properties??{})){if(q.has(X))continue;if(Qn(ae)){let Te=e.resolveSchemaReference(ae),te=V.has(X),[Z,Ee]=e.options.coerceOptionalSchemasToNullable?[!1,!te]:[!te,!1];w.push({name:X,schema:_M(ae,Z,Ee,e,[C,X],void 0,r,e.namespace),description:Te.description,parameterNameOverride:void 0,env:void 0,availability:gw(Te),source:r,clientDefault:void 0});continue}let G=V.has(X),[Y,Ce]=e.options.coerceOptionalSchemasToNullable?[!1,!G]:[!G,!1];w.push({name:X,schema:oc(ae,Y,Ce,e,[C,X],r,e.namespace),description:ae.description,parameterNameOverride:void 0,env:void 0,availability:gw(ae),source:r,clientDefault:void 0})}}if(w.length>0||z.length>0||h[C]!=null&&(h[C].publish!=null||h[C].subscribe!=null)){let q=qmr(_),V=h[C]?.__parsedMessages??[],X=[];try{if(q.length>0)X=f.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:q,handshake:{headers:w,queryParameters:z},source:r,namespace:e.namespace});else{let Te=[],{examplePublishMessage:te,exampleSubscribeMessage:Z}=rWl({messages:V,messageSchemas:s[C]??{}});te!=null&&Te.push(te),Z!=null&&Te.push(Z);let Ee=f.buildWebsocketSessionExample({handshake:{headers:w,queryParameters:z},messages:Te});Ee!=null&&X.push(Ee)}}catch(Te){e.logger.warn(`Failed to build examples for channel ${C}: ${Ai(Te)}`)}let ae=jr(_,YA.FERN_SDK_GROUP_NAME),G=jr(_,YA.FERN_SDK_METHOD_NAME),Y=(_.servers?.map(Te=>tWl(m,Te))??Object.values(m)).map(Te=>({...Te,name:Te.name})),Ce=_.address?.split("?")[0]??Wmr(C);u[C]={audiences:jr(_,Rn.AUDIENCES)??[],handshake:{headers:w.map(Te=>({...Te,schema:pd(Te.schema),env:Te.env})),queryParameters:z.map(Te=>({...Te,schema:pd(Te.schema)})),pathParameters:P.map(Te=>({...Te,parameterNameOverride:void 0,schema:pd(Te.schema)}))},groupName:e.resolveGroupName(typeof ae=="string"?[ae]:ae??[C]),messages:V,summary:jr(_,YA.FERN_DISPLAY_NAME),connectMethodName:G,servers:Y,path:Ce,description:_.description,examples:X,source:r}}else e.logger.warn(`Skipping AsyncAPI channel ${C} as it does not qualify for inclusion (no headers, query params, or operations)`)}let A={...o,...p},b={},v=vH();for(let[C,_]of Object.entries(A)){let w=v.getUniqueSchemaId(C,e.logger,e.options.resolveSchemaCollisions);b[w]=pd(_)}let E=HGe(e.namespace,o),I=Object.values(m).map(C=>({...C,name:C.name})),x=jr(i,YA.BASE_PATH);return{groupedSchemas:E,channels:u,servers:I,basePath:x}}function X7l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Z7l(e){if(!e.channel)throw new Error("Operation is missing required 'channel' field");if(!e.channel.$ref)throw new Error("Operation channel is missing required '$ref' field");if(!e.channel.$ref.startsWith(f9s))throw new Error(`Failed to resolve channel path from operation ${e.channel.$ref}`);return X7l(e.channel.$ref.substring(f9s.length))}function eWl(e){try{let[t,r]=e.split("#/");if(t==null||r==null)throw new Error(`Invalid location format: ${e}; unable to parse message type and parameter key`);if(!t.startsWith(kxi))throw new Error(`Invalid location format: ${e}; expected ${kxi} prefix`);let n=t.substring(kxi.length);if(n!=="header"&&n!=="path"&&n!=="payload")throw new Error(`Invalid message type: ${n}. Must be one of: header, path, payload`);return{type:n,parameterKey:r}}catch{throw new Error(`Invalid location format: ${e}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`)}}function tWl(e,t){if(!t.$ref.startsWith(d9s))throw new Error(`Failed to resolve server name from server ref ${t.$ref}`);let r=t.$ref.substring(d9s.length),n=e[r];if(n==null)throw new Error(`Failed to find server with name ${r}`);return n}function m9s({messages:e,channelPath:t,origin:r,messageSchemas:n,duplicatedMessageIds:i,context:o}){let s=[];return e.forEach((a,c)=>{try{let l=o.resolveMessageReference(a.ref,!0).name;i.includes(l)&&(l=`${t}_${l}`);let p=n[l];p!=null&&s.push({origin:r,name:l??`${r}Message${c+1}`,displayName:a.displayName,body:pd(p),methodName:a.methodName})}catch(u){o.logger.warn(`Skipping message reference ${a.ref.$ref} in channel ${t}: ${Ai(u)}`)}}),s}function rWl({messages:e,messageSchemas:t}){let r=e.find(s=>s.origin==="client")?.name,n=e.find(s=>s.origin==="server")?.name,i=r!=null?t[r]:void 0,o=n!=null?t[n]:void 0;return{examplePublishMessage:i!=null&&r!=null?{type:r,payload:i}:void 0,exampleSubscribeMessage:o!=null&&n!=null?{type:n,payload:o}:void 0}}function g9s({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:o}){let s=[];if(o!=null&&s.push(o),parseFloat(e.asyncapi)<3){let a=e;a.tags?.[0]!=null?s.push(a.tags[0].name):i.naming!=="v2"&&s.push("websocket");let c=new Umr({document:a,taskContext:t,options:r,namespace:o});return p9s({context:c,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}else{let a=e,c=new $mr({document:a,taskContext:t,options:r,namespace:o});return h9s({context:c,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}}Pt();Li();Li();function A9s(e){return jr(e,Rn.ASYNC_CONFIG)}var y9s="$request.";function b9s(e){let t=jr(e,Rn.STREAMING);if(t!=null)return typeof t=="boolean"?t?{type:"stream",format:"json",terminator:void 0}:void 0:t["stream-condition"]==null&&t.format!=null?{type:"stream",format:t.format,terminator:t.terminator}:{type:"streamCondition",format:t.format??"json",terminator:t.terminator,streamDescription:t["stream-description"],streamConditionProperty:nWl(t["stream-condition"]),streamRequestName:t["stream-request-name"],responseStream:t["response-stream"],response:t.response}}function nWl(e){return e.startsWith(y9s)?e.slice(y9s.length):e}function E9s(e){let t=e;if(t.cursor!=null)return Qx.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});let r=e;if("next_uri"in r)return Qx.uri({nextUri:r.next_uri,results:r.results});let n=e;if("next_path"in n)return Qx.path({nextPath:n.next_path,results:n.results});if("offset"in e){let i=e;return Qx.offset({offset:i.offset,results:i.results,step:i.step,hasNextPage:i["has-next-page"]})}if("type"in e&&e.type==="custom"){let i=e;return Qx.custom({results:i.results})}throw new Error("Invalid pagination extension")}function v9s(e,t){let r=jr(t,Rn.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=jr(e,Rn.PAGINATION);if(typeof n=="boolean")throw new Error("Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.");return n==null?void 0:E9s(n)}return E9s(r)}}function I9s(e,t){for(let r of Object.keys(e))if(r.includes("text/event-stream")){let n=e[r];if(n==null)continue;let i=n,o=n.schema??i.itemSchema;return{contentType:r,schema:o??{},examples:YGe(n,t)}}}function w9s(e){let t=Object.keys(e);return t.length===1&&t[0]!=null&&t[0].includes("text/event-stream")}function iWl(e){return e.includes("json")||e==="*/*"}function Nxi({content:e,context:t}){for(let[r,n]of Object.entries(e))if(Hmr({mediaType:r,mediaTypeObject:n,context:t})!=null)return[r,n]}function Hmr({mediaType:e,mediaTypeObject:t,context:r}){if(!iWl(e))return;let n=t.schema;return{contentType:e.includes("*")?void 0:e,schema:n??{},examples:YGe(t,r)}}function d_t({content:e,context:t}){let r=Nxi({content:e,context:t});if(!r)return;let[n,i]=r;return Hmr({mediaType:n,mediaTypeObject:i,context:t})}function x9s(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:YGe(n,t)}}}function YGe(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=jr(e,X1.EXAMPLES);return n!=null&&Object.keys(n).length>0&&r.push(...Object.entries(n).map(([i,o])=>({name:o.summary??i,value:o.value,description:o.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([i,o])=>{let s=Qn(o)?t.resolveExampleReference(o):o;return{name:s.summary??i,value:s.value,description:s.description}})),r}Pt();Pt();function C9s(e){let t=oWl(e),r={};return jxi({obj:t,occurrences:r,breadcrumbs:[]}),r}function jxi({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)jxi({obj:n,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let n=e.$ref;t[n]==null?t[n]=1:t[n]+=1;return}for(let n in e)jxi({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function oWl(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?m_t(r.get):void 0,put:r?.put!=null?m_t(r.put):void 0,post:r?.post!=null?m_t(r.post):void 0,patch:r?.patch!=null?m_t(r.patch):void 0,delete:r?.delete!=null?m_t(r.delete):void 0}]))}}function m_t(e){return{...e,requestBody:e.requestBody!=null?Qn(e.requestBody)?e.requestBody:sWl(e.requestBody):void 0}}function sWl(e){let t,r;for(let n in e.content){let i=Vf.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[Vf.MULTIPART_FORM_DATA]:r}}:e}var Kmr=class{endpoints;parser=new nse;constructor({context:t,options:r}){this.endpoints=r.filter?.endpoints?new Set(this.validateAndFilterEndpoints({context:t,endpoints:r.filter.endpoints})):void 0}skipEndpoint({method:t,path:r}){return this.endpoints!=null&&!this.endpoints.has(`${t} ${r}`)}hasEndpoints(){return this.endpoints!=null}validateAndFilterEndpoints({context:t,endpoints:r}){let n=[];for(let i of r){let o=this.parser.tryParse(i);if(o==null){t.logger.debug(`Ignoring configured filter endpoint "${i}"; expected format "POST /users/get"`);continue}n.push(`${o.method} ${o.path}`)}return n}};var _9s="#/components/parameters/",S9s="#/components/responses/",T9s="#/components/examples/",O9s="#/components/requestBodies/",B9s="#/components/securitySchemes/",XGe=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;schemaNamespaceMapping;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=C9s(t),this.options=i,this.source=o,this.filter=new Kmr({context:r,options:i}),this.DUMMY=this.getDummy(),this.namespace=s,this.schemaNamespaceMapping=this.buildSchemaNamespaceMapping()}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};r.push(n)}return r.concat(t??[])}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveSchemaReference(t){let r=t.$ref.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return{"x-fern-type":"unknown"};if(Array.isArray(n)){let o=parseInt(i,10);if(isNaN(o)||o<0||o>=n.length)return{"x-fern-type":"unknown"};n=n[o]}else n=n[i]}return n==null?(this.logger.debug(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(Qn(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(_9s))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(_9s.length),n=this.document.components.parameters[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Qn(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(O9s))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(O9s.length),n=this.document.components.requestBodies[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Qn(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(S9s))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(S9s.length),n=this.document.components.responses[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Qn(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(T9s))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(T9s.length),n=this.document.components.examples[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Qn(n)?this.resolveExampleReference(n):n}resolveSecuritySchemeReference(t){if(this.document.components==null||this.document.components.securitySchemes==null||!t.$ref.startsWith(B9s))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(B9s.length),n=this.document.components.securitySchemes[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Qn(n)?this.resolveSecuritySchemeReference(n):n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}getNamespace(t){return this.schemaNamespaceMapping?.get(t)}buildSchemaNamespaceMapping(){let t=new Map;if(!this.document.components?.schemas)return t;for(let[r,n]of Object.entries(this.document.components.schemas))!n||Qn(n)||t.set(r,jr(n,Rn.SDK_NAMESPACE)||this.namespace);return t}};var kPe=class extends XGe{constructor({document:t,taskContext:r,options:n,source:i,namespace:o}){super({document:t,taskContext:r,authHeaders:new Set,options:n,source:i,namespace:o})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,n){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,n){}getDiscriminatedUnionMetadata(t){}};Pt();var thr=require("fs"),rhr=require("path");var bt={};$(bt,{BRAND:()=>RWl,DIRTY:()=>NPe,EMPTY_PATH:()=>lWl,INVALID:()=>Dc,NEVER:()=>g$l,OK:()=>iB,ParseStatus:()=>Z1,Schema:()=>Sp,ZodAny:()=>lge,ZodArray:()=>kse,ZodBigInt:()=>QPe,ZodBoolean:()=>MPe,ZodBranded:()=>g_t,ZodCatch:()=>JPe,ZodDate:()=>LPe,ZodDefault:()=>KPe,ZodDiscriminatedUnion:()=>Xmr,ZodEffects:()=>Z4,ZodEnum:()=>$Pe,ZodError:()=>hN,ZodFirstPartyTypeKind:()=>su,ZodFunction:()=>ehr,ZodIntersection:()=>qPe,ZodIssueCode:()=>bn,ZodLazy:()=>GPe,ZodLiteral:()=>WPe,ZodMap:()=>i9e,ZodNaN:()=>s9e,ZodNativeEnum:()=>HPe,ZodNever:()=>Uq,ZodNull:()=>zPe,ZodNullable:()=>CH,ZodNumber:()=>jPe,ZodObject:()=>gN,ZodOptional:()=>Y4,ZodParsedType:()=>is,ZodPipeline:()=>A_t,ZodPromise:()=>pge,ZodReadonly:()=>YPe,ZodRecord:()=>Zmr,ZodSchema:()=>Sp,ZodSet:()=>o9e,ZodString:()=>uge,ZodSymbol:()=>r9e,ZodTransformer:()=>Z4,ZodTuple:()=>xH,ZodType:()=>Sp,ZodUndefined:()=>UPe,ZodUnion:()=>VPe,ZodUnknown:()=>Fse,ZodVoid:()=>n9e,addIssueToContext:()=>Oo,any:()=>UWl,array:()=>GWl,bigint:()=>NWl,boolean:()=>U9s,coerce:()=>h$l,custom:()=>Q9s,date:()=>jWl,datetimeRegex:()=>N9s,defaultErrorMap:()=>Rse,discriminatedUnion:()=>KWl,effect:()=>a$l,enum:()=>i$l,function:()=>t$l,getErrorMap:()=>ZGe,getParsedType:()=>wH,instanceof:()=>FWl,intersection:()=>JWl,isAborted:()=>Jmr,isAsync:()=>e9e,isDirty:()=>Ymr,isValid:()=>cge,late:()=>DWl,lazy:()=>r$l,literal:()=>n$l,makeIssue:()=>h_t,map:()=>ZWl,nan:()=>kWl,nativeEnum:()=>o$l,never:()=>VWl,null:()=>LWl,nullable:()=>u$l,number:()=>L9s,object:()=>WWl,objectUtil:()=>Qxi,oboolean:()=>m$l,onumber:()=>d$l,optional:()=>c$l,ostring:()=>f$l,pipeline:()=>p$l,preprocess:()=>l$l,promise:()=>s$l,quotelessJson:()=>aWl,record:()=>XWl,set:()=>e$l,setErrorMap:()=>uWl,strictObject:()=>$Wl,string:()=>M9s,symbol:()=>QWl,transformer:()=>a$l,tuple:()=>YWl,undefined:()=>MWl,union:()=>HWl,unknown:()=>zWl,util:()=>mf,void:()=>qWl});var mf;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(mf||(mf={}));var Qxi;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Qxi||(Qxi={}));var is=mf.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wH=e=>{switch(typeof e){case"undefined":return is.undefined;case"string":return is.string;case"number":return Number.isNaN(e)?is.nan:is.number;case"boolean":return is.boolean;case"function":return is.function;case"bigint":return is.bigint;case"symbol":return is.symbol;case"object":return Array.isArray(e)?is.array:e===null?is.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?is.promise:typeof Map<"u"&&e instanceof Map?is.map:typeof Set<"u"&&e instanceof Set?is.set:typeof Date<"u"&&e instanceof Date?is.date:is.object;default:return is.unknown}};var bn=mf.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),aWl=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),hN=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,mf.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};hN.create=e=>new hN(e);var cWl=(e,t)=>{let r;switch(e.code){case bn.invalid_type:e.received===is.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case bn.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,mf.jsonStringifyReplacer)}`;break;case bn.unrecognized_keys:r=`Unrecognized key(s) in object: ${mf.joinValues(e.keys,", ")}`;break;case bn.invalid_union:r="Invalid input";break;case bn.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${mf.joinValues(e.options)}`;break;case bn.invalid_enum_value:r=`Invalid enum value. Expected ${mf.joinValues(e.options)}, received '${e.received}'`;break;case bn.invalid_arguments:r="Invalid function arguments";break;case bn.invalid_return_type:r="Invalid function return type";break;case bn.invalid_date:r="Invalid date";break;case bn.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:mf.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case bn.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case bn.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case bn.custom:r="Invalid input";break;case bn.invalid_intersection_types:r="Intersection results could not be merged";break;case bn.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case bn.not_finite:r="Number must be finite";break;default:r=t.defaultError,mf.assertNever(e)}return{message:r}},Rse=cWl;var P9s=Rse;function uWl(e){P9s=e}function ZGe(){return P9s}var h_t=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},lWl=[];function Oo(e,t){let r=ZGe(),n=h_t({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Rse?void 0:Rse].filter(i=>!!i)});e.common.issues.push(n)}var Z1=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return Dc;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Dc;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},Dc=Object.freeze({status:"aborted"}),NPe=e=>({status:"dirty",value:e}),iB=e=>({status:"valid",value:e}),Jmr=e=>e.status==="aborted",Ymr=e=>e.status==="dirty",cge=e=>e.status==="valid",e9e=e=>typeof Promise<"u"&&e instanceof Promise;var wa;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(wa||(wa={}));var X4=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},R9s=(e,t)=>{if(cge(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new hN(e.common.issues);return this._error=r,this._error}}};function ep(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var Sp=class{get description(){return this._def.description}_getType(t){return wH(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:wH(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Z1,ctx:{common:t.parent.common,data:t.data,parsedType:wH(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(e9e(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wH(t)},i=this._parseSync({data:t,path:n.path,parent:n});return R9s(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wH(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return cge(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>cge(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wH(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(e9e(i)?i:Promise.resolve(i));return R9s(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:bn.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new Z4({schema:this,typeName:su.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Y4.create(this,this._def)}nullable(){return CH.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kse.create(this)}promise(){return pge.create(this,this._def)}or(t){return VPe.create([this,t],this._def)}and(t){return qPe.create(this,t,this._def)}transform(t){return new Z4({...ep(this._def),schema:this,typeName:su.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new KPe({...ep(this._def),innerType:this,defaultValue:r,typeName:su.ZodDefault})}brand(){return new g_t({typeName:su.ZodBranded,type:this,...ep(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new JPe({...ep(this._def),innerType:this,catchValue:r,typeName:su.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return A_t.create(this,t)}readonly(){return YPe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pWl=/^c[^\s-]{8,}$/i,fWl=/^[0-9a-z]+$/,dWl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mWl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hWl=/^[a-z0-9_-]{21}$/i,gWl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,AWl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,yWl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bWl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mxi,EWl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vWl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,IWl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,wWl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xWl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CWl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,F9s="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",_Wl=new RegExp(`^${F9s}$`);function k9s(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function SWl(e){return new RegExp(`^${k9s(e)}$`)}function N9s(e){let t=`${F9s}T${k9s(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function TWl(e,t){return!!((t==="v4"||!t)&&EWl.test(e)||(t==="v6"||!t)&&IWl.test(e))}function OWl(e,t){if(!gWl.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function BWl(e,t){return!!((t==="v4"||!t)&&vWl.test(e)||(t==="v6"||!t)&&wWl.test(e))}var uge=class e extends Sp{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==is.string){let o=this._getOrReturnCtx(t);return Oo(o,{code:bn.invalid_type,expected:is.string,received:o.parsedType}),Dc}let n=new Z1,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?Oo(i,{code:bn.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Oo(i,{code:bn.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")yWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"email",code:bn.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Mxi||(Mxi=new RegExp(bWl,"u")),Mxi.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"emoji",code:bn.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")mWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"uuid",code:bn.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")hWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"nanoid",code:bn.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")pWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"cuid",code:bn.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")fWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"cuid2",code:bn.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")dWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"ulid",code:bn.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Oo(i,{validation:"url",code:bn.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"regex",code:bn.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?N9s(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?_Wl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?SWl(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?AWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"duration",code:bn.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?TWl(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"ip",code:bn.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?OWl(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"jwt",code:bn.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?BWl(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"cidr",code:bn.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?xWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"base64",code:bn.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?CWl.test(t.data)||(i=this._getOrReturnCtx(t,i),Oo(i,{validation:"base64url",code:bn.invalid_string,message:o.message}),n.dirty()):mf.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:bn.invalid_string,...wa.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...wa.errToObj(t)})}url(t){return this._addCheck({kind:"url",...wa.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...wa.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...wa.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...wa.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...wa.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...wa.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...wa.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...wa.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...wa.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...wa.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...wa.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...wa.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...wa.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...wa.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...wa.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...wa.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...wa.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...wa.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...wa.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...wa.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...wa.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...wa.errToObj(r)})}nonempty(t){return this.min(1,wa.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};uge.create=e=>new uge({checks:[],typeName:su.ZodString,coerce:e?.coerce??!1,...ep(e)});function PWl(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var jPe=class e extends Sp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==is.number){let o=this._getOrReturnCtx(t);return Oo(o,{code:bn.invalid_type,expected:is.number,received:o.parsedType}),Dc}let n,i=new Z1;for(let o of this._def.checks)o.kind==="int"?mf.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?PWl(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.not_finite,message:o.message}),i.dirty()):mf.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,wa.toString(r))}gt(t,r){return this.setLimit("min",t,!1,wa.toString(r))}lte(t,r){return this.setLimit("max",t,!0,wa.toString(r))}lt(t,r){return this.setLimit("max",t,!1,wa.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:wa.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:wa.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:wa.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:wa.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:wa.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:wa.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:wa.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:wa.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:wa.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:wa.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&mf.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};jPe.create=e=>new jPe({checks:[],typeName:su.ZodNumber,coerce:e?.coerce||!1,...ep(e)});var QPe=class e extends Sp{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==is.bigint)return this._getInvalidInput(t);let n,i=new Z1;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Oo(n,{code:bn.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):mf.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Oo(r,{code:bn.invalid_type,expected:is.bigint,received:r.parsedType}),Dc}gte(t,r){return this.setLimit("min",t,!0,wa.toString(r))}gt(t,r){return this.setLimit("min",t,!1,wa.toString(r))}lte(t,r){return this.setLimit("max",t,!0,wa.toString(r))}lt(t,r){return this.setLimit("max",t,!1,wa.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:wa.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:wa.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:wa.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:wa.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:wa.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:wa.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};QPe.create=e=>new QPe({checks:[],typeName:su.ZodBigInt,coerce:e?.coerce??!1,...ep(e)});var MPe=class extends Sp{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==is.boolean){let n=this._getOrReturnCtx(t);return Oo(n,{code:bn.invalid_type,expected:is.boolean,received:n.parsedType}),Dc}return iB(t.data)}};MPe.create=e=>new MPe({typeName:su.ZodBoolean,coerce:e?.coerce||!1,...ep(e)});var LPe=class e extends Sp{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==is.date){let o=this._getOrReturnCtx(t);return Oo(o,{code:bn.invalid_type,expected:is.date,received:o.parsedType}),Dc}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return Oo(o,{code:bn.invalid_date}),Dc}let n=new Z1,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),Oo(i,{code:bn.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):mf.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:wa.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:wa.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};LPe.create=e=>new LPe({checks:[],coerce:e?.coerce||!1,typeName:su.ZodDate,...ep(e)});var r9e=class extends Sp{_parse(t){if(this._getType(t)!==is.symbol){let n=this._getOrReturnCtx(t);return Oo(n,{code:bn.invalid_type,expected:is.symbol,received:n.parsedType}),Dc}return iB(t.data)}};r9e.create=e=>new r9e({typeName:su.ZodSymbol,...ep(e)});var UPe=class extends Sp{_parse(t){if(this._getType(t)!==is.undefined){let n=this._getOrReturnCtx(t);return Oo(n,{code:bn.invalid_type,expected:is.undefined,received:n.parsedType}),Dc}return iB(t.data)}};UPe.create=e=>new UPe({typeName:su.ZodUndefined,...ep(e)});var zPe=class extends Sp{_parse(t){if(this._getType(t)!==is.null){let n=this._getOrReturnCtx(t);return Oo(n,{code:bn.invalid_type,expected:is.null,received:n.parsedType}),Dc}return iB(t.data)}};zPe.create=e=>new zPe({typeName:su.ZodNull,...ep(e)});var lge=class extends Sp{constructor(){super(...arguments),this._any=!0}_parse(t){return iB(t.data)}};lge.create=e=>new lge({typeName:su.ZodAny,...ep(e)});var Fse=class extends Sp{constructor(){super(...arguments),this._unknown=!0}_parse(t){return iB(t.data)}};Fse.create=e=>new Fse({typeName:su.ZodUnknown,...ep(e)});var Uq=class extends Sp{_parse(t){let r=this._getOrReturnCtx(t);return Oo(r,{code:bn.invalid_type,expected:is.never,received:r.parsedType}),Dc}};Uq.create=e=>new Uq({typeName:su.ZodNever,...ep(e)});var n9e=class extends Sp{_parse(t){if(this._getType(t)!==is.undefined){let n=this._getOrReturnCtx(t);return Oo(n,{code:bn.invalid_type,expected:is.void,received:n.parsedType}),Dc}return iB(t.data)}};n9e.create=e=>new n9e({typeName:su.ZodVoid,...ep(e)});var kse=class e extends Sp{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==is.array)return Oo(r,{code:bn.invalid_type,expected:is.array,received:r.parsedType}),Dc;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Oo(r,{code:s?bn.too_big:bn.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Oo(r,{code:bn.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Oo(r,{code:bn.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new X4(r,s,r.path,a)))).then(s=>Z1.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new X4(r,s,r.path,a)));return Z1.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:wa.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:wa.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:wa.toString(r)}})}nonempty(t){return this.min(1,t)}};kse.create=(e,t)=>new kse({type:e,minLength:null,maxLength:null,exactLength:null,typeName:su.ZodArray,...ep(t)});function t9e(e){if(e instanceof gN){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Y4.create(t9e(n))}return new gN({...e._def,shape:()=>t})}else return e instanceof kse?new kse({...e._def,type:t9e(e.element)}):e instanceof Y4?Y4.create(t9e(e.unwrap())):e instanceof CH?CH.create(t9e(e.unwrap())):e instanceof xH?xH.create(e.items.map(t=>t9e(t))):e}var gN=class e extends Sp{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=mf.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==is.object){let u=this._getOrReturnCtx(t);return Oo(u,{code:bn.invalid_type,expected:is.object,received:u.parsedType}),Dc}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Uq&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],p=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new X4(i,p,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Uq){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&(Oo(i,{code:bn.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let p=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new X4(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,d=await l.value;u.push({key:p,value:d,alwaysSet:l.alwaysSet})}return u}).then(u=>Z1.mergeObjectSync(n,u)):Z1.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return wa.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:wa.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:su.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of mf.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of mf.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return t9e(this)}partial(t){let r={};for(let n of mf.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of mf.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Y4;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return j9s(mf.objectKeys(this.shape))}};gN.create=(e,t)=>new gN({shape:()=>e,unknownKeys:"strip",catchall:Uq.create(),typeName:su.ZodObject,...ep(t)});gN.strictCreate=(e,t)=>new gN({shape:()=>e,unknownKeys:"strict",catchall:Uq.create(),typeName:su.ZodObject,...ep(t)});gN.lazycreate=(e,t)=>new gN({shape:e,unknownKeys:"strip",catchall:Uq.create(),typeName:su.ZodObject,...ep(t)});var VPe=class extends Sp{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new hN(a.ctx.common.issues));return Oo(r,{code:bn.invalid_union,unionErrors:s}),Dc}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new hN(c));return Oo(r,{code:bn.invalid_union,unionErrors:a}),Dc}}get options(){return this._def.options}};VPe.create=(e,t)=>new VPe({options:e,typeName:su.ZodUnion,...ep(t)});var Dse=e=>e instanceof GPe?Dse(e.schema):e instanceof Z4?Dse(e.innerType()):e instanceof WPe?[e.value]:e instanceof $Pe?e.options:e instanceof HPe?mf.objectValues(e.enum):e instanceof KPe?Dse(e._def.innerType):e instanceof UPe?[void 0]:e instanceof zPe?[null]:e instanceof Y4?[void 0,...Dse(e.unwrap())]:e instanceof CH?[null,...Dse(e.unwrap())]:e instanceof g_t||e instanceof YPe?Dse(e.unwrap()):e instanceof JPe?Dse(e._def.innerType):[],Xmr=class e extends Sp{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==is.object)return Oo(r,{code:bn.invalid_type,expected:is.object,received:r.parsedType}),Dc;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Oo(r,{code:bn.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Dc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=Dse(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:su.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...ep(n)})}};function Lxi(e,t){let r=wH(e),n=wH(t);if(e===t)return{valid:!0,data:e};if(r===is.object&&n===is.object){let i=mf.objectKeys(t),o=mf.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=Lxi(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===is.array&&n===is.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=Lxi(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===is.date&&n===is.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qPe=class extends Sp{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(Jmr(o)||Jmr(s))return Dc;let a=Lxi(o.value,s.value);return a.valid?((Ymr(o)||Ymr(s))&&r.dirty(),{status:r.value,value:a.data}):(Oo(n,{code:bn.invalid_intersection_types}),Dc)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};qPe.create=(e,t,r)=>new qPe({left:e,right:t,typeName:su.ZodIntersection,...ep(r)});var xH=class e extends Sp{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==is.array)return Oo(n,{code:bn.invalid_type,expected:is.array,received:n.parsedType}),Dc;if(n.data.length<this._def.items.length)return Oo(n,{code:bn.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dc;!this._def.rest&&n.data.length>this._def.items.length&&(Oo(n,{code:bn.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new X4(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Z1.mergeArray(r,s)):Z1.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};xH.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xH({items:e,typeName:su.ZodTuple,rest:null,...ep(t)})};var Zmr=class e extends Sp{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==is.object)return Oo(n,{code:bn.invalid_type,expected:is.object,received:n.parsedType}),Dc;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new X4(n,a,n.path,a)),value:s._parse(new X4(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Z1.mergeObjectAsync(r,i):Z1.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Sp?new e({keyType:t,valueType:r,typeName:su.ZodRecord,...ep(n)}):new e({keyType:uge.create(),valueType:t,typeName:su.ZodRecord,...ep(r)})}},i9e=class extends Sp{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==is.map)return Oo(n,{code:bn.invalid_type,expected:is.map,received:n.parsedType}),Dc;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new X4(n,a,n.path,[u,"key"])),value:o._parse(new X4(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return Dc;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return Dc;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};i9e.create=(e,t,r)=>new i9e({valueType:t,keyType:e,typeName:su.ZodMap,...ep(r)});var o9e=class e extends Sp{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==is.set)return Oo(n,{code:bn.invalid_type,expected:is.set,received:n.parsedType}),Dc;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Oo(n,{code:bn.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Oo(n,{code:bn.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return Dc;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new X4(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:wa.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:wa.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};o9e.create=(e,t)=>new o9e({valueType:e,minSize:null,maxSize:null,typeName:su.ZodSet,...ep(t)});var ehr=class e extends Sp{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==is.function)return Oo(r,{code:bn.invalid_type,expected:is.function,received:r.parsedType}),Dc;function n(a,c){return h_t({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ZGe(),Rse].filter(u=>!!u),issueData:{code:bn.invalid_arguments,argumentsError:c}})}function i(a,c){return h_t({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ZGe(),Rse].filter(u=>!!u),issueData:{code:bn.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof pge){let a=this;return iB(async function(...c){let u=new hN([]),l=await a._def.args.parseAsync(c,o).catch(f=>{throw u.addIssue(n(c,f)),u}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,o).catch(f=>{throw u.addIssue(i(p,f)),u})})}else{let a=this;return iB(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new hN([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),p=a._def.returns.safeParse(l,o);if(!p.success)throw new hN([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:xH.create(t).rest(Fse.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||xH.create([]).rest(Fse.create()),returns:r||Fse.create(),typeName:su.ZodFunction,...ep(n)})}},GPe=class extends Sp{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};GPe.create=(e,t)=>new GPe({getter:e,typeName:su.ZodLazy,...ep(t)});var WPe=class extends Sp{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Oo(r,{received:r.data,code:bn.invalid_literal,expected:this._def.value}),Dc}return{status:"valid",value:t.data}}get value(){return this._def.value}};WPe.create=(e,t)=>new WPe({value:e,typeName:su.ZodLiteral,...ep(t)});function j9s(e,t){return new $Pe({values:e,typeName:su.ZodEnum,...ep(t)})}var $Pe=class e extends Sp{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Oo(r,{expected:mf.joinValues(n),received:r.parsedType,code:bn.invalid_type}),Dc}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Oo(r,{received:r.data,code:bn.invalid_enum_value,options:n}),Dc}return iB(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};$Pe.create=j9s;var HPe=class extends Sp{_parse(t){let r=mf.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==is.string&&n.parsedType!==is.number){let i=mf.objectValues(r);return Oo(n,{expected:mf.joinValues(i),received:n.parsedType,code:bn.invalid_type}),Dc}if(this._cache||(this._cache=new Set(mf.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=mf.objectValues(r);return Oo(n,{received:n.data,code:bn.invalid_enum_value,options:i}),Dc}return iB(t.data)}get enum(){return this._def.values}};HPe.create=(e,t)=>new HPe({values:e,typeName:su.ZodNativeEnum,...ep(t)});var pge=class extends Sp{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==is.promise&&r.common.async===!1)return Oo(r,{code:bn.invalid_type,expected:is.promise,received:r.parsedType}),Dc;let n=r.parsedType===is.promise?r.data:Promise.resolve(r.data);return iB(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};pge.create=(e,t)=>new pge({type:e,typeName:su.ZodPromise,...ep(t)});var Z4=class extends Sp{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===su.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{Oo(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return Dc;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Dc:c.status==="dirty"?NPe(c.value):r.value==="dirty"?NPe(c.value):c});{if(r.value==="aborted")return Dc;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Dc:a.status==="dirty"?NPe(a.value):r.value==="dirty"?NPe(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Dc:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Dc:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!cge(s))return Dc;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>cge(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Dc);mf.assertNever(i)}};Z4.create=(e,t,r)=>new Z4({schema:e,typeName:su.ZodEffects,effect:t,...ep(r)});Z4.createWithPreprocess=(e,t,r)=>new Z4({schema:t,effect:{type:"preprocess",transform:e},typeName:su.ZodEffects,...ep(r)});var Y4=class extends Sp{_parse(t){return this._getType(t)===is.undefined?iB(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Y4.create=(e,t)=>new Y4({innerType:e,typeName:su.ZodOptional,...ep(t)});var CH=class extends Sp{_parse(t){return this._getType(t)===is.null?iB(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};CH.create=(e,t)=>new CH({innerType:e,typeName:su.ZodNullable,...ep(t)});var KPe=class extends Sp{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===is.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};KPe.create=(e,t)=>new KPe({innerType:e,typeName:su.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ep(t)});var JPe=class extends Sp{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return e9e(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new hN(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new hN(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};JPe.create=(e,t)=>new JPe({innerType:e,typeName:su.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ep(t)});var s9e=class extends Sp{_parse(t){if(this._getType(t)!==is.nan){let n=this._getOrReturnCtx(t);return Oo(n,{code:bn.invalid_type,expected:is.nan,received:n.parsedType}),Dc}return{status:"valid",value:t.data}}};s9e.create=e=>new s9e({typeName:su.ZodNaN,...ep(e)});var RWl=Symbol("zod_brand"),g_t=class extends Sp{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},A_t=class e extends Sp{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Dc:o.status==="dirty"?(r.dirty(),NPe(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Dc:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:su.ZodPipeline})}},YPe=class extends Sp{_parse(t){let r=this._def.innerType._parse(t),n=i=>(cge(i)&&(i.value=Object.freeze(i.value)),i);return e9e(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};YPe.create=(e,t)=>new YPe({innerType:e,typeName:su.ZodReadonly,...ep(t)});function D9s(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Q9s(e,t={},r){return e?lge.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=D9s(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=D9s(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):lge.create()}var DWl={object:gN.lazycreate},su;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(su||(su={}));var FWl=(e,t={message:`Input not instance of ${e.name}`})=>Q9s(r=>r instanceof e,t),M9s=uge.create,L9s=jPe.create,kWl=s9e.create,NWl=QPe.create,U9s=MPe.create,jWl=LPe.create,QWl=r9e.create,MWl=UPe.create,LWl=zPe.create,UWl=lge.create,zWl=Fse.create,VWl=Uq.create,qWl=n9e.create,GWl=kse.create,WWl=gN.create,$Wl=gN.strictCreate,HWl=VPe.create,KWl=Xmr.create,JWl=qPe.create,YWl=xH.create,XWl=Zmr.create,ZWl=i9e.create,e$l=o9e.create,t$l=ehr.create,r$l=GPe.create,n$l=WPe.create,i$l=$Pe.create,o$l=HPe.create,s$l=pge.create,a$l=Z4.create,c$l=Y4.create,u$l=CH.create,l$l=Z4.createWithPreprocess,p$l=A_t.create,f$l=()=>M9s().optional(),d$l=()=>L9s().optional(),m$l=()=>U9s().optional(),h$l={string:(e=>uge.create({...e,coerce:!0})),number:(e=>jPe.create({...e,coerce:!0})),boolean:(e=>MPe.create({...e,coerce:!0})),bigint:(e=>QPe.create({...e,coerce:!0})),date:(e=>LPe.create({...e,coerce:!0}))};var g$l=Dc;var A$l=bt.object({lang:bt.string(),label:bt.optional(bt.string()),source:bt.string()}),Uxi=bt.array(A$l);Pt();var z9s={README_EXT:"x-readme"};function y$l(e){if(!Array.isArray(e))return!1;for(let t of e)if(!Ua(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function V9s(e){let t=jr(e,z9s.README_EXT);if(!Ua(t))return[];let r=t["code-samples"];if(!y$l(r))return[];let n=[];for(let i of r)n.push({name:i.name,language:i.language,code:i.code,install:i.install,docs:void 0});return n}function b$l(e){return Ua(e)&&typeof e.$ref=="string"}function E$l(e,t){if(e!=null){if(typeof e=="string")return e;if(b$l(e)){let r=(0,rhr.resolve)(t??process.cwd(),e.$ref);if((0,thr.existsSync)(r))try{return(0,thr.readFileSync)(r,"utf-8")}catch{return}}}}function v$l(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!Ua(n))continue;let o=E$l(n.code,t);o!=null&&r.push({...n,code:o})}return r}function q9s(e,t,r){let n=jr(t,Rn.EXAMPLES),i=r.source.type==="openapi"?(0,rhr.dirname)(r.source.file):void 0,s=(n??[]).map(p=>{if(!Ua(p))return p;let f=p["code-samples"];if(f!=null){let m=v$l(f,i);return{...p,"code-samples":m}}return p}).filter(p=>{let d=th.serialization.ExampleEndpointCallSchema.parse(p);return d.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),d.ok}),a=a_t(t,X1.REDOCLY_CODE_SAMPLES_KEBAB,Uxi,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],u=[...a_t(t,X1.REDOCLY_CODE_SAMPLES_CAMEL,Uxi,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...a];u.length>0&&s.push({"code-samples":u.map(p=>({name:p.label??p.lang,language:p.lang,code:p.source,install:void 0,docs:void 0}))});let l=V9s(t);return l.length>0&&s.push({"code-samples":l}),s.map(G4.unknown)}function G9s(e){let t=jr(e,Rn.AVAILABILITY);if(t==="ga"||t==="generally-available")return f_.GenerallyAvailable;if(t==="beta"||t==="pre-release")return f_.Beta;if(t==="deprecated")return f_.Deprecated;if(e.deprecated)return f_.Deprecated}function W9s(e){let t=jr(e,Rn.RETRIES);if(t!=null&&t.disabled===!0)return Wg.RetriesConfiguration.disabled(t.disabled)}var I$l="x-fern-default-url";function nhr(e,t){let r=e.variables!=null&&Object.keys(e.variables).length>0,n=w$l(e);return{url:C$l({url:e.url,variables:e.variables??{}}),description:e.description,name:_$l(e,t),audiences:jr(e,Rn.AUDIENCES),urlTemplate:r?e.url:void 0,variables:r&&e.variables!=null?x$l(e.variables):void 0,defaultUrl:r?n:void 0}}function w$l(e){let t=e[I$l];if(typeof t=="string")return t.endsWith("/")&&t!=="/"?t.slice(0,-1):t}function x$l(e){return Object.entries(e).map(([t,r])=>({id:t,default:r.default,values:r.enum}))}function C$l({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,i.default]));for(let[n,i]of Object.entries(r))e=e.replace(`{${n}}`,encodeURIComponent(i));return e}function _$l(e,t){let r=jr(e,[Rn.SERVER_NAME_V1,Rn.SERVER_NAME_V2]);if(r!=null)return r;if(e.description?.toLowerCase()==="production")return"Production";if(e.description?.toLowerCase()==="sandbox")return"Sandbox";if(t?.groupMultiApiEnvironments&&e.description!=null&&e.description.trim()!==""){let n=e.description.toLowerCase();return n==="prd"?"Production":n==="sbx"?"Sandbox":n==="staging"||n==="stg"?"Staging":n==="development"||n==="dev"?"Development":e.description}}function $9s(e){return jr(e,Rn.PARAMETER_NAME)}function H9s(e){return jr(e,Rn.SDK_VARIABLE)}function ihr({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:o}){let s={pathParameters:[],queryParameters:[],headers:[]};for(let a of r){let c=Qn(a)?n.resolveParameterReference(a):a,u=jr(a,Rn.IGNORE)??jr(c,Rn.IGNORE);if(u!=null&&u){n.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let l=c.required??!1,p=gw(c),d=[...i,c.name],f=Vb(d,n.options.preserveSchemaIds),m=c.in==="header",[h,g]=n.options.coerceOptionalSchemasToNullable&&!m?[!1,!l]:[!l,!1],A=c.schema!=null?oc(c.schema,h,g,n,d,o,n.namespace,!1,new Set,O$l(c,n)):l?kr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Qi.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:J4({schema:c,logger:n.logger})}),description:void 0,availability:p,namespace:void 0,groupName:void 0}):kr.optional({nameOverride:void 0,generatedName:f,title:void 0,value:kr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Qi.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:J4({schema:c,logger:n.logger})}),description:void 0,availability:void 0,namespace:void 0,groupName:void 0}),description:void 0,availability:p,namespace:void 0,groupName:void 0,inline:void 0});if(c.in==="header"&&c.schema!=null&&!Qn(c.schema)&&c.schema.default!=null){let E=c.schema.default;typeof E=="string"&&E.length>0&&(A=kr.literal({nameOverride:void 0,generatedName:f,title:void 0,value:JA.string(E),description:void 0,availability:p,namespace:void 0,groupName:void 0}))}let b=jr(a,Rn.FERN_DEFAULT)??jr(c,Rn.FERN_DEFAULT),v={name:c.name,schema:A,description:c.description,parameterNameOverride:$9s(c),availability:p,source:o,clientDefault:b};c.in==="query"?s.queryParameters.push({...v,explode:T$l(c)}):c.in==="path"?s.pathParameters.push({...v,variableReference:H9s(c),explode:B$l(c)}):c.in==="header"?!S$l.has(c.name.toLowerCase())&&!n.authHeaders.has(c.name)?s.headers.push({...v,env:void 0}):n.logger.debug(`Ignoring ${c.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${c.in} parameter, ${c.name}, in ${t.toUpperCase()} ${e}`)}return s}var S$l=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]);function T$l(e){let t=e.style??"form",r=e.explode;if(r!==void 0)return t==="form"||t==="deepObject"?r===!0?void 0:r:r===!1?void 0:r}function O$l(e,t){let r=Nmr({schema:e,logger:t.logger});return r??J4({schema:e,logger:t.logger})}function B$l(e){let t=e.explode;if(t!==void 0)return t===!1?void 0:t}Pt();function P$l({content:e,context:t}){for(let[r,n]of Object.entries(e))if(J9s({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function J9s({mediaType:e,mediaTypeObject:t,context:r}){if(Vf.parse(e)?.isURLEncoded())return{schema:t.schema,contentType:e,examples:YGe(t,r)}}function R$l({content:e,context:t}){for(let[r,n]of Object.entries(e))if(Y9s({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function Y9s({mediaType:e,mediaTypeObject:t,context:r}){if(Vf.parse(e)?.isMultipart())return{schema:t.schema,encoding:t.encoding,examples:YGe(t,r)}}function X9s({mediaType:e}){return Vf.parse(e)?.isBinary()??!1}function D$l({content:e}){for(let[t,r]of Object.entries(e))if(X9s({mediaType:t}))return[t,r]}function F$l(e,t){let r=Qn(e)?zxi(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!Qn(i)&&i.type==="string"&&(i.format==="binary"||i.format==null&&i.contentMediaType==="application/octet-stream"))!=null}function shr({content:e,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s}){let a=D$l({content:e});if(a){let[d,f]=a;return _H({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s})}let c=R$l({content:e,context:n}),u=Nxi({content:e,context:n}),l=k$l({json:u,multipart:c,document:r,visitor:{json:([d,f])=>_H({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s}),multipart:([d,f])=>_H({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s}),neither:()=>{}}});if(l)return l;let p=P$l({content:e,context:n});if(p){let[d,f]=p;return _H({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s})}}function k$l({json:e,multipart:t,document:r,visitor:n}){if(!e&&!t)return n.neither();let[,i]=e??[void 0,void 0],[,o]=t??[void 0,void 0];return!i?.schema&&!o?.schema?e&&(i?.example!=null||i?.examples!=null&&Object.keys(i.examples).length>0)?n.json(e):n.neither():i?.schema&&o?.schema?i.schema&&F$l(i.schema,r)?n.multipart(t):n.json(e):i?.schema?n.json(e):o?.schema?n.multipart(t):n.neither()}function _H({mediaType:e,mediaTypeObject:t,description:r,document:n,context:i,requestBreadcrumbs:o,source:s,namespace:a}){let c=N$l({mediaTypeObject:t});if(X9s({mediaType:e}))return iD.octetStream({description:r,source:s,sdkMethodName:c,contentType:e});let u=Y9s({mediaType:e,mediaTypeObject:t,context:i}),l=u?.schema,p=u?.encoding,d=u?.examples;if(l){let h=Qn(l)?zxi(l,n):{id:void 0,schema:l},g=oc(h.schema,!1,!1,i,o,s,a,!1),A=[];if(g.type==="object"){let b=new Set(h.schema.required??[]);for(let v of g.properties){let E=b.has(v.key),{isFile:I,isOptional:x,isArray:C,description:_}=ohr({schema:v.schema,isOptional:!E});if(I){let w=K9s(v.key,p);A.push({key:v.key,schema:dH.file({isOptional:x,isArray:C,description:_}),description:_,contentType:w,exploded:!1,encoding:w==null?i.options.defaultFormParameterEncoding:void 0})}else{let w=K9s(v.key,p);A.push({key:v.key,schema:dH.json(v.schema),description:void 0,contentType:w,exploded:p?.[v.key]?.explode,encoding:w==null?i.options.defaultFormParameterEncoding:Q$l(w)})}}}return iD.multipart({name:Qn(l)&&i.getNumberOfOccurrencesForRef(l)===1?h.id:void 0,description:h.schema.description,properties:A,source:s,sdkMethodName:c,fullExamples:d})}let f=Hmr({mediaType:e,mediaTypeObject:t,context:i});if(f){let h=oc(f.schema,!1,!1,i,o,s,a,!0);return iD.json({description:void 0,schema:h,contentType:f.contentType,fullExamples:f.examples,additionalProperties:!Qn(f.schema)&&u_t(f.schema.additionalProperties,i.options),source:s,sdkMethodName:c})}let m=J9s({mediaType:e,mediaTypeObject:t,context:i});if(m!=null&&m.schema!=null){let h=oc(m.schema,!1,!1,i,o,s,a,!1);return iD.formUrlEncoded({schema:h,description:r,contentType:m.contentType,source:s,fullExamples:m.examples,additionalProperties:!1,sdkMethodName:c})}}function N$l({mediaTypeObject:e}){return jr(e,Rn.SDK_METHOD_NAME)}var j$l={"application/json":"json"};function Q$l(e){return e?j$l[e]:void 0}function zxi(e,t){if(!e.$ref.startsWith(DPe))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=GGe(e);if(r==null)throw new Error(`Failed to resolve schema reference because missing schema id: ${e.$ref}`);let n=t.components?.schemas?.[r];if(n==null)throw new Error(`Failed to resolve schema reference because missing: ${e.$ref}`);return Qn(n)?zxi(n,t):{id:r,schema:n}}function ohr({schema:e,isOptional:t,isArray:r,description:n}){return L$l(e)?ohr({schema:e.value,isOptional:!0,isArray:r,description:e.description}):U$l(e)?ohr({schema:e.value,isOptional:t,isArray:r,description:e.description}):z$l(e)?ohr({schema:e.value,isOptional:t,isArray:!0,description:e.description}):M$l(e)?{isFile:!0,isOptional:t??!1,isArray:r??!1,description:n??e.description}:{isFile:!1,isOptional:t??!1,isArray:r??!1,description:void 0}}function M$l(e){return e.type==="primitive"&&e.schema.type==="string"&&e.schema.format==="binary"}function L$l(e){return e.type==="optional"}function U$l(e){return e.type==="nullable"}function z$l(e){return e.type==="array"}function K9s(e,t){return t?.[e]?.contentType}Pt();var Vxi={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",498:"InvalidTokenError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},Z9s=new Set(Object.values(Vxi));var V$l=["200","201","202","204"];function ahr({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:o,streamTerminator:s,source:a}){if(t==null)return{value:void 0,errors:{}};let c=q$l({responses:t,context:r,source:a,namespace:r.namespace}),u=!1,l=!1,p;for(let d of i!=null?[i]:V$l){let f=t[d];if(f==null)continue;u=!0;let m=typeof d=="string"?parseInt(d):d;if(p==null){let h=e7s({operationContext:e,response:f,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,source:a,namespace:r.namespace,statusCode:m});h!=null?p=h:m===204&&(l=!0)}else if(m===204){let h=Qn(f)?r.resolveResponseReference(f):f;d_t({context:r,content:h.content??{}})==null&&(l=!0)}}if(l&&p!=null&&p.type==="json"){let d=p.schema;d.type!=="optional"&&(p=fg.json({...p,schema:kr.optional({value:d,description:d.type==="reference"?d.description:void 0,nameOverride:void 0,generatedName:"",groupName:void 0,namespace:void 0,availability:void 0,title:void 0,inline:void 0})}))}if(p==null&&!u&&t.default!=null&&(p=e7s({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,source:a,namespace:r.namespace})),p!=null)switch(p.type){case"json":return{value:p,errors:c};case"streamingJson":case"streamingSse":return{value:p,errors:c};case"bytes":case"file":case"text":case"streamingText":return{value:p,errors:c};default:Ie(p)}return{value:void 0,errors:c}}function e7s({operationContext:e,streamFormat:t,streamTerminator:r,response:n,context:i,responseBreadcrumbs:o,source:s,namespace:a,statusCode:c}){let u=Qn(n)?i.resolveResponseReference(n):n;if(u.content!=null&&Object.entries(u.content).find(([f,m])=>{if(m.schema==null)return!1;let h=Qn(m.schema)?i.resolveSchemaReference(m.schema):m.schema;return h.type==="string"&&(h.format==="binary"||h.format==null&&h.contentMediaType==="application/octet-stream")}))return i.options.useBytesForBinaryResponse&&t==null?fg.bytes({description:u.description,source:s,statusCode:c}):fg.file({description:u.description,source:s,statusCode:c});let l=I9s(u.content??{},i);if(l!=null&&t!=null)switch(t){case"json":return fg.streamingJson({statusCode:c,description:u.description,responseProperty:jr(e.operation,Rn.RESPONSE_PROPERTY),terminator:r,fullExamples:l.examples,schema:oc(l.schema,!1,!1,i,o,s,a),source:s});case"sse":return fg.streamingSse({description:u.description,responseProperty:void 0,terminator:r,fullExamples:l.examples,schema:oc(l.schema,!1,!1,i,o,s,a),source:s,statusCode:c})}let p=d_t({context:i,content:u.content??{}});if(p){if(t!=null)switch(t){case"json":return fg.streamingJson({description:u.description,responseProperty:void 0,terminator:r,fullExamples:p.examples,schema:oc(p.schema,!1,!1,i,o,s,a),source:s,statusCode:c});case"sse":return fg.streamingSse({description:u.description,responseProperty:void 0,terminator:r,fullExamples:p.examples,schema:oc(p.schema,!1,!1,i,o,s,a),source:s,statusCode:c})}return fg.json({description:u.description,schema:oc(p.schema,!1,!1,i,o,s,a),responseProperty:jr(e.operation,Rn.RESPONSE_PROPERTY),terminator:void 0,fullExamples:p.examples,source:s,statusCode:c})}for(let[d,f]of Object.entries(u.content??{})){let m=Vf.parse(d);if(m!=null){if(m.isOctetStream()||m.isPDF()||m.isAudio()||m.isImage()||m.isVideo()||m.isMultiPartMixed())return fg.file({description:u.description,source:s,statusCode:c});if(m.isText()&&!d.includes("event-stream")){let h=f.schema;if(h==null)return fg.text({description:u.description,source:s,statusCode:c});let g=Qn(h)?i.resolveSchemaReference(h):h;return g.type==="string"&&g.format==="byte"?fg.file({description:u.description,source:s,statusCode:c}):fg.text({description:u.description,source:s,statusCode:c})}}}}function q$l({responses:e,context:t,source:r,namespace:n}){let i={};for(let[o,s]of Object.entries(e)){if(o==="default")continue;let a=parseInt(o);if(a<400||a>600)continue;let c=Qn(s)?t.resolveResponseReference(s):s,u=x9s(c.content??{},t),l=Vxi[a];if(l==null){t.logger.warn(`No error name found for status code ${o}`);continue}i[a]={statusCode:a,nameOverride:void 0,generatedName:l,description:c.description,schema:oc(u?.schema??{},!1,!1,t,[l,"Body"],r,n),fullExamples:u?.examples,source:r}}return i}function Nse({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,streamTerminator:o,source:s,streamRequestNameOverride:a}){let{document:c,operation:u,path:l,method:p,baseBreadcrumbs:d,pathItem:f}=e,m=jr(u,Rn.IDEMPOTENT),h=jr(u,[Rn.REQUEST_NAME_V1,Rn.REQUEST_NAME_V2]),g=[...d,"Request"],A=ihr({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:g,path:l,httpMethod:p,source:s}),b=/{([^}]+)}/g,v=[...l.matchAll(b)].map(V=>V[1]).filter(V=>V!==void 0),E=[...l.matchAll(b)].map(V=>V[1]);switch(t.options.pathParameterOrder){case kn.PathParameterOrder.SpecOrder:{let V=E.filter(X=>!A.pathParameters.some(ae=>ae.name===X));if(V.length>0)for(let X of V)A.pathParameters.push({name:X??"",variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:s,schema:kr.primitive({schema:Qi.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0,clientDefault:void 0})}break;case kn.PathParameterOrder.UrlOrder:if(v.length>0){let V=new Map(A.pathParameters.map(G=>[G.name,G])),X=[],ae=new Set;for(let G of v){let Y=V.get(G);ae.add(G),Y?X.push(Y):X.push({name:G,variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:s,schema:kr.primitive({schema:Qi.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0,clientDefault:void 0})}for(let G of A.pathParameters)ae.has(G.name)||X.push(G);A.pathParameters=X}break;default:Ie(t.options.pathParameterOrder)}let I=(()=>{if(e.method==="GET")return[void 0];if(!u.requestBody)return[void 0];let V=Qn(u.requestBody)?t.resolveRequestBodyReference(u.requestBody):u.requestBody,X=Object.values(V.content).every(G=>W$l({mediaTypeObject:G})!=null),ae=[];if(X)return ae.push(...Object.entries(V.content).map(([G,Y])=>{let Ce=_H({mediaType:G,mediaTypeObject:Y,description:V.description,document:c,context:new kPe({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:g,source:s,namespace:t.namespace});return t7s({context:t,convertedParameters:A})&&Ce!=null&&(Ce.type==="json"||Ce.type==="formUrlEncoded")&&Ce.schema.type!=="object"&&u.requestBody!=null?Ce=_H({mediaType:G,mediaTypeObject:Y,description:V.description,document:c,context:t,requestBreadcrumbs:[...g,"Body"],source:s,namespace:t.namespace}):u.requestBody!=null&&(Ce=_H({mediaType:G,mediaTypeObject:Y,description:V.description,document:c,context:t,requestBreadcrumbs:[...g],source:s,namespace:t.namespace})),Ce}).filter(G=>G!=null)),ae.length===0?[void 0]:ae;{let G=shr({content:V.content,description:V.description,document:c,context:new kPe({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:g,source:s,namespace:t.namespace});return t7s({context:t,convertedParameters:A})&&G!=null&&(G.type==="json"||G.type==="formUrlEncoded")&&G.schema.type!=="object"&&u.requestBody!=null?G=shr({content:V.content,description:V.description,document:c,context:t,requestBreadcrumbs:[...g,"Body"],source:s,namespace:t.namespace}):u.requestBody!=null&&(G=shr({content:V.content,description:V.description,document:c,context:t,requestBreadcrumbs:[...g],source:s,namespace:t.namespace})),[G]}})(),x=I.length>1,C=[...d,"Response"],_=ahr({operationContext:e,streamFormat:i,streamTerminator:o,responses:u.responses,context:t,responseBreadcrumbs:C,responseStatusCode:r,source:s}),w=W9s(u),P=G9s(u),z=q9s(e,u,t),q=jr(u,Rn.SERVER_NAME_V2);return I.map(V=>({summary:u.summary,internal:jr(u,X1.INTERNAL),idempotent:m,audiences:jr(u,Rn.AUDIENCES)??[],operationId:u.operationId!=null&&n!=null?u.operationId+"_"+n:u.operationId,tags:t.resolveTagsToTagIds(u.tags),namespace:t.namespace,sdkName:$$l({operationContext:e,request:V}),pathParameters:A.pathParameters,queryParameters:A.queryParameters,headers:A.headers,requestNameOverride:a??h??void 0,generatedRequestName:Vb(x?G$l({breadcrumbs:g,request:V}):g,t.options.preserveSchemaIds),request:V,response:_.value,errors:_.errors,servers:q!=null?[{name:q,url:void 0,audiences:void 0}]:(u.servers??f.servers??[]).map(X=>nhr(X,{groupMultiApiEnvironments:t.options.groupMultiApiEnvironments})),description:u.description,authed:K$l(u,c),security:H$l(u),availability:P,method:p,path:l,examples:z,pagination:e.pagination,source:s,retries:w}))}function G$l({breadcrumbs:e,request:t}){return t?[...e,t.type]:e}function W$l({mediaTypeObject:e}){return jr(e,Rn.SDK_METHOD_NAME)}function $$l({operationContext:e,request:t}){return!t||!t.sdkMethodName?e.sdkMethodName:e.sdkMethodName?{groupName:[...e.sdkMethodName.groupName],methodName:t.sdkMethodName??e.sdkMethodName.methodName}:{groupName:[],methodName:t.sdkMethodName}}function H$l(e){return e.security}function K$l(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function t7s({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function n7s({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:o,operationParameters:s}=e,a=r.discriminant.name,c=r.discriminant.value,u=r["response-status-code"],l=r7s({context:t,headerToIgnore:a,parameters:o}),p=r7s({context:t,headerToIgnore:a,parameters:s}),d=Nse({operationContext:{...e,pathItemParameters:l,operationParameters:p,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([m])=>parseInt(m)!==u))}},context:t,streamFormat:void 0,source:n}),f=Nse({operationContext:{...e,pathItemParameters:l,operationParameters:p,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:u,streamFormat:void 0,source:n});return f.forEach(m=>{m.headers.push({name:a,schema:kr.literal({nameOverride:void 0,generatedName:Vb([a],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:JA.string(c),namespace:void 0,groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n,clientDefault:void 0})}),{sync:d,async:f}}function r7s({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=Qn(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}Pt();var qxi="stream";function a7s({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:Nse({operationContext:e,context:t,streamFormat:r.format,streamTerminator:r.terminator,source:t.source}),nonStreaming:[]};case"streamCondition":{let n=i7s({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0}),i=o7s({operation:e.operation,response:r.responseStream}),o=(()=>{if(r.streamRequestName!=null)return r.streamRequestName;if(n?.schemaReference!=null){let l=t.resolveSchemaReference(n.schemaReference),p=jr(l,Rn.TYPE_NAME);if(p!=null)return`${p}Streaming`}})(),s=Nse({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+qxi}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:n?.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,qxi]},context:t,streamFormat:r.format,streamTerminator:r.terminator,suffix:qxi,source:t.source,streamRequestNameOverride:o});s.forEach(l=>{l.examples=l.examples.filter(p=>s7s(p,t)!==!1)});let a=i7s({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),c=o7s({operation:e.operation,response:r.response}),u=Nse({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:a?.requestBody,responses:c}},context:t,source:t.source});return u.forEach(l=>{l.examples=l.examples.filter(p=>s7s(p,t)!==!0)}),{streaming:s,nonStreaming:u}}default:Ie(r)}}function i7s({context:e,operation:t,streamingExtension:r,isStreaming:n}){if(t.requestBody==null)return;let i=Qn(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,o=d_t({content:i.content,context:e});if(o==null)return;let s=Qn(o.schema)?e.resolveSchemaReference(o.schema):o.schema;if(s.allOf==null&&s.properties==null)return;let a=s.properties?.[r.streamConditionProperty];a!=null&&Qn(a)&&(a=void 0);let c={...s,properties:{...s.properties,[r.streamConditionProperty]:{...a??{},type:"boolean","x-fern-boolean-literal":n}},title:void 0,required:[...s.required??[],r.streamConditionProperty]};return{requestBody:{content:{[Vf.APPLICATION_JSON]:{schema:c}}},schemaReference:Qn(o.schema)?o.schema:void 0}}function o7s({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[Vf.APPLICATION_JSON]:{schema:t}}}}}function s7s(e,t){return e._visit({unknown:r=>{let n=th.serialization.ExampleEndpointCallSchema.parse(r);if(n.ok&&n.value.response!=null)return n.value.response.stream!=null},full:()=>{},_other:()=>{}})}var d7s=require("crypto");function J$l(e){switch(e){case"unix-seconds":return Wg.WebhookTimestampFormat.UnixSeconds;case"unix-millis":return Wg.WebhookTimestampFormat.UnixMillis;case"iso8601":return Wg.WebhookTimestampFormat.Iso8601}}function c7s(e){if(e!=null)return{header:e.header,format:e.format!=null?J$l(e.format):void 0,tolerance:e.tolerance}}function Y$l(e){if(e!=null)return{components:e.components.map(t=>{switch(t){case"body":return Wg.WebhookPayloadComponent.Body;case"timestamp":return Wg.WebhookPayloadComponent.Timestamp;case"notification-url":return Wg.WebhookPayloadComponent.NotificationUrl;case"message-id":return Wg.WebhookPayloadComponent.MessageId}}),delimiter:e.delimiter,bodySort:X$l(e["body-sort"])}}function X$l(e){if(e!=null&&e==="alphabetical")return Wg.WebhookPayloadBodySort.Alphabetical}function Z$l(e){if(e!=null)switch(e){case"sha256":return Wg.WebhookSignatureAlgorithm.Sha256;case"sha1":return Wg.WebhookSignatureAlgorithm.Sha1;case"sha384":return Wg.WebhookSignatureAlgorithm.Sha384;case"sha512":return Wg.WebhookSignatureAlgorithm.Sha512}}function u7s(e){if(e!=null)switch(e){case"base64":return Wg.WebhookSignatureEncoding.Base64;case"hex":return Wg.WebhookSignatureEncoding.Hex}}function eHl(e){if(e!=null)switch(e){case"rsa-sha256":return Wg.AsymmetricAlgorithm.RsaSha256;case"rsa-sha384":return Wg.AsymmetricAlgorithm.RsaSha384;case"rsa-sha512":return Wg.AsymmetricAlgorithm.RsaSha512;case"ecdsa-sha256":return Wg.AsymmetricAlgorithm.EcdsaSha256;case"ecdsa-sha384":return Wg.AsymmetricAlgorithm.EcdsaSha384;case"ecdsa-sha512":return Wg.AsymmetricAlgorithm.EcdsaSha512;case"ed25519":return Wg.AsymmetricAlgorithm.Ed25519}}function p7s(e){if(e.type==="hmac")return Wg.WebhookSignatureVerification.hmac({header:e.header,algorithm:Z$l(e.algorithm),encoding:u7s(e.encoding),signaturePrefix:e["signature-prefix"],payloadFormat:Y$l(e["payload-format"]),timestamp:c7s(e.timestamp)});if(e.type==="asymmetric"){let t=eHl(e["asymmetric-algorithm"]);return t==null?void 0:Wg.WebhookSignatureVerification.asymmetric({header:e.header,asymmetricAlgorithm:t,encoding:u7s(e.encoding),signaturePrefix:e["signature-prefix"],jwksUrl:e["jwks-url"],keyIdHeader:e["key-id-header"],timestamp:c7s(e.timestamp)})}}function l7s(e){let t=jr(e,Rn.WEBHOOK_SIGNATURE);if(!(t==null||typeof t=="boolean"))return p7s(t)}function f7s(e,t){let r=jr(t,Rn.WEBHOOK_SIGNATURE);return r!=null?typeof r=="boolean"?l7s(e):p7s(r):l7s(e)}function m7s({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:o,method:s,baseBreadcrumbs:a,sdkMethodName:c}=t,u=[...a,"Payload"],l=[...a,"Response"],p=ihr({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:u,path:o,httpMethod:s,source:r});if(s!=="POST"&&s!=="GET")return e.logger.warn(`Skipping webhook ${s.toUpperCase()} ${o}: Only POST and GET methods are currently supported`),[];let d=i.operationId??rHl({path:o,method:s,sdkMethodName:c}),f=i.responses?ahr({operationContext:t,streamFormat:void 0,responses:i.responses,context:e,responseBreadcrumbs:l,source:r}):void 0,m=f7s(n,i);if(i.requestBody==null){if(p.queryParameters.length===0)return e.logger.error(`Skipping webhook ${s.toUpperCase()} ${o}: Missing a request body and no query parameters`),[];let g=p.queryParameters.map(v=>({key:v.name,schema:v.schema,readonly:void 0,writeonly:void 0,audiences:[],conflict:{},nameOverride:v.parameterNameOverride,generatedName:Vb([...u,v.name],e.options.preserveSchemaIds),availability:v.availability})),A=kr.object({description:i.description,properties:g,nameOverride:void 0,generatedName:Vb(u,e.options.preserveSchemaIds),title:void 0,allOf:[],allOfPropertyConflicts:[],namespace:e.namespace,groupName:void 0,fullExamples:void 0,additionalProperties:!1,availability:void 0,encoding:void 0,source:r,inline:void 0,minProperties:void 0,maxProperties:void 0});return[{summary:i.summary,audiences:jr(i,Rn.AUDIENCES)??[],sdkName:c,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:Vb(u,e.options.preserveSchemaIds),payload:A,signatureVerification:m,multipartFormData:void 0,response:f?.value,description:i.description,examples:[],source:r}]}let h=Qn(i.requestBody)?e.resolveRequestBodyReference(i.requestBody):i.requestBody;return Object.entries(h.content).map(([g,A])=>_H({mediaType:g,mediaTypeObject:A,description:h.description,document:n,context:e,requestBreadcrumbs:[...a,"Payload"],source:r,namespace:e.namespace})).filter(g=>g!=null).map(g=>{if(g==null||g.type!=="json"&&g.type!=="formUrlEncoded"&&g.type!=="multipart"){e.logger.error(`Skipping webhook ${o} because non-json, non-formUrlEncoded, and non-multipart request body`);return}let A,b;return g.type==="multipart"?(A={name:g.name,properties:g.properties,description:g.description,source:g.source},b=kr.unknown({nameOverride:void 0,generatedName:Vb(u,e.options.preserveSchemaIds),title:void 0,description:g.description,availability:void 0,namespace:e.namespace,groupName:void 0,example:void 0})):b=g.schema,{summary:i.summary,audiences:jr(i,Rn.AUDIENCES)??[],sdkName:c,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:Vb(u,e.options.preserveSchemaIds),payload:b,signatureVerification:m,multipartFormData:A,response:f?.value,description:i.description,examples:tHl(g.fullExamples),source:r}}).filter(g=>g!=null)}function tHl(e){if(e==null)return[];let t=[];for(let r of e){let n=sge(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function rHl({path:e,method:t,sdkMethodName:r}){if(r?.methodName!=null)return r.methodName;let n=nHl(e);if(n===e.toLowerCase())return e;let i=(0,d7s.createHash)("sha256").update(e).digest("hex").slice(0,8);return iHl(`${n}_${t.toLowerCase()}_${i}`)}function nHl(e){return e.replace(/[{$}#]/g,"").replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/_+/g,"_").toLowerCase().slice(0,64)}function iHl(e){return e.split("_").map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Gxi({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=jr(r,Rn.IGNORE);if(i!=null&&i){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let o=oHl(r,e),s=v9s(e.document,r),a={...t,sdkMethodName:o,baseBreadcrumbs:sHl({operation:r,sdkMethodName:o,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:s};if(n)return{type:"webhook",value:m7s({context:e,operationContext:a,source:e.source})};let c=b9s(r);if(c==null&&aHl({operation:r,context:e})&&(c={type:"stream",format:"sse",terminator:void 0}),c!=null){let p=a7s({context:e,operationContext:a,streamingExtension:c});return p!=null?{type:"streaming",streaming:p.streaming,nonStreaming:p.nonStreaming}:void 0}let u=A9s(r);if(u!=null){let p=n7s({context:e,operationContext:a,asyncExtension:u,source:e.source});return{type:"async",async:p.async,sync:p.sync}}return{type:"http",value:Nse({context:e,operationContext:a,streamFormat:void 0,source:e.source})}}function oHl(e,t){let r=jr(e,Rn.SDK_METHOD_NAME),n=jr(e,Rn.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function sHl({sdkMethodName:e,operation:t,httpMethod:r,path:n,shouldUseIdiomaticRequestNames:i}){let o=[];if(e!=null){if(i&&o.push(e.methodName),e.groupName.length>0){let s=e.groupName[e.groupName.length-1];s!=null&&o.push(typeof s=="string"?s:s.name)}i||o.push(e.methodName)}else t.operationId!=null?o.push(t.operationId):o.push(Zn(`${r}_${n.split("/").join("_")}`));return o}function aHl({operation:e,context:t}){if(e.responses==null)return!1;for(let[r,n]of Object.entries(e.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=Qn(n)?t.resolveResponseReference(n):n;if(o.content!=null&&w9s(o.content))return!0}return!1}function h7s(e,t,r,n){let i=[],o=A7s(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let c=cHl({operation:a.operation}),u=Gxi({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:c});u&&i.push(u)}return i}function g7s(e,t,r,n){let i=[],o=A7s(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let c=Gxi({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:!0});c&&i.push(c)}return i}function A7s(e){let t=[];return e.get!=null&&t.push({method:d_.Get,operation:e.get}),e.post!=null&&t.push({method:d_.Post,operation:e.post}),e.put!=null&&t.push({method:d_.Put,operation:e.put}),e.delete!=null&&t.push({method:d_.Delete,operation:e.delete}),e.patch!=null&&t.push({method:d_.Patch,operation:e.patch}),e.head!=null&&t.push({method:d_.Head,operation:e.head}),t}function cHl({operation:e}){return jr(e,[Rn.WEBHOOK])??!1}function y7s(e){let t=jr(e,Rn.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=jr(e,Rn.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function b7s(e){return jr(e,Rn.FERN_BASIC_AUTH)}function v7s(e,t,r,n){if(Qn(e)){if(n==null)throw new Error(`Converting referenced security schemes requires context: ${JSON.stringify(e)}`);let i=n.resolveSecuritySchemeReference(e);return E7s(i,t,r)}return E7s(e,t,r)}function E7s(e,t,r){try{if(e.type==="apiKey"&&e.in==="header"){let n=jr(e,X1.BEARER_FORMAT),i=jr(e,Rn.FERN_HEADER_AUTH);return p_.header({headerName:e.name,prefix:n!=null?"Bearer":i?.prefix,headerVariableName:i?.name??jr(e,Rn.HEADER_VARIABLE_NAME),headerEnvVar:i?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="bearer"){let n=jr(e,Rn.FERN_BEARER_TOKEN);return p_.bearer({tokenVariableName:n?.name??jr(e,Rn.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:n?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="basic"){let n=b7s(e),i=y7s(e);return p_.basic({usernameVariableName:n?.username?.name??i.usernameVariable,usernameEnvVar:n?.username?.env,passwordVariableName:n?.password?.name??i.passwordVariable,passwordEnvVar:n?.password?.env})}else{if(e.type==="openIdConnect")return p_.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return p_.oauth({scopesEnum:uHl(e,t)})}}catch(n){r.logger.debug(`Error converting security scheme: ${n?.message}`)}r.logger.debug(`Skipping security scheme: ${JSON.stringify(e,null)} - not currently supported. Please reach out to Fern support team!`)}function uHl(e,t){let r=e.flows.authorizationCode?.scopes??e.flows.clientCredentials?.scopes??e.flows.implicit?.scopes??e.flows.password?.scopes;if(r!=null){let n=ige({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([o,s])=>[o,{description:s}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsOptional:!1,wrapAsNullable:!1,namespace:void 0,groupName:void 0,context:void 0,source:t,inline:void 0}),i=pd(n);if(i.type==="enum")return i}}function I7s(e){return jr(e,Rn.BASE_PATH)}var lHl=bt.record(bt.string(),bt.object({summary:bt.string().optional(),description:bt.string().optional()}));function w7s({document:e,context:t}){return a_t(e,Rn.GROUPS,lHl,t.logger)}function x7s({context:e,document:t}){return jr(t,Rn.FERN_VERSION)??void 0}function C7s(e){let t=jr(e,Rn.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({header:n.header,name:n.name,optional:n.optional,env:n.env,clientDefault:n["x-fern-default"],schema:n.type!=null?c_t({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function _7s(e){let t=jr(e,Rn.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?c_t({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function S7s(e,t){let r=jr(e,Rn.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([n,i])=>{if(i.type==="string")return[n,{nameOverride:void 0,generatedName:Vb([n],t),title:i.title,schema:Sl.string({default:WGe(i),pattern:i.pattern,format:i.format,minLength:i.minLength,maxLength:i.maxLength}),description:i.description,availability:void 0,namespace:void 0,groupName:void 0}];throw new Error(`Variable ${n} has unsupported schema ${JSON.stringify(i)}`)}))}var pHl="webhooks";function T7s(e){return jr(e,pHl)??{}}var y_t=class extends XGe{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discriminatedUnionReferences={};discriminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){super({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s})}getDummy(){return new kPe({document:this.document,taskContext:this.taskContext,options:this.options,source:this.source,namespace:this.namespace})}markSchemaAsReferencedByNonRequest(t){this.nonRequestReferencedSchemas.add(t)}markSchemaAsReferencedByRequest(t){this.singleRequestReferencedSchemas.has(t)?this.twoOrMoreRequestsReferencedSchemas.add(t):this.singleRequestReferencedSchemas.add(t)}getReferencedSchemas(){return new Set([...this.nonRequestReferencedSchemas,...this.twoOrMoreRequestsReferencedSchemas])}markReferencedByDiscriminatedUnion(t,r,n){let i=this.discriminatedUnionReferences[t.$ref];i!=null?(i.discriminants.add(r),i.numReferences+=n):this.discriminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:n}}getReferencesFromDiscriminatedUnion(t){return this.discriminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,n){let i=this.discriminatedUnionMetadata[t.$ref];i!=null?i.discriminants.set(r,n):this.discriminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,n]])}}getDiscriminatedUnionMetadata(t){return this.discriminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}};function O7s(e){return jr(e,Rn.RESOLUTIONS)}function B7s({openapi:e}){let t=O7s(e);if(t==null)return e;let r={};for(let n of t){let i=`#/components/schemas/${n.name}`;for(let o of n.resolutions)e=fHl({openapi:e,schemaReference:o,schemaName:n.name}),e=P7s({openapi:e,replaceReference:o,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(s=>[i,s]))}}return e}function fHl({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(o=>o.replaceAll("~1","/")),i=e;for(let o of n){let s=i[o];if(s==null)return e;i=s}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function P7s({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(c=>t.startsWith(c)).sort((c,u)=>u.length-c.length)[0];if(i!=null){let c=n[i];if(c!=null){let u=r.replace(i,c);return P7s({openapi:e,replaceReference:t,schemaReference:u,replacedReferences:{}})}}let o=t.replace("#/","").split("/").map(c=>c.replaceAll("~1","/")),s=e;for(let c of o.slice(0,-1)){let u=s[c];if(u==null)return e;s=u}let a=o[o.length-1];return a==null||(s[a]={$ref:r}),e}function D7s({openApi:e,taskContext:t,options:r,source:n,namespace:i}){e=B7s({openapi:e}),AHl({openApi:e,taskContext:t}),Lmr();let o=new y_t({document:e,taskContext:t,authHeaders:new Set,options:r,source:n,namespace:i}),s=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([z,q])=>{let V=v7s(q,n,t,o);return V==null?null:[z,V]}).filter(z=>z!==null)),a=e.security?.filter(z=>z!=null),c=new Set(Object.entries(s).map(([z,q])=>q.type==="basic"||q.type==="bearer"||q.type==="oauth"?"Authorization":q.type==="header"?q.headerName:null).filter(z=>z!=null)),u=S7s(e,r.preserveSchemaIds),l=C7s(e),p=_7s(e),d=r.audiences??[],f=[],m=[],h=new y_t({document:e,taskContext:t,authHeaders:c,options:r,source:n,namespace:i});h.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied..."),Object.entries(e.paths??{}).forEach(([z,q])=>{if(q==null)return;let V=h7s(z,q,e,h);for(let X of V){let ae=R7s({operation:X});if(!(d.length>0&&!d.some(G=>ae.includes(G))))switch(X.type){case"async":f.push(...X.sync),f.push(...X.async);break;case"http":f.push(...X.value);break;case"streaming":f.push(...X.streaming),X.nonStreaming&&f.push(...X.nonStreaming);break;case"webhook":m.push(...X.value);break;default:Ie(X)}}}),Object.entries(T7s(e)).forEach(([z,q])=>{if(q==null)return;t.logger.debug(`Converting path ${z}`);let V=g7s(z,q,e,h);for(let X of V){let ae=R7s({operation:X});d.length>0&&!d.some(G=>ae.includes(G))||m.push(...X.value)}});let g=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([z,q])=>{let V=jr(q,Rn.SDK_NAMESPACE);if(!Qn(q)){let X=jr(q,Rn.IGNORE);if(X!=null&&X)return[];if(Z9s.has(z))return[z,oc({...q,"x-fern-type-name":`${z}Body`},!1,!1,h,[z],n,V??i)]}return[z,oc(q,!1,!1,h,[z],n,V??i)]}).filter(z=>z.length>0)),A=dHl(g,h,n),b=hHl(A,h),v=vH(),E={};for(let[z,q]of Object.entries(b)){let V=pd(q);if(h.isSchemaExcluded(z))continue;let X=v.getUniqueSchemaId(z,h.logger,r.resolveSchemaCollisions);E[X]=V}let I=new age(b,h.nonRequestReferencedSchemas,h),x=m.map(z=>{let V=z.examples;if(!r.disableExamples&&V.length===0){let X=I.buildExample({schema:z.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});X!=null&&(V=[{name:void 0,description:void 0,payload:X}])}return{...z,payload:pd(z.payload),examples:V}}),C=new Vmr(b,h,l),_=f.map(z=>{let q=z.examples,V=q;if(!r.disableExamples&&(q.length===0||q.every(f_t))){let G=C.buildEndpointExample(z);G.length>0&&(V=[...G,...q.filter(Y=>!f_t(Y))])}let X=z.request,ae=z.response;return{...z,request:X?.type==="json"||X?.type==="formUrlEncoded"?{...X,schema:pd(X.schema)}:X,response:ae?.type==="json"?{...ae,schema:pd(ae.schema)}:ae,queryParameters:z.queryParameters.map(G=>({description:G.description,name:G.name,schema:pd(G.schema),parameterNameOverride:G.parameterNameOverride,explode:G.explode,availability:G.availability,source:G.source,clientDefault:G.clientDefault})),pathParameters:z.pathParameters.map(G=>({description:G.description,name:G.name,schema:pd(G.schema),parameterNameOverride:G.parameterNameOverride,variableReference:G.variableReference,availability:G.availability,source:G.source,clientDefault:G.clientDefault})),headers:z.headers.map(G=>({description:G.description,name:G.name,schema:pd(G.schema),parameterNameOverride:G.parameterNameOverride,env:G.env,availability:G.availability,source:G.source,clientDefault:G.clientDefault})),examples:V,errors:Xl(z.errors,G=>{let Y=G.fullExamples?.map(Ce=>{let Te=sge(Ce.value);if(Te!=null)return{name:Ce.name,description:Ce.description,example:Te}}).filter(Pa);if(Y?.length===0){let Ce=I.buildExample({schema:G.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});Ce!=null&&Y.push({name:void 0,description:void 0,example:Ce})}return{generatedName:G.generatedName,nameOverride:G.nameOverride,schema:pd(G.schema),description:G.description,source:G.source,examples:Y}}),retries:z.retries}});C.finalize();let w=w7s({document:e,context:h});return{apiVersion:x7s({context:h,document:e}),basePath:I7s(e),title:e.info.title??"",description:e.info.description,groups:Object.fromEntries(Object.entries(w??{}).map(([z,q])=>[z,{summary:q.summary??void 0,description:q.description??void 0}])),servers:(e.servers??[]).map(z=>nhr(z,{groupMultiApiEnvironments:r.groupMultiApiEnvironments})),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(z=>[z.name,{id:z.name,description:z.description}])),orderedTagIds:e.tags?.map(z=>z.name)},endpoints:_,webhooks:x,channels:{},groupedSchemas:HGe(i,E),securitySchemes:s,security:a,hasEndpointsMarkedInternal:_.some(z=>z.internal),nonRequestReferencedSchemas:h.getReferencedSchemas(),variables:u,globalHeaders:l,idempotencyHeaders:p}}function dHl(e,t,r){if(t.options.removeDiscriminantsFromSchemas===kn.RemoveDiscriminantsFromSchemas.Never)return e;let n=mHl(e,t),i={};for(let[o,s]of Object.entries(e)){if(s.type!=="object"){i[o]=s;continue}let a={$ref:`#/components/schemas/${o}`},c=t.getReferencesFromDiscriminatedUnion(a);if(c==null){i[o]=s;continue}if(t.getReferencedSchemas().has(o)){i[o]=s;continue}let l={...s,type:"object",properties:s.properties.filter(d=>!c.discriminants.has(d.key)),allOfPropertyConflicts:s.allOfPropertyConflicts.filter(d=>!c.discriminants.has(d.propertyKey)),source:r};i[o]=l;let p=Wxi({schema:s,schemas:e});for(let d of[...new Set(p)]){if(n.has(d))continue;let f=i[d]??e[d];f==null||f.type!=="object"||(i[d]={...f,type:"object",properties:f.properties.filter(m=>!c.discriminants.has(m.key)),allOfPropertyConflicts:f.allOfPropertyConflicts.filter(m=>!c.discriminants.has(m.propertyKey))})}}return i}function mHl(e,t){let r=new Set;for(let[n,i]of Object.entries(e)){if(i.type!=="object")continue;let o={$ref:`#/components/schemas/${n}`};if(t.getReferencesFromDiscriminatedUnion(o)==null)for(let s of Wxi({schema:i,schemas:e}))r.add(s)}return r}function hHl(e,t){let r={};for(let[n,i]of Object.entries(e)){if(i.type!=="object"){r[n]=i;continue}let o={$ref:`#/components/schemas/${n}`},s=t.getDiscriminatedUnionMetadata(o);if(s==null){r[n]=i;continue}let a=[];for(let u of i.properties)if(s.discriminants.has(u.key)){let l=s.discriminants.get(u.key);l!=null&&a.push({...u,schema:kr.literal({nameOverride:void 0,generatedName:Vb([i.generatedName,l],t.options.preserveSchemaIds),title:void 0,value:JA.string(l),namespace:void 0,groupName:void 0,description:void 0,availability:i.availability})})}else a.push(u);let c={...i,type:"object",properties:a};r[n]=c}return r}function Wxi({schema:e,schemas:t}){let r=[];for(let n of e.allOf){r.push(n.schema);let i=t[n.schema];i!=null&&i.type==="object"&&r.push(...Wxi({schema:i,schemas:t}))}return r}function chr(e){return[...new Set(e)]}var uhr=new RegExp("[^\\x00-\\x7F]"),gHl=/(?:^|\n)\s*---\s*(?:\n|$)/;function AHl({openApi:e,taskContext:t}){for(let r of e.tags??[])if(uhr.test(r.name)){let n=[...r.name].filter(i=>uhr.test(i));t.logger.error(`Tag name "${r.name}" contains non-ASCII characters: ${n.join(", ")}. Non-ASCII characters in tag names will be included in URL paths and HTTP headers, which only support ASCII characters. This will cause runtime errors (ERR_INVALID_CHAR). Remove non-ASCII characters from the tag name.`)}for(let[r,n]of Object.entries(e.paths??{}))if(n!=null)for(let i of["get","post","put","delete","patch","options","head","trace"]){let o=n[i];if(o?.description!=null&&gHl.test(o.description)&&t.logger.error(`Description at paths.${r}.${i} contains "---" frontmatter delimiters which will cause YAML parsing failures in the generated docs site. Remove the "---" delimiters from the description.`),o?.tags!=null&&(e.tags==null||e.tags.length===0)){for(let s of o.tags)if(uhr.test(s)){let a=[...s].filter(c=>uhr.test(c));t.logger.error(`Tag name "${s}" at paths.${r}.${i} contains non-ASCII characters: ${a.join(", ")}. Remove non-ASCII characters from the tag name.`)}}}}function R7s({operation:e}){let t=[];switch(e.type){case"async":t=chr(e.async.flatMap(r=>r.audiences));break;case"http":t=chr(e.value.flatMap(r=>r.audiences));break;case"streaming":t=chr(e.streaming.flatMap(r=>r.audiences));break;case"webhook":t=chr(e.value.flatMap(r=>r.audiences));break;default:Ie(e)}return t}function XPe({context:e,documents:t,options:r}){let n={apiVersion:void 0,title:void 0,description:void 0,basePath:void 0,servers:[],websocketServers:[],tags:{tagsById:{},orderedTagIds:void 0},hasEndpointsMarkedInternal:!1,endpoints:[],webhooks:[],channels:{},groupedSchemas:{rootSchemas:{},namespacedSchemas:{}},variables:{},nonRequestReferencedSchemas:new Set,securitySchemes:{},security:void 0,globalHeaders:[],idempotencyHeaders:[],groups:{}},i=0;for(let o of t)try{let s=o.source!=null?o.source:tB.openapi({file:"<memory>"});switch(o.type){case"openapi":{let a=D7s({taskContext:e,openApi:o.value,options:K4({options:o.settings,overrides:r}),source:s,namespace:o.namespace});n=IHl(n,a,K4({options:o.settings,overrides:r})),i++;break}case"asyncapi":{let a=g9s({document:o.value,taskContext:e,options:K4({options:o.settings,overrides:r}),source:s,asyncApiOptions:yHl({options:o.settings}),namespace:o.namespace});a.servers!=null&&(n.websocketServers=[...n.websocketServers,...a.servers.map(c=>({...c,audiences:void 0,description:void 0,defaultUrl:void 0,urlTemplate:void 0,variables:void 0}))]),a.channels!=null&&(n.channels={...n.channels,...a.channels}),a.groupedSchemas!=null&&(n.groupedSchemas=lhr(n.groupedSchemas,a.groupedSchemas,r)),a.basePath!=null&&(n.basePath=a.basePath),i++;break}default:Ie(o)}}catch(s){e.logger.error(`Failed to parse ${o.type} document ${o.type==="openapi"?o.value.info?.title:o.source?.file}`),s instanceof Error&&e.logger.error(s.message,s.stack?`
|
|
1580
1580
|
`+s.stack:"")}return n}function yHl({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??RGs.naming}}function phr(e){let t=String(e.description||e.name||e["x-fern-server-name"]||"default").trim(),r=t.toUpperCase();return r==="PRODUCTION"||r==="PRD"||r==="PROD"?"PRD":r==="SANDBOX"||r==="SBX"?"SBX":r==="STAGING"||r==="STG"?"STG":r==="PERFORMANCE"||r==="PRF"||r==="PERF"?"PRF":r==="E2E"||r==="E_2_E"?"E2E":r==="QAL"||r==="QUALITY"?"QAL":t}function Hxi(e){try{let n=new URL(e).hostname.split("."),i=new Set(["api","www","service","services","example","com","org","net","io"]);for(let s of n){let a=s.split("-")[0],c=a&&a.length>2?a:s;if(c&&!i.has(c.toLowerCase())&&c.length>2)return c.toLowerCase()}let o=n[0];return o&&o.length>0?o.toLowerCase():"api"}catch{let t=e.match(/https?:\/\/([^./-]+)/);return t&&t[1]?t[1].toLowerCase():"api"}}function $xi(e,t){let r=e??[],n=t??[];if(r.length===0&&n.length===0)return;let i=new Map;for(let o of[...r,...n]){let s=Object.keys(o).sort(),a={};for(let u of s)a[u]=o[u]??[];let c=JSON.stringify(a);i.has(c)||i.set(c,o)}return Array.from(i.values())}function bHl(e,t){if(vHl(e))return!0;if(e.length===0||t.length===0||e.length!==t.length)return!1;let r=new Map;for(let o of e){if(o.type==="grouped")continue;let s=phr(o);r.set(s,o.url)}let n=!0,i=!0;for(let o of t){if(o.type==="grouped")continue;let s=phr(o),a=r.get(s);a?a===o.url&&(i=!1):n=!1}return n&&i}function Kxi(e){return e.defaultUrl??e.url}function EHl(e){if(e.length===0||!e[0])return"api";let t=e[0];return t.type==="grouped"?Object.keys(t.urls)[0]??"api":Hxi(Kxi(t))}function vHl(e){return e.some(t=>t.type==="grouped")}function IHl(e,t,r){if(!(r?.groupMultiApiEnvironments===!0))return{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:lhr(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:$xi(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}};if(bHl(e.servers,t.servers)){let o=[],s=[],a=EHl(t.servers),c=new Map;for(let p of e.servers)if(p.type==="grouped"){let d=p.name??"default";c.has(d)||c.set(d,{});let f=c.get(d);if(f)for(let[m,h]of Object.entries(p.urls))f[m]=h}else{let d=Hxi(Kxi(p)),f=phr(p);c.has(f)||c.set(f,{});let m=c.get(f);m&&(m[d]={url:p.url,audiences:p.audiences,defaultUrl:p.defaultUrl,urlTemplate:p.urlTemplate,variables:p.variables})}for(let p of t.servers){let d=phr(p);c.has(d)||c.set(d,{});let f=c.get(d);f&&(f[a]={url:p.url,audiences:p.audiences,defaultUrl:p.defaultUrl,urlTemplate:p.urlTemplate,variables:p.variables})}for(let[p,d]of c.entries()){let f={type:"grouped",name:p,description:`${p} environment`,urls:d};o.push(f)}let u=e.endpoints.map(p=>{let d=p.__apiName;if(d)return{...p,type:"multi-api",apiName:d,servers:[{name:d,url:void 0,audiences:void 0}]};let f=e.servers[0],m=f!=null&&f.type!=="grouped"?Hxi(Kxi(f)):"api";return{...p,type:"multi-api",apiName:m,servers:[{name:m,url:void 0,audiences:void 0}]}}),l=t.endpoints.map(p=>({...p,type:"multi-api",apiName:a,servers:[{name:a,url:void 0,audiences:void 0}]}));return s=[...u,...l],{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:o,websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:s.map(p=>{if(p.type==="multi-api"){let{type:m,apiName:h,servers:g,...A}=p;return{...A,__apiName:h,servers:g}}let{type:d,...f}=p;return f}),webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:lhr(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:$xi(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}return{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:lhr(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:$xi(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}function lhr(e,t,r){let n=vH(),i=r?.resolveSchemaCollisions??!1,o={...e.rootSchemas};for(let[s,a]of Object.entries(t.rootSchemas)){let c=n.getUniqueSchemaId(s,void 0,i);o[c]=a}e.rootSchemas=o;for(let[s,a]of Object.entries(t.namespacedSchemas))if(e.namespacedSchemas[s]!=null){let c=e.namespacedSchemas[s];for(let[u,l]of Object.entries(a)){let p=n.getUniqueSchemaId(u,void 0,i);c[p]=l}}else e.namespacedSchemas[s]=a;return e}var Kta=ve(hbr(),1),gbr={config:new Kta.Config({apis:{},styleguide:{plugins:[_xi],rules:{struct:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!1};function Kq({options:e,overrides:t}={}){return{...K4({options:e,overrides:t}),...IPe({options:e,overrides:t})}}var S0p={shouldUseTitleAsName:"useTitlesAsName",shouldUseUndiscriminatedUnionsWithLiterals:["shouldUseUndiscriminatedUnionsWithLiterals","discriminatedUnionV2"],shouldUseIdiomaticRequestNames:"shouldUseIdiomaticRequestNames",asyncApiMessageNaming:"asyncApiNaming",shouldUseOptionalAdditionalProperties:"optionalAdditionalProperties",coerceEnumsToLiterals:"coerceEnumsToLiterals",objectQueryParameters:"objectQueryParameters",respectReadonlySchemas:"respectReadonlySchemas",respectNullableSchemas:"respectNullableSchemas",onlyIncludeReferencedSchemas:"onlyIncludeReferencedSchemas",inlinePathParameters:"inlinePathParameters",useBytesForBinaryResponse:"useBytesForBinaryResponse",respectForwardCompatibleEnums:"respectForwardCompatibleEnums",filter:"filter",defaultFormParameterEncoding:"defaultFormParameterEncoding",exampleGeneration:"exampleGeneration",additionalPropertiesDefaultsTo:"additionalPropertiesDefaultsTo",typeDatesAsStrings:"typeDatesAsStrings",preserveSingleSchemaOneOf:"preserveSingleSchemaOneOf",inlineAllOfSchemas:"inlineAllOfSchemas",resolveAliases:"resolveAliases",groupMultiApiEnvironments:"groupMultiApiEnvironments",groupEnvironmentsByHost:"groupEnvironmentsByHost",inferDefaultEnvironment:"inferDefaultEnvironment",wrapReferencesToNullableInOptional:"wrapReferencesToNullableInOptional",coerceOptionalSchemasToNullable:"coerceOptionalSchemasToNullable",removeDiscriminantsFromSchemas:"removeDiscriminantsFromSchemas",defaultIntegerFormat:"defaultIntegerFormat",pathParameterOrder:"pathParameterOrder",resolveSchemaCollisions:"resolveSchemaCollisions",inferForwardCompatible:"inferForwardCompatible",coerceConstsTo:"coerceConstsTo"};function T0p(e,t,r){r!==void 0&&(e[t]=r)}function Abr(e){let t={};if(e!=null)for(let[r,n]of Object.entries(S0p)){let i=e[r],o=Array.isArray(n)?n:[n];for(let s of o)T0p(t,s,i)}return Kq({options:t})}function u7e(e){if(e.settings==null&&e.apiOverride?.auth==null&&e.apiOverride?.["auth-schemes"]==null&&e.apiOverride?.headers==null)return;let t={detectGlobalHeaders:!0};return e.settings?.unions==="v1"&&(t.discriminatedUnionV2=!0),e.apiOverride?.auth!=null&&(t.auth=e.apiOverride.auth),e.apiOverride?.["auth-schemes"]!=null&&(t.authSchemes=e.apiOverride["auth-schemes"]),e.apiOverride?.headers!=null&&(t.headers=e.apiOverride.headers),t}function AD(e){return e.swagger!=null}function FOi(e){return e.openapi!=null}Pt();GA();Li();function Lge(e,t={}){return{...Object.fromEntries(Rb(e.namedDefinitionFiles).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...Rb(e.importedDefinitions).reduce((r,[n,i])=>({...r,...BIt(Lge(i.definition,{defaultURL:i.url}),(o,s)=>QE(n,Ks.of(s)))}),{})}}Pt();GA();Li();function BSt(e,t={}){return{...Object.fromEntries(Rb(e.packageMarkers).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...Rb(e.importedDefinitions).reduce((r,[n,i])=>({...r,...BIt(BSt(i.definition,{defaultURL:i.url}),(o,s)=>QE(n,Ks.of(s)))}),{})}}function tae(e){return{...BSt(e),...Lge(e)}}function uz(e,t){return tae(e.definition)[t]?.contents}Pt();GA();function Hv(e,t){for(let[r,n]of Rb(tae(e.definition)))t(r,n.contents,{isPackageMarker:kO(r)===Pf,defaultUrl:n.defaultUrl})}Pt();function TRe(e,t){for(let[r,n]of Rb(BSt(e.definition)))t(r,n.contents)}Pt();var Jta=ve(require("path"),1);async function ybr({schema:e,value:t,context:r,filepathBeingParsed:n}){let i=await e.safeParseAsync(t);if(i.success)return i.data;let o=i.error.errors.map(a=>{let c=a.path.length>0?`${a.message} at "${O0p(a.path)}"`:a.message;return ZU({content:c,prefix:" - "})}),s=[`Failed to parse file: ${Jta.default.relative(process.cwd(),n)}`,...o].join(`
|
|
1581
|
-
`);return r.failAndThrow(s)}function O0p(e){return e.reduce((t,r)=>typeof r=="number"?t+"["+r+"]":t+(t===""?"":".")+r,"")}Jt();var Yta=ve(require("path"),1),B0p={dependencies:{}};async function Xta({absolutePathToWorkspace:e,rawDependenciesConfiguration:t,context:r}){if(t==null)return B0p;let n={};for(let[i,o]of Object.entries(t.dependencies))if(R0p(o)){let s=Wt.of(Yta.default.join(e,o));await ar(s)?n[i]={type:"local",absoluteFilepath:s,path:o}:r.failWithoutThrowing(`Path to ${i} dependency does not exist: ${s}`)}else{let a=i.substring(1).split("/"),c=a[0],u=a[1];c!=null&&u!=null?n[i]={type:"version",organization:c,apiName:u,version:o}:r.failWithoutThrowing(`Failed to parse dependency: ${i}`)}return r.getResult()===Bf.Failure&&r.failAndThrow(),{dependencies:n}}var P0p=/^\.\.\/.*$/;function R0p(e){return P0p.test(e)}Jt();var era=require("fs/promises");var Zta=bt.object({dependencies:bt.record(bt.string(),bt.string())});async function tra({absolutePathToWorkspace:e,context:t}){let r=Ke(e,Be.of(vUs));if(!await ar(r))return;let n=await(0,era.readFile)(r),i=Rr.load(n.toString());return await ybr({schema:Zta,value:i,context:t,filepathBeingParsed:r})}async function kOi({absolutePathToWorkspace:e,context:t}){let r=await tra({absolutePathToWorkspace:e,context:t});return Xta({absolutePathToWorkspace:e,rawDependenciesConfiguration:r,context:t})}Pt();vbr();function lra(e={accentPrimary:void 0,background:void 0},t){e.accentPrimary=e.accentPrimary??e.accentPrimaryDeprecated;let r=wbr(e);switch(r){case"dark":return{type:"dark",...Ibr(e,t,"dark")};case"light":return{type:"light",...Ibr(e,t,"light")};case"darkAndLight":return{type:"darkAndLight",dark:Ibr(e,t,"dark"),light:Ibr(e,t,"light")};default:Ie(r)}}function wbr({background:e,accentPrimary:t,accentPrimaryDeprecated:r}){if(t=t??r,typeof e=="string"&&typeof t=="string")return os(e).isDark()?"dark":"light";if(e!=null){if(typeof e=="string")return os(e).isDark()?"dark":"light";if(e.dark!=null&&e.light!=null)return"darkAndLight"}if(t!=null){if(typeof t=="string")return os(t).isLight()?"dark":"light";if(t.dark!=null&&t.light!=null)return"darkAndLight"}if(t!=null&&e!=null){if(e.dark!=null&&t.dark!=null)return"dark";if(e.light!=null&&t.light!=null)return"light"}return"darkAndLight"}function Ibr(e,t,r){let n=v_(e.accentPrimary??e.accentPrimaryDeprecated,t,"accent-primary",r)??os.random(),i=v_(e.background,t,"background",r);return{accentPrimary:n.toRgb(),background:i?.toRgb(),border:v_(e.border,t,"border",r)?.toRgb(),sidebarBackground:v_(e.sidebarBackground,t,"sidebar-background",r)?.toRgb(),headerBackground:v_(e.headerBackground,t,"header-background",r)?.toRgb(),cardBackground:v_(e.cardBackground,t,"card-background",r)?.toRgb(),accent1:v_(e.accent1,t,"accent-1",r)?.toRgb(),accent2:v_(e.accent2,t,"accent-2",r)?.toRgb(),accent3:v_(e.accent3,t,"accent-3",r)?.toRgb(),accent4:v_(e.accent4,t,"accent-4",r)?.toRgb(),accent5:v_(e.accent5,t,"accent-5",r)?.toRgb(),accent6:v_(e.accent6,t,"accent-6",r)?.toRgb(),accent7:v_(e.accent7,t,"accent-7",r)?.toRgb(),accent8:v_(e.accent8,t,"accent-8",r)?.toRgb(),accent9:v_(e.accent9,t,"accent-9",r)?.toRgb(),accent10:v_(e.accent10,t,"accent-10",r)?.toRgb(),accent11:v_(e.accent11,t,"accent-11",r)?.toRgb(),accent12:v_(e.accent12,t,"accent-12",r)?.toRgb(),logo:void 0,backgroundImage:void 0}}function RSt(e,t,r){if(e==null)return;let n=typeof e=="string"?e:e[r];if(n==null&&t==="accent-primary"&&typeof e!="string"&&(n=e[r==="dark"?"light":"dark"]),n!=null)return n}function v_(e,t,r,n){let i=RSt(e,r,n);if(i==null)return;let o=os(i);return o.isValid()||t.failAndThrow(`'${typeof e=="string"?r:`colors.${r}.${n}`}' should be a hex color of the format #FFFFFF`),o}Pt();Jt();var fra=require("fs/promises");Li();var pra=100;async function nEp({files:e,absolutePathToFernFolder:t}){let r=await Promise.all(e.map(async n=>{let i=await(0,fra.readFile)(n,"utf-8");return[R0(t,n),i]}));return Object.fromEntries(r)}async function dra({files:e,absolutePathToFernFolder:t}){let r={};for(let n=0;n<e.length;n+=pra){let i=e.slice(n,n+pra),o=await nEp({files:i,absolutePathToFernFolder:t});Object.assign(r,o)}return r}function ORe({landingPage:e,navigation:t}){return e4([e?.absolutePath,...iEp(t)])}function iEp(e){switch(e.type){case"tabbed":return e.items.flatMap(t=>t.child.type==="layout"?t.child.layout.flatMap(r=>xbr({item:r})):t.child.type==="variants"?t.child.variants.flatMap(r=>r.layout.flatMap(n=>xbr({item:n}))):t.child.type==="changelog"?t.child.changelog:[]);case"untabbed":return e.items.flatMap(t=>xbr({item:t}));case"versioned":return e.versions.flatMap(t=>ORe({landingPage:t.landingPage,navigation:t.navigation}));case"productgroup":return e.products.flatMap(t=>t.type==="external"?[]:ORe({landingPage:t.landingPage,navigation:t.navigation}));default:Ie(e)}}function xbr({item:e}){switch(e.type){case"apiSection":return e4([e.overviewAbsolutePath,...e.navigation.flatMap(t=>mra({item:t}))]);case"link":return[];case"page":return[e.absolutePath];case"section":return e4([e.overviewAbsolutePath,...e.contents.flatMap(t=>xbr({item:t}))]);case"changelog":return e.changelog;case"librarySection":return[];default:Ie(e)}}function mra({item:e}){return e.type==="page"?[e.absolutePath]:e.type==="package"||e.type==="section"?e4([e.overviewAbsolutePath,...e.contents.flatMap(t=>mra({item:t}))]):[]}Pt();hg();Jt();var s$e=require("fs/promises");var aNa=ve(require("path"),1);Jt();var rQi=require("fs/promises"),iNa=ve(UG(),1);function owr({name:e}){return e.replace(/\.(md|mdx)$/i,"").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function nQi({name:e}){return e.replace(/\.(md|mdx)$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}async function swr({absolutePath:e,readFileFn:t=(r,n)=>(0,rQi.readFile)(r,n)}){try{let r=await t(e,"utf-8"),{data:n}=(0,iNa.default)(r),i;if(n.position!=null){let c=typeof n.position=="string"?parseFloat(n.position):n.position;typeof c=="number"&&Number.isFinite(c)&&(i=c)}let o=typeof n.title=="string"&&n.title.trim().length>0?n.title.trim():void 0,s=n.hidden===!0?!0:void 0,a=n.noindex===!0?!0:void 0;return{position:i,title:o,hidden:s,noindex:a}}catch{return{position:void 0,title:void 0,hidden:void 0,noindex:void 0}}}function nNa({frontmatterTitle:e,useFrontmatterTitles:t,fallbackName:r}){return t&&e!=null?e:nQi({name:r})}async function iQi({directoryPath:e,titleSource:t,getDir:r=kb,readFileFn:n=(i,o)=>(0,rQi.readFile)(i,o)}){let i=await r(e),o=t==="frontmatter",s=i.filter(d=>d.type==="file"&&!d.name.startsWith("_")&&(d.name.toLowerCase().endsWith(".md")||d.name.toLowerCase().endsWith(".mdx"))),a=i.filter(d=>d.type==="directory"&&!d.name.startsWith("_")),c=await Promise.all(s.map(d=>swr({absolutePath:d.absolutePath,readFileFn:n}))),u=s.map((d,f)=>{let m=c[f];return{type:"page",title:nNa({frontmatterTitle:m?.title,useFrontmatterTitles:o,fallbackName:d.name}),absolutePath:d.absolutePath,slug:owr({name:d.name}),icon:void 0,hidden:m?.hidden,noindex:m?.noindex,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0}}),l=await Promise.all(a.map(async d=>{let f=await iQi({directoryPath:d.absolutePath,titleSource:t,getDir:r,readFileFn:n}),m=f.find(b=>b.type==="page"&&(b.slug==="index"||b.absolutePath.toLowerCase().endsWith("/index.mdx")||b.absolutePath.toLowerCase().endsWith("/index.md"))),h=m?f.filter(b=>b!==m):f,g=m?.type==="page"?await swr({absolutePath:m.absolutePath,readFileFn:n}):void 0;return{section:{type:"section",title:nNa({frontmatterTitle:g?.title,useFrontmatterTitles:o,fallbackName:d.name}),slug:owr({name:d.name}),icon:void 0,contents:h,collapsed:void 0,collapsible:void 0,collapsedByDefault:void 0,hidden:g?.hidden,skipUrlSlug:!1,overviewAbsolutePath:m?.type==="page"?m.absolutePath:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0},position:g?.position}})),p=[...u.map((d,f)=>({item:d,title:d.type==="page"?d.title:"",position:c[f]?.position})),...l.map(d=>({item:d.section,title:d.section.type==="section"?d.section.title:"",position:d.position}))];return p.sort((d,f)=>{let m=typeof d.position=="number",h=typeof f.position=="number";if(m&&!h)return-1;if(!m&&h)return 1;if(typeof d.position=="number"&&typeof f.position=="number"){let g=d.position-f.position;return g!==0?g:d.title.localeCompare(f.title,void 0,{sensitivity:"base"})}return d.title.localeCompare(f.title,void 0,{sensitivity:"base"})}),p.map(d=>d.item)}function Sgf(e){return!e||e.startsWith("<")?!1:e.startsWith(".")||e.includes("/")||e.includes("\\")||e.includes(":")}function $b(e,t){if(e)return Sgf(e)?sb(e,t):e}async function XOt({rawDocsConfiguration:e,absolutePathToFernFolder:t,absoluteFilepathToDocsConfig:r,context:n}){let{instances:i,title:o,tabs:s,products:a,versions:c,navigation:u,navbarLinks:l,footerLinks:p,defaultLanguage:d,metadata:f,redirects:m,logo:h,favicon:g,backgroundImage:A,colors:b,typography:v,layout:E,integrations:I,css:x,js:C,aiChat:_,aiSearch:w,agents:P,pageActions:z,experimental:q}=e,V=ZOt(e.landingPage,r),X=e.settings?.folderTitleSource,ae=Ugf({tabs:s,products:a,versions:c,navigation:u,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:X}),G=ae.then(Mt=>dra({files:ORe({navigation:Mt,landingPage:V}),absolutePathToFernFolder:t})),Y=Tgf(h,r),Ce=sb(g,r),Te=Ogf(A,r),te=v!=null?zgf({rawTypography:v,absoluteFilepathToDocsConfig:r}):void 0,Z=Bgf(x,r),Ee=Dgf(C,r),ye=pAf(f,r),De=Mgf({rawPath:e.integrations?.context7,absoluteFilepathToDocsConfig:r,context:n}),Re=oNa({rawPath:P?.llmsTxt,absoluteFilepathToDocsConfig:r}),Ye=oNa({rawPath:P?.llmsFullTxt,absoluteFilepathToDocsConfig:r}),[ct,ut,Qt,Kt,le,ne,Pe,Xe,be]=await Promise.all([ae,G,te,Z,Ee,ye,De,Re,Ye]),Ne=jgf(e.theme),lt=Ne?.tabs!=null&&typeof Ne.tabs=="object"?Ne.tabs:void 0,st=lt?.placement??E?.tabsPlacement??"sidebar",Qe=lt?.alignment??"left";return st==="sidebar"&&Qe==="center"&&n.logger.warn("Tabs alignment 'center' is not supported when tabs placement is 'sidebar'. The alignment will be ignored."),{title:o,instances:i,roles:e.roles,libraries:tAf(e.libraries),pages:ut,landingPage:V,navigation:ct,navbarLinks:uAf(l,r),footerLinks:lAf(p),defaultLanguage:d,languages:e.languages,announcement:e.announcement,metadata:ne,redirects:m?.map(Mt=>({...Mt,permanent:Mt?.permanent})),logo:Y,favicon:Ce,backgroundImage:Te,colors:lra(b,n),typography:Qt,layout:Lgf(E,lt?.alignment,lt?.placement),settings:Qgf(e.settings),context7File:Pe,llmsTxtFile:Xe,llmsFullTxtFile:be,theme:Ne,analyticsConfig:{...e.analytics,intercom:e.analytics?.intercom?{...e.analytics.intercom,appId:e.analytics.intercom.appId,apiBase:e.analytics.intercom.apiBase}:void 0,fullstory:e.analytics?.fullstory,posthog:e.analytics?.posthog?{...e.analytics.posthog,apiKey:e.analytics.posthog.apiKey,endpoint:e.analytics.posthog.endpoint}:void 0,segment:e.analytics?.segment,gtm:e.analytics?.gtm,ga4:e.analytics?.ga4,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},integrations:{...I,intercom:I?.intercom?I.intercom:void 0},css:Kt,js:le,aiChatConfig:w??_,agents:P,pageActions:Fgf(z,r),header:sb(e.header,r),footer:sb(e.footer,r),experimental:q}}function Tgf(e,t){return e!=null?{dark:sb(e.dark,t),light:sb(e.light,t),height:e.height,href:e.href!=null?Fr.Url(e.href):void 0,rightText:e.rightText}:void 0}function Ogf(e,t){if(e!=null)if(typeof e=="string"){let r=sb(e,t);return{dark:r,light:r}}else{let r=sb(e.dark,t),n=sb(e.light,t);return{dark:r,light:n}}}async function Bgf(e,t){if(e==null)return;let r=typeof e=="string"?[e]:e;return{inline:await Promise.all(r.map(async n=>(await(0,s$e.readFile)(sb(n,t))).toString()))}}function Pgf(e){return Object.hasOwn(e,"url")}function Rgf(e){return Object.hasOwn(e,"path")}async function Dgf(e,t){let r=[],n=[];if(e==null)return{files:[]};let i=Array.isArray(e)?e:[e];for(let o of i)typeof o=="string"?n.push({absolutePath:sb(o,t)}):Pgf(o)?r.push({strategy:o.strategy,url:Fr.Url(o.url)}):Rgf(o)&&n.push({absolutePath:sb(o.path,t),strategy:o.strategy});return{remote:r,files:n}}function Fgf(e,t){return e==null?void 0:{default:e.default!=null?kgf(e.default):void 0,options:{askAi:e.options?.askAi??!0,copyPage:e.options?.copyPage??!0,viewAsMarkdown:e.options?.viewAsMarkdown??!0,openAi:e.options?.chatgpt??!0,claude:e.options?.claude??!0,cursor:e.options?.cursor??!0,vscode:e.options?.vscode??!1,custom:(e.options?.custom??[]).map(n=>Ngf(n,t))}}}function kgf(e){switch(e){case"copy-page":return Fr.docs.v1.commons.PageActionOption.CopyPage;case"view-as-markdown":return Fr.docs.v1.commons.PageActionOption.ViewAsMarkdown;case"ask-ai":return Fr.docs.v1.commons.PageActionOption.AskAi;case"chatgpt":return Fr.docs.v1.commons.PageActionOption.OpenAi;case"claude":return Fr.docs.v1.commons.PageActionOption.Claude;case"cursor":return Fr.docs.v1.commons.PageActionOption.Cursor;case"vscode":return Fr.docs.v1.commons.PageActionOption.Vscode;default:Ie(e)}}function Ngf(e,t){return{title:e.title,subtitle:e.subtitle,url:e.url,icon:$b(e.icon,t),default:e.default}}function jgf(e){if(e==null)return;let t;if(e.tabs!=null&&typeof e.tabs=="object"){let r=e.tabs;t={style:r.style??"default",alignment:r.alignment,placement:r.placement}}else t=e.tabs??"default";return{sidebar:e.sidebar??"default",tabs:t,body:e.body??"default",pageActions:e.pageActions??"default",footerNav:e.footerNav??"default",languageSwitcher:e.languageSwitcher??"default",productSwitcher:e.productSwitcher??"default"}}function Qgf(e){if(e!=null)return{darkModeCode:e.darkModeCode??!1,defaultSearchFilters:e.defaultSearchFilters??!1,language:e.language??"en",disableSearch:e.disableSearch??!1,hide404Page:e.hide404Page??!1,httpSnippets:e.httpSnippets??!0,searchText:e.searchText??void 0,useJavascriptAsTypescript:e.useJavascriptAsTypescript??!1,disableExplorerProxy:e.disableExplorerProxy??!1,disableAnalytics:e.disableAnalytics??!1}}async function oNa({rawPath:e,absoluteFilepathToDocsConfig:t}){if(e==null)return;let r=sb(e,t);return await(0,s$e.readFile)(r,"utf8"),r}async function Mgf({rawPath:e,absoluteFilepathToDocsConfig:t,context:r}){if(e==null)return;let n=sb(e,t),i=await(0,s$e.readFile)(n,"utf8");try{JSON.parse(i)}catch(o){r.failAndThrow(`Invalid JSON in Context7 config file: ${e}`,o instanceof Error?o.message:String(o))}return n}function Lgf(e,t,r){if(e==null&&t==null&&r==null)return;let n=t==="center"?"CENTER":"LEFT",i=r==="header"?Fr.docs.v1.commons.TabsPlacement.Header:r==="sidebar"?Fr.docs.v1.commons.TabsPlacement.Sidebar:void 0;return e==null?{...i!=null?{tabsPlacement:i}:{},tabsAlignment:n}:{pageWidth:e.pageWidth?.trim().toLowerCase()==="full"?{type:"full"}:awr(e.pageWidth),contentWidth:awr(e.contentWidth),sidebarWidth:awr(e.sidebarWidth),headerHeight:awr(e.headerHeight),searchbarPlacement:e.searchbarPlacement==="header"?Fr.docs.v1.commons.SearchbarPlacement.Header:e.searchbarPlacement==="header-tabs"?Fr.docs.v1.commons.SearchbarPlacement.HeaderTabs:Fr.docs.v1.commons.SearchbarPlacement.Sidebar,switcherPlacement:!e.switcherPlacement||e.switcherPlacement==="header"?Fr.docs.v1.commons.SwitcherPlacement.Header:Fr.docs.v1.commons.SwitcherPlacement.Sidebar,tabsPlacement:i??(e.tabsPlacement==="header"?Fr.docs.v1.commons.TabsPlacement.Header:Fr.docs.v1.commons.TabsPlacement.Sidebar),contentAlignment:e.contentAlignment==="left"?Fr.docs.v1.commons.ContentAlignment.Left:Fr.docs.v1.commons.ContentAlignment.Center,headerPosition:e.headerPosition==="static"?Fr.docs.v1.commons.HeaderPosition.Absolute:Fr.docs.v1.commons.HeaderPosition.Fixed,disableHeader:e.disableHeader??!1,hideNavLinks:e.hideNavLinks??!1,hideFeedback:e.hideFeedback??!1,tabsAlignment:n}}function awr(e){if(e==null)return;let t=e.trim().toLowerCase(),r=t.match(/^(\d+)px$/);if(r!=null&&r[1]!=null)return{type:"px",value:parseFloat(r[1])};let n=t.match(/^(\d+)rem$/);if(n!=null&&n[1]!=null)return{type:"rem",value:parseFloat(n[1])}}async function sNa({versions:e,absolutePathToFernFolder:t,context:r,folderTitleSource:n}){let i=[];for(let o of e){let s=eo(t,o.path),a=Rr.load((await(0,s$e.readFile)(s)).toString()),c=[],u=lM(a,[],c);c.length>0&&r.logger.warn(`Version file ${o.path} contained null/undefined sections that were ignored: ${c.map(d=>d.join(".")).join(", ")}`);let l=c_.RawSchemas.Serializer.VersionFileConfig.parseOrThrow(u),p=await aQi({tabs:l.tabs,rawNavigationConfig:l.navigation,absolutePathToFernFolder:t,absolutePathToConfig:s,context:r,folderTitleSource:n});i.push({landingPage:ZOt(l.landingPage,s),version:o.displayName,navigation:p,availability:o.availability,slug:o.slug,hidden:o.hidden,viewers:R_(o.viewers),orphaned:o.orphaned,featureFlags:P_(o.featureFlag),announcement:o.announcement})}return{type:"versioned",versions:i}}async function Ugf({tabs:e,products:t,versions:r,navigation:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a}){if(n!=null)return await aQi({tabs:e,rawNavigationConfig:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a});if(t!=null){let c=[];for(let u of t){let l=u.image!=null?eo(i,u.image):void 0;if("path"in u){let p,d=eo(i,u.path),f=Rr.load((await(0,s$e.readFile)(d)).toString()),m=[],h=lM(f,[],m);m.length>0&&s.logger.warn(`Product file ${u.path} contained null/undefined sections that were ignored: ${m.map(A=>A.join(".")).join(", ")}`);let g=c_.RawSchemas.Serializer.ProductFileConfig.parseOrThrow(h);u.versions!=null&&u.versions.length>0?p=await sNa({versions:u.versions,absolutePathToFernFolder:i,context:s,folderTitleSource:a}):p=await aQi({tabs:g.tabs,rawNavigationConfig:g.navigation,absolutePathToFernFolder:i,absolutePathToConfig:d,context:s,folderTitleSource:a}),c.push({type:"internal",landingPage:ZOt(g.landingPage,d),product:u.displayName,navigation:p,slug:u.slug,subtitle:u.subtitle,icon:$b(u.icon,o)||"fa-solid fa-code",image:l,viewers:R_(u.viewers),orphaned:u.orphaned,featureFlags:P_(u.featureFlag),announcement:u.announcement})}else if("href"in u&&u.href!=null)c.push({type:"external",product:u.displayName,href:u.href,target:u.target,subtitle:u.subtitle,icon:$b(u.icon,o)||"fa-solid fa-code",image:l,viewers:R_(u.viewers),orphaned:u.orphaned,featureFlags:P_(u.featureFlag)});else throw new Error("Invalid product configuration: product must have either 'path' or valid 'href' property")}return{type:"productgroup",products:c}}else if(r!=null)return await sNa({versions:r,absolutePathToFernFolder:i,context:s,folderTitleSource:a});throw new Error("Unexpected. Docs have neither navigation or versions defined.")}function P_(e){if(e!=null)return typeof e=="string"?[{flag:e,match:!0,fallbackValue:void 0}]:Array.isArray(e)?e.map(t=>({flag:t.flag,match:t.match,fallbackValue:t.fallbackValue})):[{flag:e.flag,match:e.match??!0,fallbackValue:e.fallbackValue}]}async function zgf({rawTypography:e,absoluteFilepathToDocsConfig:t}){return{headingsFont:e.headingsFont!=null?await oQi({rawFontConfig:e.headingsFont,absoluteFilepathToDocsConfig:t}):void 0,bodyFont:e.bodyFont!=null?await oQi({rawFontConfig:e.bodyFont,absoluteFilepathToDocsConfig:t}):void 0,codeFont:e.codeFont!=null?await oQi({rawFontConfig:e.codeFont,absoluteFilepathToDocsConfig:t}):void 0}}async function oQi({rawFontConfig:e,absoluteFilepathToDocsConfig:t}){return{name:e.name,variants:await Vgf(e,t),display:e.display,fallback:e.fallback,fontVariationSettings:e.fontVariationSettings}}function Vgf(e,t){let r=[];return e.path!=null&&r.push({path:e.path,weight:e.weight,style:e.style}),e.paths?.forEach(n=>{typeof n=="string"?r.push({path:n,weight:e.weight,style:e.style}):r.push({path:n.path,weight:n.weight??e.weight,style:n.style??e.style})}),Promise.all(r.map(async n=>({absolutePath:sb(n.path,t),weight:qgf(n.weight),style:n.style})))}function qgf(e){return e==null?void 0:typeof e=="number"?[e.toString()]:e.split(/\D+/).filter(r=>r!==""&&["100","200","300","400","500","600","700","800","900"].includes(r))}async function Ggf({tabs:e,item:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){let s=e[t.tab];if(s==null)throw new Error(`Tab ${t.tab} is not defined in the tabs config.`);if(cAf(t)){let a=await Promise.all(t.variants.map(async c=>{let u=await Promise.all(c.layout.map(l=>lwr({rawConfig:l,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:c.title,subtitle:c.subtitle,icon:$b(c.icon,n),layout:u,slug:c.slug,skipUrlSlug:c.skipSlug,hidden:c.hidden,default:c.default,viewers:R_(c.viewers),orphaned:c.orphaned,featureFlags:P_(c.featureFlag)}}));return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"variants",variants:a},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)}}if(aAf(t)){let a=await Promise.all(t.layout.map(c=>lwr({rawConfig:c,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"layout",layout:a},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)}}if(s.href!=null)return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"link",href:s.href,target:s.target},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)};if(s.changelog!=null)return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"changelog",changelog:await qC(sb(s.changelog,n),"{md,mdx}")},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)};Ie(s)}async function aQi({tabs:e={},rawNavigationConfig:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){return sAf(t)?{type:"tabbed",items:await Promise.all(t.map(a=>Ggf({tabs:e,item:a,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}:{type:"untabbed",items:await Promise.all(t.map(s=>lwr({rawConfig:s,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}}var Wgf="Changelog";async function $gf({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){let o=sb(e.folder,r);await ar(o)||n.failAndThrow(`Folder not found: ${e.folder}`),cQi({context:n,sectionTitle:e.folder,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0});let s=e.titleSource??i,a=await iQi({directoryPath:o,titleSource:s}),c=a.find(m=>m.type==="page"&&(m.slug==="index"||m.absolutePath.toLowerCase().endsWith("/index.mdx")||m.absolutePath.toLowerCase().endsWith("/index.md"))),u=c?a.filter(m=>m!==c):a,l=aNa.default.basename(o),p=s==="frontmatter"&&c?.type==="page"?(await swr({absolutePath:c.absolutePath})).title:void 0,d=e.title??p??nQi({name:l}),f=e.slug??owr({name:l});return{type:"section",title:d,icon:$b(e.icon,r),contents:u,slug:f,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:c?.type==="page"?c.absolutePath:void 0,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag),availability:e.availability}}async function lwr({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){if(cNa(e))return ZOt(e,r);if(Kgf(e))return cQi({context:n,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),{type:"section",title:e.section,icon:$b(e.icon,r),contents:await Promise.all(e.contents.map(o=>lwr({rawConfig:o,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}))),slug:e.slug??void 0,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:sb(e.path,r),viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag),availability:e.availability};if(Jgf(e))return{type:"apiSection",openrpc:e.openrpc,title:e.api,icon:$b(e.icon,r),apiName:e.apiName??void 0,audiences:e.audiences!=null?{type:"select",audiences:eBt(e.audiences)??[]}:{type:"all"},availability:e.availability,showErrors:e.displayErrors??!0,tagDescriptionPages:e.tagDescriptionPages??!1,snippetsConfiguration:e.snippets!=null?Hgf({rawConfig:e.snippets}):void 0,postman:e.postman,navigation:e.layout?.flatMap(o=>uwr(o,r,n))??[],overviewAbsolutePath:sb(e.summary,r),collapsed:e.collapsed??void 0,hidden:e.hidden??void 0,slug:e.slug,skipUrlSlug:e.skipSlug??!1,flattened:e.flattened??!1,alphabetized:e.alphabetized??!1,paginated:e.paginated??!1,playground:e.playground,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)};if(uNa(e))return{type:"link",text:e.link,url:e.href,icon:$b(e.icon,r),target:e.target};if(Ygf(e))return{type:"changelog",changelog:await qC(sb(e.changelog,r),"{md,mdx}"),hidden:e.hidden??!1,icon:$b(e.icon,r),title:e.title??Wgf,slug:e.slug,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)};if(Xgf(e))return await $gf({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i});if(Zgf(e))return{type:"librarySection",libraryName:e.library,title:e.title??void 0,slug:e.slug??void 0,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)};Ie(e)}function ZOt(e,t){if(e!=null)return{type:"page",title:e.page,absolutePath:sb(e.path,t),slug:e.slug,icon:$b(e.icon,t),hidden:e.hidden,noindex:e.noindex,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag),availability:e.availability}}function uwr(e,t,r){return typeof e=="string"?[{type:"item",value:e}]:cNa(e)?[ZOt(e,t)]:uNa(e)?[{type:"link",text:e.link,url:e.href,icon:$b(e.icon,t),target:e.target}]:rAf(e)?(r!=null&&cQi({context:r,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),[{type:"section",title:e.section,referencedSubpackages:e.referencedPackages??[],overviewAbsolutePath:sb(e.summary,t),contents:e.contents?.flatMap(n=>uwr(n,t,r))??[],slug:e.slug,hidden:e.hidden,skipUrlSlug:e.skipSlug,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,availability:e.availability,icon:$b(e.icon,t),playground:e.playground,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)}]):nAf(e)?[{type:"endpoint",endpoint:e.endpoint,title:e.title,icon:$b(e.icon,t),slug:e.slug,hidden:e.hidden,availability:e.availability,playground:e.playground,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)}]:iAf(e)?[{type:"operation",operation:e.operation,title:e.title,slug:e.slug,hidden:e.hidden,availability:e.availability,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)}]:Object.entries(e).map(([n,i])=>oAf(i)?{type:"package",title:i.title,package:n,overviewAbsolutePath:sb(i.summary,t),contents:i.contents?.flatMap(o=>uwr(o,t,r))??[],slug:i.slug,hidden:i.hidden,skipUrlSlug:i.skipSlug,icon:$b(i.icon,t),playground:i.playground,availability:i.availability,viewers:R_(i.viewers),orphaned:i.orphaned,featureFlags:P_(i.featureFlag)}:{type:"package",title:void 0,package:n,overviewAbsolutePath:void 0,contents:i.flatMap(o=>uwr(o,t,r)),hidden:!1,slug:void 0,skipUrlSlug:!1,icon:void 0,playground:void 0,availability:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}function Hgf({rawConfig:e}){return{python:e.python,typescript:e.typescript,go:e.go,java:e.java,ruby:e.ruby,csharp:e.csharp,php:e.php,swift:e.swift}}function cNa(e){return Ua(e)&&typeof e.page=="string"&&typeof e.path=="string"}function Kgf(e){return e.section!=null}function Jgf(e){return e.api!=null}function uNa(e){return c_.RawSchemas,Ua(e)&&typeof e.link=="string"&&typeof e.href=="string"}function Ygf(e){return Ua(e)&&typeof e.changelog=="string"}function Xgf(e){return Ua(e)&&typeof e.folder=="string"}function Zgf(e){return Ua(e)&&typeof e.library=="string"}function eAf(e){return"git"in e}function tAf(e){if(e==null)return;let t={};for(let[r,n]of Object.entries(e)){if(!eAf(n.input))throw new Error(`Library '${r}' uses 'path' input which is not yet supported. Please use 'git' input.`);t[r]={input:{git:n.input.git,subpath:n.input.subpath},output:{path:n.output.path},lang:n.lang}}return t}function rAf(e){return Ua(e)&&typeof e.section=="string"&&Array.isArray(e.contents)}function nAf(e){return Ua(e)&&typeof e.endpoint=="string"}function iAf(e){return Ua(e)&&typeof e.operation=="string"}function oAf(e){return!Array.isArray(e)}function sb(e,t){if(e!=null)return eo(Pn(t),e)}function sAf(e){return Array.isArray(e)&&e.length>0&&e[0].tab!=null}function aAf(e){return"layout"in e&&Array.isArray(e.layout)}function cAf(e){return"variants"in e&&Array.isArray(e.variants)}function uAf(e,t){return e?.map(r=>{if(r.type==="github"){let i=r.value;return typeof i=="string"?{type:"github",url:Fr.Url(i),viewers:void 0,target:void 0}:{type:"github",url:Fr.Url(i.url),viewers:sQi(i.viewers),target:i.target}}let n=sQi(r.viewers);return r.type==="dropdown"?{type:"dropdown",text:r.text,icon:$b(r.icon,t),rightIcon:$b(r.rightIcon,t),rounded:r.rounded,viewers:n,links:r.links?.map(i=>({href:i.href,target:i.target,url:Fr.Url(i.url??i.href??"/"),text:i.text,icon:$b(i.icon,t),rightIcon:$b(i.rightIcon,t),rounded:i.rounded,viewers:sQi(i.viewers)}))??[]}:{type:r.type,text:r.text,url:Fr.Url(r.href??r.url??"/"),target:r.target,icon:$b(r.icon,t),rightIcon:$b(r.rightIcon,t),rounded:r.rounded,viewers:n}})}function sQi(e){if(e!=null)return Array.isArray(e)?e.map(t=>Fr.RoleId(t)):[Fr.RoleId(e)]}function lAf(e){if(e==null)return;let t=[];if(Object.keys(e).forEach(r=>{let n=e[r];n!=null&&t.push({type:r,value:Fr.Url(n)})}),t.length!==0)return t}async function pAf(e,t){if(e!=null)return{"og:site_name":e.ogSiteName,"og:title":e.ogTitle,"og:description":e.ogDescription,"og:url":e.ogUrl,"og:image":await cwr(e.ogImage,t),"og:image:width":e.ogImageWidth,"og:image:height":e.ogImageHeight,"og:locale":e.ogLocale,"og:logo":await cwr(e.ogLogo,t),"twitter:title":e.twitterTitle,"twitter:description":e.twitterDescription,"twitter:image":await cwr(e.twitterImage,t),"twitter:handle":e.twitterHandle,"twitter:site":e.twitterSite,"twitter:url":e.twitterUrl,"twitter:card":e.twitterCard,"og:dynamic":e.ogDynamic,"og:background-image":await cwr(e.ogBackgroundImage,t),nofollow:void 0,noindex:void 0,canonicalHost:e.canonicalHost}}async function cwr(e,t){if(e==null)return;if(e.startsWith("http"))return{type:"url",value:e};let r=sb(e,t);return await ar(r)?{type:"filepath",value:r}:{type:"url",value:e}}function R_(e){if(e!=null){if(typeof e=="string")return[Fr.RoleId(e)];if(e.length!==0)return e.map(Fr.RoleId)}}function eBt(e){if(e!=null){if(typeof e=="string")return[e];if(e.length!==0)return e}}function cQi({context:e,sectionTitle:t,collapsed:r,collapsible:n,collapsedByDefault:i}){n!=null&&r!=null&&e.failAndThrow(`Section "${t}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead.`),i!=null&&n!==!0&&e.failAndThrow(`Section "${t}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section.`)}Jt();var pNa=require("fs/promises");var lNa=bt.strictObject({organization:bt.string(),version:bt.string()});async function xD({directory:e,context:t}){let r=Ke(e,Be.of(zE)),n=await(0,pNa.readFile)(r),i=JSON.parse(n.toString()),o=await ybr({schema:lNa,value:i,context:t,filepathBeingParsed:r});return{_absolutePath:r,rawConfig:o,organization:o.organization,version:o.version}}var rt={TYPESCRIPT:"fernapi/fern-typescript",TYPESCRIPT_SDK:"fernapi/fern-typescript-sdk",TYPESCRIPT_NODE_SDK:"fernapi/fern-typescript-node-sdk",TYPESCRIPT_BROWSER_SDK:"fernapi/fern-typescript-browser-sdk",TYPESCRIPT_EXPRESS:"fernapi/fern-typescript-express",JAVA:"fernapi/fern-java",JAVA_MODEL:"fernapi/fern-java-model",JAVA_SDK:"fernapi/fern-java-sdk",JAVA_SPRING:"fernapi/fern-java-spring",PYTHON_FASTAPI:"fernapi/fern-fastapi-server",PYTHON_PYDANTIC:"fernapi/fern-pydantic-model",PYTHON_SDK:"fernapi/fern-python-sdk",GO_MODEL:"fernapi/fern-go-model",GO_SDK:"fernapi/fern-go-sdk",RUBY_SDK:"fernapi/fern-ruby-sdk",CSHARP_MODEL:"fernapi/fern-csharp-model",CSHARP_SDK:"fernapi/fern-csharp-sdk",SWIFT_MODEL:"fernapi/fern-swift-model",SWIFT_SDK:"fernapi/fern-swift-sdk",PHP_MODEL:"fernapi/fern-php-model",PHP_SDK:"fernapi/fern-php-sdk",RUST_MODEL:"fernapi/fern-rust-model",RUST_SDK:"fernapi/fern-rust-sdk",OPENAPI:"fernapi/fern-openapi",STOPLIGHT:"fernapi/fern-stoplight",POSTMAN:"fernapi/fern-postman",OPENAPI_PYTHON_CLIENT:"fernapi/openapi-python-client"};var _Li=ve(LC(),1);var tBt={[rt.JAVA]:{version:"2.38.1"},[rt.TYPESCRIPT_EXPRESS]:{version:"0.18.4",output:{location:"local-file-system",path:"../src/fern"}},[rt.JAVA_MODEL]:{version:"1.0.0"},[rt.JAVA_SDK]:{version:"2.38.1",output:{location:"local-file-system",path:"../sdks/java/src/main/java/"}},[rt.JAVA_SPRING]:{version:"0.9.2",output:{location:"local-file-system",path:"../src/main/java/com/fern"}},[rt.TYPESCRIPT]:{version:"0.0.247"},[rt.TYPESCRIPT_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[rt.TYPESCRIPT_NODE_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[rt.TYPESCRIPT_BROWSER_SDK]:{version:"1.0.0",output:{location:"local-file-system",path:"../sdks/typescript"}},[rt.PYTHON_PYDANTIC]:{version:"1.4.7"},[rt.PYTHON_FASTAPI]:{version:"1.7.0",output:{location:"local-file-system",path:"../src/fern"}},[rt.PYTHON_SDK]:{version:"4.23.2",output:{location:"local-file-system",path:"../sdks/python"}},[rt.GO_MODEL]:{version:"0.23.5"},[rt.GO_SDK]:{version:"1.4.0",output:{location:"local-file-system",path:"../sdks/go"},config:{module:{path:"sdk"}}},[rt.RUBY_SDK]:{version:"0.8.2",output:{location:"local-file-system",path:"../sdks/ruby"}},[rt.OPENAPI]:{version:"0.1.7",config:{format:"yaml"},output:{location:"local-file-system",path:"../openapi"}},[rt.STOPLIGHT]:{version:"0.0.28",config:{format:"yaml"}},[rt.POSTMAN]:{version:"0.4.0",output:{location:"local-file-system",path:"../postman"}},[rt.OPENAPI_PYTHON_CLIENT]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/python"},config:{format:"yaml"}},[rt.CSHARP_MODEL]:{version:"0.0.1"},[rt.CSHARP_SDK]:{version:"2.0.2",output:{location:"local-file-system",path:"../sdks/csharp"}},[rt.SWIFT_MODEL]:{version:"0.0.0"},[rt.SWIFT_SDK]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/swift/sdk"}},[rt.PHP_MODEL]:{version:"0.0.0"},[rt.PHP_SDK]:{version:"1.16.3",output:{location:"local-file-system",path:"../sdks/php/sdk"}},[rt.RUST_MODEL]:{version:"0.0.1",output:{location:"local-file-system",path:"../models/rust"}},[rt.RUST_SDK]:{version:"0.0.1",output:{location:"local-file-system",path:"../sdks/rust"}}};var rBt="fernapi",IFe="fern-api";function U0(e){return e=a$e(e),e.includes("/")?e:`${rBt}/${e}`}function a$e(e){let t=`${IFe}/`;return e.startsWith(t)?`${rBt}/${e.slice(t.length)}`:e}function pwr(e,t){let r=`${IFe}/`;if(e.startsWith(r)){let n=`${rBt}/${e.slice(r.length)}`;return t.logger.warn(`"${e}" is not a valid generator name. Using "${n}" instead \u2014 the Docker org is "fernapi", not "fern-api".`),n}return e}function wFe(e){let t=`${rBt}/`;return e.startsWith(t)?e.slice(t.length):e}function uQi(e,t){let r=xFe(e);return r??t.failAndThrow("Unrecognized generator: "+e)}var fAf={"fernapi/java-model":rt.JAVA_MODEL,"fernapi/fern-typescript-node-sdk":rt.TYPESCRIPT_SDK};function xFe(e){e=U0(e);let t=fAf[e];if(t!=null&&(e=t),dAf(e))return e}function dAf(e){return Object.values(rt).includes(e)}var Yxr=ve(V$e(),1),A4a=ve(LC(),1);async function IB({generatorName:e,cliVersion:t,channel:r,currentGeneratorVersion:n,includeMajor:i,context:o}){let s=A4a.default.parse(n),a="https://registry.buildwithfern.com",c=new Yxr.FernRegistryClient({environment:a});o?.logger.debug(`Getting latest version for ${e} with CLI version ${t}, includeMajor: ${i}, prior version: ${s}, FDR origin: ${a}`);let u={generator:zTf(e,o),releaseTypes:[r??Yxr.FernRegistry.generators.ReleaseType.Ga],cliVersion:t};!i&&s!=null&&(u.generatorMajorVersion=s.major),o?.logger.debug(`[FDR] getLatestGeneratorRelease request: ${JSON.stringify(u)}`);let l=await c.generators.versions.getLatestGeneratorRelease(u);if(l.ok)return o?.logger.debug(`[FDR] getLatestGeneratorRelease response for ${e}: version=${l.body.version}, irVersion=${l.body.irVersion}`),l.body.version;o?.logger.debug(`[FDR] getLatestGeneratorRelease failed for ${e}: ${JSON.stringify(l)}`)}function zTf(e,t){switch(e.startsWith("fernapi/")&&(e=e.replace("fernapi/","")),e){case"fern-python-sdk":return"python-sdk";case"fern-pydantic-model":return"pydantic";case"fern-fastapi-server":return"fastapi";case"fern-typescript":case"fern-typescript-browser-sdk":case"fern-typescript-node-sdk":case"fern-typescript-sdk":return"ts-sdk";case"fern-typescript-express":return"ts-express";case"fern-java-sdk":return"java-sdk";case"fern-java-model":case"java-model":return"java-model";case"fern-java-spring":return"java-spring";case"fern-go-sdk":return"go-sdk";case"fern-go-model":return"go-model";case"fern-csharp-sdk":return"csharp-sdk";case"fern-csharp-model":return"csharp-model";case"fern-ruby-sdk":return"ruby-sdk";case"fern-postman":return"postman";case"fern-openapi":return"openapi";case"fern-php-sdk":return"php-sdk";case"fern-php-model":return"php-model";case"fern-rust-sdk":return"rust-sdk";case"fern-rust-model":return"rust-model";case"fern-swift-sdk":return"swift-sdk";case"fern-swift-model":return"swift-model";default:return t?.logger.warn(`Unrecognized generator name found, attempting to parse manually: ${e}`),e.startsWith("fern-")?e.replace("fern-",""):e}}async function y4a({generatorsConfiguration:e,groupName:t=e[kn.DEFAULT_GROUP_GENERATORS_CONFIG_KEY],context:r,update:n}){if(t==null){let s=Object.keys(e.groups??{});if(s.length>0){let a=`No group specified. Use the --group option:
|
|
1581
|
+
`);return r.failAndThrow(s)}function O0p(e){return e.reduce((t,r)=>typeof r=="number"?t+"["+r+"]":t+(t===""?"":".")+r,"")}Jt();var Yta=ve(require("path"),1),B0p={dependencies:{}};async function Xta({absolutePathToWorkspace:e,rawDependenciesConfiguration:t,context:r}){if(t==null)return B0p;let n={};for(let[i,o]of Object.entries(t.dependencies))if(R0p(o)){let s=Wt.of(Yta.default.join(e,o));await ar(s)?n[i]={type:"local",absoluteFilepath:s,path:o}:r.failWithoutThrowing(`Path to ${i} dependency does not exist: ${s}`)}else{let a=i.substring(1).split("/"),c=a[0],u=a[1];c!=null&&u!=null?n[i]={type:"version",organization:c,apiName:u,version:o}:r.failWithoutThrowing(`Failed to parse dependency: ${i}`)}return r.getResult()===Bf.Failure&&r.failAndThrow(),{dependencies:n}}var P0p=/^\.\.\/.*$/;function R0p(e){return P0p.test(e)}Jt();var era=require("fs/promises");var Zta=bt.object({dependencies:bt.record(bt.string(),bt.string())});async function tra({absolutePathToWorkspace:e,context:t}){let r=Ke(e,Be.of(vUs));if(!await ar(r))return;let n=await(0,era.readFile)(r),i=Rr.load(n.toString());return await ybr({schema:Zta,value:i,context:t,filepathBeingParsed:r})}async function kOi({absolutePathToWorkspace:e,context:t}){let r=await tra({absolutePathToWorkspace:e,context:t});return Xta({absolutePathToWorkspace:e,rawDependenciesConfiguration:r,context:t})}Pt();vbr();function lra(e={accentPrimary:void 0,background:void 0},t){e.accentPrimary=e.accentPrimary??e.accentPrimaryDeprecated;let r=wbr(e);switch(r){case"dark":return{type:"dark",...Ibr(e,t,"dark")};case"light":return{type:"light",...Ibr(e,t,"light")};case"darkAndLight":return{type:"darkAndLight",dark:Ibr(e,t,"dark"),light:Ibr(e,t,"light")};default:Ie(r)}}function wbr({background:e,accentPrimary:t,accentPrimaryDeprecated:r}){if(t=t??r,typeof e=="string"&&typeof t=="string")return os(e).isDark()?"dark":"light";if(e!=null){if(typeof e=="string")return os(e).isDark()?"dark":"light";if(e.dark!=null&&e.light!=null)return"darkAndLight"}if(t!=null){if(typeof t=="string")return os(t).isLight()?"dark":"light";if(t.dark!=null&&t.light!=null)return"darkAndLight"}if(t!=null&&e!=null){if(e.dark!=null&&t.dark!=null)return"dark";if(e.light!=null&&t.light!=null)return"light"}return"darkAndLight"}function Ibr(e,t,r){let n=v_(e.accentPrimary??e.accentPrimaryDeprecated,t,"accent-primary",r)??os.random(),i=v_(e.background,t,"background",r);return{accentPrimary:n.toRgb(),background:i?.toRgb(),border:v_(e.border,t,"border",r)?.toRgb(),sidebarBackground:v_(e.sidebarBackground,t,"sidebar-background",r)?.toRgb(),headerBackground:v_(e.headerBackground,t,"header-background",r)?.toRgb(),cardBackground:v_(e.cardBackground,t,"card-background",r)?.toRgb(),accent1:v_(e.accent1,t,"accent-1",r)?.toRgb(),accent2:v_(e.accent2,t,"accent-2",r)?.toRgb(),accent3:v_(e.accent3,t,"accent-3",r)?.toRgb(),accent4:v_(e.accent4,t,"accent-4",r)?.toRgb(),accent5:v_(e.accent5,t,"accent-5",r)?.toRgb(),accent6:v_(e.accent6,t,"accent-6",r)?.toRgb(),accent7:v_(e.accent7,t,"accent-7",r)?.toRgb(),accent8:v_(e.accent8,t,"accent-8",r)?.toRgb(),accent9:v_(e.accent9,t,"accent-9",r)?.toRgb(),accent10:v_(e.accent10,t,"accent-10",r)?.toRgb(),accent11:v_(e.accent11,t,"accent-11",r)?.toRgb(),accent12:v_(e.accent12,t,"accent-12",r)?.toRgb(),logo:void 0,backgroundImage:void 0}}function RSt(e,t,r){if(e==null)return;let n=typeof e=="string"?e:e[r];if(n==null&&t==="accent-primary"&&typeof e!="string"&&(n=e[r==="dark"?"light":"dark"]),n!=null)return n}function v_(e,t,r,n){let i=RSt(e,r,n);if(i==null)return;let o=os(i);return o.isValid()||t.failAndThrow(`'${typeof e=="string"?r:`colors.${r}.${n}`}' should be a hex color of the format #FFFFFF`),o}Pt();Jt();var fra=require("fs/promises");Li();var pra=100;async function nEp({files:e,absolutePathToFernFolder:t}){let r=await Promise.all(e.map(async n=>{let i=await(0,fra.readFile)(n,"utf-8");return[R0(t,n),i]}));return Object.fromEntries(r)}async function dra({files:e,absolutePathToFernFolder:t}){let r={};for(let n=0;n<e.length;n+=pra){let i=e.slice(n,n+pra),o=await nEp({files:i,absolutePathToFernFolder:t});Object.assign(r,o)}return r}function ORe({landingPage:e,navigation:t}){return e4([e?.absolutePath,...iEp(t)])}function iEp(e){switch(e.type){case"tabbed":return e.items.flatMap(t=>t.child.type==="layout"?t.child.layout.flatMap(r=>xbr({item:r})):t.child.type==="variants"?t.child.variants.flatMap(r=>r.layout.flatMap(n=>xbr({item:n}))):t.child.type==="changelog"?t.child.changelog:[]);case"untabbed":return e.items.flatMap(t=>xbr({item:t}));case"versioned":return e.versions.flatMap(t=>ORe({landingPage:t.landingPage,navigation:t.navigation}));case"productgroup":return e.products.flatMap(t=>t.type==="external"?[]:ORe({landingPage:t.landingPage,navigation:t.navigation}));default:Ie(e)}}function xbr({item:e}){switch(e.type){case"apiSection":return e4([e.overviewAbsolutePath,...e.navigation.flatMap(t=>mra({item:t}))]);case"link":return[];case"page":return[e.absolutePath];case"section":return e4([e.overviewAbsolutePath,...e.contents.flatMap(t=>xbr({item:t}))]);case"changelog":return e.changelog;case"librarySection":return[];default:Ie(e)}}function mra({item:e}){return e.type==="page"?[e.absolutePath]:e.type==="package"||e.type==="section"?e4([e.overviewAbsolutePath,...e.contents.flatMap(t=>mra({item:t}))]):[]}Pt();hg();Jt();var s$e=require("fs/promises");var aNa=ve(require("path"),1);Jt();var rQi=require("fs/promises"),iNa=ve(UG(),1);function owr({name:e}){return e.replace(/\.(md|mdx)$/i,"").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function nQi({name:e}){return e.replace(/\.(md|mdx)$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}async function swr({absolutePath:e,readFileFn:t=(r,n)=>(0,rQi.readFile)(r,n)}){try{let r=await t(e,"utf-8"),{data:n}=(0,iNa.default)(r),i;if(n.position!=null){let c=typeof n.position=="string"?parseFloat(n.position):n.position;typeof c=="number"&&Number.isFinite(c)&&(i=c)}let o=typeof n.title=="string"&&n.title.trim().length>0?n.title.trim():void 0,s=n.hidden===!0?!0:void 0,a=n.noindex===!0?!0:void 0;return{position:i,title:o,hidden:s,noindex:a}}catch{return{position:void 0,title:void 0,hidden:void 0,noindex:void 0}}}function nNa({frontmatterTitle:e,useFrontmatterTitles:t,fallbackName:r}){return t&&e!=null?e:nQi({name:r})}async function iQi({directoryPath:e,titleSource:t,getDir:r=kb,readFileFn:n=(i,o)=>(0,rQi.readFile)(i,o)}){let i=await r(e),o=t==="frontmatter",s=i.filter(d=>d.type==="file"&&!d.name.startsWith("_")&&(d.name.toLowerCase().endsWith(".md")||d.name.toLowerCase().endsWith(".mdx"))),a=i.filter(d=>d.type==="directory"&&!d.name.startsWith("_")),c=await Promise.all(s.map(d=>swr({absolutePath:d.absolutePath,readFileFn:n}))),u=s.map((d,f)=>{let m=c[f];return{type:"page",title:nNa({frontmatterTitle:m?.title,useFrontmatterTitles:o,fallbackName:d.name}),absolutePath:d.absolutePath,slug:owr({name:d.name}),icon:void 0,hidden:m?.hidden,noindex:m?.noindex,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0}}),l=await Promise.all(a.map(async d=>{let f=await iQi({directoryPath:d.absolutePath,titleSource:t,getDir:r,readFileFn:n}),m=f.find(b=>b.type==="page"&&(b.slug==="index"||b.absolutePath.toLowerCase().endsWith("/index.mdx")||b.absolutePath.toLowerCase().endsWith("/index.md"))),h=m?f.filter(b=>b!==m):f,g=m?.type==="page"?await swr({absolutePath:m.absolutePath,readFileFn:n}):void 0;return{section:{type:"section",title:nNa({frontmatterTitle:g?.title,useFrontmatterTitles:o,fallbackName:d.name}),slug:owr({name:d.name}),icon:void 0,contents:h,collapsed:void 0,collapsible:void 0,collapsedByDefault:void 0,hidden:g?.hidden,skipUrlSlug:!1,overviewAbsolutePath:m?.type==="page"?m.absolutePath:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0},position:g?.position}})),p=[...u.map((d,f)=>({item:d,title:d.type==="page"?d.title:"",position:c[f]?.position})),...l.map(d=>({item:d.section,title:d.section.type==="section"?d.section.title:"",position:d.position}))];return p.sort((d,f)=>{let m=typeof d.position=="number",h=typeof f.position=="number";if(m&&!h)return-1;if(!m&&h)return 1;if(typeof d.position=="number"&&typeof f.position=="number"){let g=d.position-f.position;return g!==0?g:d.title.localeCompare(f.title,void 0,{sensitivity:"base"})}return d.title.localeCompare(f.title,void 0,{sensitivity:"base"})}),p.map(d=>d.item)}function Sgf(e){return!e||e.startsWith("<")?!1:e.startsWith(".")||e.includes("/")||e.includes("\\")||e.includes(":")}function $b(e,t){if(e)return Sgf(e)?sb(e,t):e}async function XOt({rawDocsConfiguration:e,absolutePathToFernFolder:t,absoluteFilepathToDocsConfig:r,context:n}){let{instances:i,title:o,tabs:s,products:a,versions:c,navigation:u,navbarLinks:l,footerLinks:p,defaultLanguage:d,metadata:f,redirects:m,logo:h,favicon:g,backgroundImage:A,colors:b,typography:v,layout:E,integrations:I,css:x,js:C,aiChat:_,aiSearch:w,agents:P,pageActions:z,experimental:q}=e,V=ZOt(e.landingPage,r),X=e.settings?.folderTitleSource,ae=Ugf({tabs:s,products:a,versions:c,navigation:u,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:X}),G=ae.then(Mt=>dra({files:ORe({navigation:Mt,landingPage:V}),absolutePathToFernFolder:t})),Y=Tgf(h,r),Ce=sb(g,r),Te=Ogf(A,r),te=v!=null?zgf({rawTypography:v,absoluteFilepathToDocsConfig:r}):void 0,Z=Bgf(x,r),Ee=Dgf(C,r),ye=pAf(f,r),De=Mgf({rawPath:e.integrations?.context7,absoluteFilepathToDocsConfig:r,context:n}),Re=oNa({rawPath:P?.llmsTxt,absoluteFilepathToDocsConfig:r}),Ye=oNa({rawPath:P?.llmsFullTxt,absoluteFilepathToDocsConfig:r}),[ct,ut,Qt,Kt,le,ne,Pe,Xe,be]=await Promise.all([ae,G,te,Z,Ee,ye,De,Re,Ye]),Ne=jgf(e.theme),lt=Ne?.tabs!=null&&typeof Ne.tabs=="object"?Ne.tabs:void 0,st=lt?.placement??E?.tabsPlacement??"sidebar",Qe=lt?.alignment??"left";return st==="sidebar"&&Qe==="center"&&n.logger.warn("Tabs alignment 'center' is not supported when tabs placement is 'sidebar'. The alignment will be ignored."),{title:o,instances:i,roles:e.roles,libraries:tAf(e.libraries),pages:ut,landingPage:V,navigation:ct,navbarLinks:uAf(l,r),footerLinks:lAf(p),defaultLanguage:d,languages:e.languages,announcement:e.announcement,metadata:ne,redirects:m?.map(Mt=>({...Mt,permanent:Mt?.permanent})),logo:Y,favicon:Ce,backgroundImage:Te,colors:lra(b,n),typography:Qt,layout:Lgf(E,lt?.alignment,lt?.placement),settings:Qgf(e.settings),context7File:Pe,llmsTxtFile:Xe,llmsFullTxtFile:be,theme:Ne,analyticsConfig:{...e.analytics,intercom:e.analytics?.intercom?{...e.analytics.intercom,appId:e.analytics.intercom.appId,apiBase:e.analytics.intercom.apiBase}:void 0,fullstory:e.analytics?.fullstory,posthog:e.analytics?.posthog?{...e.analytics.posthog,apiKey:e.analytics.posthog.apiKey,endpoint:e.analytics.posthog.endpoint}:void 0,segment:e.analytics?.segment,gtm:e.analytics?.gtm,ga4:e.analytics?.ga4,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},integrations:{...I,intercom:I?.intercom?I.intercom:void 0},css:Kt,js:le,aiChatConfig:w??_,agents:P,pageActions:Fgf(z,r),header:sb(e.header,r),footer:sb(e.footer,r),experimental:q}}function Tgf(e,t){return e!=null?{dark:sb(e.dark,t),light:sb(e.light,t),height:e.height,href:e.href!=null?Fr.Url(e.href):void 0,rightText:e.rightText}:void 0}function Ogf(e,t){if(e!=null)if(typeof e=="string"){let r=sb(e,t);return{dark:r,light:r}}else{let r=sb(e.dark,t),n=sb(e.light,t);return{dark:r,light:n}}}async function Bgf(e,t){if(e==null)return;let r=typeof e=="string"?[e]:e;return{inline:await Promise.all(r.map(async n=>(await(0,s$e.readFile)(sb(n,t))).toString()))}}function Pgf(e){return Object.hasOwn(e,"url")}function Rgf(e){return Object.hasOwn(e,"path")}async function Dgf(e,t){let r=[],n=[];if(e==null)return{files:[]};let i=Array.isArray(e)?e:[e];for(let o of i)typeof o=="string"?n.push({absolutePath:sb(o,t)}):Pgf(o)?r.push({strategy:o.strategy,url:Fr.Url(o.url)}):Rgf(o)&&n.push({absolutePath:sb(o.path,t),strategy:o.strategy});return{remote:r,files:n}}function Fgf(e,t){return e==null?void 0:{default:e.default!=null?kgf(e.default):void 0,options:{askAi:e.options?.askAi??!0,copyPage:e.options?.copyPage??!0,viewAsMarkdown:e.options?.viewAsMarkdown??!0,openAi:e.options?.chatgpt??!0,claude:e.options?.claude??!0,cursor:e.options?.cursor??!0,vscode:e.options?.vscode??!1,custom:(e.options?.custom??[]).map(n=>Ngf(n,t))}}}function kgf(e){switch(e){case"copy-page":return Fr.docs.v1.commons.PageActionOption.CopyPage;case"view-as-markdown":return Fr.docs.v1.commons.PageActionOption.ViewAsMarkdown;case"ask-ai":return Fr.docs.v1.commons.PageActionOption.AskAi;case"chatgpt":return Fr.docs.v1.commons.PageActionOption.OpenAi;case"claude":return Fr.docs.v1.commons.PageActionOption.Claude;case"cursor":return Fr.docs.v1.commons.PageActionOption.Cursor;case"vscode":return Fr.docs.v1.commons.PageActionOption.Vscode;default:Ie(e)}}function Ngf(e,t){return{title:e.title,subtitle:e.subtitle,url:e.url,icon:$b(e.icon,t),default:e.default}}function jgf(e){if(e==null)return;let t;if(e.tabs!=null&&typeof e.tabs=="object"){let r=e.tabs;t={style:r.style??"default",alignment:r.alignment,placement:r.placement}}else t=e.tabs??"default";return{sidebar:e.sidebar??"default",tabs:t,body:e.body??"default",pageActions:e.pageActions??"default",footerNav:e.footerNav??"default",languageSwitcher:e.languageSwitcher??"default",productSwitcher:e.productSwitcher??"default"}}function Qgf(e){if(e!=null)return{darkModeCode:e.darkModeCode??!1,defaultSearchFilters:e.defaultSearchFilters??!1,language:e.language??"en",disableSearch:e.disableSearch??!1,hide404Page:e.hide404Page??!1,httpSnippets:e.httpSnippets??!0,searchText:e.searchText??void 0,useJavascriptAsTypescript:e.useJavascriptAsTypescript??!1,disableExplorerProxy:e.disableExplorerProxy??!1,disableEnvironmentEditing:e.disableEnvironmentEditing??!1,disableAnalytics:e.disableAnalytics??!1}}async function oNa({rawPath:e,absoluteFilepathToDocsConfig:t}){if(e==null)return;let r=sb(e,t);return await(0,s$e.readFile)(r,"utf8"),r}async function Mgf({rawPath:e,absoluteFilepathToDocsConfig:t,context:r}){if(e==null)return;let n=sb(e,t),i=await(0,s$e.readFile)(n,"utf8");try{JSON.parse(i)}catch(o){r.failAndThrow(`Invalid JSON in Context7 config file: ${e}`,o instanceof Error?o.message:String(o))}return n}function Lgf(e,t,r){if(e==null&&t==null&&r==null)return;let n=t==="center"?"CENTER":"LEFT",i=r==="header"?Fr.docs.v1.commons.TabsPlacement.Header:r==="sidebar"?Fr.docs.v1.commons.TabsPlacement.Sidebar:void 0;return e==null?{...i!=null?{tabsPlacement:i}:{},tabsAlignment:n}:{pageWidth:e.pageWidth?.trim().toLowerCase()==="full"?{type:"full"}:awr(e.pageWidth),contentWidth:awr(e.contentWidth),sidebarWidth:awr(e.sidebarWidth),headerHeight:awr(e.headerHeight),searchbarPlacement:e.searchbarPlacement==="header"?Fr.docs.v1.commons.SearchbarPlacement.Header:e.searchbarPlacement==="header-tabs"?Fr.docs.v1.commons.SearchbarPlacement.HeaderTabs:Fr.docs.v1.commons.SearchbarPlacement.Sidebar,switcherPlacement:!e.switcherPlacement||e.switcherPlacement==="header"?Fr.docs.v1.commons.SwitcherPlacement.Header:Fr.docs.v1.commons.SwitcherPlacement.Sidebar,tabsPlacement:i??(e.tabsPlacement==="header"?Fr.docs.v1.commons.TabsPlacement.Header:Fr.docs.v1.commons.TabsPlacement.Sidebar),contentAlignment:e.contentAlignment==="left"?Fr.docs.v1.commons.ContentAlignment.Left:Fr.docs.v1.commons.ContentAlignment.Center,headerPosition:e.headerPosition==="static"?Fr.docs.v1.commons.HeaderPosition.Absolute:Fr.docs.v1.commons.HeaderPosition.Fixed,disableHeader:e.disableHeader??!1,hideNavLinks:e.hideNavLinks??!1,hideFeedback:e.hideFeedback??!1,tabsAlignment:n}}function awr(e){if(e==null)return;let t=e.trim().toLowerCase(),r=t.match(/^(\d+)px$/);if(r!=null&&r[1]!=null)return{type:"px",value:parseFloat(r[1])};let n=t.match(/^(\d+)rem$/);if(n!=null&&n[1]!=null)return{type:"rem",value:parseFloat(n[1])}}async function sNa({versions:e,absolutePathToFernFolder:t,context:r,folderTitleSource:n}){let i=[];for(let o of e){let s=eo(t,o.path),a=Rr.load((await(0,s$e.readFile)(s)).toString()),c=[],u=lM(a,[],c);c.length>0&&r.logger.warn(`Version file ${o.path} contained null/undefined sections that were ignored: ${c.map(d=>d.join(".")).join(", ")}`);let l=c_.RawSchemas.Serializer.VersionFileConfig.parseOrThrow(u),p=await aQi({tabs:l.tabs,rawNavigationConfig:l.navigation,absolutePathToFernFolder:t,absolutePathToConfig:s,context:r,folderTitleSource:n});i.push({landingPage:ZOt(l.landingPage,s),version:o.displayName,navigation:p,availability:o.availability,slug:o.slug,hidden:o.hidden,viewers:R_(o.viewers),orphaned:o.orphaned,featureFlags:P_(o.featureFlag),announcement:o.announcement})}return{type:"versioned",versions:i}}async function Ugf({tabs:e,products:t,versions:r,navigation:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a}){if(n!=null)return await aQi({tabs:e,rawNavigationConfig:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a});if(t!=null){let c=[];for(let u of t){let l=u.image!=null?eo(i,u.image):void 0;if("path"in u){let p,d=eo(i,u.path),f=Rr.load((await(0,s$e.readFile)(d)).toString()),m=[],h=lM(f,[],m);m.length>0&&s.logger.warn(`Product file ${u.path} contained null/undefined sections that were ignored: ${m.map(A=>A.join(".")).join(", ")}`);let g=c_.RawSchemas.Serializer.ProductFileConfig.parseOrThrow(h);u.versions!=null&&u.versions.length>0?p=await sNa({versions:u.versions,absolutePathToFernFolder:i,context:s,folderTitleSource:a}):p=await aQi({tabs:g.tabs,rawNavigationConfig:g.navigation,absolutePathToFernFolder:i,absolutePathToConfig:d,context:s,folderTitleSource:a}),c.push({type:"internal",landingPage:ZOt(g.landingPage,d),product:u.displayName,navigation:p,slug:u.slug,subtitle:u.subtitle,icon:$b(u.icon,o)||"fa-solid fa-code",image:l,viewers:R_(u.viewers),orphaned:u.orphaned,featureFlags:P_(u.featureFlag),announcement:u.announcement})}else if("href"in u&&u.href!=null)c.push({type:"external",product:u.displayName,href:u.href,target:u.target,subtitle:u.subtitle,icon:$b(u.icon,o)||"fa-solid fa-code",image:l,viewers:R_(u.viewers),orphaned:u.orphaned,featureFlags:P_(u.featureFlag)});else throw new Error("Invalid product configuration: product must have either 'path' or valid 'href' property")}return{type:"productgroup",products:c}}else if(r!=null)return await sNa({versions:r,absolutePathToFernFolder:i,context:s,folderTitleSource:a});throw new Error("Unexpected. Docs have neither navigation or versions defined.")}function P_(e){if(e!=null)return typeof e=="string"?[{flag:e,match:!0,fallbackValue:void 0}]:Array.isArray(e)?e.map(t=>({flag:t.flag,match:t.match,fallbackValue:t.fallbackValue})):[{flag:e.flag,match:e.match??!0,fallbackValue:e.fallbackValue}]}async function zgf({rawTypography:e,absoluteFilepathToDocsConfig:t}){return{headingsFont:e.headingsFont!=null?await oQi({rawFontConfig:e.headingsFont,absoluteFilepathToDocsConfig:t}):void 0,bodyFont:e.bodyFont!=null?await oQi({rawFontConfig:e.bodyFont,absoluteFilepathToDocsConfig:t}):void 0,codeFont:e.codeFont!=null?await oQi({rawFontConfig:e.codeFont,absoluteFilepathToDocsConfig:t}):void 0}}async function oQi({rawFontConfig:e,absoluteFilepathToDocsConfig:t}){return{name:e.name,variants:await Vgf(e,t),display:e.display,fallback:e.fallback,fontVariationSettings:e.fontVariationSettings}}function Vgf(e,t){let r=[];return e.path!=null&&r.push({path:e.path,weight:e.weight,style:e.style}),e.paths?.forEach(n=>{typeof n=="string"?r.push({path:n,weight:e.weight,style:e.style}):r.push({path:n.path,weight:n.weight??e.weight,style:n.style??e.style})}),Promise.all(r.map(async n=>({absolutePath:sb(n.path,t),weight:qgf(n.weight),style:n.style})))}function qgf(e){return e==null?void 0:typeof e=="number"?[e.toString()]:e.split(/\D+/).filter(r=>r!==""&&["100","200","300","400","500","600","700","800","900"].includes(r))}async function Ggf({tabs:e,item:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){let s=e[t.tab];if(s==null)throw new Error(`Tab ${t.tab} is not defined in the tabs config.`);if(cAf(t)){let a=await Promise.all(t.variants.map(async c=>{let u=await Promise.all(c.layout.map(l=>lwr({rawConfig:l,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:c.title,subtitle:c.subtitle,icon:$b(c.icon,n),layout:u,slug:c.slug,skipUrlSlug:c.skipSlug,hidden:c.hidden,default:c.default,viewers:R_(c.viewers),orphaned:c.orphaned,featureFlags:P_(c.featureFlag)}}));return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"variants",variants:a},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)}}if(aAf(t)){let a=await Promise.all(t.layout.map(c=>lwr({rawConfig:c,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"layout",layout:a},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)}}if(s.href!=null)return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"link",href:s.href,target:s.target},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)};if(s.changelog!=null)return{title:s.displayName,icon:$b(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"changelog",changelog:await qC(sb(s.changelog,n),"{md,mdx}")},viewers:R_(s.viewers),orphaned:s.orphaned,featureFlags:P_(s.featureFlag)};Ie(s)}async function aQi({tabs:e={},rawNavigationConfig:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){return sAf(t)?{type:"tabbed",items:await Promise.all(t.map(a=>Ggf({tabs:e,item:a,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}:{type:"untabbed",items:await Promise.all(t.map(s=>lwr({rawConfig:s,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}}var Wgf="Changelog";async function $gf({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){let o=sb(e.folder,r);await ar(o)||n.failAndThrow(`Folder not found: ${e.folder}`),cQi({context:n,sectionTitle:e.folder,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0});let s=e.titleSource??i,a=await iQi({directoryPath:o,titleSource:s}),c=a.find(m=>m.type==="page"&&(m.slug==="index"||m.absolutePath.toLowerCase().endsWith("/index.mdx")||m.absolutePath.toLowerCase().endsWith("/index.md"))),u=c?a.filter(m=>m!==c):a,l=aNa.default.basename(o),p=s==="frontmatter"&&c?.type==="page"?(await swr({absolutePath:c.absolutePath})).title:void 0,d=e.title??p??nQi({name:l}),f=e.slug??owr({name:l});return{type:"section",title:d,icon:$b(e.icon,r),contents:u,slug:f,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:c?.type==="page"?c.absolutePath:void 0,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag),availability:e.availability}}async function lwr({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){if(cNa(e))return ZOt(e,r);if(Kgf(e))return cQi({context:n,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),{type:"section",title:e.section,icon:$b(e.icon,r),contents:await Promise.all(e.contents.map(o=>lwr({rawConfig:o,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}))),slug:e.slug??void 0,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:sb(e.path,r),viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag),availability:e.availability};if(Jgf(e))return{type:"apiSection",openrpc:e.openrpc,title:e.api,icon:$b(e.icon,r),apiName:e.apiName??void 0,audiences:e.audiences!=null?{type:"select",audiences:eBt(e.audiences)??[]}:{type:"all"},availability:e.availability,showErrors:e.displayErrors??!0,tagDescriptionPages:e.tagDescriptionPages??!1,snippetsConfiguration:e.snippets!=null?Hgf({rawConfig:e.snippets}):void 0,postman:e.postman,navigation:e.layout?.flatMap(o=>uwr(o,r,n))??[],overviewAbsolutePath:sb(e.summary,r),collapsed:e.collapsed??void 0,hidden:e.hidden??void 0,slug:e.slug,skipUrlSlug:e.skipSlug??!1,flattened:e.flattened??!1,alphabetized:e.alphabetized??!1,paginated:e.paginated??!1,playground:e.playground,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)};if(uNa(e))return{type:"link",text:e.link,url:e.href,icon:$b(e.icon,r),target:e.target};if(Ygf(e))return{type:"changelog",changelog:await qC(sb(e.changelog,r),"{md,mdx}"),hidden:e.hidden??!1,icon:$b(e.icon,r),title:e.title??Wgf,slug:e.slug,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)};if(Xgf(e))return await $gf({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i});if(Zgf(e))return{type:"librarySection",libraryName:e.library,title:e.title??void 0,slug:e.slug??void 0,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)};Ie(e)}function ZOt(e,t){if(e!=null)return{type:"page",title:e.page,absolutePath:sb(e.path,t),slug:e.slug,icon:$b(e.icon,t),hidden:e.hidden,noindex:e.noindex,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag),availability:e.availability}}function uwr(e,t,r){return typeof e=="string"?[{type:"item",value:e}]:cNa(e)?[ZOt(e,t)]:uNa(e)?[{type:"link",text:e.link,url:e.href,icon:$b(e.icon,t),target:e.target}]:rAf(e)?(r!=null&&cQi({context:r,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),[{type:"section",title:e.section,referencedSubpackages:e.referencedPackages??[],overviewAbsolutePath:sb(e.summary,t),contents:e.contents?.flatMap(n=>uwr(n,t,r))??[],slug:e.slug,hidden:e.hidden,skipUrlSlug:e.skipSlug,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,availability:e.availability,icon:$b(e.icon,t),playground:e.playground,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)}]):nAf(e)?[{type:"endpoint",endpoint:e.endpoint,title:e.title,icon:$b(e.icon,t),slug:e.slug,hidden:e.hidden,availability:e.availability,playground:e.playground,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)}]:iAf(e)?[{type:"operation",operation:e.operation,title:e.title,slug:e.slug,hidden:e.hidden,availability:e.availability,viewers:R_(e.viewers),orphaned:e.orphaned,featureFlags:P_(e.featureFlag)}]:Object.entries(e).map(([n,i])=>oAf(i)?{type:"package",title:i.title,package:n,overviewAbsolutePath:sb(i.summary,t),contents:i.contents?.flatMap(o=>uwr(o,t,r))??[],slug:i.slug,hidden:i.hidden,skipUrlSlug:i.skipSlug,icon:$b(i.icon,t),playground:i.playground,availability:i.availability,viewers:R_(i.viewers),orphaned:i.orphaned,featureFlags:P_(i.featureFlag)}:{type:"package",title:void 0,package:n,overviewAbsolutePath:void 0,contents:i.flatMap(o=>uwr(o,t,r)),hidden:!1,slug:void 0,skipUrlSlug:!1,icon:void 0,playground:void 0,availability:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}function Hgf({rawConfig:e}){return{python:e.python,typescript:e.typescript,go:e.go,java:e.java,ruby:e.ruby,csharp:e.csharp,php:e.php,swift:e.swift}}function cNa(e){return Ua(e)&&typeof e.page=="string"&&typeof e.path=="string"}function Kgf(e){return e.section!=null}function Jgf(e){return e.api!=null}function uNa(e){return c_.RawSchemas,Ua(e)&&typeof e.link=="string"&&typeof e.href=="string"}function Ygf(e){return Ua(e)&&typeof e.changelog=="string"}function Xgf(e){return Ua(e)&&typeof e.folder=="string"}function Zgf(e){return Ua(e)&&typeof e.library=="string"}function eAf(e){return"git"in e}function tAf(e){if(e==null)return;let t={};for(let[r,n]of Object.entries(e)){if(!eAf(n.input))throw new Error(`Library '${r}' uses 'path' input which is not yet supported. Please use 'git' input.`);t[r]={input:{git:n.input.git,subpath:n.input.subpath},output:{path:n.output.path},lang:n.lang}}return t}function rAf(e){return Ua(e)&&typeof e.section=="string"&&Array.isArray(e.contents)}function nAf(e){return Ua(e)&&typeof e.endpoint=="string"}function iAf(e){return Ua(e)&&typeof e.operation=="string"}function oAf(e){return!Array.isArray(e)}function sb(e,t){if(e!=null)return eo(Pn(t),e)}function sAf(e){return Array.isArray(e)&&e.length>0&&e[0].tab!=null}function aAf(e){return"layout"in e&&Array.isArray(e.layout)}function cAf(e){return"variants"in e&&Array.isArray(e.variants)}function uAf(e,t){return e?.map(r=>{if(r.type==="github"){let i=r.value;return typeof i=="string"?{type:"github",url:Fr.Url(i),viewers:void 0,target:void 0}:{type:"github",url:Fr.Url(i.url),viewers:sQi(i.viewers),target:i.target}}let n=sQi(r.viewers);return r.type==="dropdown"?{type:"dropdown",text:r.text,icon:$b(r.icon,t),rightIcon:$b(r.rightIcon,t),rounded:r.rounded,viewers:n,links:r.links?.map(i=>({href:i.href,target:i.target,url:Fr.Url(i.url??i.href??"/"),text:i.text,icon:$b(i.icon,t),rightIcon:$b(i.rightIcon,t),rounded:i.rounded,viewers:sQi(i.viewers)}))??[]}:{type:r.type,text:r.text,url:Fr.Url(r.href??r.url??"/"),target:r.target,icon:$b(r.icon,t),rightIcon:$b(r.rightIcon,t),rounded:r.rounded,viewers:n}})}function sQi(e){if(e!=null)return Array.isArray(e)?e.map(t=>Fr.RoleId(t)):[Fr.RoleId(e)]}function lAf(e){if(e==null)return;let t=[];if(Object.keys(e).forEach(r=>{let n=e[r];n!=null&&t.push({type:r,value:Fr.Url(n)})}),t.length!==0)return t}async function pAf(e,t){if(e!=null)return{"og:site_name":e.ogSiteName,"og:title":e.ogTitle,"og:description":e.ogDescription,"og:url":e.ogUrl,"og:image":await cwr(e.ogImage,t),"og:image:width":e.ogImageWidth,"og:image:height":e.ogImageHeight,"og:locale":e.ogLocale,"og:logo":await cwr(e.ogLogo,t),"twitter:title":e.twitterTitle,"twitter:description":e.twitterDescription,"twitter:image":await cwr(e.twitterImage,t),"twitter:handle":e.twitterHandle,"twitter:site":e.twitterSite,"twitter:url":e.twitterUrl,"twitter:card":e.twitterCard,"og:dynamic":e.ogDynamic,"og:background-image":await cwr(e.ogBackgroundImage,t),nofollow:void 0,noindex:void 0,canonicalHost:e.canonicalHost}}async function cwr(e,t){if(e==null)return;if(e.startsWith("http"))return{type:"url",value:e};let r=sb(e,t);return await ar(r)?{type:"filepath",value:r}:{type:"url",value:e}}function R_(e){if(e!=null){if(typeof e=="string")return[Fr.RoleId(e)];if(e.length!==0)return e.map(Fr.RoleId)}}function eBt(e){if(e!=null){if(typeof e=="string")return[e];if(e.length!==0)return e}}function cQi({context:e,sectionTitle:t,collapsed:r,collapsible:n,collapsedByDefault:i}){n!=null&&r!=null&&e.failAndThrow(`Section "${t}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead.`),i!=null&&n!==!0&&e.failAndThrow(`Section "${t}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section.`)}Jt();var pNa=require("fs/promises");var lNa=bt.strictObject({organization:bt.string(),version:bt.string()});async function xD({directory:e,context:t}){let r=Ke(e,Be.of(zE)),n=await(0,pNa.readFile)(r),i=JSON.parse(n.toString()),o=await ybr({schema:lNa,value:i,context:t,filepathBeingParsed:r});return{_absolutePath:r,rawConfig:o,organization:o.organization,version:o.version}}var rt={TYPESCRIPT:"fernapi/fern-typescript",TYPESCRIPT_SDK:"fernapi/fern-typescript-sdk",TYPESCRIPT_NODE_SDK:"fernapi/fern-typescript-node-sdk",TYPESCRIPT_BROWSER_SDK:"fernapi/fern-typescript-browser-sdk",TYPESCRIPT_EXPRESS:"fernapi/fern-typescript-express",JAVA:"fernapi/fern-java",JAVA_MODEL:"fernapi/fern-java-model",JAVA_SDK:"fernapi/fern-java-sdk",JAVA_SPRING:"fernapi/fern-java-spring",PYTHON_FASTAPI:"fernapi/fern-fastapi-server",PYTHON_PYDANTIC:"fernapi/fern-pydantic-model",PYTHON_SDK:"fernapi/fern-python-sdk",GO_MODEL:"fernapi/fern-go-model",GO_SDK:"fernapi/fern-go-sdk",RUBY_SDK:"fernapi/fern-ruby-sdk",CSHARP_MODEL:"fernapi/fern-csharp-model",CSHARP_SDK:"fernapi/fern-csharp-sdk",SWIFT_MODEL:"fernapi/fern-swift-model",SWIFT_SDK:"fernapi/fern-swift-sdk",PHP_MODEL:"fernapi/fern-php-model",PHP_SDK:"fernapi/fern-php-sdk",RUST_MODEL:"fernapi/fern-rust-model",RUST_SDK:"fernapi/fern-rust-sdk",OPENAPI:"fernapi/fern-openapi",STOPLIGHT:"fernapi/fern-stoplight",POSTMAN:"fernapi/fern-postman",OPENAPI_PYTHON_CLIENT:"fernapi/openapi-python-client"};var _Li=ve(LC(),1);var tBt={[rt.JAVA]:{version:"2.38.1"},[rt.TYPESCRIPT_EXPRESS]:{version:"0.18.4",output:{location:"local-file-system",path:"../src/fern"}},[rt.JAVA_MODEL]:{version:"1.0.0"},[rt.JAVA_SDK]:{version:"2.38.1",output:{location:"local-file-system",path:"../sdks/java/src/main/java/"}},[rt.JAVA_SPRING]:{version:"0.9.2",output:{location:"local-file-system",path:"../src/main/java/com/fern"}},[rt.TYPESCRIPT]:{version:"0.0.247"},[rt.TYPESCRIPT_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[rt.TYPESCRIPT_NODE_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[rt.TYPESCRIPT_BROWSER_SDK]:{version:"1.0.0",output:{location:"local-file-system",path:"../sdks/typescript"}},[rt.PYTHON_PYDANTIC]:{version:"1.4.7"},[rt.PYTHON_FASTAPI]:{version:"1.7.0",output:{location:"local-file-system",path:"../src/fern"}},[rt.PYTHON_SDK]:{version:"4.23.2",output:{location:"local-file-system",path:"../sdks/python"}},[rt.GO_MODEL]:{version:"0.23.5"},[rt.GO_SDK]:{version:"1.4.0",output:{location:"local-file-system",path:"../sdks/go"},config:{module:{path:"sdk"}}},[rt.RUBY_SDK]:{version:"0.8.2",output:{location:"local-file-system",path:"../sdks/ruby"}},[rt.OPENAPI]:{version:"0.1.7",config:{format:"yaml"},output:{location:"local-file-system",path:"../openapi"}},[rt.STOPLIGHT]:{version:"0.0.28",config:{format:"yaml"}},[rt.POSTMAN]:{version:"0.4.0",output:{location:"local-file-system",path:"../postman"}},[rt.OPENAPI_PYTHON_CLIENT]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/python"},config:{format:"yaml"}},[rt.CSHARP_MODEL]:{version:"0.0.1"},[rt.CSHARP_SDK]:{version:"2.0.2",output:{location:"local-file-system",path:"../sdks/csharp"}},[rt.SWIFT_MODEL]:{version:"0.0.0"},[rt.SWIFT_SDK]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/swift/sdk"}},[rt.PHP_MODEL]:{version:"0.0.0"},[rt.PHP_SDK]:{version:"1.16.3",output:{location:"local-file-system",path:"../sdks/php/sdk"}},[rt.RUST_MODEL]:{version:"0.0.1",output:{location:"local-file-system",path:"../models/rust"}},[rt.RUST_SDK]:{version:"0.0.1",output:{location:"local-file-system",path:"../sdks/rust"}}};var rBt="fernapi",IFe="fern-api";function U0(e){return e=a$e(e),e.includes("/")?e:`${rBt}/${e}`}function a$e(e){let t=`${IFe}/`;return e.startsWith(t)?`${rBt}/${e.slice(t.length)}`:e}function pwr(e,t){let r=`${IFe}/`;if(e.startsWith(r)){let n=`${rBt}/${e.slice(r.length)}`;return t.logger.warn(`"${e}" is not a valid generator name. Using "${n}" instead \u2014 the Docker org is "fernapi", not "fern-api".`),n}return e}function wFe(e){let t=`${rBt}/`;return e.startsWith(t)?e.slice(t.length):e}function uQi(e,t){let r=xFe(e);return r??t.failAndThrow("Unrecognized generator: "+e)}var fAf={"fernapi/java-model":rt.JAVA_MODEL,"fernapi/fern-typescript-node-sdk":rt.TYPESCRIPT_SDK};function xFe(e){e=U0(e);let t=fAf[e];if(t!=null&&(e=t),dAf(e))return e}function dAf(e){return Object.values(rt).includes(e)}var Yxr=ve(V$e(),1),A4a=ve(LC(),1);async function IB({generatorName:e,cliVersion:t,channel:r,currentGeneratorVersion:n,includeMajor:i,context:o}){let s=A4a.default.parse(n),a="https://registry.buildwithfern.com",c=new Yxr.FernRegistryClient({environment:a});o?.logger.debug(`Getting latest version for ${e} with CLI version ${t}, includeMajor: ${i}, prior version: ${s}, FDR origin: ${a}`);let u={generator:zTf(e,o),releaseTypes:[r??Yxr.FernRegistry.generators.ReleaseType.Ga],cliVersion:t};!i&&s!=null&&(u.generatorMajorVersion=s.major),o?.logger.debug(`[FDR] getLatestGeneratorRelease request: ${JSON.stringify(u)}`);let l=await c.generators.versions.getLatestGeneratorRelease(u);if(l.ok)return o?.logger.debug(`[FDR] getLatestGeneratorRelease response for ${e}: version=${l.body.version}, irVersion=${l.body.irVersion}`),l.body.version;o?.logger.debug(`[FDR] getLatestGeneratorRelease failed for ${e}: ${JSON.stringify(l)}`)}function zTf(e,t){switch(e.startsWith("fernapi/")&&(e=e.replace("fernapi/","")),e){case"fern-python-sdk":return"python-sdk";case"fern-pydantic-model":return"pydantic";case"fern-fastapi-server":return"fastapi";case"fern-typescript":case"fern-typescript-browser-sdk":case"fern-typescript-node-sdk":case"fern-typescript-sdk":return"ts-sdk";case"fern-typescript-express":return"ts-express";case"fern-java-sdk":return"java-sdk";case"fern-java-model":case"java-model":return"java-model";case"fern-java-spring":return"java-spring";case"fern-go-sdk":return"go-sdk";case"fern-go-model":return"go-model";case"fern-csharp-sdk":return"csharp-sdk";case"fern-csharp-model":return"csharp-model";case"fern-ruby-sdk":return"ruby-sdk";case"fern-postman":return"postman";case"fern-openapi":return"openapi";case"fern-php-sdk":return"php-sdk";case"fern-php-model":return"php-model";case"fern-rust-sdk":return"rust-sdk";case"fern-rust-model":return"rust-model";case"fern-swift-sdk":return"swift-sdk";case"fern-swift-model":return"swift-model";default:return t?.logger.warn(`Unrecognized generator name found, attempting to parse manually: ${e}`),e.startsWith("fern-")?e.replace("fern-",""):e}}async function y4a({generatorsConfiguration:e,groupName:t=e[kn.DEFAULT_GROUP_GENERATORS_CONFIG_KEY],context:r,update:n}){if(t==null){let s=Object.keys(e.groups??{});if(s.length>0){let a=`No group specified. Use the --group option:
|
|
1582
1582
|
`+s.map(c=>` \u203A ${c}`).join(`
|
|
1583
1583
|
`);return r.failAndThrow(a)}return r.failAndThrow("No group specified.")}let i=e.groups??={},o=i[t];if(o==null){let s=i[t]??={generators:[]};await n(s,t)}else await n(o,t);return e}async function SLi({generatorName:e,generatorsConfiguration:t,groupName:r=t[ghe],context:n,cliVersion:i}){let o=uQi(e,n),s=wFe(o),a=tBt[o];return await y4a({generatorsConfiguration:t,groupName:r,context:n,update:async c=>{c.generators.some(p=>U0("image"in p?p.image.name:p.name)===o)&&n.failAndThrow(`${e} is already installed in group ${r}.`);let u=await IB({cliVersion:i,generatorName:o,context:n,channel:void 0}),l=u!=null&&_Li.default.valid(u)&&_Li.default.gt(u,a.version)?u:a.version;c.generators.push({name:s,...a,version:l})}})}Pt();Jt();K$();var Gr={};$(Gr,{ApiId:()=>Xxr,CommitSha:()=>Zxr,GithubLicense:()=>qAe,GithubLicenseId:()=>rCr,GithubOutputModeV2:()=>oY,GithubPublishInfo:()=>k_,GithubPullRequestReviewer:()=>GAe,LogLevel:()=>q$e,Mode:()=>tCr,OrganizationId:()=>eCr,OutputMode:()=>HN,PackageCoordinate:()=>wB,PackagePublishStatus:()=>G$e,PublishOutputModeV2:()=>N_,RemoteGenJobId:()=>nCr,RemoteGenTaskId:()=>iCr,TaskStatus:()=>Rz,commons:()=>TLi,definitionRegistry:()=>Jg,demoCreation:()=>FFe,health:()=>kFe,remoteGen:()=>Ii});var TLi={};$(TLi,{ApiId:()=>Xxr,CommitSha:()=>Zxr,OrganizationId:()=>eCr});function Xxr(e){return e}function Zxr(e){return e}function eCr(e){return e}var Jg={};$(Jg,{get:()=>OLi,getLatestVersion:()=>BLi,registerUsingOrgToken:()=>PLi});var OLi={};$(OLi,{Error:()=>VTf});var VTf={orgDoesNotExistError:()=>({error:"OrgDoesNotExistError",_visit:function(e){return Jg.get.Error._visit(this,e)}}),apiDoesNotExistError:()=>({error:"ApiDoesNotExistError",_visit:function(e){return Jg.get.Error._visit(this,e)}}),versionDoesNotExistError:()=>({error:"VersionDoesNotExistError",_visit:function(e){return Jg.get.Error._visit(this,e)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Jg.get.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){case"OrgDoesNotExistError":return t.orgDoesNotExistError();case"ApiDoesNotExistError":return t.apiDoesNotExistError();case"VersionDoesNotExistError":return t.versionDoesNotExistError();default:return t._other(e.content)}}};var BLi={};$(BLi,{Error:()=>qTf});var qTf={orgDoesNotExistError:()=>({error:"OrgDoesNotExistError",_visit:function(e){return Jg.getLatestVersion.Error._visit(this,e)}}),apiDoesNotExistError:()=>({error:"ApiDoesNotExistError",_visit:function(e){return Jg.getLatestVersion.Error._visit(this,e)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Jg.getLatestVersion.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){case"OrgDoesNotExistError":return t.orgDoesNotExistError();case"ApiDoesNotExistError":return t.apiDoesNotExistError();default:return t._other(e.content)}}};var PLi={};$(PLi,{Error:()=>GTf});var GTf={versionAlreadyExists:()=>({error:"VersionAlreadyExists",_visit:function(e){return Jg.registerUsingOrgToken.Error._visit(this,e)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Jg.registerUsingOrgToken.Error._visit(this,t)}}),_visit:(e,t)=>e.error==="VersionAlreadyExists"?t.versionAlreadyExists():t._other(e.content)};var FFe={};$(FFe,{Mode:()=>tCr,createSdkDemo:()=>RLi});var RLi={};$(RLi,{Error:()=>WTf});var WTf={_unknown:e=>({error:void 0,content:e,_visit:function(t){return FFe.createSdkDemo.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){default:return t._other(e.content)}}};var $Tf={Fern:"FERN",Openapi:"OPENAPI"},tCr=Object.assign(Object.assign({},$Tf),{_visit:(e,t)=>{switch(e){case tCr.Fern:return t.fern();case tCr.Openapi:return t.openapi();default:return t._other()}}});var kFe={};$(kFe,{status:()=>DLi});var DLi={};$(DLi,{Error:()=>HTf});var HTf={_unknown:e=>({error:void 0,content:e,_visit:function(t){return kFe.status.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){default:return t._other(e.content)}}};var Ii={};$(Ii,{GithubLicense:()=>qAe,GithubLicenseId:()=>rCr,GithubOutputModeV2:()=>oY,GithubPublishInfo:()=>k_,GithubPullRequestReviewer:()=>GAe,LogLevel:()=>q$e,OutputMode:()=>HN,PackageCoordinate:()=>wB,PackagePublishStatus:()=>G$e,PublishOutputModeV2:()=>N_,RemoteGenJobId:()=>nCr,RemoteGenTaskId:()=>iCr,TaskStatus:()=>Rz,createJob:()=>FLi,createJobV2:()=>kLi,createJobV3:()=>NLi,createReplayInitPr:()=>jLi,getDefinitionUploadUrl:()=>QLi,getJobStatus:()=>MLi});var FLi={};$(FLi,{Error:()=>KTf});var KTf={illegalApiNameError:()=>({error:"IllegalApiNameError",_visit:function(e){return Ii.createJob.Error._visit(this,e)}}),illegalApiVersionError:e=>({content:e,error:"IllegalApiVersionError",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),generatorsDoNotExistError:e=>({content:e,error:"GeneratorsDoNotExistError",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),cannotPublishToNpmScope:e=>({content:e,error:"CannotPublishToNpmScope",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),cannotPublishToMavenGroup:e=>({content:e,error:"CannotPublishToMavenGroup",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),cannotPublishPypiPackage:e=>({content:e,error:"CannotPublishPypiPackage",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),insufficientPermissions:e=>({content:e,error:"InsufficientPermissions",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),orgNotConfiguredForWhitelabel:e=>({content:e,error:"OrgNotConfiguredForWhitelabel",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),branchDoesNotExist:e=>({content:e,error:"BranchDoesNotExist",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),rateLimitExceeded:e=>({content:e,error:"RateLimitExceeded",_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Ii.createJob.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){case"IllegalApiNameError":return t.illegalApiNameError();case"IllegalApiVersionError":return t.illegalApiVersionError(e.content);case"GeneratorsDoNotExistError":return t.generatorsDoNotExistError(e.content);case"CannotPublishToNpmScope":return t.cannotPublishToNpmScope(e.content);case"CannotPublishToMavenGroup":return t.cannotPublishToMavenGroup(e.content);case"CannotPublishPypiPackage":return t.cannotPublishPypiPackage(e.content);case"InsufficientPermissions":return t.insufficientPermissions(e.content);case"OrgNotConfiguredForWhitelabel":return t.orgNotConfiguredForWhitelabel(e.content);case"BranchDoesNotExist":return t.branchDoesNotExist(e.content);case"RateLimitExceeded":return t.rateLimitExceeded(e.content);default:return t._other(e.content)}}};var kLi={};$(kLi,{Error:()=>JTf});var JTf={illegalApiNameError:()=>({error:"IllegalApiNameError",_visit:function(e){return Ii.createJobV2.Error._visit(this,e)}}),illegalApiVersionError:e=>({content:e,error:"IllegalApiVersionError",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),generatorsDoNotExistError:e=>({content:e,error:"GeneratorsDoNotExistError",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),cannotPublishToNpmScope:e=>({content:e,error:"CannotPublishToNpmScope",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),cannotPublishToMavenGroup:e=>({content:e,error:"CannotPublishToMavenGroup",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),cannotPublishPypiPackage:e=>({content:e,error:"CannotPublishPypiPackage",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),insufficientPermissions:e=>({content:e,error:"InsufficientPermissions",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),orgNotConfiguredForWhitelabel:e=>({content:e,error:"OrgNotConfiguredForWhitelabel",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),branchDoesNotExist:e=>({content:e,error:"BranchDoesNotExist",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),rateLimitExceeded:e=>({content:e,error:"RateLimitExceeded",_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Ii.createJobV2.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){case"IllegalApiNameError":return t.illegalApiNameError();case"IllegalApiVersionError":return t.illegalApiVersionError(e.content);case"GeneratorsDoNotExistError":return t.generatorsDoNotExistError(e.content);case"CannotPublishToNpmScope":return t.cannotPublishToNpmScope(e.content);case"CannotPublishToMavenGroup":return t.cannotPublishToMavenGroup(e.content);case"CannotPublishPypiPackage":return t.cannotPublishPypiPackage(e.content);case"InsufficientPermissions":return t.insufficientPermissions(e.content);case"OrgNotConfiguredForWhitelabel":return t.orgNotConfiguredForWhitelabel(e.content);case"BranchDoesNotExist":return t.branchDoesNotExist(e.content);case"RateLimitExceeded":return t.rateLimitExceeded(e.content);default:return t._other(e.content)}}};var NLi={};$(NLi,{Error:()=>YTf});var YTf={illegalApiNameError:()=>({error:"IllegalApiNameError",_visit:function(e){return Ii.createJobV3.Error._visit(this,e)}}),illegalApiVersionError:e=>({content:e,error:"IllegalApiVersionError",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),generatorsDoNotExistError:e=>({content:e,error:"GeneratorsDoNotExistError",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),cannotPublishToNpmScope:e=>({content:e,error:"CannotPublishToNpmScope",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),cannotPublishToMavenGroup:e=>({content:e,error:"CannotPublishToMavenGroup",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),cannotPublishPypiPackage:e=>({content:e,error:"CannotPublishPypiPackage",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),insufficientPermissions:e=>({content:e,error:"InsufficientPermissions",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),orgNotConfiguredForWhitelabel:e=>({content:e,error:"OrgNotConfiguredForWhitelabel",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),branchDoesNotExist:e=>({content:e,error:"BranchDoesNotExist",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),rateLimitExceeded:e=>({content:e,error:"RateLimitExceeded",_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Ii.createJobV3.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){case"IllegalApiNameError":return t.illegalApiNameError();case"IllegalApiVersionError":return t.illegalApiVersionError(e.content);case"GeneratorsDoNotExistError":return t.generatorsDoNotExistError(e.content);case"CannotPublishToNpmScope":return t.cannotPublishToNpmScope(e.content);case"CannotPublishToMavenGroup":return t.cannotPublishToMavenGroup(e.content);case"CannotPublishPypiPackage":return t.cannotPublishPypiPackage(e.content);case"InsufficientPermissions":return t.insufficientPermissions(e.content);case"OrgNotConfiguredForWhitelabel":return t.orgNotConfiguredForWhitelabel(e.content);case"BranchDoesNotExist":return t.branchDoesNotExist(e.content);case"RateLimitExceeded":return t.rateLimitExceeded(e.content);default:return t._other(e.content)}}};var jLi={};$(jLi,{Error:()=>XTf});var XTf={insufficientPermissions:e=>({content:e,error:"InsufficientPermissions",_visit:function(t){return Ii.createReplayInitPr.Error._visit(this,t)}}),githubAppNotInstalled:e=>({content:e,error:"GithubAppNotInstalled",_visit:function(t){return Ii.createReplayInitPr.Error._visit(this,t)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Ii.createReplayInitPr.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){case"InsufficientPermissions":return t.insufficientPermissions(e.content);case"GithubAppNotInstalled":return t.githubAppNotInstalled(e.content);default:return t._other(e.content)}}};var QLi={};$(QLi,{Error:()=>ZTf});var ZTf={insufficientPermissions:e=>({content:e,error:"InsufficientPermissions",_visit:function(t){return Ii.getDefinitionUploadUrl.Error._visit(this,t)}}),_unknown:e=>({error:void 0,content:e,_visit:function(t){return Ii.getDefinitionUploadUrl.Error._visit(this,t)}}),_visit:(e,t)=>e.error==="InsufficientPermissions"?t.insufficientPermissions(e.content):t._other(e.content)};var MLi={};$(MLi,{Error:()=>eOf});var eOf={_unknown:e=>({error:void 0,content:e,_visit:function(t){return Ii.getJobStatus.Error._visit(this,t)}}),_visit:(e,t)=>{switch(e.error){default:return t._other(e.content)}}};var qAe={basic:e=>Object.assign(Object.assign({},e),{type:"basic",_visit:function(t){return qAe._visit(this,t)}}),custom:e=>Object.assign(Object.assign({},e),{type:"custom",_visit:function(t){return qAe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"custom":return t.custom(e);default:return t._other(e)}}};var tOf={Mit:"MIT",Apache:"APACHE"},rCr=Object.assign(Object.assign({},tOf),{_visit:(e,t)=>{switch(e){case rCr.Mit:return t.mit();case rCr.Apache:return t.apache();default:return t._other()}}});var oY={push:e=>Object.assign(Object.assign({},e),{type:"push",_visit:function(t){return oY._visit(this,t)}}),commitAndRelease:e=>Object.assign(Object.assign({},e),{type:"commitAndRelease",_visit:function(t){return oY._visit(this,t)}}),pullRequest:e=>Object.assign(Object.assign({},e),{type:"pullRequest",_visit:function(t){return oY._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"push":return t.push(e);case"commitAndRelease":return t.commitAndRelease(e);case"pullRequest":return t.pullRequest(e);default:return t._other(e)}}};var k_={npm:e=>Object.assign(Object.assign({},e),{type:"npm",_visit:function(t){return k_._visit(this,t)}}),maven:e=>Object.assign(Object.assign({},e),{type:"maven",_visit:function(t){return k_._visit(this,t)}}),postman:e=>Object.assign(Object.assign({},e),{type:"postman",_visit:function(t){return k_._visit(this,t)}}),pypi:e=>Object.assign(Object.assign({},e),{type:"pypi",_visit:function(t){return k_._visit(this,t)}}),rubygems:e=>Object.assign(Object.assign({},e),{type:"rubygems",_visit:function(t){return k_._visit(this,t)}}),nuget:e=>Object.assign(Object.assign({},e),{type:"nuget",_visit:function(t){return k_._visit(this,t)}}),crates:e=>Object.assign(Object.assign({},e),{type:"crates",_visit:function(t){return k_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"npm":return t.npm(e);case"maven":return t.maven(e);case"postman":return t.postman(e);case"pypi":return t.pypi(e);case"rubygems":return t.rubygems(e);case"nuget":return t.nuget(e);case"crates":return t.crates(e);default:return t._other(e)}}};var GAe={team:e=>Object.assign(Object.assign({},e),{type:"team",_visit:function(t){return GAe._visit(this,t)}}),user:e=>Object.assign(Object.assign({},e),{type:"user",_visit:function(t){return GAe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"team":return t.team(e);case"user":return t.user(e);default:return t._other(e)}}};var rOf={Debug:"DEBUG",Info:"INFO",Warn:"WARN",Error:"ERROR"},q$e=Object.assign(Object.assign({},rOf),{_visit:(e,t)=>{switch(e){case q$e.Debug:return t.debug();case q$e.Info:return t.info();case q$e.Warn:return t.warn();case q$e.Error:return t.error();default:return t._other()}}});var HN={publish:e=>Object.assign(Object.assign({},e),{type:"publish",_visit:function(t){return HN._visit(this,t)}}),publishV2:e=>({publishV2:e,type:"publishV2",_visit:function(t){return HN._visit(this,t)}}),downloadFiles:e=>Object.assign(Object.assign({},e),{type:"downloadFiles",_visit:function(t){return HN._visit(this,t)}}),github:e=>Object.assign(Object.assign({},e),{type:"github",_visit:function(t){return HN._visit(this,t)}}),githubV2:e=>({githubV2:e,type:"githubV2",_visit:function(t){return HN._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"publish":return t.publish(e);case"publishV2":return t.publishV2(e.publishV2);case"downloadFiles":return t.downloadFiles(e);case"github":return t.github(e);case"githubV2":return t.githubV2(e.githubV2);default:return t._other(e)}}};var wB={npm:e=>Object.assign(Object.assign({},e),{type:"npm",_visit:function(t){return wB._visit(this,t)}}),maven:e=>Object.assign(Object.assign({},e),{type:"maven",_visit:function(t){return wB._visit(this,t)}}),pypi:e=>Object.assign(Object.assign({},e),{type:"pypi",_visit:function(t){return wB._visit(this,t)}}),ruby:e=>Object.assign(Object.assign({},e),{type:"ruby",_visit:function(t){return wB._visit(this,t)}}),nuget:e=>Object.assign(Object.assign({},e),{type:"nuget",_visit:function(t){return wB._visit(this,t)}}),crates:e=>Object.assign(Object.assign({},e),{type:"crates",_visit:function(t){return wB._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"npm":return t.npm(e);case"maven":return t.maven(e);case"pypi":return t.pypi(e);case"ruby":return t.ruby(e);case"nuget":return t.nuget(e);case"crates":return t.crates(e);default:return t._other(e)}}};var nOf={NotStartedPublishing:"NOT_STARTED_PUBLISHING",Publishing:"PUBLISHING",Published:"PUBLISHED",FailedToPublish:"FAILED_TO_PUBLISH"},G$e=Object.assign(Object.assign({},nOf),{_visit:(e,t)=>{switch(e){case G$e.NotStartedPublishing:return t.notStartedPublishing();case G$e.Publishing:return t.publishing();case G$e.Published:return t.published();case G$e.FailedToPublish:return t.failedToPublish();default:return t._other()}}});var N_={npmOverride:e=>({npmOverride:e,type:"npmOverride",_visit:function(t){return N_._visit(this,t)}}),mavenOverride:e=>({mavenOverride:e,type:"mavenOverride",_visit:function(t){return N_._visit(this,t)}}),pypiOverride:e=>({pypiOverride:e,type:"pypiOverride",_visit:function(t){return N_._visit(this,t)}}),rubyGemsOverride:e=>({rubyGemsOverride:e,type:"rubyGemsOverride",_visit:function(t){return N_._visit(this,t)}}),nugetOverride:e=>({nugetOverride:e,type:"nugetOverride",_visit:function(t){return N_._visit(this,t)}}),cratesOverride:e=>({cratesOverride:e,type:"cratesOverride",_visit:function(t){return N_._visit(this,t)}}),postman:e=>Object.assign(Object.assign({},e),{type:"postman",_visit:function(t){return N_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"npmOverride":return t.npmOverride(e.npmOverride);case"mavenOverride":return t.mavenOverride(e.mavenOverride);case"pypiOverride":return t.pypiOverride(e.pypiOverride);case"rubyGemsOverride":return t.rubyGemsOverride(e.rubyGemsOverride);case"nugetOverride":return t.nugetOverride(e.nugetOverride);case"cratesOverride":return t.cratesOverride(e.cratesOverride);case"postman":return t.postman(e);default:return t._other(e)}}};function nCr(e){return e}function iCr(e){return e}var Rz={notStarted:()=>({type:"notStarted",_visit:function(e){return Rz._visit(this,e)}}),running:()=>({type:"running",_visit:function(e){return Rz._visit(this,e)}}),failed:e=>Object.assign(Object.assign({},e),{type:"failed",_visit:function(t){return Rz._visit(this,t)}}),finished:e=>Object.assign(Object.assign({},e),{type:"finished",_visit:function(t){return Rz._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"notStarted":return t.notStarted();case"running":return t.running();case"failed":return t.failed(e);case"finished":return t.finished(e);default:return t._other(e)}}};var kBt=class{getAuthRequest(){return Promise.resolve({headers:{}})}};var iOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},b4a={get:(e,t)=>iOf(void 0,void 0,void 0,function*(){return typeof e=="function"?e(t):e})};var NBt=(e,t,r)=>JSON.stringify(e,t,r);function jBt(e,t){return JSON.parse(e,t)}var JG={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},E4a={[JG.Debug]:1,[JG.Info]:2,[JG.Warn]:3,[JG.Error]:4},QBt=class{debug(t,...r){console.debug(t,...r)}info(t,...r){console.info(t,...r)}warn(t,...r){console.warn(t,...r)}error(t,...r){console.error(t,...r)}},W$e=class{constructor(t){this.level=E4a[t.level],this.logger=t.logger,this.silent=t.silent}shouldLog(t){return!this.silent&&this.level<=E4a[t]}isDebug(){return this.shouldLog(JG.Debug)}debug(t,...r){this.isDebug()&&this.logger.debug(t,...r)}isInfo(){return this.shouldLog(JG.Info)}info(t,...r){this.isInfo()&&this.logger.info(t,...r)}isWarn(){return this.shouldLog(JG.Warn)}warn(t,...r){this.isWarn()&&this.logger.warn(t,...r)}isError(){return this.shouldLog(JG.Error)}error(t,...r){this.isError()&&this.logger.error(t,...r)}};function LLi(e){var t,r,n;return e==null?oOf:e instanceof W$e?e:(e=e??{},(t=e.level)!==null&&t!==void 0||(e.level=JG.Info),(r=e.logger)!==null&&r!==void 0||(e.logger=new QBt),(n=e.silent)!==null&&n!==void 0||(e.silent=!0),new W$e(e))}var oOf=new W$e({level:JG.Info,logger:new QBt,silent:!0});var sOf={arrayFormat:"indices",encode:!0};function v4a(e,t){if(e===void 0||e===null)return"";let r=String(e);return t?encodeURIComponent(r):r}function ULi(e,t="",r){let n=[];for(let[i,o]of Object.entries(e)){let s=t?`${t}[${i}]`:i;if(o!==void 0)if(Array.isArray(o)){if(o.length===0)continue;for(let a=0;a<o.length;a++){let c=o[a];if(c!==void 0)if(typeof c=="object"&&!Array.isArray(c)&&c!==null){let u=r.arrayFormat==="indices"?`${s}[${a}]`:s;n.push(...ULi(c,u,r))}else{let u=r.arrayFormat==="indices"?`${s}[${a}]`:s,l=r.encode?encodeURIComponent(u):u;n.push(`${l}=${v4a(c,r.encode)}`)}}}else if(typeof o=="object"&&o!==null){if(Object.keys(o).length===0)continue;n.push(...ULi(o,s,r))}else{let a=r.encode?encodeURIComponent(s):s;n.push(`${a}=${v4a(o,r.encode)}`)}}return n}function $$e(e,t){return e==null||typeof e!="object"?"":ULi(e,"",Object.assign(Object.assign({},sOf),t)).join("&")}function I4a(e,t){let r=$$e(t,{arrayFormat:"repeat"});return r?`${e}?${r}`:e}function w4a(e){let t={get bodyUsed(){return e.bodyUsed},stream:()=>e.body,arrayBuffer:e.arrayBuffer.bind(e),blob:e.blob.bind(e)};return"bytes"in e&&typeof e.bytes=="function"&&(t.bytes=e.bytes.bind(e)),t}var aOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};function oCr(e,t){return aOf(this,void 0,void 0,function*(){switch(t){case"binary-response":return w4a(e);case"blob":return yield e.blob();case"arrayBuffer":return yield e.arrayBuffer();case"sse":return e.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:e.status}}:e.body;case"streaming":return e.body==null?{ok:!1,error:{reason:"body-is-null",statusCode:e.status}}:e.body;case"text":return yield e.text()}let r=yield e.text();if(r.length>0)try{return jBt(r)}catch{return{ok:!1,error:{reason:"non-json",statusCode:e.status,rawBody:r}}}})}var cOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};function x4a(e){return cOf(this,void 0,void 0,function*(){var t,r,n;let i=(t=e.headers.get("Content-Type"))===null||t===void 0?void 0:t.toLowerCase();if(i==null||i.length===0)return oCr(e);switch(i.indexOf(";")!==-1&&(i=(n=(r=i.split(";")[0])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n:""),i){case"application/hal+json":case"application/json":case"application/ld+json":case"application/problem+json":case"application/vnd.api+json":case"text/json":{let o=yield e.text();return o.length>0?jBt(o):void 0}default:if(i.startsWith("application/vnd.")&&i.endsWith("+json")){let o=yield e.text();return o.length>0?jBt(o):void 0}return yield e.text()}})}var uOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};function C4a(){return uOf(this,void 0,void 0,function*(){return fetch})}var lOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};function _4a(e){return lOf(this,arguments,void 0,function*({body:t,type:r}){return r==="form"?$$e(t,{arrayFormat:"repeat",encode:!0}):r.includes("json")?NBt(t):t})}var WAe;typeof globalThis.Headers<"u"?WAe=globalThis.Headers:WAe=class S4a{constructor(t){if(this.headers=new Map,t)if(t instanceof S4a)t.forEach((r,n)=>this.append(n,r));else if(Array.isArray(t))for(let[r,n]of t)if(typeof r=="string"&&typeof n=="string")this.append(r,n);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,n]of Object.entries(t))if(typeof n=="string")this.append(r,n);else throw new TypeError("Header values must be strings")}append(t,r){let n=t.toLowerCase(),i=this.headers.get(n)||[];this.headers.set(n,[...i,r])}delete(t){let r=t.toLowerCase();this.headers.delete(r)}get(t){let r=t.toLowerCase(),n=this.headers.get(r);return n?n.join(", "):null}has(t){let r=t.toLowerCase();return this.headers.has(r)}set(t,r){let n=t.toLowerCase();this.headers.set(n,[r])}forEach(t,r){let n=r?t.bind(r):t;this.headers.forEach((i,o)=>n(i.join(", "),o,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,r]of this.headers.entries())yield[t,r.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let t of this.headers.values())yield t.join(", ")}[Symbol.iterator](){return this.entries()}};var pOf="timeout";function T4a(e){let t=new AbortController,r=setTimeout(()=>t.abort(pOf),e);return{signal:t.signal,abortId:r}}function O4a(...e){let t=e.length===1&&Array.isArray(e[0])?e[0]:e,r=new AbortController;for(let n of t){if(n.aborted){r.abort(n?.reason);break}n.addEventListener("abort",()=>r.abort(n?.reason),{signal:r.signal})}return r.signal}var fOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},B4a=(e,t,r,n,i,o,s,a,c)=>fOf(void 0,void 0,void 0,function*(){let u=[],l;if(o!=null){let{signal:f,abortId:m}=T4a(o);l=m,u.push(f)}s!=null&&u.push(s);let p=O4a(u),d=yield e(t,{method:r,headers:n,body:i,signal:p,credentials:a?"include":void 0,duplex:c});return l!=null&&clearTimeout(l),d});var zLi={headers:new WAe,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},VLi={headers:new WAe,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function qLi(e){return{headers:e.headers,redirected:e.redirected,status:e.status,statusText:e.statusText,type:e.type,url:e.url}}var dOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};function mOf(e){let t=1+Math.random()*.2;return e*t}function hOf(e){let t=1+(Math.random()-.5)*.2;return e*t}function gOf(e,t){let r=e.headers.get("Retry-After");if(r){let i=parseInt(r,10);if(!Number.isNaN(i)&&i>0)return Math.min(i*1e3,6e4);let o=new Date(r);if(!Number.isNaN(o.getTime())){let s=o.getTime()-Date.now();if(s>0)return Math.min(Math.max(s,0),6e4)}}let n=e.headers.get("X-RateLimit-Reset");if(n){let i=parseInt(n,10);if(!Number.isNaN(i)){let o=i*1e3-Date.now();if(o>0)return mOf(Math.min(o,6e4))}}return hOf(Math.min(1e3*Math.pow(2,t),6e4))}function P4a(e){return dOf(this,arguments,void 0,function*(t,r=2){let n=yield t();for(let i=0;i<r&&([408,429].includes(n.status)||n.status>=500);++i){let o=gOf(n,i);yield new Promise(s=>setTimeout(s,o)),n=yield t()}return n})}var WLi=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},AOf=new Set(["authorization","www-authenticate","x-api-key","api-key","apikey","x-api-token","x-auth-token","auth-token","cookie","set-cookie","proxy-authorization","proxy-authenticate","x-csrf-token","x-xsrf-token","x-session-token","x-access-token"]);function GLi(e){let t={};for(let[r,n]of e instanceof WAe?e.entries():Object.entries(e))AOf.has(r.toLowerCase())?t[r]="[REDACTED]":t[r]=n;return t}var $Li=new Set(["api_key","api-key","apikey","token","access_token","access-token","auth_token","auth-token","password","passwd","secret","api_secret","api-secret","apisecret","key","session","session_id","session-id"]);function yOf(e){if(e==null)return e;let t={};for(let[r,n]of Object.entries(e))$Li.has(r.toLowerCase())?t[r]="[REDACTED]":t[r]=n;return t}function NFe(e){let t=e.indexOf("://");if(t===-1)return e;let r=t+3,n=e.indexOf("/",r),i=e.indexOf("?",r),o=e.indexOf("#",r),s=Math.min(n===-1?e.length:n,i===-1?e.length:i,o===-1?e.length:o),a=-1;for(let m=r;m<s;m++)e[m]==="@"&&(a=m);if(a!==-1&&(e=`${e.slice(0,r)}[REDACTED]@${e.slice(a+1)}`),i=e.indexOf("?"),i===-1)return e;o=e.indexOf("#",i);let c=o!==-1?o:e.length,u=e.slice(i+1,c);if(u.length===0)return e;let l=u.toLowerCase();if(!(l.includes("token")||l.includes("key")||l.includes("password")||l.includes("passwd")||l.includes("secret")||l.includes("session")||l.includes("auth")))return e;let d=[],f=u.split("&");for(let m of f){let h=m.indexOf("=");if(h===-1){d.push(m);continue}let g=m.slice(0,h),A=$Li.has(g.toLowerCase());if(!A&&g.includes("%"))try{let b=decodeURIComponent(g);A=$Li.has(b.toLowerCase())}catch{}d.push(A?`${g}=[REDACTED]`:m)}return e.slice(0,i+1)+d.join("&")+e.slice(c)}function bOf(e){return WLi(this,void 0,void 0,function*(){var t;let r=new WAe;if(r.set("Accept",e.responseType==="json"?"application/json":e.responseType==="text"?"text/plain":"*/*"),e.body!==void 0&&e.contentType!=null&&r.set("Content-Type",e.contentType),e.headers==null)return r;for(let[n,i]of Object.entries(e.headers)){let o=yield b4a.get(i,{endpointMetadata:(t=e.endpointMetadata)!==null&&t!==void 0?t:{}});if(typeof o=="string"){r.set(n,o);continue}o!=null&&r.set(n,`${o}`)}return r})}function EOf(e){return WLi(this,void 0,void 0,function*(){var t,r,n;let i=I4a(e.url,e.queryParameters),o=yield _4a({body:e.body,type:(t=e.requestType)!==null&&t!==void 0?t:"other"}),s=(r=e.fetchFn)!==null&&r!==void 0?r:yield C4a(),a=yield bOf(e),c=LLi(e.logging);if(c.isDebug()){let u={method:e.method,url:NFe(i),headers:GLi(a),queryParameters:yOf(e.queryParameters),hasBody:o!=null};c.debug("Making HTTP request",u)}try{let u=yield P4a(()=>WLi(this,void 0,void 0,function*(){return B4a(s,i,e.method,a,o,e.timeoutMs,e.abortSignal,e.withCredentials,e.duplex)}),e.maxRetries);if(u.status>=200&&u.status<400){if(c.isDebug()){let p={method:e.method,url:NFe(i),statusCode:u.status,responseHeaders:GLi(u.headers)};c.debug("HTTP request succeeded",p)}return{ok:!0,body:yield oCr(u,e.responseType),headers:u.headers,rawResponse:qLi(u)}}else{if(c.isError()){let l={method:e.method,url:NFe(i),statusCode:u.status,responseHeaders:GLi(Object.fromEntries(u.headers.entries()))};c.error("HTTP request failed with error status",l)}return{ok:!1,error:{reason:"status-code",statusCode:u.status,body:yield x4a(u)},rawResponse:qLi(u)}}}catch(u){if(!((n=e.abortSignal)===null||n===void 0)&&n.aborted){if(c.isError()){let l={method:e.method,url:NFe(i)};c.error("HTTP request was aborted",l)}return{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:zLi}}else if(u instanceof Error&&u.name==="AbortError"){if(c.isError()){let l={method:e.method,url:NFe(i),timeoutMs:e.timeoutMs};c.error("HTTP request timed out",l)}return{ok:!1,error:{reason:"timeout"},rawResponse:zLi}}else if(u instanceof Error){if(c.isError()){let l={method:e.method,url:NFe(i),errorMessage:u.message};c.error("HTTP request failed with error",l)}return{ok:!1,error:{reason:"unknown",errorMessage:u.message},rawResponse:VLi}}if(c.isError()){let l={method:e.method,url:NFe(i),error:NBt(u)};c.error("HTTP request failed with unknown error",l)}return{ok:!1,error:{reason:"unknown",errorMessage:NBt(u)},rawResponse:VLi}}})}var xB=EOf;var vOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},j_=class e extends Promise{constructor(t){super(r=>{r(void 0)}),this.innerPromise=t}static fromFunction(t,...r){return new e(t(...r))}static interceptFunction(t){return(...r)=>e.fromPromise(t(...r))}static fromPromise(t){return new e(t)}static fromExecutor(t){let r=new Promise(t);return new e(r)}static fromResult(t){let r=Promise.resolve(t);return new e(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,r){return this.unwrap().then(t,r)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}withRawResponse(){return vOf(this,void 0,void 0,function*(){return yield this.innerPromise})}};var IOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},Ag={get:e=>IOf(void 0,void 0,void 0,function*(){return typeof e=="function"?e():e})};var sCr={};$(sCr,{ConsoleLogger:()=>QBt,LogLevel:()=>JG,Logger:()=>W$e,createLogger:()=>LLi});var aCr=wOf();function wOf(){var e,t,r,n,i;return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&((e=globalThis?.navigator)===null||e===void 0?void 0:e.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(((t=self.constructor)===null||t===void 0?void 0:t.name)==="DedicatedWorkerGlobalScope"||((r=self.constructor)===null||r===void 0?void 0:r.name)==="ServiceWorkerGlobalScope"||((n=self.constructor)===null||n===void 0?void 0:n.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!(!((i=process.versions)===null||i===void 0)&&i.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:{type:"unknown"}}var Ue={};$(Ue,{JsonError:()=>H$e,ParseError:()=>K$e,any:()=>W4a,bigint:()=>D4a,boolean:()=>$4a,booleanLiteral:()=>q4a,date:()=>F4a,discriminant:()=>nza,enum_:()=>uCr,getObjectLikeUtils:()=>YG,getObjectUtils:()=>jFe,getSchemaUtils:()=>Im,isProperty:()=>$Ae,lazy:()=>k4a,lazyObject:()=>z4a,list:()=>pCr,never:()=>H4a,number:()=>K4a,object:()=>lCr,objectWithoutOptionalProperties:()=>U4a,optional:()=>HLi,property:()=>j4a,record:()=>Z4a,set:()=>eza,string:()=>J4a,stringLiteral:()=>G4a,transform:()=>KLi,undiscriminatedUnion:()=>rza,union:()=>oza,unknown:()=>Y4a,withParsedProperties:()=>YLi});var Wu={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Ud(e,t){return`Expected ${t}. Received ${xOf(e)}.`}function xOf(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function Q_(e){return Object.assign(Object.assign({},e),{json:R4a(e.json),parse:R4a(e.parse)})}function R4a(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1584
1584
|
`)),{ok:!0,value:t}):n}}function cCr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var H$e=class e extends Error{constructor(t){super(t.map(cCr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var K$e=class e extends Error{constructor(t){super(t.map(cCr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Im(e){return{nullable:()=>COf(e),optional:()=>HLi(e),optionalNullable:()=>_Of(e),transform:t=>KLi(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new K$e(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new H$e(n.errors)}}}function COf(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Wu.NULLABLE};return Object.assign(Object.assign({},t),Im(t))}function HLi(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Wu.OPTIONAL};return Object.assign(Object.assign({},t),Im(t))}function _Of(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Wu.OPTIONAL_NULLABLE};return Object.assign(Object.assign({},t),Im(t))}function KLi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return Object.assign(Object.assign({},r),Im(r))}function D4a(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:Ud(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Ud(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Wu.BIGINT};return Object.assign(Object.assign({},Q_(e)),Im(e))}var SOf=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function F4a(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Ud(t,"string")}]}:SOf.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Ud(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Ud(t,"Date object")}]},getType:()=>Wu.DATE};return Object.assign(Object.assign({},Q_(e)),Im(e))}function M_(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return Object.assign(Object.assign({},Q_(r)),Im(r))}}function uCr(e){let t=new Set(e);return M_(Wu.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Ud(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Ud(n,"enum")}]}:{ok:!0,value:n})()}function k4a(e){let t=JLi(e);return Object.assign(Object.assign({},t),Im(t))}function JLi(e){return{parse:(t,r)=>J$e(e).parse(t,r),json:(t,r)=>J$e(e).json(t,r),getType:()=>J$e(e).getType()}}function J$e(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function MBt(e){return Object.entries(e)}function LBt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function _ce(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function UBt(e){return Object.keys(e)}function N4a(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function YG(e){return{withParsedProperties:t=>YLi(e,t)}}function YLi(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s=Object.entries(t).reduce((a,[c,u])=>Object.assign(Object.assign({},a),{[c]:typeof u=="function"?u(o.value):u}),{});return{ok:!0,value:Object.assign(Object.assign({},o.value),s)}},json:(n,i)=>{var o;if(!_ce(n))return{ok:!1,errors:[{path:(o=i?.breadcrumbsPrefix)!==null&&o!==void 0?o:[],message:Ud(n,"object")}]};let s=new Set(Object.keys(t)),a=LBt(n,Object.keys(n).filter(c=>!s.has(c)));return e.json(a,i)},getType:()=>e.getType()};return Object.assign(Object.assign(Object.assign({},r),Im(r)),YG(r))}function j4a(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function $Ae(e){return e.isProperty}function lCr(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>$Ae(n)?n.rawKey:r),_getParsedProperties:()=>UBt(e),parse:(r,n)=>{let i={},o=[];for(let[s,a]of MBt(e)){let c=$Ae(a)?a.rawKey:s,u=$Ae(a)?a.valueSchema:a,l={rawKey:c,parsedKey:s,valueSchema:u};i[c]=l,L4a(u)&&o.push(c)}return Q4a({value:r,requiredKeys:o,getProperty:s=>{let a=i[s];if(a!=null)return{transformedKey:a.parsedKey,transform:c=>{var u;return a.valueSchema.parse(c,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(u=n?.breadcrumbsPrefix)!==null&&u!==void 0?u:[],s]}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[o,s]of MBt(e)){let a=$Ae(s)?s.valueSchema:s;L4a(a)&&i.push(o)}return Q4a({value:r,requiredKeys:i,getProperty:o=>{let s=e[o];if(s!=null)return $Ae(s)?{transformedKey:s.rawKey,transform:a=>{var c;return s.valueSchema.json(a,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[],o]}))}}:{transformedKey:o,transform:a=>{var c;return s.json(a,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[],o]}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>Wu.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},Q_(t)),Im(t)),YG(t)),jFe(t))}function Q4a({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:o=[]}){if(!_ce(e))return{ok:!1,errors:[{path:o,message:Ud(e,"object")}]};let s=new Set(t),a=[],c={};for(let[u,l]of Object.entries(e)){let p=r(u);if(p!=null){s.delete(u);let d=p.transform(l);d.ok?c[p.transformedKey]=d.value:(c[u]=l,a.push(...d.errors))}else switch(n){case"fail":a.push({path:[...o,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":c[u]=l;break}}return a.push(...t.filter(u=>s.has(u)).map(u=>({path:o,message:`Missing required key "${u}"`}))),a.length===0||i?{ok:!0,value:c}:{ok:!1,errors:a}}function jFe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>M4a({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>M4a({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Wu.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),Im(r)),YG(r)),jFe(r))},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,Object.assign(Object.assign({},o),{unrecognizedObjectKeys:"passthrough"}));if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:Object.assign(Object.assign({},a),s.value)}},json:(i,o)=>{let s=e.json(i,Object.assign(Object.assign({},o),{unrecognizedObjectKeys:"passthrough"}));if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:Object.assign(Object.assign({},a),s.value)}},getType:()=>Wu.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},n),Im(n)),YG(n)),jFe(n))}}}function M4a({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!_ce(t))return{ok:!1,errors:[{path:i,message:Ud(t,"object")}]};let o=new Set(e),[s,a]=N4a(UBt(t),l=>o.has(l)),c=r(LBt(t,a)),u=n(LBt(t,s));return c.ok&&u.ok?{ok:!0,value:Object.assign(Object.assign({},c.value),u.value)}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function L4a(e){return!TOf(e)}function TOf(e){switch(e.getType()){case Wu.ANY:case Wu.UNKNOWN:case Wu.OPTIONAL:case Wu.OPTIONAL_NULLABLE:return!0;default:return!1}}function U4a(e){return lCr(e)}function z4a(e){let t=Object.assign(Object.assign({},JLi(e)),{_getRawProperties:()=>J$e(e)._getRawProperties(),_getParsedProperties:()=>J$e(e)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},t),Im(t)),YG(t)),jFe(t))}function pCr(e){let t={parse:(r,n)=>V4a(r,(i,o)=>{var s;return e.parse(i,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(s=n?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`[${o}]`]}))}),json:(r,n)=>V4a(r,(i,o)=>{var s;return e.json(i,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(s=n?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`[${o}]`]}))}),getType:()=>Wu.LIST};return Object.assign(Object.assign({},Q_(t)),Im(t))}function V4a(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let o=[];return n.ok||o.push(...n.errors),i.ok||o.push(...i.errors),{ok:!1,errors:o}},{ok:!0,value:[]}):{ok:!1,errors:[{message:Ud(e,"list"),path:[]}]}}function q4a(e){return M_(Wu.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Ud(r,`${e.toString()}`)}]})()}function G4a(e){return M_(Wu.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Ud(r,`"${e}"`)}]})()}var W4a=M_(Wu.ANY,e=>({ok:!0,value:e}));var $4a=M_(Wu.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Ud(e,"boolean")}]});var H4a=M_(Wu.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var K4a=M_(Wu.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Ud(e,"number")}]});var J4a=M_(Wu.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Ud(e,"string")}]});var Y4a=M_(Wu.UNKNOWN,e=>({ok:!0,value:e}));function Z4a(e,t){let r={parse:(n,i)=>X4a({value:n,isKeyNumeric:e.getType()===Wu.NUMBER,transformKey:o=>{var s;return e.parse(o,Object.assign(Object.assign({},i),{breadcrumbsPrefix:[...(s=i?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${o} (key)`]}))},transformValue:(o,s)=>{var a;return t.parse(o,Object.assign(Object.assign({},i),{breadcrumbsPrefix:[...(a=i?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${s}`]}))},breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>X4a({value:n,isKeyNumeric:e.getType()===Wu.NUMBER,transformKey:o=>{var s;return e.json(o,Object.assign(Object.assign({},i),{breadcrumbsPrefix:[...(s=i?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${o} (key)`]}))},transformValue:(o,s)=>{var a;return t.json(o,Object.assign(Object.assign({},i),{breadcrumbsPrefix:[...(a=i?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${s}`]}))},breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Wu.RECORD};return Object.assign(Object.assign({},Q_(r)),Im(r))}function X4a({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return _ce(e)?MBt(e).reduce((o,[s,a])=>{if(a===void 0)return o;let c=o,u=s;if(t){let f=s.length>0?Number(s):NaN;Number.isNaN(f)||(u=f)}let l=r(u),p=n(a,u);if(c.ok&&l.ok&&p.ok)return{ok:!0,value:Object.assign(Object.assign({},c.value),{[l.value]:p.value})};let d=[];return c.ok||d.push(...c.errors),l.ok||d.push(...l.errors),p.ok||d.push(...p.errors),{ok:!1,errors:d}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:Ud(e,"object")}]}}function eza(e){let t=pCr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>{var o;return n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:(o=i?.breadcrumbsPrefix)!==null&&o!==void 0?o:[],message:Ud(n,"Set")}]}},getType:()=>Wu.SET};return Object.assign(Object.assign({},Q_(r)),Im(r))}function rza(e){let t={parse:(r,n)=>tza((i,o)=>i.parse(r,o),e,n),json:(r,n)=>tza((i,o)=>i.json(r,o),e,n),getType:()=>Wu.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},Q_(t)),Im(t))}function tza(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,Object.assign(Object.assign({},r),{skipValidation:!1}));if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function nza(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var OOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};function oza(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=uCr(UBt(t)),o={parse:(s,a)=>iza({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>{var u;return i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(u=a?.breadcrumbsPrefix)!==null&&u!==void 0?u:[],r]})},getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>iza({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>{var u;return i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(u=a?.breadcrumbsPrefix)!==null&&u!==void 0?u:[],n]})},getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Wu.UNION};return Object.assign(Object.assign(Object.assign({},Q_(o)),Im(o)),YG(o))}function iza({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!_ce(e))return{ok:!1,errors:[{path:a,message:Ud(e,"object")}]};let c=e,u=t,l=c[u],p=OOf(c,[typeof u=="symbol"?u:u+""]);if(l==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let d=n(l);if(!d.ok)return{ok:!1,errors:d.errors};let f=i(d.value);if(f==null)return o?{ok:!0,value:Object.assign({[r]:d.value},p)}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let m=s(p,f);return m.ok?{ok:!0,value:Object.assign({[r]:l},m.value)}:m}var V0={};$(V0,{encodePathParam:()=>sza,join:()=>cza,toQueryString:()=>$$e});function sza(e){if(e===null)return"null";switch(typeof e){case"undefined":return"undefined";case"string":case"number":case"boolean":break;default:e=String(e);break}return encodeURIComponent(e)}function cza(e,...t){if(!e)return"";if(t.length===0)return e;if(e.includes("://")){let r;try{r=new URL(e)}catch{return aza(e,...t)}let n=t[t.length-1],i=n?.endsWith("/");for(let o of t){let s=lza(o);s&&(r.pathname=uza(r.pathname,s))}return i&&!r.pathname.endsWith("/")&&(r.pathname+="/"),r.toString()}return aza(e,...t)}function aza(e,...t){if(t.length===0)return e;let r=e,n=t[t.length-1],i=n?.endsWith("/");for(let o of t){let s=lza(o);s&&(r=uza(r,s))}return i&&!r.endsWith("/")&&(r+="/"),r}function uza(e,t){return e.endsWith("/")?e+t:`${e}/${t}`}function lza(e){if(!e)return e;let t=0,r=e.length;return e.startsWith("/")&&(t=1),e.endsWith("/")&&(r=e.length-1),t===0&&r===e.length?e:e.slice(t,r)}var BOf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},XLi="token",Y$e=class{constructor(t){this.options=t}static canCreate(t){return t?.[XLi]!=null}getAuthRequest(){return BOf(this,arguments,void 0,function*({endpointMetadata:t}={}){let r=yield Ag.get(this.options[XLi]);return r==null?{headers:{}}:{headers:{Authorization:`Bearer ${r}`}}})}};(function(e){e.AUTH_SCHEME="bearer",e.AUTH_CONFIG_ERROR_MESSAGE=`Please provide '${XLi}' when initializing the client`;function t(r){return new e(r)}e.createInstance=t})(Y$e||(Y$e={}));function _T(...e){let t={};for(let[r,n]of e.filter(i=>i!=null).flatMap(i=>Object.entries(i))){let i=r.toLowerCase();n!=null?t[i]=n:i in t&&delete t[i]}return t}function ZLi(e){let t=_T({"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@fern-fern/fiddle-sdk","X-Fern-SDK-Version":"0.0.64","User-Agent":"@fern-fern/fiddle-sdk/0.0.64","X-Fern-Runtime":aCr.type,"X-Fern-Runtime-Version":aCr.version},e?.headers);return Object.assign(Object.assign({},e),{logging:sCr.createLogger(e?.logging),headers:t})}function HAe(e){var t;let r=ZLi(e),n=POf(r);return(t=r.authProvider)!==null&&t!==void 0||(r.authProvider=new Y$e(n)),r}function POf(e){return Object.assign(Object.assign({},e),{authProvider:new kBt})}var QFe=Ue.string().transform({transform:Xxr,untransform:e=>e});var fCr=Ue.string().transform({transform:Zxr,untransform:e=>e});var eUi=Ue.string().transform({transform:eCr,untransform:e=>e});var dCr=Ue.object({apiId:QFe,version:Ue.string().optional(),commitSha:fCr.optional(),cliVersion:Ue.string(),yamlSchemaVersion:Ue.string().optional()});var MFe={};$(MFe,{Api:()=>iUi,RegisterApiRequest:()=>dCr,RegisterApiResponse:()=>oUi,get:()=>tUi,getLatestVersion:()=>rUi,registerUsingOrgToken:()=>nUi});var tUi={};$(tUi,{Error:()=>DOf});var ROf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},DOf=Ue.union("error",{OrgDoesNotExistError:Ue.object({}),ApiDoesNotExistError:Ue.object({}),VersionDoesNotExistError:Ue.object({})}).transform({transform:e=>{switch(e.error){case"OrgDoesNotExistError":return Jg.get.Error.orgDoesNotExistError();case"ApiDoesNotExistError":return Jg.get.Error.apiDoesNotExistError();case"VersionDoesNotExistError":return Jg.get.Error.versionDoesNotExistError()}},untransform:e=>{var{_visit:t}=e,r=ROf(e,["_visit"]);return r}});var rUi={};$(rUi,{Error:()=>NOf,Response:()=>kOf});var FOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},kOf=Ue.string(),NOf=Ue.union("error",{OrgDoesNotExistError:Ue.object({}),ApiDoesNotExistError:Ue.object({})}).transform({transform:e=>{switch(e.error){case"OrgDoesNotExistError":return Jg.getLatestVersion.Error.orgDoesNotExistError();case"ApiDoesNotExistError":return Jg.getLatestVersion.Error.apiDoesNotExistError()}},untransform:e=>{var{_visit:t}=e,r=FOf(e,["_visit"]);return r}});var nUi={};$(nUi,{Error:()=>QOf});var jOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},QOf=Ue.union("error",{VersionAlreadyExists:Ue.object({})}).transform({transform:e=>{if(e.error==="VersionAlreadyExists")return Jg.registerUsingOrgToken.Error.versionAlreadyExists()},untransform:e=>{var{_visit:t}=e,r=jOf(e,["_visit"]);return r}});var iUi=Ue.object({apiId:QFe,version:Ue.string(),commitSha:fCr.optional(),cliVersion:Ue.string(),definitionS3DownloadUrl:Ue.string(),yamlSchemaVersion:Ue.string().optional()});var oUi=Ue.object({version:Ue.string(),definitionS3UploadUrl:Ue.string()});var pza=Ue.enum_(["FERN","OPENAPI"]);var fza=Ue.object({python:Ue.boolean(),typescript:Ue.boolean(),java:Ue.boolean(),rust:Ue.boolean(),openApi:Ue.boolean(),postman:Ue.boolean()});var dza=Ue.object({githubOrgId:Ue.string(),kebabCaseOrgId:Ue.string(),companyDisplayName:Ue.string(),docsUrl:Ue.string().optional(),logoUrl:Ue.string().optional(),fernUserToken:Ue.string(),mode:pza,repoCreationConfig:fza});var mCr={};$(mCr,{status:()=>sUi});var sUi={};$(sUi,{Response:()=>MOf});var MOf=Ue.string();var zBt=Ue.object({keyId:Ue.string(),password:Ue.string(),secretKey:Ue.string()});var LFe=Ue.object({registryUrl:Ue.string(),username:Ue.string(),password:Ue.string(),coordinate:Ue.string(),signature:zBt.optional(),downloadSnippets:Ue.boolean().optional()});var UFe=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),token:Ue.string(),downloadSnippets:Ue.boolean().optional()});var aUi=Ue.object({npm:UFe.optional(),maven:LFe.optional()});var cUi=Ue.object({id:Ue.string(),version:Ue.string(),customConfig:Ue.unknown(),willDownloadFiles:Ue.boolean(),outputs:aUi});var hCr=Ue.object({apiName:Ue.string(),organizationName:Ue.string(),version:Ue.string().optional(),generators:Ue.list(cUi)});var gCr=Ue.object({apiName:Ue.string(),organizationName:Ue.string(),version:Ue.string().optional()});var Sce={};$(Sce,{BaseGithubInfo:()=>JFe,BasicGithubLicense:()=>DUi,BranchDoesNotExistDetails:()=>zFe,CannotPublishPypiPackageDetails:()=>VFe,CannotPublishToMavenGroupDetails:()=>qFe,CannotPublishToNpmScopeDetails:()=>GFe,CratesCoordinate:()=>gUi,CratesOutput:()=>VUi,CratesOutputWithOptionalToken:()=>kUi,CreateJobRequest:()=>hCr,CreateJobRequestV2:()=>ACr,CreateJobResponse:()=>JBt,CreateReplayInitPrRequest:()=>p4i,CreateReplayInitPrResponse:()=>f4i,CustomGithubLicense:()=>FUi,DownloadFilesOutputMode:()=>GUi,FailedTaskStatus:()=>SUi,FernDefinitionMetadata:()=>qUi,FinishedTaskStatus:()=>TUi,GeneratorConfig:()=>cUi,GeneratorConfigV2:()=>c4i,GeneratorIdAndVersion:()=>uUi,GeneratorOutputs:()=>aUi,GeneratorsDoNotExistErrorBodyType:()=>WFe,GithubAppNotInstalledDetails:()=>dUi,GithubCommitAndReleaseMode:()=>$Ui,GithubLicense:()=>qBt,GithubLicenseId:()=>RUi,GithubOutputMode:()=>WUi,GithubOutputModeV2:()=>ZUi,GithubPublishInfo:()=>HBt,GithubPullRequestMode:()=>YUi,GithubPullRequestReviewer:()=>JUi,GithubPushMode:()=>XUi,GithubTeamReviewer:()=>HUi,GithubUserReviewer:()=>KUi,GithubWhitelabelConfig:()=>u4i,IllegalApiVersionErrorDetails:()=>$Fe,InsufficientPermissionsDetails:()=>XG,LogLevel:()=>CUi,MavenCentralSignature:()=>zBt,MavenCoordinate:()=>AUi,MavenOutput:()=>LFe,MavenOutputWithOptionalCreds:()=>NUi,NpmCoordinate:()=>yUi,NpmOutput:()=>UFe,NpmOutputWithOptionalToken:()=>jUi,NugetCoordinate:()=>bUi,NugetOutput:()=>r4i,NugetOutputWithOptionalCreds:()=>QUi,OrgNotConfiguredForWhitelabelDetails:()=>HFe,OutputMetadata:()=>LUi,OutputMetadataAuthor:()=>MUi,OutputMode:()=>s4i,Package:()=>xUi,PackageCoordinate:()=>IUi,PackagePublishStatus:()=>wUi,PostmanOutput:()=>WBt,PublishOutputMode:()=>t4i,PublishOutputModeV2:()=>o4i,PublishingMetadata:()=>a4i,PyPiOutputWithOptionalCreds:()=>UUi,PypiCoordinate:()=>EUi,PypiMetadata:()=>$Bt,PypiOutput:()=>n4i,RateLimitExceededDetails:()=>KFe,RegistryOverrides:()=>e4i,RemoteGenJobId:()=>KBt,RemoteGenTaskId:()=>VBt,RubyGemsCoordinate:()=>vUi,RubyGemsOutput:()=>i4i,RubyGemsOutputWithOptionalCreds:()=>zUi,Task:()=>BUi,TaskLog:()=>_Ui,TaskStatus:()=>OUi,UploadDefinitionRequest:()=>gCr,UploadDefinitionResponse:()=>d4i,UsernamePassword:()=>GBt,WhitelabelConfig:()=>l4i,createJob:()=>lUi,createJobV2:()=>pUi,createJobV3:()=>fUi,createReplayInitPr:()=>mUi,getDefinitionUploadUrl:()=>hUi,getJobStatus:()=>PUi});var lUi={};$(lUi,{Error:()=>UOf});var zFe=Ue.object({repositoryOwner:Ue.string(),repositoryName:Ue.string(),branch:Ue.string()});var VFe=Ue.object({generatorId:Ue.string(),invalidPackageName:Ue.string(),validPrefix:Ue.string()});var qFe=Ue.object({generatorId:Ue.string(),invalidGroup:Ue.string(),validGroup:Ue.string()});var GFe=Ue.object({generatorId:Ue.string(),invalidScope:Ue.string(),validScope:Ue.string()});var uUi=Ue.object({id:Ue.string(),version:Ue.string()});var WFe=Ue.object({nonExistentGenerators:Ue.list(uUi)});var $Fe=Ue.object({message:Ue.string().optional()});var XG=Ue.object({dummy:Ue.string().optional(),message:Ue.string().optional()});var HFe=Ue.object({message:Ue.string().optional()});var KFe=Ue.object({retryAfter:Ue.number().optional()});var LOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},UOf=Ue.union("error",{IllegalApiNameError:Ue.object({}),IllegalApiVersionError:Ue.object({content:$Fe}),GeneratorsDoNotExistError:Ue.object({content:WFe}),CannotPublishToNpmScope:Ue.object({content:GFe}),CannotPublishToMavenGroup:Ue.object({content:qFe}),CannotPublishPypiPackage:Ue.object({content:VFe}),InsufficientPermissions:Ue.object({content:XG}),OrgNotConfiguredForWhitelabel:Ue.object({content:HFe}),BranchDoesNotExist:Ue.object({content:zFe}),RateLimitExceeded:Ue.object({content:KFe})}).transform({transform:e=>{switch(e.error){case"IllegalApiNameError":return Ii.createJob.Error.illegalApiNameError();case"IllegalApiVersionError":return Ii.createJob.Error.illegalApiVersionError(e.content);case"GeneratorsDoNotExistError":return Ii.createJob.Error.generatorsDoNotExistError(e.content);case"CannotPublishToNpmScope":return Ii.createJob.Error.cannotPublishToNpmScope(e.content);case"CannotPublishToMavenGroup":return Ii.createJob.Error.cannotPublishToMavenGroup(e.content);case"CannotPublishPypiPackage":return Ii.createJob.Error.cannotPublishPypiPackage(e.content);case"InsufficientPermissions":return Ii.createJob.Error.insufficientPermissions(e.content);case"OrgNotConfiguredForWhitelabel":return Ii.createJob.Error.orgNotConfiguredForWhitelabel(e.content);case"BranchDoesNotExist":return Ii.createJob.Error.branchDoesNotExist(e.content);case"RateLimitExceeded":return Ii.createJob.Error.rateLimitExceeded(e.content)}},untransform:e=>{var{_visit:t}=e,r=LOf(e,["_visit"]);return r}});var pUi={};$(pUi,{Error:()=>VOf});var zOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},VOf=Ue.union("error",{IllegalApiNameError:Ue.object({}),IllegalApiVersionError:Ue.object({content:$Fe}),GeneratorsDoNotExistError:Ue.object({content:WFe}),CannotPublishToNpmScope:Ue.object({content:GFe}),CannotPublishToMavenGroup:Ue.object({content:qFe}),CannotPublishPypiPackage:Ue.object({content:VFe}),InsufficientPermissions:Ue.object({content:XG}),OrgNotConfiguredForWhitelabel:Ue.object({content:HFe}),BranchDoesNotExist:Ue.object({content:zFe}),RateLimitExceeded:Ue.object({content:KFe})}).transform({transform:e=>{switch(e.error){case"IllegalApiNameError":return Ii.createJobV2.Error.illegalApiNameError();case"IllegalApiVersionError":return Ii.createJobV2.Error.illegalApiVersionError(e.content);case"GeneratorsDoNotExistError":return Ii.createJobV2.Error.generatorsDoNotExistError(e.content);case"CannotPublishToNpmScope":return Ii.createJobV2.Error.cannotPublishToNpmScope(e.content);case"CannotPublishToMavenGroup":return Ii.createJobV2.Error.cannotPublishToMavenGroup(e.content);case"CannotPublishPypiPackage":return Ii.createJobV2.Error.cannotPublishPypiPackage(e.content);case"InsufficientPermissions":return Ii.createJobV2.Error.insufficientPermissions(e.content);case"OrgNotConfiguredForWhitelabel":return Ii.createJobV2.Error.orgNotConfiguredForWhitelabel(e.content);case"BranchDoesNotExist":return Ii.createJobV2.Error.branchDoesNotExist(e.content);case"RateLimitExceeded":return Ii.createJobV2.Error.rateLimitExceeded(e.content)}},untransform:e=>{var{_visit:t}=e,r=zOf(e,["_visit"]);return r}});var fUi={};$(fUi,{Error:()=>GOf});var qOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},GOf=Ue.union("error",{IllegalApiNameError:Ue.object({}),IllegalApiVersionError:Ue.object({content:$Fe}),GeneratorsDoNotExistError:Ue.object({content:WFe}),CannotPublishToNpmScope:Ue.object({content:GFe}),CannotPublishToMavenGroup:Ue.object({content:qFe}),CannotPublishPypiPackage:Ue.object({content:VFe}),InsufficientPermissions:Ue.object({content:XG}),OrgNotConfiguredForWhitelabel:Ue.object({content:HFe}),BranchDoesNotExist:Ue.object({content:zFe}),RateLimitExceeded:Ue.object({content:KFe})}).transform({transform:e=>{switch(e.error){case"IllegalApiNameError":return Ii.createJobV3.Error.illegalApiNameError();case"IllegalApiVersionError":return Ii.createJobV3.Error.illegalApiVersionError(e.content);case"GeneratorsDoNotExistError":return Ii.createJobV3.Error.generatorsDoNotExistError(e.content);case"CannotPublishToNpmScope":return Ii.createJobV3.Error.cannotPublishToNpmScope(e.content);case"CannotPublishToMavenGroup":return Ii.createJobV3.Error.cannotPublishToMavenGroup(e.content);case"CannotPublishPypiPackage":return Ii.createJobV3.Error.cannotPublishPypiPackage(e.content);case"InsufficientPermissions":return Ii.createJobV3.Error.insufficientPermissions(e.content);case"OrgNotConfiguredForWhitelabel":return Ii.createJobV3.Error.orgNotConfiguredForWhitelabel(e.content);case"BranchDoesNotExist":return Ii.createJobV3.Error.branchDoesNotExist(e.content);case"RateLimitExceeded":return Ii.createJobV3.Error.rateLimitExceeded(e.content)}},untransform:e=>{var{_visit:t}=e,r=qOf(e,["_visit"]);return r}});var mUi={};$(mUi,{Error:()=>$Of});var dUi=Ue.object({owner:Ue.string(),repo:Ue.string(),message:Ue.string().optional()});var WOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},$Of=Ue.union("error",{InsufficientPermissions:Ue.object({content:XG}),GithubAppNotInstalled:Ue.object({content:dUi})}).transform({transform:e=>{switch(e.error){case"InsufficientPermissions":return Ii.createReplayInitPr.Error.insufficientPermissions(e.content);case"GithubAppNotInstalled":return Ii.createReplayInitPr.Error.githubAppNotInstalled(e.content)}},untransform:e=>{var{_visit:t}=e,r=WOf(e,["_visit"]);return r}});var hUi={};$(hUi,{Error:()=>KOf});var HOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},KOf=Ue.union("error",{InsufficientPermissions:Ue.object({content:XG})}).transform({transform:e=>{if(e.error==="InsufficientPermissions")return Ii.getDefinitionUploadUrl.Error.insufficientPermissions(e.content)},untransform:e=>{var{_visit:t}=e,r=HOf(e,["_visit"]);return r}});var PUi={};$(PUi,{Response:()=>XOf});var VBt=Ue.string().transform({transform:iCr,untransform:e=>e});var gUi=Ue.object({name:Ue.string(),version:Ue.string()});var AUi=Ue.object({group:Ue.string(),artifact:Ue.string(),version:Ue.string()});var yUi=Ue.object({name:Ue.string(),version:Ue.string()});var bUi=Ue.object({name:Ue.string(),version:Ue.string()});var EUi=Ue.object({name:Ue.string(),version:Ue.string()});var vUi=Ue.object({name:Ue.string(),version:Ue.string()});var JOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},IUi=Ue.union(Ue.discriminant("type","_type"),{npm:yUi,maven:AUi,pypi:EUi,ruby:vUi,nuget:bUi,crates:gUi}).transform({transform:e=>{switch(e.type){case"npm":return wB.npm(e);case"maven":return wB.maven(e);case"pypi":return wB.pypi(e);case"ruby":return wB.ruby(e);case"nuget":return wB.nuget(e);case"crates":return wB.crates(e);default:return e}},untransform:e=>{var{_visit:t}=e,r=JOf(e,["_visit"]);return r}});var wUi=Ue.enum_(["NOT_STARTED_PUBLISHING","PUBLISHING","PUBLISHED","FAILED_TO_PUBLISH"]);var xUi=Ue.object({coordinate:IUi,status:wUi});var CUi=Ue.enum_(["DEBUG","INFO","WARN","ERROR"]);var _Ui=Ue.object({level:CUi,message:Ue.string()});var SUi=Ue.object({message:Ue.string(),s3PreSignedReadUrl:Ue.string().optional()});var TUi=Ue.object({createdSnippets:Ue.boolean().optional(),hasFilesToDownload:Ue.boolean(),s3PreSignedReadUrl:Ue.string(),s3PreSignedReadUrlV2:Ue.string().optional(),snippetsS3PreSignedReadUrl:Ue.string().optional()});var YOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},OUi=Ue.union(Ue.discriminant("type","_type"),{notStarted:Ue.object({}),running:Ue.object({}),failed:SUi,finished:TUi}).transform({transform:e=>{switch(e.type){case"notStarted":return Rz.notStarted();case"running":return Rz.running();case"failed":return Rz.failed(e);case"finished":return Rz.finished(e);default:return e}},untransform:e=>{var{_visit:t}=e,r=YOf(e,["_visit"]);return r}});var BUi=Ue.object({status:OUi,packages:Ue.list(xUi),logs:Ue.list(_Ui)});var XOf=Ue.record(VBt,BUi);var RUi=Ue.enum_(["MIT","APACHE"]);var DUi=Ue.object({id:RUi});var FUi=Ue.object({contents:Ue.string()});var ZOf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},qBt=Ue.union("type",{basic:DUi,custom:FUi}).transform({transform:e=>{switch(e.type){case"basic":return qAe.basic(e);case"custom":return qAe.custom(e);default:return e}},untransform:e=>{var{_visit:t}=e,r=ZOf(e,["_visit"]);return r}});var kUi=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),token:Ue.string().optional()});var GBt=Ue.object({username:Ue.string(),password:Ue.string()});var NUi=Ue.object({registryUrl:Ue.string(),coordinate:Ue.string(),credentials:GBt.optional(),signature:zBt.optional()});var jUi=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),token:Ue.string().optional()});var QUi=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),apiKey:Ue.string().optional()});var WBt=Ue.object({apiKey:Ue.string(),workspaceId:Ue.string()});var MUi=Ue.object({name:Ue.string(),email:Ue.string()});var LUi=Ue.object({description:Ue.string().optional(),authors:Ue.list(MUi).optional()});var $Bt=Ue.object({keywords:Ue.list(Ue.string()).optional(),documentationLink:Ue.string().optional(),homepageLink:Ue.string().optional()}).extend(LUi);var UUi=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),credentials:GBt.optional(),pypiMetadata:$Bt.optional()});var zUi=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),apiKey:Ue.string().optional()});var eBf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},HBt=Ue.union("type",{npm:jUi,maven:NUi,postman:WBt,pypi:UUi,rubygems:zUi,nuget:QUi,crates:kUi}).transform({transform:e=>{switch(e.type){case"npm":return k_.npm(e);case"maven":return k_.maven(e);case"postman":return k_.postman(e);case"pypi":return k_.pypi(e);case"rubygems":return k_.rubygems(e);case"nuget":return k_.nuget(e);case"crates":return k_.crates(e);default:return e}},untransform:e=>{var{_visit:t}=e,r=eBf(e,["_visit"]);return r}});var JFe=Ue.object({owner:Ue.string(),repo:Ue.string(),directory:Ue.string().optional(),publishInfo:HBt.optional(),license:qBt.optional(),downloadSnippets:Ue.boolean().optional()});var VUi=Ue.object({registryUrl:Ue.string(),token:Ue.string(),packageName:Ue.string(),downloadSnippets:Ue.boolean().optional()});var qUi=Ue.object({definitionS3DownloadUrl:Ue.string(),outputPath:Ue.string().optional(),cliVersion:Ue.string().optional()});var GUi=Ue.object({downloadSnippets:Ue.boolean().optional()});var WUi=Ue.object({owner:Ue.string(),repo:Ue.string(),publishInfo:HBt.optional(),makePr:Ue.boolean().optional(),branch:Ue.string().optional(),license:qBt.optional()});var $Ui=Ue.object({}).extend(JFe);var HUi=Ue.object({name:Ue.string()});var KUi=Ue.object({name:Ue.string()});var tBf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},JUi=Ue.union("type",{team:HUi,user:KUi}).transform({transform:e=>{switch(e.type){case"team":return GAe.team(e);case"user":return GAe.user(e);default:return e}},untransform:e=>{var{_visit:t}=e,r=tBf(e,["_visit"]);return r}});var YUi=Ue.object({reviewers:Ue.list(JUi).optional(),branch:Ue.string().optional()}).extend(JFe);var XUi=Ue.object({branch:Ue.string().optional()}).extend(JFe);var rBf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},ZUi=Ue.union("type",{push:XUi,commitAndRelease:$Ui,pullRequest:YUi}).transform({transform:e=>{switch(e.type){case"push":return oY.push(e);case"commitAndRelease":return oY.commitAndRelease(e);case"pullRequest":return oY.pullRequest(e);default:return e}},untransform:e=>{var{_visit:t}=e,r=rBf(e,["_visit"]);return r}});var e4i=Ue.object({npm:UFe.optional(),maven:LFe.optional()});var t4i=Ue.object({registryOverrides:e4i});var r4i=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),apiKey:Ue.string(),downloadSnippets:Ue.boolean().optional()});var n4i=Ue.object({registryUrl:Ue.string(),username:Ue.string(),password:Ue.string(),coordinate:Ue.string(),downloadSnippets:Ue.boolean().optional(),pypiMetadata:$Bt.optional()});var i4i=Ue.object({registryUrl:Ue.string(),packageName:Ue.string(),apiKey:Ue.string(),downloadSnippets:Ue.boolean().optional()});var nBf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},o4i=Ue.union("type",{npmOverride:Ue.object({npmOverride:UFe.optional()}),mavenOverride:Ue.object({mavenOverride:LFe.optional()}),pypiOverride:Ue.object({pypiOverride:n4i.optional()}),rubyGemsOverride:Ue.object({rubyGemsOverride:i4i.optional()}),nugetOverride:Ue.object({nugetOverride:r4i.optional()}),cratesOverride:Ue.object({cratesOverride:VUi.optional()}),postman:WBt}).transform({transform:e=>{switch(e.type){case"npmOverride":return N_.npmOverride(e.npmOverride);case"mavenOverride":return N_.mavenOverride(e.mavenOverride);case"pypiOverride":return N_.pypiOverride(e.pypiOverride);case"rubyGemsOverride":return N_.rubyGemsOverride(e.rubyGemsOverride);case"nugetOverride":return N_.nugetOverride(e.nugetOverride);case"cratesOverride":return N_.cratesOverride(e.cratesOverride);case"postman":return N_.postman(e);default:return e}},untransform:e=>{var{_visit:t}=e,r=nBf(e,["_visit"]);return r}});var iBf=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},s4i=Ue.union("type",{publish:t4i,publishV2:Ue.object({publishV2:o4i}),downloadFiles:GUi,github:WUi,githubV2:Ue.object({githubV2:ZUi})}).transform({transform:e=>{switch(e.type){case"publish":return HN.publish(e);case"publishV2":return HN.publishV2(e.publishV2);case"downloadFiles":return HN.downloadFiles(e);case"github":return HN.github(e);case"githubV2":return HN.githubV2(e.githubV2);default:return e}},untransform:e=>{var{_visit:t}=e,r=iBf(e,["_visit"]);return r}});var a4i=Ue.object({packageDescription:Ue.property("package_description",Ue.string().optional()),publisherEmail:Ue.property("publisher_email",Ue.string().optional()),referenceUrl:Ue.property("reference_url",Ue.string().optional()),publisherName:Ue.property("publisher_name",Ue.string().optional())});var c4i=Ue.object({id:Ue.string(),version:Ue.string(),customConfig:Ue.unknown(),publishMetadata:a4i.optional(),outputMode:s4i});var u4i=Ue.object({token:Ue.string(),username:Ue.string(),email:Ue.string()});var l4i=Ue.object({github:u4i});var ACr=Ue.object({apiName:Ue.string(),organizationName:Ue.string(),version:Ue.string().optional(),generators:Ue.list(c4i),uploadToS3:Ue.boolean().optional(),preview:Ue.boolean().optional(),pushPreviewBranch:Ue.boolean().optional(),whitelabel:l4i.optional(),fernDefinitionMetadata:qUi.optional(),fernignoreContents:Ue.string().optional()});var KBt=Ue.string().transform({transform:nCr,untransform:e=>e});var JBt=Ue.object({jobId:KBt,taskIds:Ue.list(VBt)});var p4i=Ue.object({owner:Ue.string(),repo:Ue.string(),lockfileContents:Ue.string(),fernignoreEntries:Ue.list(Ue.string()).optional(),baseBranch:Ue.string().optional(),prTitle:Ue.string().optional(),prBody:Ue.string().optional()});var f4i=Ue.object({prUrl:Ue.string(),branch:Ue.string()});var d4i=Ue.object({s3Url:Ue.property("s3url",Ue.string())});var m4i=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},yCr=class{constructor(t){this._options=HAe(t)}registerUsingOrgToken(t,r){return j_.fromPromise(this.__registerUsingOrgToken(t,r))}__registerUsingOrgToken(t,r){return m4i(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l,p;let d=yield this._options.authProvider.getAuthRequest(),f=_T(d.headers,(n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),m=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),"/api/registry/register"),method:"POST",headers:f,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:dCr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:!0}),timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});return m.ok?{data:{ok:!0,body:oUi.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:m.headers,rawResponse:m.rawResponse},rawResponse:m.rawResponse}:m.error.reason==="status-code"&&((p=m.error.body)===null||p===void 0?void 0:p.error)==="VersionAlreadyExists"?{data:{ok:!1,error:MFe.registerUsingOrgToken.Error.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse},rawResponse:m.rawResponse}:{data:{ok:!1,error:Jg.registerUsingOrgToken.Error._unknown(m.error),rawResponse:m.rawResponse},rawResponse:m.rawResponse}})}get(t,r,n,i){return j_.fromPromise(this.__get(t,r,n,i))}__get(t,r,n,i){return m4i(this,void 0,void 0,function*(){var o,s,a,c,u,l,p,d,f;let m=_T((o=this._options)===null||o===void 0?void 0:o.headers,i?.headers),h=yield xB({url:V0.join((s=yield Ag.get(this._options.baseUrl))!==null&&s!==void 0?s:yield Ag.get(this._options.environment),`/api/registry/definition/${V0.encodePathParam(eUi.jsonOrThrow(t,{omitUndefined:!0}))}/${V0.encodePathParam(QFe.jsonOrThrow(r,{omitUndefined:!0}))}/${V0.encodePathParam(n)}`),method:"GET",headers:m,queryParameters:i?.queryParams,timeoutMs:((u=(a=i?.timeoutInSeconds)!==null&&a!==void 0?a:(c=this._options)===null||c===void 0?void 0:c.timeoutInSeconds)!==null&&u!==void 0?u:60)*1e3,maxRetries:(l=i?.maxRetries)!==null&&l!==void 0?l:(p=this._options)===null||p===void 0?void 0:p.maxRetries,abortSignal:i?.abortSignal,fetchFn:(d=this._options)===null||d===void 0?void 0:d.fetch,logging:this._options.logging});if(h.ok)return{data:{ok:!0,body:iUi.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:h.headers,rawResponse:h.rawResponse},rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch((f=h.error.body)===null||f===void 0?void 0:f.error){case"OrgDoesNotExistError":case"ApiDoesNotExistError":case"VersionDoesNotExistError":return{data:{ok:!1,error:MFe.get.Error.parseOrThrow(h.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:h.rawResponse},rawResponse:h.rawResponse}}return{data:{ok:!1,error:Jg.get.Error._unknown(h.error),rawResponse:h.rawResponse},rawResponse:h.rawResponse}})}getLatestVersion(t,r,n){return j_.fromPromise(this.__getLatestVersion(t,r,n))}__getLatestVersion(t,r,n){return m4i(this,void 0,void 0,function*(){var i,o,s,a,c,u,l,p,d;let f=_T((i=this._options)===null||i===void 0?void 0:i.headers,n?.headers),m=yield xB({url:V0.join((o=yield Ag.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Ag.get(this._options.environment),`/api/registry/latest-version/${V0.encodePathParam(eUi.jsonOrThrow(t,{omitUndefined:!0}))}/${V0.encodePathParam(QFe.jsonOrThrow(r,{omitUndefined:!0}))}`),method:"GET",headers:f,queryParameters:n?.queryParams,timeoutMs:((c=(s=n?.timeoutInSeconds)!==null&&s!==void 0?s:(a=this._options)===null||a===void 0?void 0:a.timeoutInSeconds)!==null&&c!==void 0?c:60)*1e3,maxRetries:(u=n?.maxRetries)!==null&&u!==void 0?u:(l=this._options)===null||l===void 0?void 0:l.maxRetries,abortSignal:n?.abortSignal,fetchFn:(p=this._options)===null||p===void 0?void 0:p.fetch,logging:this._options.logging});if(m.ok)return{data:{ok:!0,body:MFe.getLatestVersion.Response.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:m.headers,rawResponse:m.rawResponse},rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch((d=m.error.body)===null||d===void 0?void 0:d.error){case"OrgDoesNotExistError":case"ApiDoesNotExistError":return{data:{ok:!1,error:MFe.getLatestVersion.Error.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse},rawResponse:m.rawResponse}}return{data:{ok:!1,error:Jg.getLatestVersion.Error._unknown(m.error),rawResponse:m.rawResponse},rawResponse:m.rawResponse}})}};var oBf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},ECr=class{constructor(t){this._options=HAe(t)}createSdkDemo(t,r){return j_.fromPromise(this.__createSdkDemo(t,r))}__createSdkDemo(t,r){return oBf(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l;let p=yield this._options.authProvider.getAuthRequest(),d=_T(p.headers,(n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),f=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),"/api/demo-creation/create"),method:"POST",headers:d,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:dza.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:!0}),timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});return f.ok?{data:{ok:!0,body:void 0,headers:f.headers,rawResponse:f.rawResponse},rawResponse:f.rawResponse}:{data:{ok:!1,error:FFe.createSdkDemo.Error._unknown(f.error),rawResponse:f.rawResponse},rawResponse:f.rawResponse}})}};var sBf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},vCr=class{constructor(t){this._options=ZLi(t)}status(t){return j_.fromPromise(this.__status(t))}__status(t){return sBf(this,void 0,void 0,function*(){var r,n,i,o,s,a,c,u;let l=_T((r=this._options)===null||r===void 0?void 0:r.headers,t?.headers),p=yield xB({url:V0.join((n=yield Ag.get(this._options.baseUrl))!==null&&n!==void 0?n:yield Ag.get(this._options.environment),"/api/health"),method:"GET",headers:l,queryParameters:t?.queryParams,timeoutMs:((s=(i=t?.timeoutInSeconds)!==null&&i!==void 0?i:(o=this._options)===null||o===void 0?void 0:o.timeoutInSeconds)!==null&&s!==void 0?s:60)*1e3,maxRetries:(a=t?.maxRetries)!==null&&a!==void 0?a:(c=this._options)===null||c===void 0?void 0:c.maxRetries,abortSignal:t?.abortSignal,fetchFn:(u=this._options)===null||u===void 0?void 0:u.fetch,logging:this._options.logging});return p.ok?{data:{ok:!0,body:mCr.status.Response.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:p.headers,rawResponse:p.rawResponse},rawResponse:p.rawResponse}:{data:{ok:!1,error:kFe.status.Error._unknown(p.error),rawResponse:p.rawResponse},rawResponse:p.rawResponse}})}};var X$e=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},ICr=class{constructor(t){this._options=HAe(t)}createJob(t,r){return j_.fromPromise(this.__createJob(t,r))}__createJob(t,r){return X$e(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l,p;let d=_T((n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),f=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),"/api/remote-gen/create-job"),method:"POST",headers:d,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:hCr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:!0}),timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});if(f.ok)return{data:{ok:!0,body:JBt.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:f.headers,rawResponse:f.rawResponse},rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch((p=f.error.body)===null||p===void 0?void 0:p.error){case"IllegalApiNameError":case"IllegalApiVersionError":case"GeneratorsDoNotExistError":case"CannotPublishToNpmScope":case"CannotPublishToMavenGroup":case"CannotPublishPypiPackage":case"InsufficientPermissions":case"OrgNotConfiguredForWhitelabel":case"BranchDoesNotExist":case"RateLimitExceeded":return{data:{ok:!1,error:Sce.createJob.Error.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse},rawResponse:f.rawResponse}}return{data:{ok:!1,error:Ii.createJob.Error._unknown(f.error),rawResponse:f.rawResponse},rawResponse:f.rawResponse}})}createJobV2(t,r){return j_.fromPromise(this.__createJobV2(t,r))}__createJobV2(t,r){return X$e(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l,p;let d=_T((n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),f=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),"/api/remote-gen/create-job-v2"),method:"POST",headers:d,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:ACr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:!0}),timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});if(f.ok)return{data:{ok:!0,body:JBt.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:f.headers,rawResponse:f.rawResponse},rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch((p=f.error.body)===null||p===void 0?void 0:p.error){case"IllegalApiNameError":case"IllegalApiVersionError":case"GeneratorsDoNotExistError":case"CannotPublishToNpmScope":case"CannotPublishToMavenGroup":case"CannotPublishPypiPackage":case"InsufficientPermissions":case"OrgNotConfiguredForWhitelabel":case"BranchDoesNotExist":case"RateLimitExceeded":return{data:{ok:!1,error:Sce.createJobV2.Error.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse},rawResponse:f.rawResponse}}return{data:{ok:!1,error:Ii.createJobV2.Error._unknown(f.error),rawResponse:f.rawResponse},rawResponse:f.rawResponse}})}createJobV3(t,r){return j_.fromPromise(this.__createJobV3(t,r))}__createJobV3(t,r){return X$e(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l,p;let d=yield this._options.authProvider.getAuthRequest(),f=_T(d.headers,(n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),m=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),"/api/remote-gen/create-job-v3"),method:"POST",headers:f,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:ACr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:!0}),timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});if(m.ok)return{data:{ok:!0,body:JBt.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:m.headers,rawResponse:m.rawResponse},rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch((p=m.error.body)===null||p===void 0?void 0:p.error){case"IllegalApiNameError":case"IllegalApiVersionError":case"GeneratorsDoNotExistError":case"CannotPublishToNpmScope":case"CannotPublishToMavenGroup":case"CannotPublishPypiPackage":case"InsufficientPermissions":case"OrgNotConfiguredForWhitelabel":case"BranchDoesNotExist":case"RateLimitExceeded":return{data:{ok:!1,error:Sce.createJobV3.Error.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse},rawResponse:m.rawResponse}}return{data:{ok:!1,error:Ii.createJobV3.Error._unknown(m.error),rawResponse:m.rawResponse},rawResponse:m.rawResponse}})}getJobStatus(t,r){return j_.fromPromise(this.__getJobStatus(t,r))}__getJobStatus(t,r){return X$e(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l;let p=_T((n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),d=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),`/api/remote-gen/jobs/${V0.encodePathParam(KBt.jsonOrThrow(t,{omitUndefined:!0}))}/status`),method:"POST",headers:p,queryParameters:r?.queryParams,timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});return d.ok?{data:{ok:!0,body:Sce.getJobStatus.Response.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:d.headers,rawResponse:d.rawResponse},rawResponse:d.rawResponse}:{data:{ok:!1,error:Ii.getJobStatus.Error._unknown(d.error),rawResponse:d.rawResponse},rawResponse:d.rawResponse}})}getDefinitionUploadUrl(t,r){return j_.fromPromise(this.__getDefinitionUploadUrl(t,r))}__getDefinitionUploadUrl(t,r){return X$e(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l,p;let d=yield this._options.authProvider.getAuthRequest(),f=_T(d.headers,(n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),m=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),"/api/remote-gen/definition"),method:"PUT",headers:f,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:gCr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:!0}),timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});return m.ok?{data:{ok:!0,body:d4i.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:m.headers,rawResponse:m.rawResponse},rawResponse:m.rawResponse}:m.error.reason==="status-code"&&((p=m.error.body)===null||p===void 0?void 0:p.error)==="InsufficientPermissions"?{data:{ok:!1,error:Sce.getDefinitionUploadUrl.Error.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse},rawResponse:m.rawResponse}:{data:{ok:!1,error:Ii.getDefinitionUploadUrl.Error._unknown(m.error),rawResponse:m.rawResponse},rawResponse:m.rawResponse}})}createReplayInitPr(t,r){return j_.fromPromise(this.__createReplayInitPr(t,r))}__createReplayInitPr(t,r){return X$e(this,void 0,void 0,function*(){var n,i,o,s,a,c,u,l,p;let d=yield this._options.authProvider.getAuthRequest(),f=_T(d.headers,(n=this._options)===null||n===void 0?void 0:n.headers,r?.headers),m=yield xB({url:V0.join((i=yield Ag.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Ag.get(this._options.environment),"/api/remote-gen/replay/init"),method:"POST",headers:f,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:p4i.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:!0}),timeoutMs:((a=(o=r?.timeoutInSeconds)!==null&&o!==void 0?o:(s=this._options)===null||s===void 0?void 0:s.timeoutInSeconds)!==null&&a!==void 0?a:60)*1e3,maxRetries:(c=r?.maxRetries)!==null&&c!==void 0?c:(u=this._options)===null||u===void 0?void 0:u.maxRetries,abortSignal:r?.abortSignal,fetchFn:(l=this._options)===null||l===void 0?void 0:l.fetch,logging:this._options.logging});if(m.ok)return{data:{ok:!0,body:f4i.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),headers:m.headers,rawResponse:m.rawResponse},rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch((p=m.error.body)===null||p===void 0?void 0:p.error){case"InsufficientPermissions":case"GithubAppNotInstalled":return{data:{ok:!1,error:Sce.createReplayInitPr.Error.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse},rawResponse:m.rawResponse}}return{data:{ok:!1,error:Ii.createReplayInitPr.Error._unknown(m.error),rawResponse:m.rawResponse},rawResponse:m.rawResponse}})}};var YBt=class{constructor(t){this._options=HAe(t)}get definitionRegistry(){var t;return(t=this._definitionRegistry)!==null&&t!==void 0?t:this._definitionRegistry=new yCr(this._options)}get demoCreation(){var t;return(t=this._demoCreation)!==null&&t!==void 0?t:this._demoCreation=new ECr(this._options)}get health(){var t;return(t=this._health)!==null&&t!==void 0?t:this._health=new vCr(this._options)}get remoteGen(){var t;return(t=this._remoteGen)!==null&&t!==void 0?t:this._remoteGen=new ICr(this._options)}};var hza=require("fs/promises"),gza=ve(require("path"),1);var Aza={shouldUseTitleAsName:void 0,shouldUseUndiscriminatedUnionsWithLiterals:void 0,shouldUseIdiomaticRequestNames:void 0,asyncApiMessageNaming:void 0,onlyIncludeReferencedSchemas:void 0,shouldUseOptionalAdditionalProperties:void 0,coerceEnumsToLiterals:void 0,objectQueryParameters:void 0,respectReadonlySchemas:void 0,respectNullableSchemas:void 0,inlinePathParameters:void 0,useBytesForBinaryResponse:void 0,respectForwardCompatibleEnums:void 0,filter:void 0,exampleGeneration:void 0,defaultFormParameterEncoding:void 0,additionalPropertiesDefaultsTo:void 0,typeDatesAsStrings:void 0,preserveSingleSchemaOneOf:void 0,inlineAllOfSchemas:void 0,resolveAliases:void 0,groupMultiApiEnvironments:void 0,groupEnvironmentsByHost:void 0,inferDefaultEnvironment:void 0,wrapReferencesToNullableInOptional:void 0,coerceOptionalSchemasToNullable:void 0,removeDiscriminantsFromSchemas:void 0,pathParameterOrder:void 0,defaultIntegerFormat:void 0,resolveSchemaCollisions:void 0,inferForwardCompatible:void 0,coerceConstsTo:void 0};async function yza({absolutePathToGeneratorsConfiguration:e,rawGeneratorsConfiguration:t,context:r}){let n=wza(t.metadata),i=t.readme;IBf(r,t);let o=await uBf(t);return{absolutePathToConfiguration:e,api:o,rawConfiguration:t,defaultGroup:t["default-group"],groupAliases:t.aliases??{},reviewers:t.reviewers,groups:t.groups!=null?await Promise.all(Object.entries(t.groups).map(([s,a])=>lBf({absolutePathToGeneratorsConfiguration:e,groupName:s,group:a,maybeTopLevelMetadata:n,maybeTopLevelReviewers:t.reviewers,maybeRootAutomation:t.automation,readme:i,context:r}))):[],whitelabel:t.whitelabel!=null&&t.whitelabel.github!=null?{github:t.whitelabel.github}:void 0,ai:t.ai,replay:t.replay}}function wCr(e){return{...Aza,shouldUseTitleAsName:e?.["use-title"],shouldUseUndiscriminatedUnionsWithLiterals:e?.unions==="v1",asyncApiMessageNaming:e?.["message-naming"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],inlinePathParameters:e?.["inline-path-parameters"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],removeDiscriminantsFromSchemas:Eza(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"]}}function bza(e){return{...xCr(e),shouldUseUndiscriminatedUnionsWithLiterals:e?.["prefer-undiscriminated-unions-with-literals"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],objectQueryParameters:e?.["object-query-parameters"],respectReadonlySchemas:e?.["respect-readonly-schemas"],inlinePathParameters:e?.["inline-path-parameters"],filter:e?.filter,exampleGeneration:e?.["example-generation"],defaultFormParameterEncoding:e?.["default-form-parameter-encoding"],useBytesForBinaryResponse:e?.["use-bytes-for-binary-response"],respectForwardCompatibleEnums:e?.["respect-forward-compatible-enums"],additionalPropertiesDefaultsTo:e?.["additional-properties-defaults-to"],typeDatesAsStrings:e?.["type-dates-as-strings"],preserveSingleSchemaOneOf:e?.["preserve-single-schema-oneof"],inlineAllOfSchemas:e?.["inline-all-of-schemas"],resolveAliases:e?.["resolve-aliases"],groupMultiApiEnvironments:e?.["group-multi-api-environments"],groupEnvironmentsByHost:e?.["group-environments-by-host"],defaultIntegerFormat:e?.["default-integer-format"],pathParameterOrder:e?.["path-parameter-order"]}}function aBf(e){return{...xCr(e),asyncApiMessageNaming:e?.["message-naming"]}}function xCr(e){return{...Aza,shouldUseTitleAsName:e?.["title-as-schema-name"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],shouldUseOptionalAdditionalProperties:e?.["optional-additional-properties"],coerceEnumsToLiterals:e?.["coerce-enums-to-literals"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],groupEnvironmentsByHost:e?.["group-environments-by-host"],inferDefaultEnvironment:e?.["infer-default-environment"],groupMultiApiEnvironments:e!=null&&"group-multi-api-environments"in e?e["group-multi-api-environments"]:void 0,removeDiscriminantsFromSchemas:Eza(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"],resolveSchemaCollisions:e?.["resolve-schema-collisions"],inferForwardCompatible:e?.["infer-forward-compatible"],coerceConstsTo:e?.["coerce-consts-to"]}}function Eza(e){if(e==null||e==="always")return kn.RemoveDiscriminantsFromSchemas.Always;if(e==="never")return kn.RemoveDiscriminantsFromSchemas.Never;throw new Error(`Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${e}`)}function KAe(e,t){return{...e,...Object.fromEntries(Object.entries(t).filter(([r,n])=>n!==void 0))}}async function mza(e,t,r){let n=[];if(e!=null)if(typeof e=="string")n.push({schema:{type:"oss",path:e},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r});else if(kn.isRawProtobufAPIDefinitionSchema(e))n.push({schema:{type:"protobuf",root:e.proto.root,target:e.proto.target??"",localGeneration:e.proto["local-generation"]??!1,fromOpenAPI:e.proto["from-openapi"]??!1,dependencies:e.proto.dependencies??[]},origin:void 0,overrides:e.proto.overrides,overlays:void 0,audiences:[],settings:r});else if(Array.isArray(e))for(let i of e)typeof i=="string"?n.push({schema:{type:"oss",path:i},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r}):kn.isRawProtobufAPIDefinitionSchema(i)?n.push({schema:{type:"protobuf",root:i.proto.root,target:i.proto.target??"",localGeneration:i.proto["local-generation"]??!1,fromOpenAPI:i.proto["from-openapi"]??!1,dependencies:i.proto.dependencies??[]},origin:void 0,overrides:i.proto.overrides,overlays:void 0,audiences:[],settings:r}):n.push({schema:{type:"oss",path:i.path},origin:i.origin,overrides:i.overrides,overlays:void 0,audiences:i.audiences,settings:KAe(r,wCr(i.settings))});else n.push({schema:{type:"oss",path:e.path},origin:e.origin,overrides:e.overrides,overlays:void 0,audiences:e.audiences,settings:KAe(r,wCr(e.settings))});else{let i=t[kn.API_SETTINGS_KEY],o=t[kn.OPENAPI_LOCATION_KEY],s=t[kn.API_ORIGIN_LOCATION_KEY],a=t[kn.OPENAPI_OVERRIDES_LOCATION_KEY],c=t[kn.ASYNC_API_LOCATION_KEY];o!=null&&(typeof o=="string"?n.push({schema:{type:"oss",path:o},origin:s,overrides:a,overlays:void 0,audiences:[],settings:KAe(r,wCr(i))}):typeof o=="object"&&n.push({schema:{type:"oss",path:o.path},origin:o.origin,overrides:o.overrides,overlays:void 0,audiences:[],settings:KAe(r,bza(o.settings))})),c!=null&&n.push({schema:{type:"oss",path:c},origin:s,overrides:void 0,overlays:void 0,audiences:[],settings:KAe(r,wCr(i))})}return n}async function cBf({apiConfiguration:e,rawConfiguration:t,apiSettings:r}){let n={"auth-schemes":t["auth-schemes"],...e};if(kn.isConjureSchema(e.specs))return{type:"conjure",pathToConjureDefinition:e.specs.conjure,...n,settings:r};let i=[],o={};for(let s of e.specs??[]){let a;if(kn.isOpenApiSpecSchema(s))a={schema:{type:"oss",path:s.openapi},origin:s.origin,overrides:s.overrides,overlays:s.overlays,audiences:[],settings:KAe(r,bza(s.settings))};else if(kn.isAsyncApiSpecSchema(s))a={schema:{type:"oss",path:s.asyncapi},origin:s.origin,overrides:s.overrides,overlays:void 0,audiences:[],settings:KAe(r,aBf(s.settings))};else if(kn.isProtoSpecSchema(s))a={schema:{type:"protobuf",root:s.proto.root,target:s.proto.target??"",localGeneration:s.proto["local-generation"]??!1,fromOpenAPI:s.proto["from-openapi"]??!1,dependencies:s.proto.dependencies??[]},origin:void 0,overrides:s.proto.overrides,overlays:void 0,audiences:[],settings:r};else if(kn.isOpenRpcSpecSchema(s))a={schema:{type:"openrpc",path:s.openrpc},origin:void 0,overrides:s.overrides,overlays:void 0,audiences:[],settings:r};else if(kn.isGraphQLSpecSchema(s))a={schema:{type:"graphql",path:s.graphql},origin:s.origin,overrides:s.overrides,overlays:void 0,audiences:[],settings:r};else continue;let c=kn.isGraphQLSpecSchema(s)&&"name"in s?s.name:"namespace"in s?s.namespace:void 0;c!=null?(o[c]??=[],o[c].push(a)):i.push(a)}return Object.keys(o).length===0?{type:"singleNamespace",definitions:i,...n,settings:r}:{type:"multiNamespace",rootDefinitions:i,definitions:o,...n,settings:r}}async function uBf(e){let t=e.api;if(t!=null){if(kn.isApiConfigurationV2Schema(t)){let n=xCr(t.settings);return cBf({apiConfiguration:t,rawConfiguration:e,apiSettings:n})}if(kn.isNamespacedApiConfiguration(t)){let n={},i={};for(let[o,s]of Object.entries(t.namespaces))n[o]=await mza(s,e,i);return{type:"multiNamespace",rootDefinitions:void 0,definitions:n}}}return{type:"singleNamespace",definitions:await mza(t,e,{})}}async function lBf({absolutePathToGeneratorsConfiguration:e,groupName:t,group:r,maybeTopLevelMetadata:n,maybeTopLevelReviewers:i,maybeRootAutomation:o,readme:s,context:a}){let c=wza(r.metadata);return{groupName:t,reviewers:r.reviewers,audiences:r.audiences==null?{type:"all"}:{type:"select",audiences:r.audiences},generators:await Promise.all(r.generators.map(u=>fBf({absolutePathToGeneratorsConfiguration:e,generator:u,maybeTopLevelMetadata:n,maybeGroupLevelMetadata:c,maybeTopLevelReviewers:i,maybeGroupLevelReviewers:r.reviewers,maybeRootAutomation:o,maybeGroupAutomation:r.automation,readme:s,context:a})))}}function pBf(e,t){if("image"in e){let i=pwr(e.image.name,t);return{normalizedName:U0(i),containerImage:`${e.image.registry}/${i}`}}let r=pwr(e.name,t);return{normalizedName:U0(r),containerImage:void 0}}async function fBf({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o,maybeRootAutomation:s,maybeGroupAutomation:a,readme:c,context:u}){let{normalizedName:l,containerImage:p}=pBf(t,u);return{raw:t,automation:kn.resolveAutomationConfig({rootAutomation:s,groupAutomation:a,generatorAutomation:t.automation}),name:l,containerImage:p,version:t.version,config:t.config,outputMode:await gBf({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}),keywords:t.keywords,smartCasing:t["smart-casing"]??!0,disableExamples:t["disable-examples"]??!1,absolutePathToLocalOutput:t.output?.location==="local-file-system"?eo(Pn(e),t.output.path):void 0,absolutePathToLocalSnippets:t.snippets?.path!=null?eo(Pn(e),t.snippets.path):void 0,language:bBf(l),irVersionOverride:t["ir-version"]??void 0,publishMetadata:mBf({generatorInvocation:t}),readme:c,settings:t.api?.settings??void 0,apiOverride:dBf({generator:t})}}function dBf({generator:e}){if(e.api?.specs!=null||e.api?.auth!=null||e.api?.["auth-schemes"]!=null||e.api?.headers!=null)return{specs:e.api?.specs,auth:e.api?.auth,"auth-schemes":e.api?.["auth-schemes"],headers:e.api?.headers}}function mBf({generatorInvocation:e}){let t=e["publish-metadata"];if(t!=null)return{packageDescription:t["package-description"],publisherEmail:t.email,publisherName:t.author,referenceUrl:t["reference-url"]};if(e.metadata!=null)return{packageDescription:e.metadata["package-description"],publisherEmail:e.metadata.email,publisherName:e.metadata.author,referenceUrl:e.metadata["reference-url"]}}function vza({pypiOutputMetadata:e,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r}){let n;return e!=null&&(n=vBf(e),n={...r,...t,...n}),n}function hBf({topLevelReviewers:e,groupLevelReviewers:t,outputModeReviewers:r}){let n=new Set,i=new Set,o=[],s=[...e?.teams??[],...t?.teams??[],...r?.teams??[]],a=[...e?.users??[],...t?.users??[],...r?.users??[]];for(let c of s)n.has(c.name)||(o.push(Gr.GithubPullRequestReviewer.team({name:c.name})),n.add(c.name));for(let c of a)i.has(c.name)||(o.push(Gr.GithubPullRequestReviewer.user({name:c.name})),i.add(c.name));return o}async function gBf({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r={},maybeTopLevelMetadata:n={},maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}){let s=t.snippets!=null&&t.snippets.path!=="";if(t.github){let a=JAe(t.github)?t.github.uri:t.github.repository,{owner:c,repo:u}=i_(a),l=t.output!=null?yBf(t.output,r,n):void 0,p=EBf(t),d=p!=null?await ABf({absolutePathToGeneratorsConfiguration:e,githubLicense:p}):void 0,f=t.github.mode??"release";switch(f){case"commit":case"release":return Gr.OutputMode.githubV2(Gr.GithubOutputModeV2.commitAndRelease({owner:c,repo:u,license:d,publishInfo:l,downloadSnippets:s}));case"pull-request":{let m=t.github,h=hBf({topLevelReviewers:o,groupLevelReviewers:i,outputModeReviewers:m.reviewers});return Gr.OutputMode.githubV2(Gr.GithubOutputModeV2.pullRequest({owner:c,repo:u,license:d,publishInfo:l,downloadSnippets:s,reviewers:h,branch:m.branch}))}case"push":return Gr.OutputMode.githubV2(Gr.GithubOutputModeV2.push({owner:c,repo:u,branch:t.github.mode==="push"?t.github.branch:void 0,license:d,publishInfo:l,downloadSnippets:s}));default:Ie(f)}}if(t.output==null)return Gr.remoteGen.OutputMode.publish({registryOverrides:{}});switch(t.output.location){case"local-file-system":return Gr.OutputMode.downloadFiles({downloadSnippets:s});case"npm":return Gr.OutputMode.publishV2(Gr.remoteGen.PublishOutputModeV2.npmOverride({registryUrl:t.output.url??"https://registry.npmjs.org",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:s}));case"maven":return Gr.OutputMode.publishV2(Gr.remoteGen.PublishOutputModeV2.mavenOverride({registryUrl:Iza(t.output),username:t.output.username??"",password:t.output.password??"",coordinate:t.output.coordinate,signature:t.output.signature!=null?{keyId:t.output.signature.keyId,secretKey:t.output.signature.secretKey,password:t.output.signature.password}:void 0,downloadSnippets:s}));case"postman":return Gr.OutputMode.publishV2(Gr.remoteGen.PublishOutputModeV2.postman({apiKey:t.output["api-key"],workspaceId:t.output["workspace-id"]}));case"pypi":return Gr.OutputMode.publishV2(Gr.remoteGen.PublishOutputModeV2.pypiOverride({registryUrl:t.output.url??"https://upload.pypi.org/legacy/",username:t.output.token!=null?"__token__":t.output.password??"",password:t.output.token??t.output.password??"",coordinate:t.output["package-name"],downloadSnippets:s,pypiMetadata:vza({pypiOutputMetadata:t.output.metadata,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n})}));case"nuget":return Gr.OutputMode.publishV2(Gr.remoteGen.PublishOutputModeV2.nugetOverride({registryUrl:t.output.url??"https://nuget.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:s}));case"rubygems":return Gr.OutputMode.publishV2(Gr.remoteGen.PublishOutputModeV2.rubyGemsOverride({registryUrl:t.output.url??"https://rubygems.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:s}));case"crates":return Gr.OutputMode.publishV2(Gr.remoteGen.PublishOutputModeV2.cratesOverride({registryUrl:t.output.url??"https://crates.io/api/v1/crates",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:s}));default:Ie(t.output)}}async function ABf({absolutePathToGeneratorsConfiguration:e,githubLicense:t}){if(typeof t=="string")switch(t){case"MIT":return Gr.GithubLicense.basic({id:Gr.GithubLicenseId.Mit});case"Apache-2.0":return Gr.GithubLicense.basic({id:Gr.GithubLicenseId.Apache});default:Ie(t)}let r=Ke(Wt.of(gza.default.dirname(e)),Be.of(t.custom)),n=await(0,hza.readFile)(r);return Gr.GithubLicense.custom({contents:n.toString()})}function yBf(e,t,r){switch(e.location){case"local-file-system":throw new Error("Cannot use local-file-system with github publishing");case"npm":return Gr.GithubPublishInfo.npm({registryUrl:e.url??"https://registry.npmjs.org",packageName:e["package-name"],token:e.token});case"maven":return Gr.GithubPublishInfo.maven({registryUrl:Iza(e),coordinate:e.coordinate,credentials:e.username!=null&&e.password!=null?{username:e.username,password:e.password}:void 0,signature:e.signature!=null?{keyId:e.signature.keyId,password:e.signature.password,secretKey:e.signature.secretKey}:void 0});case"postman":return Gr.GithubPublishInfo.postman({apiKey:e["api-key"],workspaceId:e["workspace-id"]});case"pypi":return Gr.GithubPublishInfo.pypi({registryUrl:e.url??"https://upload.pypi.org/legacy/",packageName:e["package-name"],credentials:e.token!=null?{username:"__token__",password:e.token}:{username:e.username??"",password:e.password??""},pypiMetadata:vza({pypiOutputMetadata:e.metadata,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r})});case"nuget":return Gr.GithubPublishInfo.nuget({registryUrl:e.url??"https://nuget.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"rubygems":return Gr.GithubPublishInfo.rubygems({registryUrl:e.url??"https://rubygems.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"crates":return Gr.GithubPublishInfo.crates({registryUrl:e.url??"https://crates.io/api/v1/crates",packageName:e["package-name"],token:e.token});default:Ie(e)}}function bBf(e){if(e.includes("csharp"))return kn.GenerationLanguage.CSHARP;if(e.includes("go"))return kn.GenerationLanguage.GO;if(e.includes("java")||e.includes("spring"))return kn.GenerationLanguage.JAVA;if(e.includes("php"))return kn.GenerationLanguage.PHP;if(e.includes("python")||e.includes("fastapi")||e.includes("pydantic"))return kn.GenerationLanguage.PYTHON;if(e.includes("ruby"))return kn.GenerationLanguage.RUBY;if(e.includes("swift"))return kn.GenerationLanguage.SWIFT;if(e.includes("typescript"))return kn.GenerationLanguage.TYPESCRIPT}function Iza(e){return e.url!=null?e.url:e.signature!=null?"https://oss.sonatype.org/service/local/staging/deploy/maven2/":"https://s01.oss.sonatype.org/content/repositories/releases/"}function EBf(e){return e["publish-metadata"]?.license!=null?e["publish-metadata"].license:e.metadata?.license!=null?e.metadata.license:JAe(e.github)&&e.github.license!=null?e.github.license:e.github?.license}function wza(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email}))}:void 0}function vBf(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email})),keywords:e.keywords,documentationLink:e["documentation-link"],homepageLink:e["homepage-link"]}:void 0}function IBf(e,t){let r=[];t["api-settings"]!=null&&r.push('"api-settings" is deprecated. Please use "api.settings" for global defaults or "api.specs[].settings" for spec-specific settings instead.'),t["async-api"]!=null&&r.push('"async-api" is deprecated. Please use "api.specs[].asyncapi" instead.'),t.openapi!=null&&r.push('"openapi" is deprecated. Please use "api.specs[].openapi" instead.'),t["openapi-overrides"]!=null&&r.push('"openapi-overrides" is deprecated. Please use "api.specs[].overrides" instead.'),t["spec-origin"]&&r.push('"spec-origin" is deprecated. Please use "api.specs[].origin" instead.'),t.api!=null&&(typeof t.api=="string"&&r.push('Using an OpenAPI or AsyncAPI path string for "api" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),Array.isArray(t.api)?r.push('Using an array for "api" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" instead.'):typeof t.api=="object"&&("path"in t.api&&r.push('Using "api.path" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),"proto"in t.api&&r.push('Using "api.proto" is deprecated. Please use "api.specs[].proto" instead.'),"namespaces"in t.api&&r.push('Using "api.namespaces" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" with the "namespace" property instead.'))),r.length>0&&(e.logger.warn("Warnings for generators.yml:"),e.logger.warn(" "+r.join(`
|
|
@@ -1741,7 +1741,7 @@ ${Sdc.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&eYi(th
|
|
|
1741
1741
|
`+HNe.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?HNe.default.cyan(Ndc(t,this.opt.mask)):HNe.default.italic(HNe.default.dim("[hidden]")):this.opt.mask?Ndc(t,this.opt.mask):HNe.default.italic(HNe.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var y2r=ve(rC(),1);var kmc=ve(kYi(),1),g2r=require("child_process"),RYe=require("fs"),h2r=ve(require("path"),1),Nmc=ve(require("os"),1),jmc=require("crypto"),bXi=ve(Dmc(),1);var f2r=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var vNt=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var d2r=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var m2r=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function A2r(e="",t,r){let n=new EXi(e,r);n.runAsync((i,o)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,o)}catch(s){setImmediate(t,s,void 0)}})}function Fmc(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function t_d(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var EXi=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=t_d(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??Nmc.default.tmpdir(),r=(0,jmc.randomUUID)(),n=Fmc(this.fileOptions.prefix),i=Fmc(this.fileOptions.postfix),o=`${n}${r}${i}`,s=h2r.default.resolve(t,o),a=h2r.default.resolve(t)+h2r.default.sep;if(!s.startsWith(a))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=s;let c={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(c.mode=this.fileOptions.mode),(0,RYe.writeFileSync)(this.tempFile,this.text,c)}catch(t){throw new f2r(t)}}readTemporaryFile(){try{let t=(0,RYe.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,kmc.detect)(t)??"utf8";bXi.default.encodingExists(r)||(r="utf8"),this.text=bXi.default.decode(t,r)}}catch(t){throw new d2r(t)}}removeTemporaryFile(){try{(0,RYe.unlinkSync)(this.tempFile)}catch(t){throw new m2r(t)}}launchEditor(){try{let t=(0,g2r.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new vNt(t)}}launchEditorAsync(t){try{(0,g2r.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new vNt(r)}}};var Qmc=ve(lL(),1);var INt=class extends nC{_run(t){this.done=t,this.editorResult=new Qmc.Subject;let r=MT(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?y2r.default.dim("Received"):y2r.default.dim("Press <enter> to launch your preferred editor."),t&&(r=y2r.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),A2r(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var Vmc=require("stream");var Umc=ve(require("readline"),1),zmc=ve(Lmc(),1),XNe=class{constructor(t){this.rl||=Umc.default.createInterface(n_d(t)),this.rl.resume(),this.onForceClose=this.onForceClose.bind(this),process.on("exit",this.onForceClose),this.rl.on("SIGINT",this.onForceClose)}onForceClose(){this.close(),process.kill(process.pid,"SIGINT"),console.log("")}close(){this.rl.removeListener("SIGINT",this.onForceClose),process.removeListener("exit",this.onForceClose),this.rl.output.unmute(),this.activePrompt&&typeof this.activePrompt.close=="function"&&this.activePrompt.close(),this.rl.output.end(),this.rl.pause(),this.rl.close()}};function n_d(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new zmc.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var wNt=class extends XNe{constructor(t={}){super(t),this.log=new Vmc.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return sNt(this.rl,this.bottomBar.split(`
|
|
1742
1742
|
`).length),this}updateBottomBar(t){return sNt(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=t,this.render(),this.rl.output.mute(),this}writeLog(t){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(t.toString())),this.render(),this.rl.output.mute(),this}enforceLF(t){return/[\n\r]$/.test(t)?t:t+`
|
|
1743
1743
|
`}write(t){let r=t.split(/\n/);this.height=r.length,this.rl.setPrompt(r.at(-1)),this.rl.output.rows===0&&this.rl.output.columns===0&&LNr(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var bd=ve(lL(),1),Wmc=ve(jkt(),1);var b2r=ve(lL(),1),qmc=ve(jkt(),1),E2r=function(e,t,r){return typeof e[t]!="function"?(0,b2r.of)(e):(0,b2r.from)((0,qmc.default)(e[t])(r).then(n=>(e[t]=n,e)))};var Gmc={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,o,s)=>{i==="__proto__"||i==="constructor"||(o===s.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=o=>String.prototype.split.call(t,o).filter(Boolean).reduce((s,a)=>s!=null?s[a]:s,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},DYe=class extends XNe{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,bd.from)(t):(0,bd.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,bd.from)(Object.entries(t).map(([i,o])=>({name:i,...o}))):n=(0,bd.from)([t]),this.process=n.pipe((0,bd.concatMap)(this.processQuestion.bind(this)),(0,bd.publish)()),this.process.connect(),this.process.pipe((0,bd.reduce)((i,o)=>(Gmc.set(i,o.name,o.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,bd.defer)(()=>(0,bd.of)(t).pipe((0,bd.concatMap)(this.setDefaultType.bind(this)),(0,bd.concatMap)(this.filterIfRunnable.bind(this)),(0,bd.concatMap)(()=>E2r(t,"message",this.answers)),(0,bd.concatMap)(()=>E2r(t,"default",this.answers)),(0,bd.concatMap)(()=>E2r(t,"choices",this.answers)),(0,bd.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,bd.defer)(()=>(0,bd.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,bd.defer)(()=>(0,bd.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Gmc.get(this.answers,t.name)!==void 0)return bd.EMPTY;if(t.when===!1)return bd.EMPTY;if(typeof t.when!="function")return(0,bd.of)(t);let{answers:r}=this;return(0,bd.defer)(()=>(0,bd.from)((0,Wmc.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,bd.filter)(n=>n!=null)))}};function $mc(e){let t=function(r,n){let i;try{i=new DYe(t.prompts,e)}catch(s){return Promise.reject(s)}let o=i.run(r,n);return o.ui=i,o};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",cNt),this.registerPrompt("input",$Ne),this.registerPrompt("number",uNt),this.registerPrompt("confirm",lNt),this.registerPrompt("rawlist",pNt),this.registerPrompt("expand",fNt),this.registerPrompt("checkbox",dNt),this.registerPrompt("password",mNt),this.registerPrompt("editor",INt)},t.restoreDefaultPrompts(),t}var IXi=$mc();function o_d(e,t){IXi.registerPrompt(e,t)}function s_d(){IXi.restoreDefaultPrompts()}var a_d={prompt:IXi,ui:{BottomBar:wNt,Prompt:DYe},createPromptModule:$mc,registerPrompt:o_d,restoreDefaultPrompts:s_d,Separator:b2},kp=a_d;var FYe=require("path");function Kmc(){let e=c_d();return async t=>{for(let r of t)r.module=e(r.filename);return t}}function c_d(e=process.argv[1]?(0,FYe.dirname)(process.argv[1]):process.cwd(),t=FYe.sep==="\\"){let r=t?Hmc(e):e;return n=>{if(!n)return;let i=t?Hmc(n):n,{dir:o,base:s,ext:a}=FYe.posix.parse(i);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,-1*a.length));let c=decodeURIComponent(s);o||(o=".");let u=o.lastIndexOf("/node_modules");if(u>-1)return`${o.slice(u+14).replace(/\//g,".")}:${c}`;if(o.startsWith(r)){let l=o.slice(r.length+1).replace(/\//g,".");return l?`${l}:${c}`:c}return c}}function Hmc(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var wXi=e=>{if("flags"in e){let t=Jmc(e.flags),r=Ymc(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,o])=>[i,xXi(o)])),n=Object.fromEntries(Object.entries(t).map(([i,o])=>[i,u_d(i,o,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function u_d(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var Jmc=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,xNt(r)]).filter(([,t])=>t!==void 0)),Ymc=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?xXi(n):void 0]}))};var xNt=e=>e===void 0?void 0:e.variant??e.enabled,xXi=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Xmc(){return"CompressionStream"in globalThis}async function v2r(e,t=!0){try{let n=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(n).blob()}catch(r){return t&&console.error("Failed to gzip compress data",r),null}}var I2r="0123456789abcdef",w2r=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length===16)return new e(t);throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let o=new Uint8Array(16);return o[0]=t/2**40,o[1]=t/2**32,o[2]=t/2**24,o[3]=t/2**16,o[4]=t/256,o[5]=t,o[6]=112|r>>>8,o[7]=r,o[8]=128|n>>>24,o[9]=n>>>16,o[10]=n>>>8,o[11]=n,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new e(o)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;default:break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let o=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=o>>>24,n[i+1]=o>>>16,n[i+2]=o>>>8,n[i+3]=o}return new e(n)}throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=I2r.charAt(this.bytes[r]>>>4),t+=I2r.charAt(15&this.bytes[r]),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=I2r.charAt(this.bytes[r]>>>4),t+=I2r.charAt(15&this.bytes[r]);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},CXi=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??l_d()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+r>=this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return w2r.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,w2r.ofInner(t)}},l_d=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),Zmc,Hbe=()=>p_d().toString(),p_d=()=>(Zmc||(Zmc=new CXi)).generate();var v2=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({});var f_d=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],ehc=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return f_d.concat(t).some(n=>{let i=n.toLowerCase();return r.indexOf(i)!==-1})};var m_d=Array.isArray,thc=Object.prototype,nx0=thc.hasOwnProperty,_Xi=thc.toString,SXi=m_d||function(e){return _Xi.call(e)==="[object Array]"};var TXi=e=>e===Object(e)&&!SXi(e);var CNt=e=>e===void 0,_Nt=e=>_Xi.call(e)=="[object String]",rhc=e=>_Nt(e)&&e.trim().length===0;var nhc=e=>_Xi.call(e)=="[object Number]"&&e===e;var OXi=e=>e instanceof Error;function x2r(e){return e===null||typeof e!="object"}function ZNe(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function ihc(e){return ZNe(e,"ErrorEvent")}function kYe(e){return typeof Event<"u"&&h_d(e,Event)}function ohc(e){return ZNe(e,"Object")}function h_d(e,t){try{return e instanceof t}catch{return!1}}function SNt(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),nhc(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e<t?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),SNt(i||r,t,r,n))}var g_d=864e5,C2r=class{constructor(t){this._buckets={},this._onBucketRateLimited=t._onBucketRateLimited,this._bucketSize=SNt(t.bucketSize,0,100,t._logger),this._refillRate=SNt(t.refillRate,0,this._bucketSize,t._logger),this._refillInterval=SNt(t.refillInterval,0,g_d,t._logger)}_applyRefill(t,r){let n=r-t.lastAccess,i=Math.floor(n/this._refillInterval);if(i>0){let o=i*this._refillRate;t.tokens=Math.min(t.tokens+o,this._bucketSize),t.lastAccess=t.lastAccess+i*this._refillInterval}}consumeRateLimit(t){let r=Date.now(),n=String(t),i=this._buckets[n];return i?this._applyRefill(i,r):(i={tokens:this._bucketSize,lastAccess:r},this._buckets[n]=i),i.tokens===0?!0:(i.tokens--,i.tokens===0&&this._onBucketRateLimited?.(t),i.tokens===0)}stop(){this._buckets={}}};var _2r=class{add(t){let r=Hbe();return this.promiseByIds[r]=t,t.catch(()=>{}).finally(()=>{delete this.promiseByIds[r]}),t}async join(){let t=Object.values(this.promiseByIds),r=t.length;for(;r>0;)await Promise.all(t),t=Object.values(this.promiseByIds),r=t.length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}};function A_d(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}var shc=(e,t,r)=>{function n(o,...s){t(()=>{let a=r[o];a(e,...s)})}return{info:(...o)=>{n("log",...o)},warn:(...o)=>{n("warn",...o)},error:(...o)=>{n("error",...o)},critical:(...o)=>{r.error(e,...o)},createLogger:o=>shc(`${e} ${o}`,t,r)}},y_d=e=>e();function ahc(e,t=y_d){return shc(e,t,A_d())}var jYe="Mobile",T2r="iOS",NYe="Android",chc="Tablet",hx0=NYe+" "+chc;var b_d="Apple",gx0=b_d+" Watch",uhc="Safari",O2r="BlackBerry",lhc="Samsung",E_d=lhc+"Browser",v_d=lhc+" Internet",B2r="Chrome",I_d=B2r+" OS",w_d=B2r+" "+T2r,phc="Internet Explorer",x_d=phc+" "+jYe,PXi="Opera",Ax0=PXi+" Mini",fhc="Edge",C_d="Microsoft "+fhc,RXi="Firefox",__d=RXi+" "+T2r,DXi="Nintendo",FXi="PlayStation",S2r="Xbox",S_d=NYe+" "+jYe,T_d=jYe+" "+uhc,TNt="Windows",O_d=TNt+" Phone";var dhc="Generic",yx0=dhc+" "+jYe.toLowerCase(),bx0=dhc+" "+chc.toLowerCase(),B_d="Konqueror",zD="(\\d+(\\.\\d+)?)",BXi=new RegExp("Version/"+zD),Ex0=new RegExp(S2r,"i"),vx0=new RegExp(FXi+" \\w+","i"),Ix0=new RegExp(DXi+" \\w+","i"),P_d=new RegExp(O2r+"|PlayBook|BB10","i"),R_d={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000","5.1":"XP","5.2":"XP","6.0":"Vista","6.1":"7","6.2":"8","6.3":"8.1","6.4":"10","10.0":"10"};var wx0={[x_d]:[new RegExp("rv:"+zD)],[C_d]:[new RegExp(fhc+"?\\/"+zD)],[B2r]:[new RegExp("("+B2r+"|CrMo)\\/"+zD)],[w_d]:[new RegExp("CriOS\\/"+zD)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+zD)],[uhc]:[BXi],[T_d]:[BXi],[PXi]:[new RegExp("("+PXi+"|OPR)\\/"+zD)],[RXi]:[new RegExp(RXi+"\\/"+zD)],[__d]:[new RegExp("FxiOS\\/"+zD)],[B_d]:[new RegExp("Konqueror[:/]?"+zD,"i")],[O2r]:[new RegExp(O2r+" "+zD),BXi],[S_d]:[new RegExp("android\\s"+zD,"i")],[v_d]:[new RegExp(E_d+"\\/"+zD)],[phc]:[new RegExp("(rv:|MSIE )"+zD)],Mozilla:[new RegExp("rv:"+zD)]};var xx0=[[new RegExp(S2r+"; "+S2r+" (.*?)[);]","i"),e=>[S2r,e&&e[1]||""]],[new RegExp(DXi,"i"),[DXi,""]],[new RegExp(FXi,"i"),[FXi,""]],[P_d,[O2r,""]],[new RegExp(TNt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[O_d,""];if(new RegExp(jYe).test(t)&&!/IEMobile\b/.test(t))return[TNt+" "+jYe,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let n=r[1],i=R_d[n]||"";return/arm/i.test(t)&&(i="RT"),[TNt,i]}return[TNt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){let t=[e[3],e[4],e[5]||"0"];return[T2r,t.join(".")]}return[T2r,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=CNt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+NYe+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+NYe+")","i"),e=>{if(e&&e[2]){let t=[e[2],e[3],e[4]||"0"];return[NYe,t.join(".")]}return[NYe,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[I_d,""]],[/Linux|debian/i,["Linux",""]]];var mhc="utf8";function hhc(e,t){if(!e||typeof e!="string"||D_d(e))throw new Error(t)}function D_d(e){return e.trim().length===0}function ghc(e){return e?.replace(/\/+$/,"")}async function Ahc(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function P2r(){return new Date().toISOString()}function Oue(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var yhc=e=>e instanceof Error;function kXi(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var R2r=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}};var e2e=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},QYe=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function bhc(e){if(e instanceof e2e){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function NXi(e){return typeof e=="object"&&(e instanceof e2e||e instanceof QYe)}function Ehc(e){return typeof e=="object"&&e instanceof e2e&&e.status===413}var ONt=class{constructor(t,r={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new _2r,this._events=new R2r,this._isInitialized=!1,hhc(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=ghc(r.host||"https://us.i.posthog.com"),this.flushAt=r.flushAt?Math.max(r.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r.maxQueueSize??1e3),this.flushInterval=r.flushInterval??1e4,this.preloadFeatureFlags=r.preloadFeatureFlags??!0,this.defaultOptIn=r.defaultOptIn??!0,this.disableSurveys=r.disableSurveys??!1,this._retryOptions={retryCount:r.fetchRetryCount??3,retryDelay:r.fetchRetryDelay??3e3,retryCheck:NXi},this.requestTimeout=r.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r.disableGeoip??!0,this.disabled=r.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=ahc("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=r?.evaluationContexts??r?.evaluationEnvironments,r?.evaluationEnvironments&&!r?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!Xmc()||(r?.disableCompression??!1)}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(v2.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(v2.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(v2.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>this._logger.info(n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){return this.promiseQueue.add(t)}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",o,i)})}async captureStatelessImmediate(t,r,n,i){let o=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",o,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",o,i)})}async aliasStatelessImmediate(t,r,n,i){let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",o,i)}groupIdentifyStateless(t,r,n,i,o,s){this.wrap(()=>{let a=this.buildPayload({distinct_id:o||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...s||{}}});this.enqueue("capture",a,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this._logger.error("Remote config could not be loaded",i),this._events.emit("error",i)})}async getFlags(t,r={},n={},i={},o={},s=!1){await this._initPromise;let a=s?"&config=true":"",c=`${this.host}/flags/?v=2${a}`,u={token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...o};this.evaluationContexts&&this.evaluationContexts.length>0&&(u.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(u)};return this._logger.info("Flags URL",c),this.fetchWithRetry(c,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(p=>p.json()).then(p=>({success:!0,response:wXi(p)})).catch(p=>(this._events.emit("error",p),{success:!1,error:this.categorizeRequestError(p)}))}categorizeRequestError(t){if(t instanceof e2e)return{type:"api_error",statusCode:t.status};if(t instanceof QYe){let r=t.error;return r instanceof Error&&(r.name==="AbortError"||r.name==="TimeoutError")?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailStateless(t,r,n,i,o,s);if(a===void 0)return{response:void 0,requestId:void 0};let c=xNt(a.response);return c===void 0&&(c=!1),{response:c,requestId:a.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(r,n,i,o,s,[t]);return a===void 0?void 0:{response:a.flags[t],requestId:a.requestId,evaluatedAt:a.evaluatedAt}}async getFeatureFlagPayloadStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagPayloadsStateless(r,n,i,o,s,[t]);if(!a)return;let c=a[t];return c===void 0?null:c}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},o,s){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},o,s){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(t,r,n,i,o,s);return a?{flags:a.featureFlags,payloads:a.featureFlagPayloads,requestId:a.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a={};(o??this.disableGeoip)&&(a.geoip_disable=!0),s&&(a.flag_keys_to_evaluate=s);let c=await this.getFlags(t,r,n,i,a);if(!c.success)return;let u=c.response;return u.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),u.quotaLimited?.includes("feature_flags")?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:u?.requestId,quotaLimited:u.quotaLimited}):u}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this._logger.info("Loading surveys is disabled."),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(o=>{if(o.status!==200||!o.json){let s=`Surveys API could not be loaded: ${o.status}`,a=new Error(s);this._logger.error(a),this._events.emit("error",new Error(s));return}return o.json()}).catch(o=>{this._logger.error("Surveys API could not be loaded",o),this._events.emit("error",o)}))?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(v2.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(v2.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(v2.Props,this.props)})}processBeforeEnqueue(t){return t}async flushStorage(){}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o=this.getPersistedProperty(v2.Queue)||[];o.length>=this.maxQueueSize&&(o.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),o.push({message:i}),this.setPersistedProperty(v2.Queue,o),this._events.emit(t,i),o.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Oue(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o={api_key:this.apiKey,batch:[i],sent_at:P2r()};this.historicalMigration&&(o.historical_migration=!0);let s=JSON.stringify(o),a=`${this.host}/batch/`,c=this.disableCompression?null:await v2r(s,this.isDebug),u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...c!==null&&{"Content-Encoding":"gzip"}},body:c||s};try{await this.fetchWithRetry(a,u)}catch(l){this._events.emit("error",l)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:P2r(),uuid:n?.uuid?n.uuid:Hbe()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await bhc(t)})}async flush(){let t=kXi([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),kXi([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(v2.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),o=i.map(f=>f.message),s=async()=>{let m=(this.getPersistedProperty(v2.Queue)||[]).slice(i.length);this.setPersistedProperty(v2.Queue,m),t=m,await this.flushStorage()},a={api_key:this.apiKey,batch:o,sent_at:P2r()};this.historicalMigration&&(a.historical_migration=!0);let c=JSON.stringify(a),u=`${this.host}/batch/`,l=this.disableCompression?null:await v2r(c,this.isDebug),p={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...l!==null&&{"Content-Encoding":"gzip"}},body:l||c},d={retryCheck:f=>Ehc(f)?!1:NXi(f)};try{await this.fetchWithRetry(u,p,d)}catch(f){if(Ehc(f)&&o.length>1){this.maxBatchSize=Math.max(1,Math.floor(o.length/2)),this._logger.warn(`Received 413 when sending batch of size ${o.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw f instanceof QYe||await s(),this._events.emit("error",f),f}await s(),r.push(...o)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){let o=r.body?r.body:"",s=-1;try{s=o instanceof Blob?o.size:Buffer.byteLength(o,mhc)}catch{o instanceof Blob?s=o.size:s=new TextEncoder().encode(o).length}return await Ahc(async()=>{let a=new AbortController,c=i??this.requestTimeout,u=Oue(()=>a.abort(),c),l=null;try{l=await this.fetch(t,{signal:a.signal,...r})}catch(d){throw new QYe(d)}finally{clearTimeout(u)}if(!(r.mode==="no-cors")&&(l.status<200||l.status>=400))throw new e2e(l,s);return l},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await this.promiseQueue.join();!((this.getPersistedProperty(v2.Queue)||[]).length===0||(await this.flush(),r)););}catch(o){if(!NXi(o))throw o;await bhc(o)}},i;try{return await Promise.race([new Promise((o,s)=>{i=Oue(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,s("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}finally{clearTimeout(i)}}async shutdown(t=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}};var I2={};$(I2,{DOMExceptionCoercer:()=>LXi,ErrorCoercer:()=>UXi,ErrorEventCoercer:()=>zXi,ErrorPropertiesBuilder:()=>jXi,EventCoercer:()=>GXi,ObjectCoercer:()=>qXi,PrimitiveCoercer:()=>WXi,PromiseRejectionEventCoercer:()=>$Xi,ReduceableCache:()=>HXi,StringCoercer:()=>VXi,chromeStackLineParser:()=>QXi,createDefaultStackParser:()=>H_d,createStackParser:()=>Phc,geckoStackLineParser:()=>MXi,nodeStackLineParser:()=>Shc,opera10StackLineParser:()=>xhc,opera11StackLineParser:()=>Chc,reverseAndStripFrames:()=>Bhc,winjsStackLineParser:()=>whc});var D2r,vhc,F2r;function Ihc(e){let t=globalThis._posthogChunkIds;if(!t)return;let r=Object.keys(t);return F2r&&r.length===vhc||(vhc=r.length,F2r=r.reduce((n,i)=>{D2r||(D2r={});let o=D2r[i];if(o)n[o[0]]=o[1];else{let s=e(i);for(let a=s.length-1;a>=0;a--){let u=s[a]?.filename,l=t[i];if(u&&l){n[u]=l,D2r[i]=[u,l];break}}}return n},{})),F2r}var k_d=4,jXi=class{constructor(t,r,n=[]){this.coercers=t,this.stackParser=r,this.modifiers=n}buildFromUnknown(t,r={}){let i=r&&r.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,r,0).apply(t),a=this.buildParsingContext(r),c=this.parseStacktrace(s,a);return{$exception_list:this.convertToExceptionList(c,i),$exception_level:"error"}}async modifyFrames(t){for(let r of t)r.stacktrace&&r.stacktrace.frames&&SXi(r.stacktrace.frames)&&(r.stacktrace.frames=await this.applyModifiers(r.stacktrace.frames));return t}coerceFallback(t){return{type:"Error",value:"Unknown error",stack:t.syntheticException?.stack,synthetic:!0}}parseStacktrace(t,r){let n;t.cause!=null&&(n=this.parseStacktrace(t.cause,r));let i;return t.stack!=""&&t.stack!=null&&(i=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?r.skipFirstLines:0),r.chunkIdMap)),{...t,cause:n,stack:i}}applyChunkIds(t,r){return t.map(n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n))}applyCoercers(t,r){for(let n of this.coercers)if(n.match(t))return n.coerce(t,r);return this.coerceFallback(r)}async applyModifiers(t){let r=t;for(let n of this.modifiers)r=await n(r);return r}convertToExceptionList(t,r){let n={type:t.type,value:t.value,mechanism:{type:r.type??"generic",handled:r.handled??!0,synthetic:t.synthetic??!1}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});let i=[n];return t.cause!=null&&i.push(...this.convertToExceptionList(t.cause,{...r,handled:!0})),i}buildParsingContext(t){return{chunkIdMap:Ihc(this.stackParser),skipFirstLines:t.skipFirstLines??1}}buildCoercingContext(t,r,n=0){let i=(s,a)=>{if(a<=k_d){let c=this.buildCoercingContext(t,r,a);return this.applyCoercers(s,c)}};return{...r,syntheticException:n==0?r.syntheticException:void 0,mechanism:t,apply:s=>i(s,n),next:s=>i(s,n+1)}}};var UT="?";function GY(e,t,r,n,i){let o={platform:e,filename:t,function:r==="<anonymous>"?UT:r,in_app:!0};return CNt(n)||(o.lineno=n),CNt(i)||(o.colno=i),o}var k2r=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:UT,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var N_d=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,j_d=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Q_d=/\((\S*)(?::(\d+))(?::(\d+))\)/,QXi=(e,t)=>{let r=N_d.exec(e);if(r){let[,i,o,s]=r;return GY(t,i,UT,+o,+s)}let n=j_d.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){let a=Q_d.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}let[o,s]=k2r(n[1]||UT,n[2]);return GY(t,s,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}};var M_d=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,L_d=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,MXi=(e,t)=>{let r=M_d.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let s=L_d.exec(r[3]);s&&(r[1]=r[1]||"eval",r[3]=s[1],r[4]=s[2],r[5]="")}let i=r[3],o=r[1]||UT;return[o,i]=k2r(o,i),GY(t,i,o,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}};var U_d=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,whc=(e,t)=>{let r=U_d.exec(e);return r?GY(t,r[2],r[1]||UT,+r[3],r[4]?+r[4]:void 0):void 0};var z_d=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,xhc=(e,t)=>{let r=z_d.exec(e);return r?GY(t,r[2],r[3]||UT,+r[1]):void 0},V_d=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,Chc=(e,t)=>{let r=V_d.exec(e);return r?GY(t,r[5],r[3]||r[4]||UT,+r[1],+r[2]):void 0};var q_d=/^\s*[-]{4,}$/,G_d=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,Shc=(e,t)=>{let r=e.match(G_d);if(r){let n,i,o,s,a;if(r[1]){o=r[1];let l=o.lastIndexOf(".");if(o[l-1]==="."&&l--,l>0){n=o.slice(0,l),i=o.slice(l+1);let p=n.indexOf(".Module");p>0&&(o=o.slice(p+1),n=n.slice(0,p))}s=void 0}i&&(s=n,a=i),i==="<anonymous>"&&(a=void 0,o=void 0),o===void 0&&(a=a||UT,o=s?`${s}.${a}`:a);let c=r[2]?.startsWith("file://")?r[2].slice(7):r[2],u=r[5]==="native";return c?.match(/\/[A-Z]:/)&&(c=c.slice(1)),!c&&r[5]&&!u&&(c=r[5]),{filename:c?decodeURI(c):void 0,module:void 0,function:o,lineno:_hc(r[3]),colno:_hc(r[4]),in_app:W_d(c||"",u),platform:t}}if(e.match(q_d))return{filename:e,platform:t}};function W_d(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function _hc(e){return parseInt(e||"",10)||void 0}var Thc=/\(error: (.*)\)/,Ohc=50;function Bhc(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,Ohc).map(r=>({...r,filename:r.filename||$_d(t).filename,function:r.function||UT}))}function $_d(e){return e[e.length-1]||{}}function H_d(){return Phc("web:javascript",QXi,MXi)}function Phc(e,...t){return(r,n=0)=>{let i=[],o=r.split(`
|
|
1744
|
-
`);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let c=Thc.test(a)?a.replace(Thc,"$1"):a;if(!c.match(/\S*Error: /)){for(let u of t){let l=u(c,e);if(l){i.push(l);break}}if(i.length>=Ohc)break}}return Bhc(i)}}var LXi=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=_Nt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return ZNe(t,"DOMException")}isDOMError(t){return ZNe(t,"DOMError")}};var UXi=class{match(t){return OXi(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var zXi=class{constructor(){}match(t){return ihc(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var K_d=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,VXi=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(K_d);return i&&(r=i[1],n=i[2]),[r,n]}};var Rhc=["fatal","error","warning","log","info","debug"];function N2r(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var qXi=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return kYe(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=N2r(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return _Nt(t)&&!rhc(t)&&Rhc.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(yhc(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var GXi=class{match(t){return kYe(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${N2r(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var WXi=class{match(t){return x2r(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var $Xi=class{match(t){return ZNe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!kYe(t))return!1;try{let r=t.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return x2r(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var HXi=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var khc=require("fs"),Nhc=require("readline"),j2r=new I2.ReduceableCache(25),jhc=new I2.ReduceableCache(20),KXi=7,J_d=1e3,Y_d=1e4;async function Qhc(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||tSd(s)||rSd(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(jhc.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,u)=>c-u);let s=iSd(o);if(s.every(c=>nSd(i,c)))continue;let a=oSd(j2r,i,{});n.push(X_d(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&Z_d(e,j2r),j2r.reduce(),e}function X_d(e,t,r){return new Promise(n=>{let i=(0,khc.createReadStream)(e),o=(0,Nhc.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,c=0,u=t[c];if(u===void 0)return void s();let l=u[0],p=u[1];function d(){jhc.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=sSd(f,0),a>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let m=t[c];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function Z_d(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;eSd(r.lineno,r,n)}}function eSd(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=Mhc(e);i<e;i++){let o=r[i];if(o===void 0)return void Dhc(t);t.pre_context.push(o)}if(r[e]===void 0)return void Dhc(t);t.context_line=r[e];let n=Lhc(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function Dhc(e){delete e.pre_context,delete e.context_line,delete e.post_context}function tSd(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function rSd(e){return e.lineno!==void 0&&e.lineno>Y_d||e.colno!==void 0&&e.colno>J_d}function nSd(e,t){let r=j2r.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function iSd(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=Fhc(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+KXi:(i.push(n),n=Fhc(o)),t++}return i}function Fhc(e){return[Mhc(e),Lhc(e)]}function Mhc(e){return Math.max(1,e-KXi)}function Lhc(e){return e+KXi}function oSd(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function sSd(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function aSd(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function Uhc(e,t){globalThis.process?.on("uncaughtException",aSd(e,t))}function zhc(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var cSd=2e3,W9=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new C2r({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return TXi(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i},s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n,properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(Uhc(this.onException.bind(this),this.onFatalError.bind(this)),zhc(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(cSd),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var Vhc="5.29.1";var BNt={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function qhc(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var uSd=6e4,lSd=1152921504606847e3,pSd=["is_not"],MYe=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Ed=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},WY=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Q2r=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let c=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,c)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(u){u instanceof WY||u instanceof Ed?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${t}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${u}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(c=>this.featureFlagsByKey[c]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async c=>{try{let{value:u,payload:l}=await this.computeFlagAndPayloadLocally(c,a);n[c.key]=u,l&&(i[c.key]=l)}catch(u){u instanceof WY||u instanceof Ed?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${c.key}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${c.key}: ${u}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new Ed("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let u=this.groupTypeMapping[String(c)];if(!u)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new Ed("Flag has unknown group type index");if(!(u in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[u];return await this.matchFeatureFlagProperties(t,i[u],l,r)}{let u=this.getBucketingValueForFlag(t,n,o);if(u===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new Ed(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,u,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new Ed("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new Ed(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new Ed(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new Ed(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of s){if(!(c in i)){let l=this.featureFlagsByKey[c];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[c]=p}catch(p){throw new Ed(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new Ed(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new Ed(`Dependency '${c}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,c;for(let u of s)try{if(await this.isConditionMatch(t,r,u,n,i)){let l=u.variant,p=o.multivariate?.variants||[];c=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof WY)throw l;if(l instanceof Ed)a=!0;else throw l}if(c!==void 0)return c;if(a)throw new Ed("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let u=c.type,l=!1;if(l=u==="cohort"?Khc(c,i,this.cohorts,this.debugMode):u==="flag"?await this.evaluateFlagDependency(c,i,o):Hhc(c,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await Ghc(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await Ghc(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(uSd,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new MYe(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new MYe(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new MYe(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof MYe&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=Oue(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function Ghc(e,t,r=""){let n=await qhc(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/lSd}function Hhc(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new Ed("Operator is_not_set is not supported")}else throw new Ed(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!pSd.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(u,l){return Array.isArray(u)?u.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(u).toLowerCase()===String(l).toLowerCase()}function c(u,l,p){if(p==="gt")return u>l;if(p==="gte")return u>=l;if(p==="lt")return u<l;if(p==="lte")return u<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return Whc(String(i))&&String(s).match(String(i))!==null;case"not_regex":return Whc(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u==null||s==null?c(String(s),String(i),o):typeof s=="string"?c(s,String(i),o):c(s,u,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new Ed("Date operations cannot be performed on boolean values");let u=gSd(String(i));if(u==null&&(u=$hc(i)),u==null)throw new Ed(`Invalid date: ${i}`);let l=$hc(s);return["is_date_before"].includes(o)?l<u:l>u}case"semver_eq":return h5(zT(String(s)),zT(String(i)))===0;case"semver_neq":return h5(zT(String(s)),zT(String(i)))!==0;case"semver_gt":return h5(zT(String(s)),zT(String(i)))>0;case"semver_gte":return h5(zT(String(s)),zT(String(i)))>=0;case"semver_lt":return h5(zT(String(s)),zT(String(i)))<0;case"semver_lte":return h5(zT(String(s)),zT(String(i)))<=0;case"semver_tilde":{let u=zT(String(s)),{lower:l,upper:p}=dSd(String(i));return h5(u,l)>=0&&h5(u,p)<0}case"semver_caret":{let u=zT(String(s)),{lower:l,upper:p}=mSd(String(i));return h5(u,l)>=0&&h5(u,p)<0}case"semver_wildcard":{let u=zT(String(s)),{lower:l,upper:p}=hSd(String(i));return h5(u,l)>=0&&h5(u,p)<0}default:throw new Ed(`Unknown operator: ${o}`)}}function fSd(e,t){if(!(e in t))throw new WY(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function Khc(e,t,r,n=!1){let i=String(e.value);fSd(i,r);let o=r[i];return Jhc(o,t,r,n)}function Jhc(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let c=Jhc(a,t,r,n);if(i==="AND"){if(!c)return!1}else if(c)return!0}catch(c){if(c instanceof WY)throw c;if(c instanceof Ed)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new Ed("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let c;if(a.type==="cohort")c=Khc(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else c=Hhc(a,t);let u=a.negation||!1;if(i==="AND"){if(!c&&!u||c&&u)return!1}else if(c&&!u||!c&&u)return!0}catch(c){if(c instanceof WY)throw c;if(c instanceof Ed)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new Ed("can't match cohort without a given cohort property value");return i==="AND"}function Whc(e){try{return new RegExp(e),!0}catch{return!1}}function zT(e){let r=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!r||r.startsWith("."))throw new Ed(`Invalid semver: ${e}`);let n=r.split("."),i=c=>{if(c===void 0||c==="")return 0;if(!/^\d+$/.test(c))throw new Ed(`Invalid semver: ${e}`);return parseInt(c,10)},o=i(n[0]),s=i(n[1]),a=i(n[2]);return[o,s,a]}function h5(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0}function dSd(e){let t=zT(e),r=[t[0],t[1],t[2]],n=[t[0],t[1]+1,0];return{lower:r,upper:n}}function mSd(e){let t=zT(e),[r,n,i]=t,o=[r,n,i],s;return s=r>0?[r+1,0,0]:n>0?[0,n+1,0]:[0,0,i+1],{lower:o,upper:s}}function hSd(e){let r=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!r)throw new Ed(`Invalid wildcard semver: ${e}`);let n=r.split("."),i=parseInt(n[0],10);if(isNaN(i))throw new Ed(`Invalid wildcard semver: ${e}`);let o,s;if(n.length===1)o=[i,0,0],s=[i+1,0,0];else{let a=parseInt(n[1],10);if(isNaN(a))throw new Ed(`Invalid wildcard semver: ${e}`);o=[i,a,0],s=[i,a+1,0]}return{lower:o,upper:s}}function $hc(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new Ed(`${e} is in an invalid date format`)}throw new Ed(`The date provided ${e} must be a string, number, or date object`)}function gSd(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var M2r=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var ASd=100,Yhc=3e4,ySd=5e4,bSd=50,ESd=500,L2r=class extends ONt{constructor(t,r={}){if(super(t,r),this._memoryStorage=new M2r,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,ASd):Yhc,typeof r.waitUntilDebounceMs=="number"&&(this.options.waitUntilDebounceMs=Math.max(r.waitUntilDebounceMs,0)),typeof r.waitUntilMaxWaitMs=="number"&&(this.options.waitUntilMaxWaitMs=Math.max(r.waitUntilMaxWaitMs,0)),r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new Q2r({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new W9(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||ySd}enqueue(t,r,n){super.enqueue(t,r,n),this.scheduleDebouncedFlush()}async flush(){let t=super.flush(),r=this.options.waitUntil;if(r&&!this._waitUntilCycle)try{r(t.catch(()=>{}))}catch{}return t}scheduleDebouncedFlush(){let t=this.options.waitUntil;if(!t||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let s,a=new Promise(c=>{s=c});try{t(a)}catch{return}this._waitUntilCycle={resolve:s,startedAt:Date.now(),timer:void 0}}let r=Date.now()-this._waitUntilCycle.startedAt,n=this.options.waitUntilMaxWaitMs??ESd,i=r>=n;if(this._waitUntilCycle.timer!==void 0&&clearTimeout(this._waitUntilCycle.timer),i)return void this.resolveWaitUntilFlush();let o=this.options.waitUntilDebounceMs??bSd;this._waitUntilCycle.timer=Oue(()=>{this.resolveWaitUntilFlush()},o)}_consumeWaitUntilCycle(){let t=this._waitUntilCycle;return t&&(clearTimeout(t.timer),this._waitUntilCycle=void 0),t?.resolve}async resolveWaitUntilFlush(){let t=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{t?.()}}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return Vhc}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=Yhc){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let x=this._flagOverrides[t];if(x===void 0)return;let C=this._payloadOverrides?.[t];return{key:t,enabled:x!==!1,variant:typeof x=="string"?x:void 0,payload:C}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f,m=!1,h,g,A,b,v,E;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let x=this.featureFlagsPoller?.featureFlagsByKey[t];if(x)try{let C=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(x,d,{matchValue:i});if(C){m=!0;let _=C.value;b=x.id,E="Evaluated locally",f={key:t,enabled:_!==!1,variant:typeof _=="string"?_:void 0,payload:C.payload??void 0}}}catch(C){if(C instanceof WY||C instanceof Ed)this._logger?.info(`${C.name} when computing flag locally: ${t}: ${C.message}`);else throw C}}if(!m&&!c){let x=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(x===void 0)A=BNt.UNKNOWN_ERROR;else{h=x.requestId,g=x.evaluatedAt;let C=[];x.errorsWhileComputingFlags&&C.push(BNt.ERRORS_WHILE_COMPUTING),x.quotaLimited?.includes("feature_flags")&&C.push(BNt.QUOTA_LIMITED);let _=x.flags[t];if(_===void 0)C.push(BNt.FLAG_MISSING);else{b=_.metadata?.id,v=_.metadata?.version,E=_.reason?.description??_.reason?.code;let w;if(_.metadata?.payload!==void 0)try{w=JSON.parse(_.metadata.payload)}catch{w=_.metadata.payload}f={key:t,enabled:_.enabled,variant:_.variant,payload:w}}C.length>0&&(A=C.join(","))}}if(o){let x=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,C=`${t}_${x}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C];let _={$feature_flag:t,$feature_flag_response:x,$feature_flag_id:b,$feature_flag_version:v,$feature_flag_reason:E,locally_evaluated:m,[`$feature/${t}`]:x,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():g};if(m&&this.featureFlagsPoller){let w=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();w!==void 0&&(_.$feature_flag_definitions_loaded_at=w)}A&&(_.$feature_flag_error=A),this.capture({distinctId:r,event:"$feature_flag_called",properties:_,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},g=!0;if(f&&(m=f.response,h=f.payloads,g=f.fallbackToFlags),g&&!c){let A=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...A.flags||{}},h={...h,...A.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){let r=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown();try{return await super._shutdown(t)}finally{r?.()}}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=Oue(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(ohc(s)&&r&&o in r){let a={};for(let[c,u]of Object.entries(s))a[String(c)]=String(u);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!W9.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(W9.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!W9.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");return this.addPendingPromise(W9.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=Hbe(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,c,h)}return f.event,{}}).then(h=>{let g={};if(h)for(let[b,v]of Object.entries(h))g[`$feature/${b}`]=v;let A=Object.keys(h||{}).filter(b=>h?.[b]!==!1).sort();return A.length>0&&(g.$active_feature_flags=A),g}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&ehc(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var Xhc=require("async_hooks"),U2r=class{constructor(){this.storage=new Xhc.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var Zhc="posthog-node";function vSd(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let c=s.tags[JXi.POSTHOG_ID_TAG];if(c===void 0)return s;let u=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${c}`,u).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:f}),s}}var JXi=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=Zhc,this.name=Zhc,this.setupOnce=function(s,a){let c=a()?.getClient()?.getDsn()?.projectId;s(vSd(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};W9.errorPropertiesBuilder=new I2.ErrorPropertiesBuilder([new I2.EventCoercer,new I2.ErrorCoercer,new I2.ObjectCoercer,new I2.StringCoercer,new I2.PrimitiveCoercer],I2.createStackParser("node:javascript",I2.nodeStackLineParser),[Kmc(),Qhc]);var Kbe=class extends L2r{getLibraryId(){return"posthog-node"}initializeContext(){return new U2r}};var z2r=class{posthog;constructor({posthogApiKey:t}){this.posthog=new Kbe(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"4.78.0",usingAccessToken:!0}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}};var PNt=class{async sendEvent(){}async identify(){}async flush(){}};Jt();var LYe=require("fs/promises"),egc=require("os"),tgc=require("path");var ISd="id",wSd=".fern",RNt=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new Kbe(r),this.userId=t==null?void 0:dWi(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"4.78.0",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await bf({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ke(Wt.of((0,egc.homedir)()),Be.of(wSd),Be.of(ISd));await ar(t)||(await(0,LYe.mkdir)((0,tgc.dirname)(t),{recursive:!0}),await(0,LYe.writeFile)(t,V_())),this.persistedDistinctId=(await(0,LYe.readFile)(t)).toString()}return this.persistedDistinctId}};var YXi;async function DNt(){return YXi==null&&(YXi=await xSd()),YXi}async function xSd(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new PNt;let r=await ZBr();return r!=null?new RNt({token:r,posthogApiKey:e}):await TY()!=null?new z2r({posthogApiKey:e}):new RNt({token:void 0,posthogApiKey:e})}catch{return new PNt}}Pt();var FNt=ve(require("process"),1);xVe();var igc=ve(b5i(),1),ogc=ve(ngc(),1);function aS(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=iq(e),e.length===0))return 0;e=e.replace((0,ogc.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(igc.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function V2r(e){let t=0;for(let r of e.split(`
|
|
1744
|
+
`);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let c=Thc.test(a)?a.replace(Thc,"$1"):a;if(!c.match(/\S*Error: /)){for(let u of t){let l=u(c,e);if(l){i.push(l);break}}if(i.length>=Ohc)break}}return Bhc(i)}}var LXi=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=_Nt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return ZNe(t,"DOMException")}isDOMError(t){return ZNe(t,"DOMError")}};var UXi=class{match(t){return OXi(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var zXi=class{constructor(){}match(t){return ihc(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var K_d=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,VXi=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(K_d);return i&&(r=i[1],n=i[2]),[r,n]}};var Rhc=["fatal","error","warning","log","info","debug"];function N2r(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var qXi=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return kYe(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=N2r(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return _Nt(t)&&!rhc(t)&&Rhc.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(yhc(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var GXi=class{match(t){return kYe(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${N2r(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var WXi=class{match(t){return x2r(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var $Xi=class{match(t){return ZNe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!kYe(t))return!1;try{let r=t.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return x2r(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var HXi=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var khc=require("fs"),Nhc=require("readline"),j2r=new I2.ReduceableCache(25),jhc=new I2.ReduceableCache(20),KXi=7,J_d=1e3,Y_d=1e4;async function Qhc(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||tSd(s)||rSd(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(jhc.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,u)=>c-u);let s=iSd(o);if(s.every(c=>nSd(i,c)))continue;let a=oSd(j2r,i,{});n.push(X_d(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&Z_d(e,j2r),j2r.reduce(),e}function X_d(e,t,r){return new Promise(n=>{let i=(0,khc.createReadStream)(e),o=(0,Nhc.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,c=0,u=t[c];if(u===void 0)return void s();let l=u[0],p=u[1];function d(){jhc.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=sSd(f,0),a>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let m=t[c];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function Z_d(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;eSd(r.lineno,r,n)}}function eSd(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=Mhc(e);i<e;i++){let o=r[i];if(o===void 0)return void Dhc(t);t.pre_context.push(o)}if(r[e]===void 0)return void Dhc(t);t.context_line=r[e];let n=Lhc(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function Dhc(e){delete e.pre_context,delete e.context_line,delete e.post_context}function tSd(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function rSd(e){return e.lineno!==void 0&&e.lineno>Y_d||e.colno!==void 0&&e.colno>J_d}function nSd(e,t){let r=j2r.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function iSd(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=Fhc(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+KXi:(i.push(n),n=Fhc(o)),t++}return i}function Fhc(e){return[Mhc(e),Lhc(e)]}function Mhc(e){return Math.max(1,e-KXi)}function Lhc(e){return e+KXi}function oSd(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function sSd(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function aSd(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function Uhc(e,t){globalThis.process?.on("uncaughtException",aSd(e,t))}function zhc(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var cSd=2e3,W9=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new C2r({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return TXi(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i},s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n,properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(Uhc(this.onException.bind(this),this.onFatalError.bind(this)),zhc(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(cSd),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var Vhc="5.29.1";var BNt={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function qhc(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var uSd=6e4,lSd=1152921504606847e3,pSd=["is_not"],MYe=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Ed=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},WY=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Q2r=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let c=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,c)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(u){u instanceof WY||u instanceof Ed?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${t}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${u}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(c=>this.featureFlagsByKey[c]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async c=>{try{let{value:u,payload:l}=await this.computeFlagAndPayloadLocally(c,a);n[c.key]=u,l&&(i[c.key]=l)}catch(u){u instanceof WY||u instanceof Ed?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${c.key}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${c.key}: ${u}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new Ed("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let u=this.groupTypeMapping[String(c)];if(!u)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new Ed("Flag has unknown group type index");if(!(u in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[u];return await this.matchFeatureFlagProperties(t,i[u],l,r)}{let u=this.getBucketingValueForFlag(t,n,o);if(u===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new Ed(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,u,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new Ed("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new Ed(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new Ed(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new Ed(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of s){if(!(c in i)){let l=this.featureFlagsByKey[c];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[c]=p}catch(p){throw new Ed(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new Ed(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new Ed(`Dependency '${c}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,c;for(let u of s)try{if(await this.isConditionMatch(t,r,u,n,i)){let l=u.variant,p=o.multivariate?.variants||[];c=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof WY)throw l;if(l instanceof Ed)a=!0;else throw l}if(c!==void 0)return c;if(a)throw new Ed("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let u=c.type,l=!1;if(l=u==="cohort"?Khc(c,i,this.cohorts,this.debugMode):u==="flag"?await this.evaluateFlagDependency(c,i,o):Hhc(c,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await Ghc(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await Ghc(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(uSd,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new MYe(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new MYe(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new MYe(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof MYe&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=Oue(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function Ghc(e,t,r=""){let n=await qhc(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/lSd}function Hhc(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new Ed("Operator is_not_set is not supported")}else throw new Ed(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!pSd.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(u,l){return Array.isArray(u)?u.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(u).toLowerCase()===String(l).toLowerCase()}function c(u,l,p){if(p==="gt")return u>l;if(p==="gte")return u>=l;if(p==="lt")return u<l;if(p==="lte")return u<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return Whc(String(i))&&String(s).match(String(i))!==null;case"not_regex":return Whc(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u==null||s==null?c(String(s),String(i),o):typeof s=="string"?c(s,String(i),o):c(s,u,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new Ed("Date operations cannot be performed on boolean values");let u=gSd(String(i));if(u==null&&(u=$hc(i)),u==null)throw new Ed(`Invalid date: ${i}`);let l=$hc(s);return["is_date_before"].includes(o)?l<u:l>u}case"semver_eq":return h5(zT(String(s)),zT(String(i)))===0;case"semver_neq":return h5(zT(String(s)),zT(String(i)))!==0;case"semver_gt":return h5(zT(String(s)),zT(String(i)))>0;case"semver_gte":return h5(zT(String(s)),zT(String(i)))>=0;case"semver_lt":return h5(zT(String(s)),zT(String(i)))<0;case"semver_lte":return h5(zT(String(s)),zT(String(i)))<=0;case"semver_tilde":{let u=zT(String(s)),{lower:l,upper:p}=dSd(String(i));return h5(u,l)>=0&&h5(u,p)<0}case"semver_caret":{let u=zT(String(s)),{lower:l,upper:p}=mSd(String(i));return h5(u,l)>=0&&h5(u,p)<0}case"semver_wildcard":{let u=zT(String(s)),{lower:l,upper:p}=hSd(String(i));return h5(u,l)>=0&&h5(u,p)<0}default:throw new Ed(`Unknown operator: ${o}`)}}function fSd(e,t){if(!(e in t))throw new WY(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function Khc(e,t,r,n=!1){let i=String(e.value);fSd(i,r);let o=r[i];return Jhc(o,t,r,n)}function Jhc(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let c=Jhc(a,t,r,n);if(i==="AND"){if(!c)return!1}else if(c)return!0}catch(c){if(c instanceof WY)throw c;if(c instanceof Ed)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new Ed("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let c;if(a.type==="cohort")c=Khc(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else c=Hhc(a,t);let u=a.negation||!1;if(i==="AND"){if(!c&&!u||c&&u)return!1}else if(c&&!u||!c&&u)return!0}catch(c){if(c instanceof WY)throw c;if(c instanceof Ed)n&&console.debug(`Failed to compute property ${a} locally: ${c}`),s=!0;else throw c}if(s)throw new Ed("can't match cohort without a given cohort property value");return i==="AND"}function Whc(e){try{return new RegExp(e),!0}catch{return!1}}function zT(e){let r=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!r||r.startsWith("."))throw new Ed(`Invalid semver: ${e}`);let n=r.split("."),i=c=>{if(c===void 0||c==="")return 0;if(!/^\d+$/.test(c))throw new Ed(`Invalid semver: ${e}`);return parseInt(c,10)},o=i(n[0]),s=i(n[1]),a=i(n[2]);return[o,s,a]}function h5(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0}function dSd(e){let t=zT(e),r=[t[0],t[1],t[2]],n=[t[0],t[1]+1,0];return{lower:r,upper:n}}function mSd(e){let t=zT(e),[r,n,i]=t,o=[r,n,i],s;return s=r>0?[r+1,0,0]:n>0?[0,n+1,0]:[0,0,i+1],{lower:o,upper:s}}function hSd(e){let r=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!r)throw new Ed(`Invalid wildcard semver: ${e}`);let n=r.split("."),i=parseInt(n[0],10);if(isNaN(i))throw new Ed(`Invalid wildcard semver: ${e}`);let o,s;if(n.length===1)o=[i,0,0],s=[i+1,0,0];else{let a=parseInt(n[1],10);if(isNaN(a))throw new Ed(`Invalid wildcard semver: ${e}`);o=[i,a,0],s=[i,a+1,0]}return{lower:o,upper:s}}function $hc(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new Ed(`${e} is in an invalid date format`)}throw new Ed(`The date provided ${e} must be a string, number, or date object`)}function gSd(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var M2r=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var ASd=100,Yhc=3e4,ySd=5e4,bSd=50,ESd=500,L2r=class extends ONt{constructor(t,r={}){if(super(t,r),this._memoryStorage=new M2r,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,ASd):Yhc,typeof r.waitUntilDebounceMs=="number"&&(this.options.waitUntilDebounceMs=Math.max(r.waitUntilDebounceMs,0)),typeof r.waitUntilMaxWaitMs=="number"&&(this.options.waitUntilMaxWaitMs=Math.max(r.waitUntilMaxWaitMs,0)),r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new Q2r({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new W9(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||ySd}enqueue(t,r,n){super.enqueue(t,r,n),this.scheduleDebouncedFlush()}async flush(){let t=super.flush(),r=this.options.waitUntil;if(r&&!this._waitUntilCycle)try{r(t.catch(()=>{}))}catch{}return t}scheduleDebouncedFlush(){let t=this.options.waitUntil;if(!t||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let s,a=new Promise(c=>{s=c});try{t(a)}catch{return}this._waitUntilCycle={resolve:s,startedAt:Date.now(),timer:void 0}}let r=Date.now()-this._waitUntilCycle.startedAt,n=this.options.waitUntilMaxWaitMs??ESd,i=r>=n;if(this._waitUntilCycle.timer!==void 0&&clearTimeout(this._waitUntilCycle.timer),i)return void this.resolveWaitUntilFlush();let o=this.options.waitUntilDebounceMs??bSd;this._waitUntilCycle.timer=Oue(()=>{this.resolveWaitUntilFlush()},o)}_consumeWaitUntilCycle(){let t=this._waitUntilCycle;return t&&(clearTimeout(t.timer),this._waitUntilCycle=void 0),t?.resolve}async resolveWaitUntilFlush(){let t=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{t?.()}}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return Vhc}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=Yhc){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let x=this._flagOverrides[t];if(x===void 0)return;let C=this._payloadOverrides?.[t];return{key:t,enabled:x!==!1,variant:typeof x=="string"?x:void 0,payload:C}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f,m=!1,h,g,A,b,v,E;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let x=this.featureFlagsPoller?.featureFlagsByKey[t];if(x)try{let C=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(x,d,{matchValue:i});if(C){m=!0;let _=C.value;b=x.id,E="Evaluated locally",f={key:t,enabled:_!==!1,variant:typeof _=="string"?_:void 0,payload:C.payload??void 0}}}catch(C){if(C instanceof WY||C instanceof Ed)this._logger?.info(`${C.name} when computing flag locally: ${t}: ${C.message}`);else throw C}}if(!m&&!c){let x=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(x===void 0)A=BNt.UNKNOWN_ERROR;else{h=x.requestId,g=x.evaluatedAt;let C=[];x.errorsWhileComputingFlags&&C.push(BNt.ERRORS_WHILE_COMPUTING),x.quotaLimited?.includes("feature_flags")&&C.push(BNt.QUOTA_LIMITED);let _=x.flags[t];if(_===void 0)C.push(BNt.FLAG_MISSING);else{b=_.metadata?.id,v=_.metadata?.version,E=_.reason?.description??_.reason?.code;let w;if(_.metadata?.payload!==void 0)try{w=JSON.parse(_.metadata.payload)}catch{w=_.metadata.payload}f={key:t,enabled:_.enabled,variant:_.variant,payload:w}}C.length>0&&(A=C.join(","))}}if(o){let x=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,C=`${t}_${x}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C];let _={$feature_flag:t,$feature_flag_response:x,$feature_flag_id:b,$feature_flag_version:v,$feature_flag_reason:E,locally_evaluated:m,[`$feature/${t}`]:x,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():g};if(m&&this.featureFlagsPoller){let w=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();w!==void 0&&(_.$feature_flag_definitions_loaded_at=w)}A&&(_.$feature_flag_error=A),this.capture({distinctId:r,event:"$feature_flag_called",properties:_,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},g=!0;if(f&&(m=f.response,h=f.payloads,g=f.fallbackToFlags),g&&!c){let A=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...A.flags||{}},h={...h,...A.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){let r=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown();try{return await super._shutdown(t)}finally{r?.()}}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=Oue(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(ohc(s)&&r&&o in r){let a={};for(let[c,u]of Object.entries(s))a[String(c)]=String(u);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!W9.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(W9.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!W9.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");return this.addPendingPromise(W9.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=Hbe(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:c,uuid:u});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,c,h)}return f.event,{}}).then(h=>{let g={};if(h)for(let[b,v]of Object.entries(h))g[`$feature/${b}`]=v;let A=Object.keys(h||{}).filter(b=>h?.[b]!==!1).sort();return A.length>0&&(g.$active_feature_flags=A),g}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&ehc(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var Xhc=require("async_hooks"),U2r=class{constructor(){this.storage=new Xhc.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var Zhc="posthog-node";function vSd(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let c=s.tags[JXi.POSTHOG_ID_TAG];if(c===void 0)return s;let u=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${c}`,u).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:f}),s}}var JXi=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=Zhc,this.name=Zhc,this.setupOnce=function(s,a){let c=a()?.getClient()?.getDsn()?.projectId;s(vSd(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};W9.errorPropertiesBuilder=new I2.ErrorPropertiesBuilder([new I2.EventCoercer,new I2.ErrorCoercer,new I2.ObjectCoercer,new I2.StringCoercer,new I2.PrimitiveCoercer],I2.createStackParser("node:javascript",I2.nodeStackLineParser),[Kmc(),Qhc]);var Kbe=class extends L2r{getLibraryId(){return"posthog-node"}initializeContext(){return new U2r}};var z2r=class{posthog;constructor({posthogApiKey:t}){this.posthog=new Kbe(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"4.79.0",usingAccessToken:!0}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}};var PNt=class{async sendEvent(){}async identify(){}async flush(){}};Jt();var LYe=require("fs/promises"),egc=require("os"),tgc=require("path");var ISd="id",wSd=".fern",RNt=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new Kbe(r),this.userId=t==null?void 0:dWi(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"4.79.0",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await bf({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ke(Wt.of((0,egc.homedir)()),Be.of(wSd),Be.of(ISd));await ar(t)||(await(0,LYe.mkdir)((0,tgc.dirname)(t),{recursive:!0}),await(0,LYe.writeFile)(t,V_())),this.persistedDistinctId=(await(0,LYe.readFile)(t)).toString()}return this.persistedDistinctId}};var YXi;async function DNt(){return YXi==null&&(YXi=await xSd()),YXi}async function xSd(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new PNt;let r=await ZBr();return r!=null?new RNt({token:r,posthogApiKey:e}):await TY()!=null?new z2r({posthogApiKey:e}):new RNt({token:void 0,posthogApiKey:e})}catch{return new PNt}}Pt();var FNt=ve(require("process"),1);xVe();var igc=ve(b5i(),1),ogc=ve(ngc(),1);function aS(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=iq(e),e.length===0))return 0;e=e.replace((0,ogc.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(igc.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function V2r(e){let t=0;for(let r of e.split(`
|
|
1745
1745
|
`))t=Math.max(t,aS(r));return t}var Cgc=ve(ZXi(),1);var _Sd=/[\p{Lu}]/u,SSd=/[\p{Ll}]/u,cgc=/^[\p{Lu}](?![\p{Lu}])/gu,pgc=/([\p{Alpha}\p{N}_]|$)/u,eZi=/[_.\- ]+/,TSd=new RegExp("^"+eZi.source),ugc=new RegExp(eZi.source+pgc.source,"gu"),lgc=new RegExp("\\d+"+pgc.source,"gu"),OSd=(e,t,r,n)=>{let i=!1,o=!1,s=!1,a=!1;for(let c=0;c<e.length;c++){let u=e[c];a=c>2?e[c-3]==="-":!0,i&&_Sd.test(u)?(e=e.slice(0,c)+"-"+e.slice(c),i=!1,s=o,o=!0,c++):o&&s&&SSd.test(u)&&(!a||n)?(e=e.slice(0,c-1)+"-"+e.slice(c-1),s=o,o=!1,i=!0):(i=t(u)===u&&r(u)!==u,s=o,o=r(u)===u&&t(u)!==u)}return e},BSd=(e,t)=>(cgc.lastIndex=0,e.replace(cgc,r=>t(r))),PSd=(e,t)=>(ugc.lastIndex=0,lgc.lastIndex=0,e.replace(ugc,(r,n)=>t(n)).replace(lgc,r=>t(r)));function tZi(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),n=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return e.length===1?eZi.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=OSd(e,r,n,t.preserveConsecutiveUppercase)),e=e.replace(TSd,""),e=t.preserveConsecutiveUppercase?BSd(e,r):r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),PSd(e,n))}var oZi=ve(dgc(),1);xVe();var mgc=(e=0)=>t=>`\x1B[${t+e}m`,hgc=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ggc=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,n0={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},RS0=Object.keys(n0.modifier),kSd=Object.keys(n0.color),NSd=Object.keys(n0.bgColor),DS0=[...kSd,...NSd];function jSd(){let e=new Map;for(let[t,r]of Object.entries(n0)){for(let[n,i]of Object.entries(r))n0[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=n0[n],e.set(i[0],i[1]);Object.defineProperty(n0,t,{value:r,enumerable:!1})}return Object.defineProperty(n0,"codes",{value:e,enumerable:!1}),n0.color.close="\x1B[39m",n0.bgColor.close="\x1B[49m",n0.color.ansi=mgc(),n0.color.ansi256=hgc(),n0.color.ansi16m=ggc(),n0.bgColor.ansi=mgc(10),n0.bgColor.ansi256=hgc(10),n0.bgColor.ansi16m=ggc(10),Object.defineProperties(n0,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>n0.rgbToAnsi256(...n0.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>n0.ansi256ToAnsi(n0.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>n0.ansi256ToAnsi(n0.hexToAnsi256(t)),enumerable:!1}}),n0}var QSd=jSd(),Agc=QSd;var q2r=new Set(["\x1B","\x9B"]),MSd=39,nZi="\x07",Egc="[",LSd="]",vgc="m",iZi=`${LSd}8;;`,ygc=e=>`${q2r.values().next().value}${Egc}${e}${vgc}`,bgc=e=>`${q2r.values().next().value}${iZi}${e}${nZi}`,USd=e=>e.split(" ").map(t=>aS(t)),rZi=(e,t,r)=>{let n=[...t],i=!1,o=!1,s=aS(iq(e[e.length-1]));for(let[a,c]of n.entries()){let u=aS(c);if(s+u<=r?e[e.length-1]+=c:(e.push(c),s=0),q2r.has(c)&&(i=!0,o=n.slice(a+1).join("").startsWith(iZi)),i){o?c===nZi&&(i=!1,o=!1):c===vgc&&(i=!1);continue}s+=u,s===r&&a<n.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},zSd=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(aS(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},VSd=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,o,s=USd(e),a=[""];for(let[u,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=aS(a[a.length-1]);if(u!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),p=0),(p>0||r.trim===!1)&&(a[a.length-1]+=" ",p++)),r.hard&&s[u]>t){let d=t-p,f=1+Math.floor((s[u]-d-1)/t);Math.floor((s[u]-1)/t)<f&&a.push(""),rZi(a,l,t);continue}if(p+s[u]>t&&p>0&&s[u]>0){if(r.wordWrap===!1&&p<t){rZi(a,l,t);continue}a.push("")}if(p+s[u]>t&&r.wordWrap===!1){rZi(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(u=>zSd(u)));let c=[...a.join(`
|
|
1746
1746
|
`)];for(let[u,l]of c.entries()){if(n+=l,q2r.has(l)){let{groups:d}=new RegExp(`(?:\\${Egc}(?<code>\\d+)m|\\${iZi}(?<uri>.*)${nZi})`).exec(c.slice(u).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===MSd?void 0:f}else d.uri!==void 0&&(o=d.uri.length===0?void 0:d.uri)}let p=Agc.codes.get(Number(i));c[u+1]===`
|
|
1747
1747
|
`?(o&&(n+=bgc("")),i&&p&&(n+=ygc(p))):l===`
|
|
@@ -1798,7 +1798,7 @@ public static extern void CredFree(IntPtr credential);
|
|
|
1798
1798
|
${this.indentBlock(this.suggestion)}`}indentBlock(t,r=" "){return t.split(`
|
|
1799
1799
|
`).map(n=>n.length>0?`${r}${n}`:n).join(`
|
|
1800
1800
|
`)}};var tAc=ve($0(),1),GYe=class{absoluteFilePath;relativeFilePath;document;source;constructor({absoluteFilePath:t,relativeFilePath:r,document:n,source:i}){this.absoluteFilePath=t,this.relativeFilePath=r,this.document=n,this.source=i}get errors(){return this.document.errors}toJS(){return this.document.toJS()}getSourceLocation(t){let r=this.document.getIn(t,!0);if(!(0,tAc.isNode)(r))return this.getRootSourceLocation();let n=r.range;return n==null?this.getRootSourceLocation():this.offsetToLocation(n[0])}getRootSourceLocation(){return new g5({absoluteFilePath:this.absoluteFilePath,relativeFilePath:this.relativeFilePath,line:1,column:1})}offsetToLocation(t){let r=1,n=-1;for(let i=0;i<t&&i<this.source.length;i++)this.source[i]===`
|
|
1801
|
-
`&&(r++,n=i);return new g5({absoluteFilePath:this.absoluteFilePath,relativeFilePath:this.relativeFilePath,line:r,column:t-n})}};var Z2r="$ref",ejr=class{cwd;constructor({cwd:t}){this.cwd=t}async resolve({document:t}){let r=t.absoluteFilePath,n={cwd:this.cwd,document:t,originalFile:r,currentFile:r,resolutionStack:new Set([r]),referencedDocuments:{},issues:[],pathMappings:[],yamlPathIndex:0,refFromLocation:void 0},i=await this.resolveValue({context:n,yamlPath:[],value:t.toJS()});return n.issues.length>0?{success:!1,issues:n.issues}:{success:!0,data:i,pathMappings:n.pathMappings}}getSourceLocationWithMappings({document:t,pathMappings:r,yamlPath:n}){let i;for(let o of r)this.yamlPathStartsWith(n,o.yamlPath)&&(i==null||o.yamlPath.length>i.yamlPath.length)&&(i=o);if(i!=null){let o=n.slice(i.yamlPath.length);return i.document.getSourceLocation(o).withRefFrom(i.refFromLocation)}return t.getSourceLocation(n)}async resolveValue({context:t,yamlPath:r,value:n}){if(n==null)return n;if(Array.isArray(n))return Promise.all(n.map((i,o)=>this.resolveValue({context:t,yamlPath:[...r,o],value:i})));if(typeof n=="object"){let i=n;if(Z2r in i){let s=[...r,Z2r];return this.resolveRef({context:t,yamlPath:s,location:this.getSourceLocation({context:t,yamlPath:s}),obj:i,refValue:i[Z2r]})}let o={};for(let s of Object.keys(i))o[s]=await this.resolveValue({context:t,yamlPath:[...r,s],value:i[s]});return o}return n}async resolveRef({context:t,yamlPath:r,location:n,obj:i,refValue:o}){if(typeof o!="string")return t.issues.push(new BA({message:`$ref must be a string, got ${typeof o}`,location:n,yamlPath:r})),i;let s=Object.keys(i);if(s.length>1){let d=s.filter(f=>f!==Z2r);return t.issues.push(new BA({message:`$ref cannot have sibling keys; found ${d.join(", ")}`,location:n,yamlPath:r})),i}if(o.includes("#"))return t.issues.push(new BA({message:`JSON pointer and in-document references are not supported: ${o}`,location:n,yamlPath:r})),i;let a=this.resolveFilePath({currentFile:t.currentFile,refValue:o});if(t.resolutionStack.has(a)){let d=[...t.resolutionStack,a].join(" -> ");return t.issues.push(new BA({message:`Circular $ref detected: ${d}`,location:n,yamlPath:r})),i}let c=await this.parseFile({context:t,referencedFilePath:a,yamlPath:r,location:n,refValue:o});if(c===void 0)return i;if(c===null)return t.issues.push(new BA({message:`$ref resolves to null: ${o}`,location:n,yamlPath:r})),i;let u=r.slice(0,-1),l=t.referencedDocuments[a];return l!=null&&t.pathMappings.push({yamlPath:u,document:l,refFromLocation:n}),await this.resolveReferencedFile({context:t,referencedFilePath:a,refFromLocation:n,yamlPath:u,value:c})}async resolveReferencedFile({context:t,referencedFilePath:r,refFromLocation:n,yamlPath:i,value:o}){let s=t.currentFile,a=t.yamlPathIndex,c=t.refFromLocation;t.currentFile=r,t.yamlPathIndex=i.length,t.refFromLocation=n,t.resolutionStack.add(r);try{return await this.resolveValue({context:t,yamlPath:i,value:o})}finally{t.resolutionStack.delete(r),t.currentFile=s,t.yamlPathIndex=a,t.refFromLocation=c}}async parseFile({context:t,referencedFilePath:r,yamlPath:n,location:i,refValue:o}){if(!await ar(r)){t.issues.push(new BA({message:`Referenced file does not exist: ${o}`,location:i,yamlPath:n}));return}let s=await(0,rAc.readFile)(r,"utf-8"),a=(0,nAc.parseDocument)(s);if(a.errors.length>0){let u=a.errors.map(l=>l.message).join("; ");t.issues.push(new BA({message:`Failed to parse referenced file ${o}: ${u}`,location:i,yamlPath:n}));return}let c=new GYe({absoluteFilePath:r,relativeFilePath:Be.of(Js(t.cwd,r)),document:a,source:s});return t.referencedDocuments[r]=c,c.toJS()}getSourceLocation({context:t,yamlPath:r}){if(t.currentFile===t.originalFile)return t.document.getSourceLocation(r);let n=this.getSourceLocationFromCurrentFile({context:t,yamlPath:r});return t.refFromLocation!=null?n.withRefFrom(t.refFromLocation):n}yamlPathStartsWith(t,r){if(r.length>t.length)return!1;for(let n=0;n<r.length;n++)if(t[n]!==r[n])return!1;return!0}getSourceLocationFromCurrentFile({context:t,yamlPath:r}){let n=t.referencedDocuments[t.currentFile];if(n!=null){let i=r.slice(t.yamlPathIndex);return n.getSourceLocation(i)}return this.createLocationForReferencedFile({context:t,absoluteFilePath:t.currentFile})}createLocationForReferencedFile({context:t,absoluteFilePath:r}){return new g5({absoluteFilePath:r,relativeFilePath:Be.of(Js(t.cwd,r)),line:1,column:1})}resolveFilePath({currentFile:t,refValue:r}){let n=Pn(t);return Ke(n,Be.of(r))}};Pt();Jt();function iAc(e){return $Y(e,new WeakMap)}function v1d(e){return e._zod?.def}function $Y(e,t){if(t.has(e))return t.get(e);let r=v1d(e);if(r==null)return e;switch(r.type){case"object":{let n=r.shape??{},i={};for(let[s,a]of Object.entries(n))i[s]=$Y(a,t);let o=se.object(i).strict();return t.set(e,o),o}case"array":{let n=r.element;return n!=null?se.array($Y(n,t)):e}case"optional":{let n=r.innerType;return n!=null?$Y(n,t).optional():e}case"nullable":{let n=r.innerType;return n!=null?$Y(n,t).nullable():e}case"union":{let n=r.options;return n!=null?se.union(n.map(i=>$Y(i,t))):e}case"record":{let n=r.keyType,i=r.valueType;return n!=null&&i!=null?se.record(n,$Y(i,t)):e}case"lazy":{let n=r.getter;if(n==null)return e;let i=se.lazy(()=>$Y(n(),t));return t.set(e,i),i}case"tuple":{let n=r.items;return n==null?e:se.tuple(n.map(i=>$Y(i,t)))}case"default":{let n=r.innerType;return n!=null?$Y(n,t).default(r.defaultValue):e}default:return e}}GA();var vZi=require("fs/promises"),rjr=ve($0(),1);var tjr=class{async parse(t){let r=await(0,vZi.readFile)(t,"utf-8");return(0,rjr.parse)(r)}async parseDocument({absoluteFilePath:t,cwd:r}){let n=await(0,vZi.readFile)(t,"utf-8"),i=(0,rjr.parseDocument)(n),o=Ks.of(x3e(r,t));return new GYe({absoluteFilePath:t,relativeFilePath:o,document:i,source:n})}};var njr=class{document;constructor(t){this.document=t}toSourced(t){return this.toSourcedInternal(t,[])}toSourcedInternal(t,r){let n=this.document.getSourceLocation(r);if(t===null)return new Xbe(null,n);if(t===void 0)return new Xbe(void 0,n);if(Array.isArray(t))return bZi({value:t,location:n,wrapChild:(i,o)=>this.toSourcedInternal(i,[...r,o])});if(t instanceof Object)return EZi({value:t,location:n,wrapChild:(i,o)=>this.toSourcedInternal(i,[...r,o])});switch(typeof t){case"string":return new $Nt(t,n);case"number":return new HNt(t,n);case"boolean":return new KNt(t,n);default:throw new Error(`Unexpected value type: ${typeof t}`)}}};var JNt=class{parser;cwd;referenceResolver;constructor({cwd:t}){this.parser=new tjr,this.cwd=t,this.referenceResolver=new ejr({cwd:t})}async load({absoluteFilePath:t,schema:r,resolveReferences:n=!0,strict:i=!1}){let o=await this.parseDocument(t),s=this.getYamlErrors(o);if(s.length>0)return{success:!1,issues:s};let a=await this.resolveReferences({document:o,resolveReferences:n});if(!a.success)return{success:!1,issues:a.issues};let u=(i?iAc(r):r).safeParse(a.data);if(!u.success)return{success:!1,issues:u.error.issues.map(d=>{let f=d.path.filter(m=>typeof m!="symbol");return new BA({yamlPath:f,message:this.formatZodIssue(d),location:this.referenceResolver.getSourceLocationWithMappings({document:o,pathMappings:a.pathMappings,yamlPath:f})})})};let l=new njr(o);return{success:!0,data:u.data,sourced:l.toSourced(u.data),absoluteFilePath:t,relativeFilePath:Be.of(Js(this.cwd,t)),pathMappings:a.pathMappings}}async parseDocument(t){try{return await this.parser.parseDocument({absoluteFilePath:t,cwd:this.cwd})}catch(r){throw new Error(`Failed to parse YAML file ${t}: ${Ai(r)}`)}}async resolveReferences({document:t,resolveReferences:r}){if(!r)return{success:!0,data:t.toJS(),pathMappings:[]};let n=await this.referenceResolver.resolve({document:t});return n.success?n:{success:!1,issues:n.issues}}getYamlErrors(t){return t.errors.length===0?[]:t.errors.map(r=>{let n=r.linePos?.[0]?.line??1,i=r.linePos?.[0]?.col??1;return new BA({message:r.message,location:new g5({absoluteFilePath:t.absoluteFilePath,relativeFilePath:t.relativeFilePath,line:n,column:i})})})}formatZodIssue(t){let r=t.path.join(".");switch(t.code){case"invalid_type":return t.message.endsWith("received undefined")?r.length>0?`${r} is required`:"value is required":r.length>0?`${r} must be a ${t.expected}`:`must be a ${t.expected}`;case"invalid_value":{if(t.values!=null){let n=t.values.join(", ");return r.length>0?`${r} must be one of: ${n}`:`must be one of: ${n}`}return t.message}case"unrecognized_keys":return`unknown key(s): ${t.keys.join(", ")}`;case"invalid_union":{let n=[];for(let o of t.errors)for(let s of o)s.code==="unrecognized_keys"&&n.push(...s.keys);if(n.length>0)return`unknown key(s): ${[...new Set(n)].join(", ")}`;let i=new Set;for(let o of t.errors)for(let s of o)s.code==="invalid_type"&&i.add(s.expected);if(i.size>0){let o=Array.from(i).join(" or ");return r.length>0?`${r} must be a ${o}`:`must be a ${o}`}return r.length>0?`${r} has an invalid value`:"invalid value"}case"invalid_format":return r.length>0?`${r} must be a valid ${t.format}`:`must be a valid ${t.format}`;default:return t.message}}};Jt();var ijr=class{from;constructor(t){this.from=t.from}async findOrThrow({filename:t,remediationMessage:r}){let n=await this.find({filename:t});if(n==null)throw new Error(`${t} file not found in any parent directory from ${this.from}`);return n}async find({filename:t}){let r=await hd(t,{cwd:this.from,type:"file"});if(r==null)return;let n=Wt.of(r);if(await ar(n))return n}};var oAc="fern.yml",YNt=class{finder;loader;constructor(t={}){let r=Wt.of(t.cwd??process.cwd());this.finder=new ijr({from:r}),this.loader=new JNt({cwd:r})}async loadOrThrow(){let t=await this.load();if(t.type==="notFound")throw new Error(`${oAc} file not found in any parent directory; did you forget to run \`fern init\`?`);if(t.type==="failure")throw new P9(t.issues);return t}async load(){let t=await this.finder.find({filename:oAc});if(t==null)return{type:"notFound"};let r=await this.loader.load({absoluteFilePath:t,schema:Pkt,strict:!0});return r.success?{type:"success",...r}:{type:"failure",issues:r.issues}}};Jt();var s2e=require("fs/promises"),sAc=ve(z_r(),1),ojr=ve(require("os"),1),aAc=require("os"),cAc=require("path");var XNt=class e{posthog;sentry;baseTags;accumulatedTags={};distinctId;static async create({isTTY:t}){let r=await e.getDistinctId();return new e({isTTY:t,distinctId:r})}constructor({isTTY:t,distinctId:r}){this.distinctId=r;let n=this.isTelemetryEnabled(),i="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal";this.baseTags={version:"*",arch:ojr.arch(),ci:sAc.default,os:ojr.platform(),tty:t,usingAccessToken:process.env.FERN_TOKEN!=null},this.posthog=i!=null&&i.length>0&&n?new Kbe(i):void 0;let o="";if(o!=null&&o.length>0&&n){let s="production";if(s==null||s.length===0)throw new Error("SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured");this.sentry=rIt({dsn:o,release:`cli@${"*"}`,environment:s,defaultIntegrations:!1,integrations:[r5e()],tracesSampleRate:0}),nIt()}}sendEvent(t,r){if(this.posthog!=null)try{this.posthog.capture({distinctId:this.distinctId,event:t,properties:{...this.baseTags,...this.accumulatedTags,...r}})}catch{}}sendLifecycleEvent(t){if(this.posthog!=null)try{this.posthog.capture({distinctId:this.distinctId,event:"cli",properties:{...this.baseTags,...this.accumulatedTags,...t}})}catch{}}tag(t){Object.assign(this.accumulatedTags,t)}captureException(t,{errorCode:r}){if(this.sentry!==void 0)try{this.sentry.captureException(t,{captureContext:{user:{id:this.distinctId},tags:{...this.baseTags,...this.accumulatedTags,"error.code":r}}})}catch{}}async flush(){let t=[];this.posthog!=null&&t.push(Promise.race([this.posthog.shutdown().catch(()=>{}),new Promise(r=>setTimeout(r,3e3))])),this.sentry!==void 0&&t.push(Promise.resolve(this.sentry.flush(2e3)).catch(()=>{})),await Promise.all(t)}static async getDistinctId(){let t=e.getDistinctIdFilepath(),r=null;try{await ar(t)||(await(0,s2e.mkdir)((0,cAc.dirname)(t),{recursive:!0}),await(0,s2e.writeFile)(t,V_(),{flag:"wx"}));let n=(await(0,s2e.readFile)(t)).toString().trim();if(r=n,!q4i(n)){let i=V_();await(0,s2e.writeFile)(t,i),r=i}}catch{r=V_()}return(r==null||r.length===0)&&(r=V_()),r}static getDistinctIdFilepath(){return Ke(Wt.of((0,aAc.homedir)()),Be.of(".fern"),Be.of("id"))}isTelemetryEnabled(){let t=process.env.FERN_TELEMETRY_DISABLED;return t!=null&&t.length>0?!1:new qD().loadTelemetryEnabledSync()??!0}};Jt();var WYe="api",sjr=class{cwd;issues=[];constructor({cwd:t}){this.cwd=t}async convert({fernYml:t}){let{api:r,apis:n}=t.data,i=t.sourced;if(r!=null&&n!=null)return this.issues.push(new BA({message:"Cannot define both 'api' and 'apis' in fern.yml.",location:i.$loc})),{success:!1,issues:this.issues};if(r==null&&n==null)return{success:!0,apis:{}};let o={};return r!=null&&!fI(i.api)&&(o=await this.convertApi({absoluteFernYmlPath:this.resolveBasePathForKey("api",t),api:r,sourcedApi:i.api})),n!=null&&!fI(i.apis)&&(o=await this.convertApis({absoluteFernYmlPath:t.absoluteFilePath,pathMappings:t.pathMappings,apis:n,sourcedApis:i.apis})),this.issues.length>0?{success:!1,issues:this.issues}:{success:!0,apis:o}}async convertApi({absoluteFernYmlPath:t,api:r,sourcedApi:n}){if(fI(n))return{};let o={specs:await this.convertSpecs({absoluteFernYmlPath:t,specs:r.specs,sourced:n.specs}),auth:r.auth,authSchemes:r.authSchemes,defaultUrl:r.defaultUrl,defaultEnvironment:r.defaultEnvironment,environments:r.environments,headers:r.headers};return{[WYe]:o}}async convertApis({absoluteFernYmlPath:t,pathMappings:r,apis:n,sourcedApis:i}){if(fI(i))return{};let o=Object.entries(n).filter(([a])=>!fI(i[a])).map(([a,c])=>({apiName:a,apiDef:c,sourcedApiDef:i[a]})).filter(a=>!fI(a.sourcedApiDef)),s=await Promise.all(o.map(async({apiName:a,apiDef:c,sourcedApiDef:u})=>{let l=this.findBasePathInMappings(["apis",a],r)??this.findBasePathInMappings(["apis"],r)??t,d={specs:await this.convertSpecs({absoluteFernYmlPath:l,specs:c.specs,sourced:u.specs}),auth:c.auth,authSchemes:c.authSchemes,defaultUrl:c.defaultUrl,defaultEnvironment:c.defaultEnvironment,environments:c.environments,headers:c.headers};return[a,d]}));return Object.fromEntries(s)}async convertSpecs({absoluteFernYmlPath:t,specs:r,sourced:n}){this.validateSpecCombinations({specs:r,sourced:n});let i=[];for(let o=0;o<r.length;o++){let s=r[o],a=n[o];s==null||fI(a)||i.push({spec:s,sourced:a})}return await Promise.all(i.map(({spec:o,sourced:s})=>this.convertSpec({absoluteFernYmlPath:t,spec:o,sourced:s})))}async convertSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){if("openapi"in r&&"openapi"in n)return await this.convertOpenApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("asyncapi"in r&&"asyncapi"in n)return await this.convertAsyncApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("proto"in r&&"proto"in n)return await this.convertProtobufSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("fern"in r&&"fern"in n)return await this.convertFernSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("conjure"in r&&"conjure"in n)return await this.convertConjureSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("openrpc"in r&&"openrpc"in n)return await this.convertOpenRpcSpec({absoluteFernYmlPath:t,spec:r,sourced:n});throw new Error(`Unknown spec type: ${JSON.stringify(r)}`)}async convertOpenApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={openapi:await this.resolvePath({absoluteFernYmlPath:t,path:r.openapi,sourced:n.openapi})};return r.origin!=null&&(i.origin=r.origin),r.overrides!=null&&!fI(n.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.overrides,sourced:n.overrides})),r.overlays!=null&&!fI(n.overlays)&&(i.overlays=await this.resolvePath({absoluteFernYmlPath:t,path:r.overlays,sourced:n.overlays})),r.namespace!=null&&(i.namespace=r.namespace),r.settings!=null&&(i.settings=r.settings),i}async convertAsyncApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={asyncapi:await this.resolvePath({absoluteFernYmlPath:t,path:r.asyncapi,sourced:n.asyncapi})};return r.overrides!=null&&!fI(n.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.overrides,sourced:n.overrides})),r.settings!=null&&(i.settings=r.settings),i}async convertProtobufSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={root:await this.resolvePath({absoluteFernYmlPath:t,path:r.proto.root,sourced:n.proto.root})};if(r.proto.target!=null&&!fI(n.proto.target)&&(i.target=await this.resolvePath({absoluteFernYmlPath:t,path:r.proto.target,sourced:n.proto.target})),r.proto.overrides!=null&&!fI(n.proto.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.proto.overrides,sourced:n.proto.overrides})),r.proto.localGeneration!=null&&(i.localGeneration=r.proto.localGeneration),r.proto.fromOpenapi!=null&&(i.fromOpenapi=r.proto.fromOpenapi),r.proto.dependencies!=null&&!fI(n.proto.dependencies)){let s=[];for(let a=0;a<r.proto.dependencies.length;a++){let c=r.proto.dependencies[a],u=n.proto.dependencies[a];c!=null&&!fI(u)&&s.push(await this.resolvePath({absoluteFernYmlPath:t,path:c,sourced:u}))}i.dependencies=s}let o={proto:i};return r.settings!=null&&(o.settings=r.settings),o}async convertFernSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={fern:await this.resolvePath({absoluteFernYmlPath:t,path:r.fern,sourced:n.fern})};return r.settings!=null&&(i.settings=r.settings),i}async convertConjureSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={conjure:await this.resolvePath({absoluteFernYmlPath:t,path:r.conjure,sourced:n.conjure})};return r.settings!=null&&(i.settings=r.settings),i}async convertOpenRpcSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={openrpc:await this.resolvePath({absoluteFernYmlPath:t,path:r.openrpc,sourced:n.openrpc})};return r.overrides!=null&&!fI(n.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.overrides,sourced:n.overrides})),r.settings!=null&&(i.settings=r.settings),i}async resolvePathOrPaths({absoluteFernYmlPath:t,paths:r,sourced:n}){if(!Array.isArray(r))return await this.resolvePath({absoluteFernYmlPath:t,path:r,sourced:n});let i=[],o=n;for(let s=0;s<r.length;s++){let a=r[s],c=o[s];a!=null&&!fI(c)&&i.push(await this.resolvePath({absoluteFernYmlPath:t,path:a,sourced:c}))}return i}async resolvePath({absoluteFernYmlPath:t,path:r,sourced:n}){let i=Pn(t),o=Ke(i,Be.of(r));if(!await ar(o)){let s=Be.of(Js(this.cwd,o));this.issues.push(new BA({message:`File "${s}" does not exist`,location:n.$loc}))}return o}validateSpecCombinations({specs:t,sourced:r}){let n=[],i=[],o=[];for(let s=0;s<t.length;s++){let a=t[s],c=r[s];if(!(a==null||fI(c))){if("fern"in a){n.push(c);continue}if("conjure"in a){i.push(c);continue}o.push(c)}}if(n.length>1)for(let s of n)this.issues.push(new BA({message:"Multiple Fern specs are not allowed. Use multiple definition files within a single Fern definition directory instead.",location:s.fern.$loc}));if(i.length>1)for(let s of i)this.issues.push(new BA({message:"Multiple Conjure specs are not allowed.",location:s.conjure.$loc}));if(n.length>0&&(i.length>0||o.length>0))for(let s of n)this.issues.push(new BA({message:"Fern specs cannot be mixed with other spec types. Fern definitions are a standalone definition type.",location:s.fern.$loc}));if(i.length>0&&(o.length>0||n.length>0))for(let s of i)this.issues.push(new BA({message:"Conjure specs cannot be mixed with other spec types. Conjure definitions are a standalone definition type.",location:s.conjure.$loc}))}findBasePathInMappings(t,r){for(let n of r)if(n.yamlPath.length===t.length&&t.every((i,o)=>i===n.yamlPath[o]))return n.document.absoluteFilePath}resolveBasePathForKey(t,r){return this.findBasePathInMappings([t],r.pathMappings)??r.absoluteFilePath}};var I1d="docs",ajr=class{issues=[];convert({fernYml:t}){let r=t.data.docs;if(r==null)return{success:!1,issues:[]};if(this.validateInstances({docs:r,fernYml:t}),this.issues.length>0)return{success:!1,issues:this.issues};let n=t.pathMappings.find(o=>o.yamlPath.length===1&&o.yamlPath[0]===I1d),i=n!=null?n.document.absoluteFilePath:t.absoluteFilePath;return{success:!0,config:{raw:r,absoluteFilePath:i}}}validateInstances({docs:t,fernYml:r}){t.instances.length===0&&this.issues.push(new BA({message:"You must specify at least one docs instance",location:r.sourced.$loc}))}};var HY=["csharp","go","java","php","python","ruby","rust","swift","typescript"],$Ye={typescript:"TypeScript",python:"Python",go:"Go",java:"Java",csharp:"C#",ruby:"Ruby",php:"PHP",rust:"Rust",swift:"Swift"},cjr=["typescript","python","go","java","csharp","ruby","php","rust","swift"];var ujr={csharp:"fernapi/fern-csharp-sdk",go:"fernapi/fern-go-sdk",java:"fernapi/fern-java-sdk",php:"fernapi/fern-php-sdk",python:"fernapi/fern-python-sdk",ruby:"fernapi/fern-ruby-sdk",rust:"fernapi/fern-rust-sdk",swift:"fernapi/fern-swift-sdk",typescript:"fernapi/fern-typescript-sdk"},uAc={"fernapi/fern-csharp-sdk":"csharp","fernapi/fern-go-sdk":"go","fernapi/fern-java-sdk":"java","fernapi/fern-php-sdk":"php","fernapi/fern-python-sdk":"python","fernapi/fern-ruby-sdk":"ruby","fernapi/fern-rust-sdk":"rust","fernapi/fern-swift-sdk":"swift","fernapi/fern-typescript-sdk":"typescript","fernapi/fern-typescript-express":"typescript","fernapi/fern-fastapi-server":"python","fernapi/fern-java-spring":"java"},lAc={"fernapi/fern-python-sdk":"python-sdk","fernapi/fern-pydantic-model":"pydantic","fernapi/fern-fastapi-server":"fastapi","fernapi/fern-typescript":"ts-sdk","fernapi/fern-typescript-browser-sdk":"ts-sdk","fernapi/fern-typescript-node-sdk":"ts-sdk","fernapi/fern-typescript-sdk":"ts-sdk","fernapi/fern-typescript-express":"ts-express","fernapi/fern-java-sdk":"java-sdk","fernapi/fern-java-model":"java-model","java-model":"java-model","fernapi/fern-java-spring":"java-spring","fernapi/fern-go-sdk":"go-sdk","fernapi/fern-go-model":"go-model","fernapi/fern-csharp-sdk":"csharp-sdk","fernapi/fern-csharp-model":"csharp-model","fernapi/fern-ruby-sdk":"ruby-sdk","fernapi/fern-php-sdk":"php-sdk","fernapi/fern-php-model":"php-model","fernapi/fern-rust-sdk":"rust-sdk","fernapi/fern-rust-model":"rust-model","fernapi/fern-swift-sdk":"swift-sdk","fernapi/fern-swift-model":"swift-model","fernapi/fern-postman":"postman","fernapi/fern-openapi":"openapi"},IZi={"fernapi/fern-typescript-sdk":"https://buildwithfern.com/learn/sdks/generators/typescript/changelog","fernapi/fern-python-sdk":"https://buildwithfern.com/learn/sdks/generators/python/changelog","fernapi/fern-go-sdk":"https://buildwithfern.com/learn/sdks/generators/go/changelog","fernapi/fern-java-sdk":"https://buildwithfern.com/learn/sdks/generators/java/changelog","fernapi/fern-csharp-sdk":"https://buildwithfern.com/learn/sdks/generators/csharp/changelog","fernapi/fern-php-sdk":"https://buildwithfern.com/learn/sdks/generators/php/changelog","fernapi/fern-ruby-sdk":"https://buildwithfern.com/learn/sdks/generators/ruby/changelog","fernapi/fern-swift-sdk":"https://buildwithfern.com/learn/sdks/generators/swift/changelog"};function ljr({lang:e,version:t}){return{image:ujr[e],tag:t??"latest"}}function pAc({image:e}){return uAc[e]}var pjr=class{logger;issues=[];constructor({logger:t}){this.logger=t}convert({fernYml:t}){let r=t.data.sdks,n=t.sourced.sdks;if(r==null||fI(n))return{success:!1,issues:[]};let i={org:t.data.org,defaultGroup:r.defaultGroup,defaultGroupLocation:n.defaultGroup?.$loc,targets:this.convertTargets({targetsConfig:r.targets,sourced:n.targets,globalReadme:r.readme})};return this.issues.length>0?{success:!1,issues:this.issues}:{success:!0,config:i}}convertTargets({targetsConfig:t,sourced:r,globalReadme:n}){let i=[];for(let[o,s]of Object.entries(t)){let a=r[o];if(a==null)continue;let c=this.convertTarget({name:o,target:s,sourced:a,globalReadme:n});c!=null&&i.push(c)}return i}convertTarget({name:t,target:r,sourced:n,globalReadme:i}){let o=this.resolveGeneratorInfo({name:t,target:r,sourced:n});if(o==null)return;let s=this.mergeReadme({globalReadme:i,targetReadme:r.readme});return{name:t,lang:o.lang,image:o.image,registry:o.registry,version:o.version,api:this.resolveApi({api:r.api}),sourceLocation:n.$loc,config:r.config!=null?this.convertConfig(r.config):void 0,output:e0.resolveOutputObjectSchema(r.output),publish:r.publish,groups:r.group??[],metadata:r.metadata,readme:s}}mergeReadme({globalReadme:t,targetReadme:r}){if(t==null&&r==null)return;if(t==null)return r;if(r==null)return t;let n={...t,...r};return(t.customSections!=null||r.customSections!=null)&&(n.customSections=[...t.customSections??[],...r.customSections??[]]),n}resolveApi({api:t}){return t??WYe}resolveGeneratorInfo({name:t,target:r,sourced:n}){let i=this.resolveLanguage({name:t,target:r,sourced:n});if(i==null)return;if(r.image!=null)return typeof r.image=="string"?{lang:i,image:U0(r.image),version:r.version??"latest",registry:void 0}:{lang:i,image:U0(r.image.name),version:r.version??"latest",registry:r.image.registry};let o=ljr({lang:i,version:r.version});return{lang:i,image:o.image,version:o.tag,registry:void 0}}convertConfig(t){return t}resolveLanguage({name:t,target:r,sourced:n}){if(r.lang!=null)return r.lang;if(r.image!=null){let o=typeof r.image=="string"?r.image:r.image.name;return pAc({image:U0(o)})}let i=t;if(HY.includes(i))return i;this.issues.push(new BA({message:`target "${t}" is not a recognized language; please specify the "lang" property`,location:n.$loc}))}};var ZNt=class{cwd;logger;issues=[];constructor({cwd:t,logger:r}){this.cwd=t,this.logger=r}async loadOrThrow({fernYml:t}){let r=await this.load({fernYml:t});if(!r.success)throw new P9(r.issues);return r.workspace}async load({fernYml:t}){let r=this.convertAi({fernYml:t}),n=this.convertDocs({fernYml:t}),[i,o,s]=await Promise.all([this.convertApis({fernYml:t}),this.convertCliVersion({fernYml:t}),this.convertSdks({fernYml:t})]);return this.issues.length>0?{success:!1,issues:this.issues}:{success:!0,workspace:{absoluteFilePath:t.absoluteFilePath,fernYml:t,ai:r,apis:i,cliVersion:o,docs:n,org:t.data.org,sdks:s}}}convertAi({fernYml:t}){let r=t.data.ai;if(r!=null)return{provider:r.provider,model:r.model}}async convertApis({fernYml:t}){let n=await new sjr({cwd:this.cwd}).convert({fernYml:t});return n.success?n.apis:(this.issues.push(...n.issues),{})}async convertCliVersion({fernYml:t}){return t.data.cli?.version??"*"}convertDocs({fernYml:t}){let n=new ajr().convert({fernYml:t});if(!n.success){this.issues.push(...n.issues);return}return n.config}async convertSdks({fernYml:t}){let n=new pjr({logger:this.logger}).convert({fernYml:t});if(!n.success){this.issues.push(...n.issues);return}return n.config}};function fAc(e){return{command:w1d(e),flags:x1d(e)}}function w1d(e){let t=[];for(let r of e.slice(2)){if(r.startsWith("-"))break;t.push(r)}return t.join(" ")}function x1d(e){return e.slice(2).filter(t=>t.startsWith("--")).map(t=>{let r=t.slice(2),n=r.indexOf("=");return n>=0?r.slice(0,n):r}).filter(t=>t.length>0).sort()}Jt();var HYe=require("fs"),fjr=class{absoluteFilePath;initialized=!1;constructor(t){let r=new Date().toISOString().replace(/[:.]/g,"-");this.absoluteFilePath=Ke(t,Be.of(`${r}.log`))}write({taskName:t,level:r,message:n}){this.ensureInitialized();let o=`[${new Date().toISOString()}] [${r.toUpperCase().padEnd(5)}] [${t}] ${n}
|
|
1801
|
+
`&&(r++,n=i);return new g5({absoluteFilePath:this.absoluteFilePath,relativeFilePath:this.relativeFilePath,line:r,column:t-n})}};var Z2r="$ref",ejr=class{cwd;constructor({cwd:t}){this.cwd=t}async resolve({document:t}){let r=t.absoluteFilePath,n={cwd:this.cwd,document:t,originalFile:r,currentFile:r,resolutionStack:new Set([r]),referencedDocuments:{},issues:[],pathMappings:[],yamlPathIndex:0,refFromLocation:void 0},i=await this.resolveValue({context:n,yamlPath:[],value:t.toJS()});return n.issues.length>0?{success:!1,issues:n.issues}:{success:!0,data:i,pathMappings:n.pathMappings}}getSourceLocationWithMappings({document:t,pathMappings:r,yamlPath:n}){let i;for(let o of r)this.yamlPathStartsWith(n,o.yamlPath)&&(i==null||o.yamlPath.length>i.yamlPath.length)&&(i=o);if(i!=null){let o=n.slice(i.yamlPath.length);return i.document.getSourceLocation(o).withRefFrom(i.refFromLocation)}return t.getSourceLocation(n)}async resolveValue({context:t,yamlPath:r,value:n}){if(n==null)return n;if(Array.isArray(n))return Promise.all(n.map((i,o)=>this.resolveValue({context:t,yamlPath:[...r,o],value:i})));if(typeof n=="object"){let i=n;if(Z2r in i){let s=[...r,Z2r];return this.resolveRef({context:t,yamlPath:s,location:this.getSourceLocation({context:t,yamlPath:s}),obj:i,refValue:i[Z2r]})}let o={};for(let s of Object.keys(i))o[s]=await this.resolveValue({context:t,yamlPath:[...r,s],value:i[s]});return o}return n}async resolveRef({context:t,yamlPath:r,location:n,obj:i,refValue:o}){if(typeof o!="string")return t.issues.push(new BA({message:`$ref must be a string, got ${typeof o}`,location:n,yamlPath:r})),i;let s=Object.keys(i);if(s.length>1){let d=s.filter(f=>f!==Z2r);return t.issues.push(new BA({message:`$ref cannot have sibling keys; found ${d.join(", ")}`,location:n,yamlPath:r})),i}if(o.includes("#"))return t.issues.push(new BA({message:`JSON pointer and in-document references are not supported: ${o}`,location:n,yamlPath:r})),i;let a=this.resolveFilePath({currentFile:t.currentFile,refValue:o});if(t.resolutionStack.has(a)){let d=[...t.resolutionStack,a].join(" -> ");return t.issues.push(new BA({message:`Circular $ref detected: ${d}`,location:n,yamlPath:r})),i}let c=await this.parseFile({context:t,referencedFilePath:a,yamlPath:r,location:n,refValue:o});if(c===void 0)return i;if(c===null)return t.issues.push(new BA({message:`$ref resolves to null: ${o}`,location:n,yamlPath:r})),i;let u=r.slice(0,-1),l=t.referencedDocuments[a];return l!=null&&t.pathMappings.push({yamlPath:u,document:l,refFromLocation:n}),await this.resolveReferencedFile({context:t,referencedFilePath:a,refFromLocation:n,yamlPath:u,value:c})}async resolveReferencedFile({context:t,referencedFilePath:r,refFromLocation:n,yamlPath:i,value:o}){let s=t.currentFile,a=t.yamlPathIndex,c=t.refFromLocation;t.currentFile=r,t.yamlPathIndex=i.length,t.refFromLocation=n,t.resolutionStack.add(r);try{return await this.resolveValue({context:t,yamlPath:i,value:o})}finally{t.resolutionStack.delete(r),t.currentFile=s,t.yamlPathIndex=a,t.refFromLocation=c}}async parseFile({context:t,referencedFilePath:r,yamlPath:n,location:i,refValue:o}){if(!await ar(r)){t.issues.push(new BA({message:`Referenced file does not exist: ${o}`,location:i,yamlPath:n}));return}let s=await(0,rAc.readFile)(r,"utf-8"),a=(0,nAc.parseDocument)(s);if(a.errors.length>0){let u=a.errors.map(l=>l.message).join("; ");t.issues.push(new BA({message:`Failed to parse referenced file ${o}: ${u}`,location:i,yamlPath:n}));return}let c=new GYe({absoluteFilePath:r,relativeFilePath:Be.of(Js(t.cwd,r)),document:a,source:s});return t.referencedDocuments[r]=c,c.toJS()}getSourceLocation({context:t,yamlPath:r}){if(t.currentFile===t.originalFile)return t.document.getSourceLocation(r);let n=this.getSourceLocationFromCurrentFile({context:t,yamlPath:r});return t.refFromLocation!=null?n.withRefFrom(t.refFromLocation):n}yamlPathStartsWith(t,r){if(r.length>t.length)return!1;for(let n=0;n<r.length;n++)if(t[n]!==r[n])return!1;return!0}getSourceLocationFromCurrentFile({context:t,yamlPath:r}){let n=t.referencedDocuments[t.currentFile];if(n!=null){let i=r.slice(t.yamlPathIndex);return n.getSourceLocation(i)}return this.createLocationForReferencedFile({context:t,absoluteFilePath:t.currentFile})}createLocationForReferencedFile({context:t,absoluteFilePath:r}){return new g5({absoluteFilePath:r,relativeFilePath:Be.of(Js(t.cwd,r)),line:1,column:1})}resolveFilePath({currentFile:t,refValue:r}){let n=Pn(t);return Ke(n,Be.of(r))}};Pt();Jt();function iAc(e){return $Y(e,new WeakMap)}function v1d(e){return e._zod?.def}function $Y(e,t){if(t.has(e))return t.get(e);let r=v1d(e);if(r==null)return e;switch(r.type){case"object":{let n=r.shape??{},i={};for(let[s,a]of Object.entries(n))i[s]=$Y(a,t);let o=se.object(i).strict();return t.set(e,o),o}case"array":{let n=r.element;return n!=null?se.array($Y(n,t)):e}case"optional":{let n=r.innerType;return n!=null?$Y(n,t).optional():e}case"nullable":{let n=r.innerType;return n!=null?$Y(n,t).nullable():e}case"union":{let n=r.options;return n!=null?se.union(n.map(i=>$Y(i,t))):e}case"record":{let n=r.keyType,i=r.valueType;return n!=null&&i!=null?se.record(n,$Y(i,t)):e}case"lazy":{let n=r.getter;if(n==null)return e;let i=se.lazy(()=>$Y(n(),t));return t.set(e,i),i}case"tuple":{let n=r.items;return n==null?e:se.tuple(n.map(i=>$Y(i,t)))}case"default":{let n=r.innerType;return n!=null?$Y(n,t).default(r.defaultValue):e}default:return e}}GA();var vZi=require("fs/promises"),rjr=ve($0(),1);var tjr=class{async parse(t){let r=await(0,vZi.readFile)(t,"utf-8");return(0,rjr.parse)(r)}async parseDocument({absoluteFilePath:t,cwd:r}){let n=await(0,vZi.readFile)(t,"utf-8"),i=(0,rjr.parseDocument)(n),o=Ks.of(x3e(r,t));return new GYe({absoluteFilePath:t,relativeFilePath:o,document:i,source:n})}};var njr=class{document;constructor(t){this.document=t}toSourced(t){return this.toSourcedInternal(t,[])}toSourcedInternal(t,r){let n=this.document.getSourceLocation(r);if(t===null)return new Xbe(null,n);if(t===void 0)return new Xbe(void 0,n);if(Array.isArray(t))return bZi({value:t,location:n,wrapChild:(i,o)=>this.toSourcedInternal(i,[...r,o])});if(t instanceof Object)return EZi({value:t,location:n,wrapChild:(i,o)=>this.toSourcedInternal(i,[...r,o])});switch(typeof t){case"string":return new $Nt(t,n);case"number":return new HNt(t,n);case"boolean":return new KNt(t,n);default:throw new Error(`Unexpected value type: ${typeof t}`)}}};var JNt=class{parser;cwd;referenceResolver;constructor({cwd:t}){this.parser=new tjr,this.cwd=t,this.referenceResolver=new ejr({cwd:t})}async load({absoluteFilePath:t,schema:r,resolveReferences:n=!0,strict:i=!1}){let o=await this.parseDocument(t),s=this.getYamlErrors(o);if(s.length>0)return{success:!1,issues:s};let a=await this.resolveReferences({document:o,resolveReferences:n});if(!a.success)return{success:!1,issues:a.issues};let u=(i?iAc(r):r).safeParse(a.data);if(!u.success)return{success:!1,issues:u.error.issues.map(d=>{let f=d.path.filter(m=>typeof m!="symbol");return new BA({yamlPath:f,message:this.formatZodIssue(d),location:this.referenceResolver.getSourceLocationWithMappings({document:o,pathMappings:a.pathMappings,yamlPath:f})})})};let l=new njr(o);return{success:!0,data:u.data,sourced:l.toSourced(u.data),absoluteFilePath:t,relativeFilePath:Be.of(Js(this.cwd,t)),pathMappings:a.pathMappings}}async parseDocument(t){try{return await this.parser.parseDocument({absoluteFilePath:t,cwd:this.cwd})}catch(r){throw new Error(`Failed to parse YAML file ${t}: ${Ai(r)}`)}}async resolveReferences({document:t,resolveReferences:r}){if(!r)return{success:!0,data:t.toJS(),pathMappings:[]};let n=await this.referenceResolver.resolve({document:t});return n.success?n:{success:!1,issues:n.issues}}getYamlErrors(t){return t.errors.length===0?[]:t.errors.map(r=>{let n=r.linePos?.[0]?.line??1,i=r.linePos?.[0]?.col??1;return new BA({message:r.message,location:new g5({absoluteFilePath:t.absoluteFilePath,relativeFilePath:t.relativeFilePath,line:n,column:i})})})}formatZodIssue(t){let r=t.path.join(".");switch(t.code){case"invalid_type":return t.message.endsWith("received undefined")?r.length>0?`${r} is required`:"value is required":r.length>0?`${r} must be a ${t.expected}`:`must be a ${t.expected}`;case"invalid_value":{if(t.values!=null){let n=t.values.join(", ");return r.length>0?`${r} must be one of: ${n}`:`must be one of: ${n}`}return t.message}case"unrecognized_keys":return`unknown key(s): ${t.keys.join(", ")}`;case"invalid_union":{let n=[];for(let o of t.errors)for(let s of o)s.code==="unrecognized_keys"&&n.push(...s.keys);if(n.length>0)return`unknown key(s): ${[...new Set(n)].join(", ")}`;let i=new Set;for(let o of t.errors)for(let s of o)s.code==="invalid_type"&&i.add(s.expected);if(i.size>0){let o=Array.from(i).join(" or ");return r.length>0?`${r} must be a ${o}`:`must be a ${o}`}return r.length>0?`${r} has an invalid value`:"invalid value"}case"invalid_format":return r.length>0?`${r} must be a valid ${t.format}`:`must be a valid ${t.format}`;default:return t.message}}};Jt();var ijr=class{from;constructor(t){this.from=t.from}async findOrThrow({filename:t,remediationMessage:r}){let n=await this.find({filename:t});if(n==null)throw new Error(`${t} file not found in any parent directory from ${this.from}`);return n}async find({filename:t}){let r=await hd(t,{cwd:this.from,type:"file"});if(r==null)return;let n=Wt.of(r);if(await ar(n))return n}};var oAc="fern.yml",YNt=class{finder;loader;constructor(t={}){let r=Wt.of(t.cwd??process.cwd());this.finder=new ijr({from:r}),this.loader=new JNt({cwd:r})}async loadOrThrow(){let t=await this.load();if(t.type==="notFound")throw new Error(`${oAc} file not found in any parent directory; did you forget to run \`fern init\`?`);if(t.type==="failure")throw new P9(t.issues);return t}async load(){let t=await this.finder.find({filename:oAc});if(t==null)return{type:"notFound"};let r=await this.loader.load({absoluteFilePath:t,schema:Pkt,strict:!0});return r.success?{type:"success",...r}:{type:"failure",issues:r.issues}}};Jt();var s2e=require("fs/promises"),sAc=ve(z_r(),1),ojr=ve(require("os"),1),aAc=require("os"),cAc=require("path");var XNt=class e{posthog;sentry;baseTags;accumulatedTags={};distinctId;static async create({isTTY:t}){let r=await e.getDistinctId();return new e({isTTY:t,distinctId:r})}constructor({isTTY:t,distinctId:r}){this.distinctId=r;let n=this.isTelemetryEnabled(),i="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal";this.baseTags={version:"*",arch:ojr.arch(),ci:sAc.default,os:ojr.platform(),tty:t,usingAccessToken:process.env.FERN_TOKEN!=null},this.posthog=i!=null&&i.length>0&&n?new Kbe(i):void 0;let o="https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";if(o!=null&&o.length>0&&n){let s="production";if(s==null||s.length===0)throw new Error("SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured");this.sentry=rIt({dsn:o,release:`cli@${"*"}`,environment:s,defaultIntegrations:!1,integrations:[r5e()],tracesSampleRate:0}),nIt()}}sendEvent(t,r){if(this.posthog!=null)try{this.posthog.capture({distinctId:this.distinctId,event:t,properties:{...this.baseTags,...this.accumulatedTags,...r}})}catch{}}sendLifecycleEvent(t){if(this.posthog!=null)try{this.posthog.capture({distinctId:this.distinctId,event:"cli",properties:{...this.baseTags,...this.accumulatedTags,...t}})}catch{}}tag(t){Object.assign(this.accumulatedTags,t)}captureException(t,{errorCode:r}){if(this.sentry!==void 0)try{this.sentry.captureException(t,{captureContext:{user:{id:this.distinctId},tags:{...this.baseTags,...this.accumulatedTags,"error.code":r}}})}catch{}}async flush(){let t=[];this.posthog!=null&&t.push(Promise.race([this.posthog.shutdown().catch(()=>{}),new Promise(r=>setTimeout(r,3e3))])),this.sentry!==void 0&&t.push(Promise.resolve(this.sentry.flush(2e3)).catch(()=>{})),await Promise.all(t)}static async getDistinctId(){let t=e.getDistinctIdFilepath(),r=null;try{await ar(t)||(await(0,s2e.mkdir)((0,cAc.dirname)(t),{recursive:!0}),await(0,s2e.writeFile)(t,V_(),{flag:"wx"}));let n=(await(0,s2e.readFile)(t)).toString().trim();if(r=n,!q4i(n)){let i=V_();await(0,s2e.writeFile)(t,i),r=i}}catch{r=V_()}return(r==null||r.length===0)&&(r=V_()),r}static getDistinctIdFilepath(){return Ke(Wt.of((0,aAc.homedir)()),Be.of(".fern"),Be.of("id"))}isTelemetryEnabled(){let t=process.env.FERN_TELEMETRY_DISABLED;return t!=null&&t.length>0?!1:new qD().loadTelemetryEnabledSync()??!0}};Jt();var WYe="api",sjr=class{cwd;issues=[];constructor({cwd:t}){this.cwd=t}async convert({fernYml:t}){let{api:r,apis:n}=t.data,i=t.sourced;if(r!=null&&n!=null)return this.issues.push(new BA({message:"Cannot define both 'api' and 'apis' in fern.yml.",location:i.$loc})),{success:!1,issues:this.issues};if(r==null&&n==null)return{success:!0,apis:{}};let o={};return r!=null&&!fI(i.api)&&(o=await this.convertApi({absoluteFernYmlPath:this.resolveBasePathForKey("api",t),api:r,sourcedApi:i.api})),n!=null&&!fI(i.apis)&&(o=await this.convertApis({absoluteFernYmlPath:t.absoluteFilePath,pathMappings:t.pathMappings,apis:n,sourcedApis:i.apis})),this.issues.length>0?{success:!1,issues:this.issues}:{success:!0,apis:o}}async convertApi({absoluteFernYmlPath:t,api:r,sourcedApi:n}){if(fI(n))return{};let o={specs:await this.convertSpecs({absoluteFernYmlPath:t,specs:r.specs,sourced:n.specs}),auth:r.auth,authSchemes:r.authSchemes,defaultUrl:r.defaultUrl,defaultEnvironment:r.defaultEnvironment,environments:r.environments,headers:r.headers};return{[WYe]:o}}async convertApis({absoluteFernYmlPath:t,pathMappings:r,apis:n,sourcedApis:i}){if(fI(i))return{};let o=Object.entries(n).filter(([a])=>!fI(i[a])).map(([a,c])=>({apiName:a,apiDef:c,sourcedApiDef:i[a]})).filter(a=>!fI(a.sourcedApiDef)),s=await Promise.all(o.map(async({apiName:a,apiDef:c,sourcedApiDef:u})=>{let l=this.findBasePathInMappings(["apis",a],r)??this.findBasePathInMappings(["apis"],r)??t,d={specs:await this.convertSpecs({absoluteFernYmlPath:l,specs:c.specs,sourced:u.specs}),auth:c.auth,authSchemes:c.authSchemes,defaultUrl:c.defaultUrl,defaultEnvironment:c.defaultEnvironment,environments:c.environments,headers:c.headers};return[a,d]}));return Object.fromEntries(s)}async convertSpecs({absoluteFernYmlPath:t,specs:r,sourced:n}){this.validateSpecCombinations({specs:r,sourced:n});let i=[];for(let o=0;o<r.length;o++){let s=r[o],a=n[o];s==null||fI(a)||i.push({spec:s,sourced:a})}return await Promise.all(i.map(({spec:o,sourced:s})=>this.convertSpec({absoluteFernYmlPath:t,spec:o,sourced:s})))}async convertSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){if("openapi"in r&&"openapi"in n)return await this.convertOpenApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("asyncapi"in r&&"asyncapi"in n)return await this.convertAsyncApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("proto"in r&&"proto"in n)return await this.convertProtobufSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("fern"in r&&"fern"in n)return await this.convertFernSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("conjure"in r&&"conjure"in n)return await this.convertConjureSpec({absoluteFernYmlPath:t,spec:r,sourced:n});if("openrpc"in r&&"openrpc"in n)return await this.convertOpenRpcSpec({absoluteFernYmlPath:t,spec:r,sourced:n});throw new Error(`Unknown spec type: ${JSON.stringify(r)}`)}async convertOpenApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={openapi:await this.resolvePath({absoluteFernYmlPath:t,path:r.openapi,sourced:n.openapi})};return r.origin!=null&&(i.origin=r.origin),r.overrides!=null&&!fI(n.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.overrides,sourced:n.overrides})),r.overlays!=null&&!fI(n.overlays)&&(i.overlays=await this.resolvePath({absoluteFernYmlPath:t,path:r.overlays,sourced:n.overlays})),r.namespace!=null&&(i.namespace=r.namespace),r.settings!=null&&(i.settings=r.settings),i}async convertAsyncApiSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={asyncapi:await this.resolvePath({absoluteFernYmlPath:t,path:r.asyncapi,sourced:n.asyncapi})};return r.overrides!=null&&!fI(n.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.overrides,sourced:n.overrides})),r.settings!=null&&(i.settings=r.settings),i}async convertProtobufSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={root:await this.resolvePath({absoluteFernYmlPath:t,path:r.proto.root,sourced:n.proto.root})};if(r.proto.target!=null&&!fI(n.proto.target)&&(i.target=await this.resolvePath({absoluteFernYmlPath:t,path:r.proto.target,sourced:n.proto.target})),r.proto.overrides!=null&&!fI(n.proto.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.proto.overrides,sourced:n.proto.overrides})),r.proto.localGeneration!=null&&(i.localGeneration=r.proto.localGeneration),r.proto.fromOpenapi!=null&&(i.fromOpenapi=r.proto.fromOpenapi),r.proto.dependencies!=null&&!fI(n.proto.dependencies)){let s=[];for(let a=0;a<r.proto.dependencies.length;a++){let c=r.proto.dependencies[a],u=n.proto.dependencies[a];c!=null&&!fI(u)&&s.push(await this.resolvePath({absoluteFernYmlPath:t,path:c,sourced:u}))}i.dependencies=s}let o={proto:i};return r.settings!=null&&(o.settings=r.settings),o}async convertFernSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={fern:await this.resolvePath({absoluteFernYmlPath:t,path:r.fern,sourced:n.fern})};return r.settings!=null&&(i.settings=r.settings),i}async convertConjureSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={conjure:await this.resolvePath({absoluteFernYmlPath:t,path:r.conjure,sourced:n.conjure})};return r.settings!=null&&(i.settings=r.settings),i}async convertOpenRpcSpec({absoluteFernYmlPath:t,spec:r,sourced:n}){let i={openrpc:await this.resolvePath({absoluteFernYmlPath:t,path:r.openrpc,sourced:n.openrpc})};return r.overrides!=null&&!fI(n.overrides)&&(i.overrides=await this.resolvePathOrPaths({absoluteFernYmlPath:t,paths:r.overrides,sourced:n.overrides})),r.settings!=null&&(i.settings=r.settings),i}async resolvePathOrPaths({absoluteFernYmlPath:t,paths:r,sourced:n}){if(!Array.isArray(r))return await this.resolvePath({absoluteFernYmlPath:t,path:r,sourced:n});let i=[],o=n;for(let s=0;s<r.length;s++){let a=r[s],c=o[s];a!=null&&!fI(c)&&i.push(await this.resolvePath({absoluteFernYmlPath:t,path:a,sourced:c}))}return i}async resolvePath({absoluteFernYmlPath:t,path:r,sourced:n}){let i=Pn(t),o=Ke(i,Be.of(r));if(!await ar(o)){let s=Be.of(Js(this.cwd,o));this.issues.push(new BA({message:`File "${s}" does not exist`,location:n.$loc}))}return o}validateSpecCombinations({specs:t,sourced:r}){let n=[],i=[],o=[];for(let s=0;s<t.length;s++){let a=t[s],c=r[s];if(!(a==null||fI(c))){if("fern"in a){n.push(c);continue}if("conjure"in a){i.push(c);continue}o.push(c)}}if(n.length>1)for(let s of n)this.issues.push(new BA({message:"Multiple Fern specs are not allowed. Use multiple definition files within a single Fern definition directory instead.",location:s.fern.$loc}));if(i.length>1)for(let s of i)this.issues.push(new BA({message:"Multiple Conjure specs are not allowed.",location:s.conjure.$loc}));if(n.length>0&&(i.length>0||o.length>0))for(let s of n)this.issues.push(new BA({message:"Fern specs cannot be mixed with other spec types. Fern definitions are a standalone definition type.",location:s.fern.$loc}));if(i.length>0&&(o.length>0||n.length>0))for(let s of i)this.issues.push(new BA({message:"Conjure specs cannot be mixed with other spec types. Conjure definitions are a standalone definition type.",location:s.conjure.$loc}))}findBasePathInMappings(t,r){for(let n of r)if(n.yamlPath.length===t.length&&t.every((i,o)=>i===n.yamlPath[o]))return n.document.absoluteFilePath}resolveBasePathForKey(t,r){return this.findBasePathInMappings([t],r.pathMappings)??r.absoluteFilePath}};var I1d="docs",ajr=class{issues=[];convert({fernYml:t}){let r=t.data.docs;if(r==null)return{success:!1,issues:[]};if(this.validateInstances({docs:r,fernYml:t}),this.issues.length>0)return{success:!1,issues:this.issues};let n=t.pathMappings.find(o=>o.yamlPath.length===1&&o.yamlPath[0]===I1d),i=n!=null?n.document.absoluteFilePath:t.absoluteFilePath;return{success:!0,config:{raw:r,absoluteFilePath:i}}}validateInstances({docs:t,fernYml:r}){t.instances.length===0&&this.issues.push(new BA({message:"You must specify at least one docs instance",location:r.sourced.$loc}))}};var HY=["csharp","go","java","php","python","ruby","rust","swift","typescript"],$Ye={typescript:"TypeScript",python:"Python",go:"Go",java:"Java",csharp:"C#",ruby:"Ruby",php:"PHP",rust:"Rust",swift:"Swift"},cjr=["typescript","python","go","java","csharp","ruby","php","rust","swift"];var ujr={csharp:"fernapi/fern-csharp-sdk",go:"fernapi/fern-go-sdk",java:"fernapi/fern-java-sdk",php:"fernapi/fern-php-sdk",python:"fernapi/fern-python-sdk",ruby:"fernapi/fern-ruby-sdk",rust:"fernapi/fern-rust-sdk",swift:"fernapi/fern-swift-sdk",typescript:"fernapi/fern-typescript-sdk"},uAc={"fernapi/fern-csharp-sdk":"csharp","fernapi/fern-go-sdk":"go","fernapi/fern-java-sdk":"java","fernapi/fern-php-sdk":"php","fernapi/fern-python-sdk":"python","fernapi/fern-ruby-sdk":"ruby","fernapi/fern-rust-sdk":"rust","fernapi/fern-swift-sdk":"swift","fernapi/fern-typescript-sdk":"typescript","fernapi/fern-typescript-express":"typescript","fernapi/fern-fastapi-server":"python","fernapi/fern-java-spring":"java"},lAc={"fernapi/fern-python-sdk":"python-sdk","fernapi/fern-pydantic-model":"pydantic","fernapi/fern-fastapi-server":"fastapi","fernapi/fern-typescript":"ts-sdk","fernapi/fern-typescript-browser-sdk":"ts-sdk","fernapi/fern-typescript-node-sdk":"ts-sdk","fernapi/fern-typescript-sdk":"ts-sdk","fernapi/fern-typescript-express":"ts-express","fernapi/fern-java-sdk":"java-sdk","fernapi/fern-java-model":"java-model","java-model":"java-model","fernapi/fern-java-spring":"java-spring","fernapi/fern-go-sdk":"go-sdk","fernapi/fern-go-model":"go-model","fernapi/fern-csharp-sdk":"csharp-sdk","fernapi/fern-csharp-model":"csharp-model","fernapi/fern-ruby-sdk":"ruby-sdk","fernapi/fern-php-sdk":"php-sdk","fernapi/fern-php-model":"php-model","fernapi/fern-rust-sdk":"rust-sdk","fernapi/fern-rust-model":"rust-model","fernapi/fern-swift-sdk":"swift-sdk","fernapi/fern-swift-model":"swift-model","fernapi/fern-postman":"postman","fernapi/fern-openapi":"openapi"},IZi={"fernapi/fern-typescript-sdk":"https://buildwithfern.com/learn/sdks/generators/typescript/changelog","fernapi/fern-python-sdk":"https://buildwithfern.com/learn/sdks/generators/python/changelog","fernapi/fern-go-sdk":"https://buildwithfern.com/learn/sdks/generators/go/changelog","fernapi/fern-java-sdk":"https://buildwithfern.com/learn/sdks/generators/java/changelog","fernapi/fern-csharp-sdk":"https://buildwithfern.com/learn/sdks/generators/csharp/changelog","fernapi/fern-php-sdk":"https://buildwithfern.com/learn/sdks/generators/php/changelog","fernapi/fern-ruby-sdk":"https://buildwithfern.com/learn/sdks/generators/ruby/changelog","fernapi/fern-swift-sdk":"https://buildwithfern.com/learn/sdks/generators/swift/changelog"};function ljr({lang:e,version:t}){return{image:ujr[e],tag:t??"latest"}}function pAc({image:e}){return uAc[e]}var pjr=class{logger;issues=[];constructor({logger:t}){this.logger=t}convert({fernYml:t}){let r=t.data.sdks,n=t.sourced.sdks;if(r==null||fI(n))return{success:!1,issues:[]};let i={org:t.data.org,defaultGroup:r.defaultGroup,defaultGroupLocation:n.defaultGroup?.$loc,targets:this.convertTargets({targetsConfig:r.targets,sourced:n.targets,globalReadme:r.readme})};return this.issues.length>0?{success:!1,issues:this.issues}:{success:!0,config:i}}convertTargets({targetsConfig:t,sourced:r,globalReadme:n}){let i=[];for(let[o,s]of Object.entries(t)){let a=r[o];if(a==null)continue;let c=this.convertTarget({name:o,target:s,sourced:a,globalReadme:n});c!=null&&i.push(c)}return i}convertTarget({name:t,target:r,sourced:n,globalReadme:i}){let o=this.resolveGeneratorInfo({name:t,target:r,sourced:n});if(o==null)return;let s=this.mergeReadme({globalReadme:i,targetReadme:r.readme});return{name:t,lang:o.lang,image:o.image,registry:o.registry,version:o.version,api:this.resolveApi({api:r.api}),sourceLocation:n.$loc,config:r.config!=null?this.convertConfig(r.config):void 0,output:e0.resolveOutputObjectSchema(r.output),publish:r.publish,groups:r.group??[],metadata:r.metadata,readme:s}}mergeReadme({globalReadme:t,targetReadme:r}){if(t==null&&r==null)return;if(t==null)return r;if(r==null)return t;let n={...t,...r};return(t.customSections!=null||r.customSections!=null)&&(n.customSections=[...t.customSections??[],...r.customSections??[]]),n}resolveApi({api:t}){return t??WYe}resolveGeneratorInfo({name:t,target:r,sourced:n}){let i=this.resolveLanguage({name:t,target:r,sourced:n});if(i==null)return;if(r.image!=null)return typeof r.image=="string"?{lang:i,image:U0(r.image),version:r.version??"latest",registry:void 0}:{lang:i,image:U0(r.image.name),version:r.version??"latest",registry:r.image.registry};let o=ljr({lang:i,version:r.version});return{lang:i,image:o.image,version:o.tag,registry:void 0}}convertConfig(t){return t}resolveLanguage({name:t,target:r,sourced:n}){if(r.lang!=null)return r.lang;if(r.image!=null){let o=typeof r.image=="string"?r.image:r.image.name;return pAc({image:U0(o)})}let i=t;if(HY.includes(i))return i;this.issues.push(new BA({message:`target "${t}" is not a recognized language; please specify the "lang" property`,location:n.$loc}))}};var ZNt=class{cwd;logger;issues=[];constructor({cwd:t,logger:r}){this.cwd=t,this.logger=r}async loadOrThrow({fernYml:t}){let r=await this.load({fernYml:t});if(!r.success)throw new P9(r.issues);return r.workspace}async load({fernYml:t}){let r=this.convertAi({fernYml:t}),n=this.convertDocs({fernYml:t}),[i,o,s]=await Promise.all([this.convertApis({fernYml:t}),this.convertCliVersion({fernYml:t}),this.convertSdks({fernYml:t})]);return this.issues.length>0?{success:!1,issues:this.issues}:{success:!0,workspace:{absoluteFilePath:t.absoluteFilePath,fernYml:t,ai:r,apis:i,cliVersion:o,docs:n,org:t.data.org,sdks:s}}}convertAi({fernYml:t}){let r=t.data.ai;if(r!=null)return{provider:r.provider,model:r.model}}async convertApis({fernYml:t}){let n=await new sjr({cwd:this.cwd}).convert({fernYml:t});return n.success?n.apis:(this.issues.push(...n.issues),{})}async convertCliVersion({fernYml:t}){return t.data.cli?.version??"*"}convertDocs({fernYml:t}){let n=new ajr().convert({fernYml:t});if(!n.success){this.issues.push(...n.issues);return}return n.config}async convertSdks({fernYml:t}){let n=new pjr({logger:this.logger}).convert({fernYml:t});if(!n.success){this.issues.push(...n.issues);return}return n.config}};function fAc(e){return{command:w1d(e),flags:x1d(e)}}function w1d(e){let t=[];for(let r of e.slice(2)){if(r.startsWith("-"))break;t.push(r)}return t.join(" ")}function x1d(e){return e.slice(2).filter(t=>t.startsWith("--")).map(t=>{let r=t.slice(2),n=r.indexOf("=");return n>=0?r.slice(0,n):r}).filter(t=>t.length>0).sort()}Jt();var HYe=require("fs"),fjr=class{absoluteFilePath;initialized=!1;constructor(t){let r=new Date().toISOString().replace(/[:.]/g,"-");this.absoluteFilePath=Ke(t,Be.of(`${r}.log`))}write({taskName:t,level:r,message:n}){this.ensureInitialized();let o=`[${new Date().toISOString()}] [${r.toUpperCase().padEnd(5)}] [${t}] ${n}
|
|
1802
1802
|
`;(0,HYe.appendFileSync)(this.absoluteFilePath,o)}empty(){return!this.initialized}ensureInitialized(){this.initialized||((0,HYe.mkdirSync)(Pn(this.absoluteFilePath),{recursive:!0}),(0,HYe.writeFileSync)(this.absoluteFilePath,`Fern Debug Log - ${new Date().toISOString()}
|
|
1803
1803
|
${"=".repeat(60)}
|
|
1804
1804
|
|
|
@@ -2260,7 +2260,7 @@ Hint: Values starting with "@" (such as scoped npm packages) must be wrapped in
|
|
|
2260
2260
|
`)}var EMt=class{cwd;logger;deleteOriginals;constructor(t){this.cwd=t.cwd,this.logger=t.logger,this.deleteOriginals=t.deleteOriginals??!0}async migrate(){let t=[],r=[],n=await this.findFernDirectory();if(n==null)return{success:!1,warnings:[{type:"conflict",message:"Could not find fern directory",suggestion:"Run this command from a directory containing a 'fern' folder"}],migratedFiles:r};let o=await new bMt({cwd:n}).migrate();if(t.push(...o.warnings),!o.success||o.org==null)return{success:!1,warnings:[...t,{type:"conflict",message:"Failed to migrate fern.config.json - organization is required"}],migratedFiles:r};o.absoluteFilePath!=null&&r.push(o.absoluteFilePath);let s=Ke(n,Be.of(eD)),a=await ar(s,"directory"),c;if(a){let d=await this.migrateMultiApi({fernDir:n,apisDir:s,org:o.org,warnings:t,migratedFiles:r});if(!d.success)return{success:!1,warnings:t,migratedFiles:r};c=d.fernYml}else{let d=await this.migrateSingleApi({fernDir:n,org:o.org,warnings:t,migratedFiles:r});if(!d.success)return{success:!1,warnings:t,migratedFiles:r};c=d.fernYml}let u=await Ego(n);u.docsRef!=null&&(c.docs=u.docsRef);let l=Ke(this.cwd,Be.of(wI)),p=this.serializeFernYml(c);if(await(0,xpt.writeFile)(l,p,"utf-8"),this.deleteOriginals)for(let d of r)try{await(0,xpt.rm)(d),this.logger.debug(`Deleted ${d}`)}catch{t.push({type:"info",message:`Could not delete ${d}`})}return this.logger.info(`Created ${l}`),t.push(...await vgo(this.cwd)),{success:!0,warnings:t,migratedFiles:r,outputPath:l}}async migrateSingleApi(t){let{fernDir:r,org:n,warnings:i,migratedFiles:o}=t,a=await new Gje({cwd:r}).migrate();i.push(...a.warnings),a.absoluteFilePath!=null&&o.push(a.absoluteFilePath);let c=await ygo({fernDir:r,generatorsYmlApi:a.rawApi});i.push(...c.warnings);let u={org:n};return c.api!=null&&(u.api=c.api),a.sdks!=null&&(u.sdks=a.sdks),{success:!0,fernYml:u}}async migrateMultiApi(t){let{fernDir:r,apisDir:n,org:i,warnings:o,migratedFiles:s}=t,c=(await(0,xpt.readdir)(n,{withFileTypes:!0})).filter(g=>g.isDirectory()).map(g=>g.name);if(c.length===0)return o.push({type:"conflict",message:"No API directories found in fern/apis/"}),{success:!1,fernYml:{org:i}};let u={},l={targets:{}},p;for(let g of c){let A=Ke(n,Be.of(g)),v=await new Gje({cwd:A,apiName:g}).migrate();if(o.push(...v.warnings),v.absoluteFilePath!=null&&s.push(v.absoluteFilePath),u[g]=v.rawApi,v.sdks!=null){for(let[E,I]of Object.entries(v.sdks.targets))l.targets[E]=I;v.sdks.autorelease!=null&&p==null&&(p=v.sdks.autorelease)}}let d=await bgo({fernDir:r,apisDir:n,generatorsYmlApis:u});o.push(...d.warnings);let f={org:i,apis:d.apis};Object.keys(l.targets).length>0&&(p!=null&&(l.autorelease=p),f.sdks=l);let h=await new Gje({cwd:r}).detect();return h.found&&h.absoluteFilePath!=null&&(o.push({type:"info",message:"Found generators.yml in fern root alongside apis/ directory",suggestion:"Review the migrated configuration to ensure it's correct"}),s.push(h.absoluteFilePath)),{success:!0,fernYml:f}}async findFernDirectory(){if(this.cwd.split("/").pop()===gA)return this.cwd;let r=Ke(this.cwd,Be.of(gA));if(await ar(r,"directory"))return r}serializeFernYml(t){let r={edition:t.edition,org:t.org};return t.api!=null&&(r.api=t.api),t.apis!=null&&(r.apis=t.apis),t.ai!=null&&(r.ai=t.ai),t.cli!=null&&(r.cli=t.cli),t.docs!=null&&(r.docs=t.docs),t.sdks!=null&&(r.sdks=this.simplifySdks(t.sdks)),Rr.dump(r,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"',forceQuotes:!1})}simplifySdks(t){let r={...t},n={};for(let[i,o]of Object.entries(t.targets)){let s=o.output;if(typeof s=="string"){n[i]=o;continue}if(s.git==null&&s.path!=null){n[i]={...o,output:s.path};continue}n[i]=o}return r.targets=n,r}};var Igo=class{async handle(t,r){let i=await new EMt({cwd:t.cwd,logger:t.stdout,deleteOriginals:r.delete}).migrate();for(let o of i.warnings){switch(o.type){case"deprecated":t.stdout.warn(`Deprecated: ${o.message}`);break;case"unsupported":t.stdout.warn(`Unsupported: ${o.message}`);break;case"conflict":t.stderr.error(`Error: ${o.message}`);break;case"info":t.stdout.info(o.message);break}o.suggestion!=null&&t.stdout.info(` Suggestion: ${o.suggestion}`)}if(i.success){i.outputPath!=null&&t.stdout.debug(`Created: ${i.outputPath}`);return}throw new Ae({message:"Migration failed",code:Ae.Code.ConfigError})}};function wgo(e){let t=new Igo;vo(e,"migrate","Migrate legacy configuration files to fern.yml",(r,n)=>t.handle(r,n),r=>r.option("delete",{type:"boolean",description:"Keep original files after migration",default:!0}))}function xgo(e){kE(e,"config","Configure, edit, and inspect your settings",[wgo])}var Cgo=class{async handle(t,r){let n=await t.loadWorkspaceOrThrow();if(n.docs==null)throw new Ae({message:`No docs configuration found in fern.yml.
|
|
2261
2261
|
|
|
2262
2262
|
Add a 'docs:' section to your fern.yml to get started.`,code:Ae.Code.ConfigError});let o=await new O_e({context:t}).check({workspace:n,strict:r.strict}),s=o.hasErrors||r.strict&&o.hasWarnings;if(r.json){let a=this.buildJsonResponse({result:o,hasErrors:s});if(t.stdout.info(JSON.stringify(a,null,2)),s)throw new Ae({code:Ae.Code.ValidationError});return}if(o.violations.length>0)for(let a of o.violations){let c=a.severity==="warning"?we.yellow:we.red;process.stderr.write(`${c(`${a.displayRelativeFilepath}:${a.line}:${a.column}: ${a.message}`)}
|
|
2263
|
-
`)}if(s)throw new Ae({code:Ae.Code.ValidationError});if(o.warningCount>0){t.stderr.info(`${xn.warning} ${we.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(we.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${xn.success} ${we.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>JY(i))),{success:!r,results:n}}};function _go(e){let t=new Cgo;vo(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var WLc=ve(require("net"),1),$Lc=ve(require("os"),1),cUn=class extends Error{constructor(t){super(`${t} is locked`)}},Cpt={old:new Set,young:new Set},Kim=1e3*15,HLc=new Set;var vMt,Jim=()=>{let e=$Lc.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},qLc=e=>new Promise((t,r)=>{let n=WLc.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),GLc=async(e,t)=>{if(e.host||e.port===0)return qLc(e);for(let r of t)try{await qLc({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},Yim=e=>Cpt.old.has(e)||Cpt.young.has(e)||HLc.has(e),Xim=function*(e){e&&(yield*e),yield 0};async function B_e(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let s=e.exclude;if(typeof s[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of s){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(s)}let{reserve:n,...i}=e??{};vMt===void 0&&(vMt=setTimeout(()=>{vMt=void 0,Cpt.old=Cpt.young,Cpt.young=new Set},Kim),vMt.unref&&vMt.unref());let o=Jim();for(let s of Xim(t))try{if(r.has(s))continue;let a=await GLc({...i,port:s},o);for(;Yim(a);){if(s!==0)throw new cUn(s);a=await GLc({...i,port:s},o)}return n?HLc.add(a):Cpt.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof cUn))throw a}throw new Error("No available ports found")}var JLc=/^[a-z0-9-]+-preview-[a-z0-9-]+\.docs\.buildwithfern\.com$/i,KLc="docs.buildwithfern.com";function Wje(e){let t=e.toLowerCase().trim();t.startsWith("https://")?t=t.slice(8):t.startsWith("http://")&&(t=t.slice(7));let r=t.indexOf("/");return r!==-1&&(t=t.slice(0,r)),JLc.test(t)}function YLc(e){let t=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length===0?"default":t}function IMt({orgId:e,previewId:t}){let r=YLc(t),n=`${e}-preview-${r}.${KLc}`;if(n.length<=62)return n;let i=`${e}-preview-`,o=62-i.length;if(o<8)throw new Error(`Organization name "${e}" is too long to generate a valid preview URL`);let a=r.slice(0,o).replace(/-+$/,"");return`${i}${a}.${KLc}`}Pt();hg();Jt();var d0o=require("child_process"),fWc=ve(Ogo(),1),dWc=ve(HUn(),1),m0o=ve(require("fs"),1),BLt=require("fs/promises"),mWc=ve(require("http"),1),A0o=ve(require("path"),1);var KVc=require("events"),ZUn=ve(require("fs"),1),rQe=ve(require("path"),1);var PVc=ve(require("os"),1),RVc=300,j_e=20,$Mt=1e7,DVc=PVc.default.platform();var dfm=DVc==="darwin",HAo=DVc==="win32",Q_e=dfm||HAo,FVc=3e3,kVc=2e4,KAo=1250;var Qte;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(Qte||(Qte={}));var tQe;(function(e){e.CHANGE="change",e.RENAME="rename"})(tQe||(tQe={}));var HMt;(function(e){e.CHANGE="change",e.ERROR="error"})(HMt||(HMt={}));var Bc;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(Bc||(Bc={}));var $F;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})($F||($F={}));var mfm=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,c=0,u=0,l=()=>{let E=Date.now(),I=E-c,x=E-u,C=I>=t||x>=o;return[E,C]},p=E=>{if(u=E,!s)return;let I=s;s=void 0,e.apply(void 0,I)},d=()=>{b(0)},f=()=>{a&&(d(),p(Date.now()))},m=E=>{if(u=E,n)return p(E)},h=E=>{if(i&&s)return p(E);s=void 0},g=()=>{a=void 0;let[E,I]=l();return I?h(E):A(E)},A=E=>{let I=E-c,x=E-u,C=t-I,_=o-x,w=Math.min(C,_);return b(w)},b=E=>{a&&clearTimeout(a),!(E<=0)&&(a=setTimeout(g,E))},v=(...E)=>{let[I,x]=l(),C=!!a;if(s=E,c=I,(x||!a)&&b(t),x)return C?p(I):m(I)};return v.cancel=d,v.flush=f,v},KUn=mfm;var ZAo=ve(require("fs"),1),YUn=ve(require("path"),1);var Id=ve(require("fs"),1),rO=require("util");var Gle=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},Mte=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var JAo=ve(require("process"),1),NVc=JAo.default.getuid?!JAo.default.getuid():!1,jVc=1e4,Fj=()=>{};var KMt={isChangeErrorOk:e=>{if(!KMt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!NVc&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!KMt.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!KMt.isNodeError(e))throw e;if(!KMt.isChangeErrorOk(e))throw e}},BI=KMt;var YAo=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=jVc,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},QVc=new YAo;var Wle=(e,t)=>function(n){return function i(...o){return QVc.schedule().then(s=>{let a=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(t(u)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw u};return e.apply(void 0,o).then(a,c)})}},$le=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var hfm={attempt:{chmod:Gle((0,rO.promisify)(Id.default.chmod),BI.onChangeError),chown:Gle((0,rO.promisify)(Id.default.chown),BI.onChangeError),close:Gle((0,rO.promisify)(Id.default.close),Fj),fsync:Gle((0,rO.promisify)(Id.default.fsync),Fj),mkdir:Gle((0,rO.promisify)(Id.default.mkdir),Fj),realpath:Gle((0,rO.promisify)(Id.default.realpath),Fj),stat:Gle((0,rO.promisify)(Id.default.stat),Fj),unlink:Gle((0,rO.promisify)(Id.default.unlink),Fj),chmodSync:Mte(Id.default.chmodSync,BI.onChangeError),chownSync:Mte(Id.default.chownSync,BI.onChangeError),closeSync:Mte(Id.default.closeSync,Fj),existsSync:Mte(Id.default.existsSync,Fj),fsyncSync:Mte(Id.default.fsync,Fj),mkdirSync:Mte(Id.default.mkdirSync,Fj),realpathSync:Mte(Id.default.realpathSync,Fj),statSync:Mte(Id.default.statSync,Fj),unlinkSync:Mte(Id.default.unlinkSync,Fj)},retry:{close:Wle((0,rO.promisify)(Id.default.close),BI.isRetriableError),fsync:Wle((0,rO.promisify)(Id.default.fsync),BI.isRetriableError),open:Wle((0,rO.promisify)(Id.default.open),BI.isRetriableError),readFile:Wle((0,rO.promisify)(Id.default.readFile),BI.isRetriableError),rename:Wle((0,rO.promisify)(Id.default.rename),BI.isRetriableError),stat:Wle((0,rO.promisify)(Id.default.stat),BI.isRetriableError),write:Wle((0,rO.promisify)(Id.default.write),BI.isRetriableError),writeFile:Wle((0,rO.promisify)(Id.default.writeFile),BI.isRetriableError),closeSync:$le(Id.default.closeSync,BI.isRetriableError),fsyncSync:$le(Id.default.fsyncSync,BI.isRetriableError),openSync:$le(Id.default.openSync,BI.isRetriableError),readFileSync:$le(Id.default.readFileSync,BI.isRetriableError),renameSync:$le(Id.default.renameSync,BI.isRetriableError),statSync:$le(Id.default.statSync,BI.isRetriableError),writeSync:$le(Id.default.writeSync,BI.isRetriableError),writeFileSync:$le(Id.default.writeFileSync,BI.isRetriableError)}},MVc=hfm;var JUn=ve(require("fs"),1),JMt=ve(require("path"),1);var XAo=()=>{};var gfm=()=>{let e=XAo,t=XAo,r=!1,n=!1;return{promise:new Promise((c,u)=>{e=l=>(r=!0,c(l)),t=l=>(n=!0,u(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},LVc=gfm;var Afm=()=>{let{promise:e,resolve:t,isPending:r}=LVc(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},UVc=Afm;var zVc={then:e=>{e()}};var VVc=e=>Array.isArray(e)?e:[e],qVc=e=>typeof e=="function";var yfm=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=VVc(o).map(te=>qVc(te)?te:Z=>te.test(Z)),a=te=>s.some(Z=>Z(te)),c=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},g=[],A=new Set,b={},v={},E=new Set,I={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},x={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:g,symlinksNames:A,symlinksNamesToPaths:b,map:v},{promise:C,increment:_,decrement:w}=UVc(),P=0,z=(te,Z,Ee,ye)=>{E.has(Z)||P>=i||(P+=1,te.directories.push(Z),te.directoriesNames.add(Ee),l.push(Z),p.add(Ee),d.propertyIsEnumerable(Ee)||(d[Ee]=[]),d[Ee].push(Z),E.add(Z),!(ye>=n)&&(P>=i||Y(Z,ye+1)))},q=(te,Z,Ee)=>{E.has(Z)||P>=i||(P+=1,te.files.push(Z),te.filesNames.add(Ee),f.push(Z),m.add(Ee),h.propertyIsEnumerable(Ee)||(h[Ee]=[]),h[Ee].push(Z),E.add(Z))},V=(te,Z,Ee,ye)=>{E.has(Z)||P>=i||(P+=1,te.symlinks.push(Z),te.symlinksNames.add(Ee),g.push(Z),A.add(Ee),b.propertyIsEnumerable(Ee)||(b[Ee]=[]),b[Ee].push(Z),E.add(Z),r&&(ye>=n||P>=i||Ce(Z,ye+1)))},X=(te,Z,Ee,ye,De)=>{c.aborted||a(Z)||(ye.isDirectory()?z(te,Z,Ee,De):ye.isFile()?q(te,Z,Ee):ye.isSymbolicLink()&&V(te,Z,Ee,De))},ae=(te,Z,Ee,ye)=>{if(c.aborted)return;let De=Z===JMt.default.sep?"":JMt.default.sep,Re=Ee.name,Ye=`${Z}${De}${Re}`;a(Ye)||(Ee.isDirectory()?z(te,Ye,Re,ye):Ee.isFile()?q(te,Ye,Re):Ee.isSymbolicLink()&&V(te,Ye,Re,ye))},G=(te,Z,Ee,ye)=>{for(let De=0,Re=Ee.length;De<Re;De++)ae(te,Z,Ee[De],ye)},Y=(te,Z)=>{c.aborted||Z>n||P>=i||(_(),JUn.default.readdir(te,{withFileTypes:!0},(Ee,ye)=>{if(Ee||c.aborted||!ye.length)return w();(u(ye)||zVc).then(()=>{let Re=v[te]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};G(Re,te,ye,Z),w()})}))},Ce=(te,Z)=>{_(),JUn.default.realpath(te,(Ee,ye)=>{if(Ee||c.aborted)return w();JUn.default.stat(ye,(De,Re)=>{if(De||c.aborted)return w();let Ye=JMt.default.basename(ye),ct=v[te]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};X(ct,ye,Ye,Re,Z),w()})})};return(async(te,Z=1)=>(te=JMt.default.normalize(te),E.add(te),Y(te,Z),await C,c.aborted?I:x))(e)},GVc=yfm;var Lte={lang:{debounce:KUn,attempt:e=>{try{return e()}catch(t){return Lte.lang.castError(t)}},castArray:e=>Lte.lang.isArray(e)?e:[e],castError:e=>Lte.lang.isError(e)?e:Lte.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(Lte.lang.isNaN(e))return Lte.lang.isNaN(t);if(Lte.lang.isPrimitive(e)||Lte.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(YUn.default.sep).length-1),getRealPath:(e,t)=>{try{return t?ZAo.default.realpathSync.native(e):ZAo.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===YUn.default.sep&&t.length-e.length>YUn.default.sep.length,poll:(e,t=kVc)=>MVc.retry.stat(t)(e,{bigint:!0}).catch(Lte.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await GVc(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},Jl=Lte;var XUn=ve(require("path"),1);var eyo=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||Jl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=RVc){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,c)=>{let u=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...c]),p=this.eventsDeduplicate([...u,...l]);this.onTargetEvents(p)},s=Jl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,c="",u=!1)=>{u?await this.eventsPopulate([c],n,!0):i.add(c),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===Bc.CHANGE&&a===Bc.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===Bc.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===Bc.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??j_e:Math.min(1,this.options.depth??j_e),s=this.options.limit??$Mt,[a,c]=await Jl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),u=[...a,...c];return await Promise.all(u.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())Jl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(Bc.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!Q_e&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(Bc.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Bc.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(XUn.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Bc.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(XUn.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(Bc.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Bc.ADD?this.onTargetAdd(n):r===Bc.ADD_DIR?this.onTargetAddDir(n):r===Bc.CHANGE?this.onTargetChange(n):r===Bc.UNLINK?this.onTargetUnlink(n):r===Bc.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=tQe.CHANGE,r){if(this.watcher.isClosed())return;let n=XUn.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){HAo&&t.code==="EPERM"?this.onWatcherChange(tQe.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(HMt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(HMt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(tQe.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&Q_e&&this.options.native!==!1?this.options.depth??j_e:Math.min(1,this.options.depth??j_e),n=this.options.limit??$Mt,[i,o]=await Jl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(tQe.CHANGE,a,t)}))}}},WVc=eyo;var HF={interval:100,intervalId:void 0,fns:new Map,init:()=>{HF.intervalId||(HF.intervalId=setInterval(HF.resolve,HF.interval))},reset:()=>{HF.intervalId&&(clearInterval(HF.intervalId),delete HF.intervalId)},add:(e,t)=>{HF.fns.set(e,Date.now()+t),HF.init()},remove:e=>{HF.fns.delete(e)},resolve:()=>{if(!HF.fns.size)return HF.reset();let e=Date.now();for(let[t,r]of HF.fns)r>=e||(HF.remove(t),t())}},YMt=HF;var XMt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=KAo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(Jl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let c=()=>{s.add.delete(n),YMt.remove(u)},u=()=>{c(),a()};YMt.add(u,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;c();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=KAo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let c=()=>{s.unlink.delete(n),YMt.remove(u)},u=()=>{c(),a()};YMt.add(u,r);let l=()=>(c(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Bc.ADD,Qte.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,Bc.ADD_DIR,Qte.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,Bc.UNLINK,Qte.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,Bc.UNLINK_DIR,Qte.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};XMt.DIR_EVENTS={add:Bc.ADD_DIR,rename:Bc.RENAME_DIR,unlink:Bc.UNLINK_DIR};XMt.FILE_EVENTS={add:Bc.ADD,change:Bc.CHANGE,rename:Bc.RENAME,unlink:Bc.UNLINK};var $Vc=XMt;var tyo=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Jl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(Jl.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(Jl.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(Jl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return Jl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);Jl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},ryo=tyo;var nyo=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},HVc=nyo;var iyo=class{constructor(){this.inos={},this.paths=new ryo,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await Jl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new HVc(n)}reset(){this.inos={},this.paths=new ryo,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,Bc.ADD,i),[Bc.ADD];if(i.isDirectory())return this.updateIno(t,Bc.ADD_DIR,i),[Bc.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Bc.UNLINK,n),[Bc.UNLINK];if(n.isDirectory())return this.updateIno(t,Bc.UNLINK_DIR,n),[Bc.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Bc.CHANGE,i),[Bc.CHANGE]);if(i.isDirectory())return this.updateIno(t,Bc.UNLINK,n),this.updateIno(t,Bc.ADD_DIR,i),[Bc.UNLINK,Bc.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Bc.UNLINK_DIR,n),this.updateIno(t,Bc.ADD,i),[Bc.UNLINK_DIR,Bc.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Bc.UNLINK_DIR,n),this.updateIno(t,Bc.ADD_DIR,i),[Bc.UNLINK_DIR,Bc.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?Qte.FILE:Qte.DIR;i[t]=[n.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},oyo=iyo;var syo=class e extends KVc.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on($F.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on($F.CLOSE,i)),this._readyWait=new Promise(i=>this.on($F.READY,i)),this._locker=new $Vc(this),this._roots=new Set,this._poller=new oyo,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(Jl.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit($F.CLOSE))}error(t){if(this.isClosed())return!1;let r=Jl.lang.castError(t);return this.emit($F.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit($F.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit($F.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&Jl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&Jl.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)Jl.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let o=new WVc(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=Jl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=rQe.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??j_e))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&Q_e&&l.options.native!==!1)))return!0;if(!Q_e)break;let u=rQe.default.dirname(t);if(s===u)break;s=u}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=Jl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let c=!r.recursive||Q_e&&r.native!==!1?r:{...r,recursive:!1},l={watcher:ZUn.default.watch(a,c),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=rQe.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(c){this.error(c)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||Q_e&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??j_e,a=r.limit??$Mt,[c]=await Jl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,n,i,o);if(c.length){let l=Jl.fs.getDepth(t);for(let p of c){let d=Jl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||u)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(u,l)=>{l===t&&(c(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on($F.CLOSE,c),s.watchFile(t,r,o)},c=()=>{this._subwatchers.delete(i),this.removeListener($F.CLOSE,c),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=rQe.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new oyo,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return Jl.lang.noop;if(this.pollerExists(t,r))return Jl.lang.noop;let i={...r,interval:r.pollingInterval??FVc},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on($F.CLOSE,a),ZUn.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener($F.CLOSE,a),ZUn.default.unwatchFile(t,n)};return Jl.lang.attempt(s),()=>Jl.lang.attempt(a)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=Jl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,c)=>c===s||!Jl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=rQe.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await Jl.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let o=rQe.default.dirname(t);return(await Jl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=Jl.lang.noop){if(Jl.lang.isFunction(t))return this.watch([],{},t);if(Jl.lang.isUndefined(t))return this.watch([],r,n);if(Jl.lang.isFunction(r))return this.watch(t,{},r);if(Jl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=Jl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==Jl.lang.noop&&this.on($F.ALL,n),r.readdirMap=void 0,this.ready())}},e4n=syo;h4n();Jt();var s8=require("fs/promises"),e8c=require("os"),Oyo=ve(require("path"),1),qdm=".fern",Gdm="logs",Tyo=100*1024*1024;function Wdm(){return"cli@4.78.0"}var cQe=class{logFilePath=null;initialized=!1;sessionStartTime;consoleLogger;constructor(){this.sessionStartTime=Date.now()}async initialize(t){if(this.initialized)return;this.consoleLogger=t;let r=Ke(Wt.of((0,e8c.homedir)()),Be.of(qdm)),n=Ke(r,Be.of(Gdm));await ar(n)||await(0,s8.mkdir)(n,{recursive:!0});let o=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=Ke(n,Be.of(o));let s=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${Oyo.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
|
|
2263
|
+
`)}if(s)throw new Ae({code:Ae.Code.ValidationError});if(o.warningCount>0){t.stderr.info(`${xn.warning} ${we.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(we.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${xn.success} ${we.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>JY(i))),{success:!r,results:n}}};function _go(e){let t=new Cgo;vo(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var WLc=ve(require("net"),1),$Lc=ve(require("os"),1),cUn=class extends Error{constructor(t){super(`${t} is locked`)}},Cpt={old:new Set,young:new Set},Kim=1e3*15,HLc=new Set;var vMt,Jim=()=>{let e=$Lc.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},qLc=e=>new Promise((t,r)=>{let n=WLc.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),GLc=async(e,t)=>{if(e.host||e.port===0)return qLc(e);for(let r of t)try{await qLc({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},Yim=e=>Cpt.old.has(e)||Cpt.young.has(e)||HLc.has(e),Xim=function*(e){e&&(yield*e),yield 0};async function B_e(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let s=e.exclude;if(typeof s[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of s){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(s)}let{reserve:n,...i}=e??{};vMt===void 0&&(vMt=setTimeout(()=>{vMt=void 0,Cpt.old=Cpt.young,Cpt.young=new Set},Kim),vMt.unref&&vMt.unref());let o=Jim();for(let s of Xim(t))try{if(r.has(s))continue;let a=await GLc({...i,port:s},o);for(;Yim(a);){if(s!==0)throw new cUn(s);a=await GLc({...i,port:s},o)}return n?HLc.add(a):Cpt.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof cUn))throw a}throw new Error("No available ports found")}var JLc=/^[a-z0-9-]+-preview-[a-z0-9-]+\.docs\.buildwithfern\.com$/i,KLc="docs.buildwithfern.com";function Wje(e){let t=e.toLowerCase().trim();t.startsWith("https://")?t=t.slice(8):t.startsWith("http://")&&(t=t.slice(7));let r=t.indexOf("/");return r!==-1&&(t=t.slice(0,r)),JLc.test(t)}function YLc(e){let t=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length===0?"default":t}function IMt({orgId:e,previewId:t}){let r=YLc(t),n=`${e}-preview-${r}.${KLc}`;if(n.length<=62)return n;let i=`${e}-preview-`,o=62-i.length;if(o<8)throw new Error(`Organization name "${e}" is too long to generate a valid preview URL`);let a=r.slice(0,o).replace(/-+$/,"");return`${i}${a}.${KLc}`}Pt();hg();Jt();var d0o=require("child_process"),fWc=ve(Ogo(),1),dWc=ve(HUn(),1),m0o=ve(require("fs"),1),BLt=require("fs/promises"),mWc=ve(require("http"),1),A0o=ve(require("path"),1);var KVc=require("events"),ZUn=ve(require("fs"),1),rQe=ve(require("path"),1);var PVc=ve(require("os"),1),RVc=300,j_e=20,$Mt=1e7,DVc=PVc.default.platform();var dfm=DVc==="darwin",HAo=DVc==="win32",Q_e=dfm||HAo,FVc=3e3,kVc=2e4,KAo=1250;var Qte;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(Qte||(Qte={}));var tQe;(function(e){e.CHANGE="change",e.RENAME="rename"})(tQe||(tQe={}));var HMt;(function(e){e.CHANGE="change",e.ERROR="error"})(HMt||(HMt={}));var Bc;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(Bc||(Bc={}));var $F;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})($F||($F={}));var mfm=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,c=0,u=0,l=()=>{let E=Date.now(),I=E-c,x=E-u,C=I>=t||x>=o;return[E,C]},p=E=>{if(u=E,!s)return;let I=s;s=void 0,e.apply(void 0,I)},d=()=>{b(0)},f=()=>{a&&(d(),p(Date.now()))},m=E=>{if(u=E,n)return p(E)},h=E=>{if(i&&s)return p(E);s=void 0},g=()=>{a=void 0;let[E,I]=l();return I?h(E):A(E)},A=E=>{let I=E-c,x=E-u,C=t-I,_=o-x,w=Math.min(C,_);return b(w)},b=E=>{a&&clearTimeout(a),!(E<=0)&&(a=setTimeout(g,E))},v=(...E)=>{let[I,x]=l(),C=!!a;if(s=E,c=I,(x||!a)&&b(t),x)return C?p(I):m(I)};return v.cancel=d,v.flush=f,v},KUn=mfm;var ZAo=ve(require("fs"),1),YUn=ve(require("path"),1);var Id=ve(require("fs"),1),rO=require("util");var Gle=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},Mte=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var JAo=ve(require("process"),1),NVc=JAo.default.getuid?!JAo.default.getuid():!1,jVc=1e4,Fj=()=>{};var KMt={isChangeErrorOk:e=>{if(!KMt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!NVc&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!KMt.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!KMt.isNodeError(e))throw e;if(!KMt.isChangeErrorOk(e))throw e}},BI=KMt;var YAo=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=jVc,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},QVc=new YAo;var Wle=(e,t)=>function(n){return function i(...o){return QVc.schedule().then(s=>{let a=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(t(u)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw u};return e.apply(void 0,o).then(a,c)})}},$le=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var hfm={attempt:{chmod:Gle((0,rO.promisify)(Id.default.chmod),BI.onChangeError),chown:Gle((0,rO.promisify)(Id.default.chown),BI.onChangeError),close:Gle((0,rO.promisify)(Id.default.close),Fj),fsync:Gle((0,rO.promisify)(Id.default.fsync),Fj),mkdir:Gle((0,rO.promisify)(Id.default.mkdir),Fj),realpath:Gle((0,rO.promisify)(Id.default.realpath),Fj),stat:Gle((0,rO.promisify)(Id.default.stat),Fj),unlink:Gle((0,rO.promisify)(Id.default.unlink),Fj),chmodSync:Mte(Id.default.chmodSync,BI.onChangeError),chownSync:Mte(Id.default.chownSync,BI.onChangeError),closeSync:Mte(Id.default.closeSync,Fj),existsSync:Mte(Id.default.existsSync,Fj),fsyncSync:Mte(Id.default.fsync,Fj),mkdirSync:Mte(Id.default.mkdirSync,Fj),realpathSync:Mte(Id.default.realpathSync,Fj),statSync:Mte(Id.default.statSync,Fj),unlinkSync:Mte(Id.default.unlinkSync,Fj)},retry:{close:Wle((0,rO.promisify)(Id.default.close),BI.isRetriableError),fsync:Wle((0,rO.promisify)(Id.default.fsync),BI.isRetriableError),open:Wle((0,rO.promisify)(Id.default.open),BI.isRetriableError),readFile:Wle((0,rO.promisify)(Id.default.readFile),BI.isRetriableError),rename:Wle((0,rO.promisify)(Id.default.rename),BI.isRetriableError),stat:Wle((0,rO.promisify)(Id.default.stat),BI.isRetriableError),write:Wle((0,rO.promisify)(Id.default.write),BI.isRetriableError),writeFile:Wle((0,rO.promisify)(Id.default.writeFile),BI.isRetriableError),closeSync:$le(Id.default.closeSync,BI.isRetriableError),fsyncSync:$le(Id.default.fsyncSync,BI.isRetriableError),openSync:$le(Id.default.openSync,BI.isRetriableError),readFileSync:$le(Id.default.readFileSync,BI.isRetriableError),renameSync:$le(Id.default.renameSync,BI.isRetriableError),statSync:$le(Id.default.statSync,BI.isRetriableError),writeSync:$le(Id.default.writeSync,BI.isRetriableError),writeFileSync:$le(Id.default.writeFileSync,BI.isRetriableError)}},MVc=hfm;var JUn=ve(require("fs"),1),JMt=ve(require("path"),1);var XAo=()=>{};var gfm=()=>{let e=XAo,t=XAo,r=!1,n=!1;return{promise:new Promise((c,u)=>{e=l=>(r=!0,c(l)),t=l=>(n=!0,u(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},LVc=gfm;var Afm=()=>{let{promise:e,resolve:t,isPending:r}=LVc(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},UVc=Afm;var zVc={then:e=>{e()}};var VVc=e=>Array.isArray(e)?e:[e],qVc=e=>typeof e=="function";var yfm=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=VVc(o).map(te=>qVc(te)?te:Z=>te.test(Z)),a=te=>s.some(Z=>Z(te)),c=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},g=[],A=new Set,b={},v={},E=new Set,I={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},x={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:g,symlinksNames:A,symlinksNamesToPaths:b,map:v},{promise:C,increment:_,decrement:w}=UVc(),P=0,z=(te,Z,Ee,ye)=>{E.has(Z)||P>=i||(P+=1,te.directories.push(Z),te.directoriesNames.add(Ee),l.push(Z),p.add(Ee),d.propertyIsEnumerable(Ee)||(d[Ee]=[]),d[Ee].push(Z),E.add(Z),!(ye>=n)&&(P>=i||Y(Z,ye+1)))},q=(te,Z,Ee)=>{E.has(Z)||P>=i||(P+=1,te.files.push(Z),te.filesNames.add(Ee),f.push(Z),m.add(Ee),h.propertyIsEnumerable(Ee)||(h[Ee]=[]),h[Ee].push(Z),E.add(Z))},V=(te,Z,Ee,ye)=>{E.has(Z)||P>=i||(P+=1,te.symlinks.push(Z),te.symlinksNames.add(Ee),g.push(Z),A.add(Ee),b.propertyIsEnumerable(Ee)||(b[Ee]=[]),b[Ee].push(Z),E.add(Z),r&&(ye>=n||P>=i||Ce(Z,ye+1)))},X=(te,Z,Ee,ye,De)=>{c.aborted||a(Z)||(ye.isDirectory()?z(te,Z,Ee,De):ye.isFile()?q(te,Z,Ee):ye.isSymbolicLink()&&V(te,Z,Ee,De))},ae=(te,Z,Ee,ye)=>{if(c.aborted)return;let De=Z===JMt.default.sep?"":JMt.default.sep,Re=Ee.name,Ye=`${Z}${De}${Re}`;a(Ye)||(Ee.isDirectory()?z(te,Ye,Re,ye):Ee.isFile()?q(te,Ye,Re):Ee.isSymbolicLink()&&V(te,Ye,Re,ye))},G=(te,Z,Ee,ye)=>{for(let De=0,Re=Ee.length;De<Re;De++)ae(te,Z,Ee[De],ye)},Y=(te,Z)=>{c.aborted||Z>n||P>=i||(_(),JUn.default.readdir(te,{withFileTypes:!0},(Ee,ye)=>{if(Ee||c.aborted||!ye.length)return w();(u(ye)||zVc).then(()=>{let Re=v[te]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};G(Re,te,ye,Z),w()})}))},Ce=(te,Z)=>{_(),JUn.default.realpath(te,(Ee,ye)=>{if(Ee||c.aborted)return w();JUn.default.stat(ye,(De,Re)=>{if(De||c.aborted)return w();let Ye=JMt.default.basename(ye),ct=v[te]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};X(ct,ye,Ye,Re,Z),w()})})};return(async(te,Z=1)=>(te=JMt.default.normalize(te),E.add(te),Y(te,Z),await C,c.aborted?I:x))(e)},GVc=yfm;var Lte={lang:{debounce:KUn,attempt:e=>{try{return e()}catch(t){return Lte.lang.castError(t)}},castArray:e=>Lte.lang.isArray(e)?e:[e],castError:e=>Lte.lang.isError(e)?e:Lte.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(Lte.lang.isNaN(e))return Lte.lang.isNaN(t);if(Lte.lang.isPrimitive(e)||Lte.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(YUn.default.sep).length-1),getRealPath:(e,t)=>{try{return t?ZAo.default.realpathSync.native(e):ZAo.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===YUn.default.sep&&t.length-e.length>YUn.default.sep.length,poll:(e,t=kVc)=>MVc.retry.stat(t)(e,{bigint:!0}).catch(Lte.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await GVc(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},Jl=Lte;var XUn=ve(require("path"),1);var eyo=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||Jl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=RVc){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,c)=>{let u=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...c]),p=this.eventsDeduplicate([...u,...l]);this.onTargetEvents(p)},s=Jl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,c="",u=!1)=>{u?await this.eventsPopulate([c],n,!0):i.add(c),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===Bc.CHANGE&&a===Bc.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===Bc.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===Bc.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??j_e:Math.min(1,this.options.depth??j_e),s=this.options.limit??$Mt,[a,c]=await Jl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),u=[...a,...c];return await Promise.all(u.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())Jl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(Bc.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!Q_e&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(Bc.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Bc.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(XUn.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Bc.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(XUn.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(Bc.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Bc.ADD?this.onTargetAdd(n):r===Bc.ADD_DIR?this.onTargetAddDir(n):r===Bc.CHANGE?this.onTargetChange(n):r===Bc.UNLINK?this.onTargetUnlink(n):r===Bc.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=tQe.CHANGE,r){if(this.watcher.isClosed())return;let n=XUn.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){HAo&&t.code==="EPERM"?this.onWatcherChange(tQe.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(HMt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(HMt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(tQe.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&Q_e&&this.options.native!==!1?this.options.depth??j_e:Math.min(1,this.options.depth??j_e),n=this.options.limit??$Mt,[i,o]=await Jl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(tQe.CHANGE,a,t)}))}}},WVc=eyo;var HF={interval:100,intervalId:void 0,fns:new Map,init:()=>{HF.intervalId||(HF.intervalId=setInterval(HF.resolve,HF.interval))},reset:()=>{HF.intervalId&&(clearInterval(HF.intervalId),delete HF.intervalId)},add:(e,t)=>{HF.fns.set(e,Date.now()+t),HF.init()},remove:e=>{HF.fns.delete(e)},resolve:()=>{if(!HF.fns.size)return HF.reset();let e=Date.now();for(let[t,r]of HF.fns)r>=e||(HF.remove(t),t())}},YMt=HF;var XMt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=KAo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(Jl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let c=()=>{s.add.delete(n),YMt.remove(u)},u=()=>{c(),a()};YMt.add(u,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;c();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=KAo){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let c=()=>{s.unlink.delete(n),YMt.remove(u)},u=()=>{c(),a()};YMt.add(u,r);let l=()=>(c(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Bc.ADD,Qte.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,Bc.ADD_DIR,Qte.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,Bc.UNLINK,Qte.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,Bc.UNLINK_DIR,Qte.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};XMt.DIR_EVENTS={add:Bc.ADD_DIR,rename:Bc.RENAME_DIR,unlink:Bc.UNLINK_DIR};XMt.FILE_EVENTS={add:Bc.ADD,change:Bc.CHANGE,rename:Bc.RENAME,unlink:Bc.UNLINK};var $Vc=XMt;var tyo=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Jl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(Jl.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(Jl.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(Jl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return Jl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);Jl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},ryo=tyo;var nyo=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},HVc=nyo;var iyo=class{constructor(){this.inos={},this.paths=new ryo,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await Jl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new HVc(n)}reset(){this.inos={},this.paths=new ryo,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,Bc.ADD,i),[Bc.ADD];if(i.isDirectory())return this.updateIno(t,Bc.ADD_DIR,i),[Bc.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Bc.UNLINK,n),[Bc.UNLINK];if(n.isDirectory())return this.updateIno(t,Bc.UNLINK_DIR,n),[Bc.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Bc.CHANGE,i),[Bc.CHANGE]);if(i.isDirectory())return this.updateIno(t,Bc.UNLINK,n),this.updateIno(t,Bc.ADD_DIR,i),[Bc.UNLINK,Bc.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Bc.UNLINK_DIR,n),this.updateIno(t,Bc.ADD,i),[Bc.UNLINK_DIR,Bc.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Bc.UNLINK_DIR,n),this.updateIno(t,Bc.ADD_DIR,i),[Bc.UNLINK_DIR,Bc.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?Qte.FILE:Qte.DIR;i[t]=[n.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},oyo=iyo;var syo=class e extends KVc.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on($F.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on($F.CLOSE,i)),this._readyWait=new Promise(i=>this.on($F.READY,i)),this._locker=new $Vc(this),this._roots=new Set,this._poller=new oyo,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(Jl.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit($F.CLOSE))}error(t){if(this.isClosed())return!1;let r=Jl.lang.castError(t);return this.emit($F.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit($F.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit($F.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&Jl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&Jl.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)Jl.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let o=new WVc(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=Jl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=rQe.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??j_e))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&Q_e&&l.options.native!==!1)))return!0;if(!Q_e)break;let u=rQe.default.dirname(t);if(s===u)break;s=u}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=Jl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let c=!r.recursive||Q_e&&r.native!==!1?r:{...r,recursive:!1},l={watcher:ZUn.default.watch(a,c),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=rQe.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(c){this.error(c)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||Q_e&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??j_e,a=r.limit??$Mt,[c]=await Jl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,n,i,o);if(c.length){let l=Jl.fs.getDepth(t);for(let p of c){let d=Jl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||u)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(u,l)=>{l===t&&(c(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on($F.CLOSE,c),s.watchFile(t,r,o)},c=()=>{this._subwatchers.delete(i),this.removeListener($F.CLOSE,c),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=rQe.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new oyo,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return Jl.lang.noop;if(this.pollerExists(t,r))return Jl.lang.noop;let i={...r,interval:r.pollingInterval??FVc},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on($F.CLOSE,a),ZUn.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener($F.CLOSE,a),ZUn.default.unwatchFile(t,n)};return Jl.lang.attempt(s),()=>Jl.lang.attempt(a)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=Jl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,c)=>c===s||!Jl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=rQe.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await Jl.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let o=rQe.default.dirname(t);return(await Jl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=Jl.lang.noop){if(Jl.lang.isFunction(t))return this.watch([],{},t);if(Jl.lang.isUndefined(t))return this.watch([],r,n);if(Jl.lang.isFunction(r))return this.watch(t,{},r);if(Jl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=Jl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==Jl.lang.noop&&this.on($F.ALL,n),r.readdirMap=void 0,this.ready())}},e4n=syo;h4n();Jt();var s8=require("fs/promises"),e8c=require("os"),Oyo=ve(require("path"),1),qdm=".fern",Gdm="logs",Tyo=100*1024*1024;function Wdm(){return"cli@4.79.0"}var cQe=class{logFilePath=null;initialized=!1;sessionStartTime;consoleLogger;constructor(){this.sessionStartTime=Date.now()}async initialize(t){if(this.initialized)return;this.consoleLogger=t;let r=Ke(Wt.of((0,e8c.homedir)()),Be.of(qdm)),n=Ke(r,Be.of(Gdm));await ar(n)||await(0,s8.mkdir)(n,{recursive:!0});let o=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=Ke(n,Be.of(o));let s=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${Oyo.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
|
|
2264
2264
|
`);await(0,s8.writeFile)(this.logFilePath,s,"utf-8"),this.initialized=!0,this.enforceLogSizeLimit(n)}getLogFilePath(){return this.logFilePath}async writeEntry(t){if(!this.initialized||!this.logFilePath)return;let r=JSON.stringify(t)+`
|
|
2265
2265
|
`;try{await(0,s8.appendFile)(this.logFilePath,r,"utf-8")}catch{}}async logFrontendMetrics(t){let r={timestamp:t.timestamp,source:t.source,level:t.level,eventType:this.getEventType(t.payload,t.isAggregate),isAggregate:t.isAggregate,data:t.payload};await this.writeEntry(r)}async logCliMetric(t,r="info"){let n={timestamp:t.timestamp,source:Wdm(),level:r,eventType:t.type,data:{durationMs:t.durationMs,metadata:t.metadata}};await this.writeEntry(n)}async logCliMemory(){let t=process.memoryUsage(),r={type:"cli_memory",timestamp:new Date().toISOString(),metadata:{heapUsed:t.heapUsed,heapTotal:t.heapTotal,external:t.external,rss:t.rss,heapUsedMB:Math.round(t.heapUsed/1024/1024*100)/100,heapTotalMB:Math.round(t.heapTotal/1024/1024*100)/100,rssMB:Math.round(t.rss/1024/1024*100)/100}};await this.logCliMetric(r)}async logCliReloadStart(){let t={type:"cli_reload_start",timestamp:new Date().toISOString()};await this.logCliMetric(t)}async logCliReloadFinish(t,r){let n={type:"cli_reload_finish",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliDocsGeneration(t,r){let n={type:"cli_docs_generation",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliValidation(t,r){let n={type:"cli_validation",timestamp:new Date().toISOString(),durationMs:t,metadata:{success:r}};await this.logCliMetric(n)}async enforceLogSizeLimit(t){try{let n=(await(0,s8.readdir)(t)).filter(c=>c.endsWith(".log")),i=[];for(let c of n){let u=Oyo.default.join(t,c);try{let l=await(0,s8.stat)(u);i.push({name:c,fullPath:u,size:l.size,mtimeMs:l.mtimeMs})}catch{}}let o=i.reduce((c,u)=>c+u.size,0),s=Math.round(o/1024/1024*100)/100,a=Tyo/1024/1024;if(o<=Tyo){this.consoleLogger?.debug(`Log directory size ${s} MB does not exceed ${a} MB cap`);return}this.consoleLogger?.info(`Rotating logs: total size ${s} MB exceeds ${a} MB cap`),i.sort((c,u)=>c.mtimeMs-u.mtimeMs);for(let c of i){if(o<=Tyo)break;if(!(this.logFilePath!=null&&c.fullPath===this.logFilePath))try{await(0,s8.unlink)(c.fullPath),o-=c.size}catch{}}}catch{}}getEventType(t,r){return r?"aggregate_summary":"type"in t&&typeof t.type=="string"?t.type:"unknown"}static isMetricsMessage(t){if(typeof t!="object"||t===null)return!1;let r=t;return r.type==="metrics"&&typeof r.timestamp=="string"&&typeof r.source=="string"}};var Byo={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"};function t8c(e){let t=$dm();if(t==null)return;let{port:r,debugLogger:n,getDocsLoadResponse:i}=e,o=new Map;function s(c){let u=JSON.stringify(c),l=[];for(let[p]of o)try{p.send(u)}catch{l.push(p)}for(let p of l){let d=o.get(p);d&&(clearInterval(d.pingInterval),o.delete(p))}}let a=t.serve({port:r,fetch(c,u){if(c.method==="OPTIONS")return new Response(null,{status:204,headers:Byo});let l=new URL(c.url);if(c.headers.get("upgrade")?.toLowerCase()==="websocket"){u.upgrade(c,{data:{connectionId:`${Date.now()}`}});return}if(c.method==="POST"&&l.pathname==="/v2/registry/docs/load-with-url")return new Response(JSON.stringify(i()),{headers:{"Content-Type":"application/json",...Byo}});let p=/^\/_local\/(.*)/.exec(l.pathname);return c.method==="GET"&&p!=null?new Response(t.file(`/${p[1]}`),{headers:Byo}):new Response("Not Found",{status:404})},websocket:{open(c){let{connectionId:u}=c.data,l=setInterval(()=>{let p=o.get(c);if(!p)return;let d=Date.now();if(d-p.lastPong>9e4){c.close();return}try{c.send(JSON.stringify({type:"ping",timestamp:d}))}catch{c.close()}},3e4);o.set(c,{pingInterval:l,lastPong:Date.now()});try{c.send(JSON.stringify({type:"connected",connectionId:u}))}catch{}},message(c,u){try{let l=JSON.parse(u.toString());if(l.type==="pong"){let p=o.get(c);p&&(p.lastPong=Date.now())}else cQe.isMetricsMessage(l)&&n.logFrontendMetrics(l)}catch{}},close(c){let u=o.get(c);u&&(clearInterval(u.pingInterval),o.delete(c))}}});return{sendData:s,stop:c=>a.stop(c)}}function $dm(){return globalThis.Bun}Jt();var nWc=require("child_process"),Tzn=ve(Myo(),1),iWc=ve(Xbo(),1),JF=require("fs"),kj=require("fs/promises"),oWc=require("os"),G7=ve(require("path"),1),sWc=ve(WC(),1),aWc=ve(rWc(),1),AQe=process.platform==="win32",Szn=we.cyan("[docs]:"),wym="etag",xym=23,u0o=e=>e.padEnd(xym," "),Cym="preview",_ym="app-preview",Sym="bundle",Tym=".next",Oym="standalone",Bym=".fern",Pym="packages/fern-docs/bundle/.next/server/instrumentation.js",Rym='Cannot find matching keyid: {"signatures":';function Dym(e){try{let r=(0,nWc.execSync)('reg query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem" /v LongPathsEnabled',{encoding:"utf-8",timeout:5e3}).match(/LongPathsEnabled\s+REG_DWORD\s+0x(\d+)/i);if(r!=null&&r[1]==="1")return}catch(t){e.debug(`Registry query for LongPathsEnabled failed: ${t}`)}e.warn(we.yellow.bold(`
|
|
2266
2266
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
@@ -2294,7 +2294,7 @@ ${w.stack}`)),m}};m=await b();let v=f.apiWorkspaces.flatMap(C=>C.getAbsoluteFile
|
|
|
2294
2294
|
`)}function Jym(e){return e.some(t=>t.severity==="fatal")?"fatal":e.some(t=>t.severity==="error")?"error":"warning"}function Yym(e){switch(e){case"fatal":return ri.Error;case"error":return ri.Error;case"warning":return ri.Warn;default:Ie(e)}}function Xym(e){switch(e){case"fatal":return we.red("[error]");case"error":return we.red("[error]");case"warning":return we.yellow("[warning]");default:Ie(e)}}function Zym({stats:e,context:t,logWarnings:r,elapsedMillis:n=0}){let{numFatal:i,numErrors:o,numWarnings:s}=e,a=n>0?` in ${(n/1e3).toFixed(3)} seconds.`:".",c=`Found ${i+o} errors and ${s} warnings`+a;!r&&s>0&&(c+=" Run fern check --warnings to print out the warnings not shown."),i+o>0?t.logger.error(c):s>0?t.logger.warn(c):t.logger.info(we.green("\u2713 All checks passed"))}function ebm(e){let t=0,r=0,n=0;for(let i of e)switch(i.severity){case"fatal":t+=1;continue;case"error":r+=1;continue;case"warning":n+=1;continue;default:Ie(i.severity)}return{numFatal:t,numErrors:r,numWarnings:n}}Jt();Pt();async function bWc({groups:e,visitor:t,nodePath:r,cliVersion:n}){if(e!=null)for(let[i,o]of Object.entries(e))await tbm({group:o,visitor:t,nodePath:[...r,i],cliVersion:n})}async function tbm({group:e,visitor:t,nodePath:r,cliVersion:n}){await Promise.all(e.generators.map(async(i,o)=>await t.generatorInvocation?.({invocation:i,cliVersion:n},[...r,"generators",o.toString(),"image"in i?i.image.name:i.name])))}async function EWc(e,t,r){await r.file?.(e,[]),await r4(e,{"auth-schemes":At,api:At,whitelabel:At,metadata:At,readme:At,"default-group":At,aliases:At,reviewers:At,openapi:At,"openapi-overrides":At,"spec-origin":At,"async-api":At,"api-settings":At,ai:At,autorelease:At,replay:At,automation:At,groups:async n=>{await bWc({groups:n,visitor:r,nodePath:["groups"],cliVersion:t})}})}function vWc({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(o){let s=async(a,c)=>{for(let{name:u,visitors:l}of r){let p=l.generatorsYml?.[o];if(p!=null){let d=await p(a,{relativeFilepath:e,contents:t});n(d.map(f=>({name:u,severity:f.severity,relativeFilepath:e,nodePath:c,message:f.message})))}}};return{[o]:s}}return{...i("file"),...i("generatorInvocation")}}function rbm(e,t,r){if(!t2(r,t))return[{severity:"fatal",message:`The generator ${e} requires CLI version ${t} or later (current version: ${r}). Please run \`fern upgrade\` to upgrade your CLI version and use this generator.`}]}function nbm(e){return Number(e.replace("v",""))}var I0o={name:"compatible-ir-version",create:async()=>({generatorsYml:{generatorInvocation:async({invocation:e,cliVersion:t})=>{if(t==null||t==="0.0.0")return[];let r=ESr({token:void 0}),n=await r.generators.cli.getCliRelease(t);if(!n.ok)return[];let i=n.body.irVersion,o="image"in e?e.image.name:e.name,s;if(e["ir-version"]!=null)s=nbm(e["ir-version"]);else{let c={...e,name:U0(o)},u=await Eke(c);if(u==null)return[];s=u}if(s<=i)return[];let a=await r.generators.cli.getMinCliForIr(s);return a.ok?rbm(o,a.body.version,t)??[]:[]}}})};var w0o={name:"valid-alias-group-references",create:async()=>({generatorsYml:{file:async e=>{let t=[],r=e.aliases,n=e.groups??{};if(r==null)return t;let i=new Set(Object.keys(n));for(let[o,s]of Object.entries(r))if(Array.isArray(s))for(let a of s)i.has(a)||t.push({severity:"error",message:`Alias "${o}" references unknown group "${a}". Available groups: ${[...i].join(", ")||"none"}`});return t}}})};function IWc(){return[I0o,w0o]}async function Nzn(e,t){return ibm({workspace:e,rules:IWc(),logger:t})}async function ibm({workspace:e,rules:t,logger:r}){let n=[],i=await Promise.all(t.map(async o=>({name:o.name,visitors:await o.create({workspace:e,logger:r})})));if(e.generatorsConfiguration?.rawConfiguration){let o=await obm({contents:e.generatorsConfiguration.rawConfiguration,allRuleVisitors:i,cliVersion:e.cliVersion});n.push(...o)}return n}async function obm({contents:e,allRuleVisitors:t,cliVersion:r}){let n=[],i=vWc({relativeFilepath:Be.of(ef),contents:e,allRuleVisitors:t,addViolations:o=>{n.push(...o)}});return await EWc(e,r,i),n}var x0o=ve(xWc(),1);async function C0o({workspace:e,context:t,ossWorkspace:r}){(0,x0o.default)(e.definition.rootApiFile.contents.name).validForNewPackages||t.failAndThrow("API name is not valid.");let n=performance.now(),i=uke(e,t.logger),o=await Nzn(e,t.logger),s=[...i,...o];r&&s.push(...await obe(r,t));let a=performance.now()-n,c=s.some(u=>u.severity==="fatal"||u.severity==="error");return{apiName:e.definition.rootApiFile.contents.name,violations:s,elapsedMillis:a,hasErrors:c}}async function CWc({workspace:e,context:t,logWarnings:r,logSummary:n=!0,ossWorkspace:i}){let o=performance.now(),s=uke(e,t.logger),a=await Nzn(e,t.logger),c=[...s,...a];i&&c.push(...await obe(i,t));let u=performance.now()-o,{hasErrors:l}=bQe({violations:c,context:t,logWarnings:r,logSummary:n,elapsedMillis:u});return{hasErrors:l}}async function W7({workspace:e,context:t,logWarnings:r,ossWorkspace:n}){(0,x0o.default)(e.definition.rootApiFile.contents.name).validForNewPackages||t.failAndThrow("API name is not valid.");let{hasErrors:i}=await CWc({workspace:e,context:t,logWarnings:r,ossWorkspace:n});i&&t.failAndThrow()}Pt();function lbm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function _0o(e,t){for(let[r,n]of Rb(e.failures))pbm({relativeFilepath:r,failure:n,logger:t})}function pbm({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case Ol.MISCONFIGURED_DIRECTORY:r.error(`No API definition found. Expected one of the following:
|
|
2295
2295
|
- An api section in generators.yml pointing to your API spec(s)
|
|
2296
2296
|
- A definition/ directory with Fern Definition files
|
|
2297
|
-
For more information, see https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder`);break;case Ol.FILE_READ:r.error("Failed to open file: "+e);break;case Ol.FILE_MISSING:r.error("Missing file: "+e);break;case Ol.FILE_PARSE:t.error instanceof o_t?r.error(Nz({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case Ol.STRUCTURE_VALIDATION:for(let n of t.error.issues)for(let{title:i,subtitle:o}of fbm(n))r.error(Nz({title:i,subtitle:o,breadcrumbs:[e,...n.path]}));break;case Ol.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case Ol.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${csr}: `+t.dependencyName);break;case Ol.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case Ol.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case Ol.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let n=t.error.error.instancePath.split("/").filter(i=>i!=="").map(lbm);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?n.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&n.push(t.error.error.params.additionalProperty),r.error(Nz({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...n]}))}break;default:Ie(t)}}function fbm(e){switch(e.code){case bn.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${we.underline(e.expected)} but received ${we.underline(e.received)}`}];case bn.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${we.underline(t)}`}));case bn.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>we.underline(t)).join(", ")}`}];case bn.invalid_union:case bn.invalid_arguments:case bn.invalid_return_type:case bn.invalid_date:case bn.invalid_string:case bn.too_small:case bn.too_big:case bn.invalid_intersection_types:case bn.not_multiple_of:case bn.custom:default:return[{title:e.message}]}}Jt();Jt();Jt();var _Wc=require("fs/promises");async function SWc(e,t){let r=[];for(let n of await qC(e,t))r.push(await dbm({relativeFilepath:Js(e,n),absoluteFilepath:n}));return r}async function dbm({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,_Wc.readFile)(t)).toString()}}async function TWc({absolutePathToWorkspace:e}){let t=Ke(e,Be.of(EUs));if(!await ar(t))return;let n=await SWc(t,"{md,mdx}");return{files:await Promise.all(n.map(i=>({absoluteFilepath:i.absoluteFilepath,contents:i.fileContents})))}}async function S0o({absolutePathToWorkspace:e,namespace:t,definitions:r}){let n=[];for(let i of r){let o;i.overrides!=null&&(Array.isArray(i.overrides)?o=i.overrides.map(u=>Ke(e,Be.of(u))):o=Ke(e,Be.of(i.overrides)));let s=i.overlays!=null?Ke(e,Be.of(i.overlays)):void 0;if(i.schema.type==="protobuf"){let u=Be.of(i.schema.root),l=Ke(e,u);if(!await ar(l))return{didSucceed:!1,failures:{[Be.of(i.schema.root)]:{type:Ol.FILE_MISSING}}};let p=i.schema.target.length===0?void 0:Ke(e,Be.of(i.schema.target));if(p!=null&&!await ar(p))return{didSucceed:!1,failures:{[Be.of(i.schema.target)]:{type:Ol.FILE_MISSING}}};let d=Abr(i.settings);n.push({type:"protobuf",absoluteFilepathToProtobufRoot:l,absoluteFilepathToProtobufTarget:p,absoluteFilepathToOverrides:o,relativeFilepathToProtobufRoot:u,dependencies:i.schema.dependencies,generateLocally:i.schema.localGeneration,fromOpenAPI:i.schema.fromOpenAPI,settings:{...d,audiences:i.audiences??[]}});continue}if(i.schema.type==="openrpc"){let u=Be.of(i.schema.path),l=Ke(e,u);n.push({type:"openrpc",absoluteFilepath:l,absoluteFilepathToOverrides:o,namespace:t});continue}if(i.schema.type==="graphql"){let u=Be.of(i.schema.path),l=Ke(e,u);if(!await ar(l))return{didSucceed:!1,failures:{[u]:{type:Ol.FILE_MISSING}}};n.push({type:"graphql",absoluteFilepath:l,absoluteFilepathToOverrides:o,namespace:t});continue}let a=Ke(e,Be.of(i.schema.path));if(!await ar(a))return{didSucceed:!1,failures:{[Be.of(i.schema.path)]:{type:Ol.FILE_MISSING}}};if(i.overrides!=null&&o!=null){let u=Array.isArray(o)?o:[o],l=Array.isArray(i.overrides)?i.overrides:[i.overrides];for(let p=0;p<u.length;p++){let d=u[p],f=l[p];if(d!=null&&f!=null&&!await ar(d))return{didSucceed:!1,failures:{[Be.of(f)]:{type:Ol.FILE_MISSING}}}}}if(i.overlays!=null&&s!=null&&!await ar(s))return{didSucceed:!1,failures:{[Be.of(i.overlays)]:{type:Ol.FILE_MISSING}}};let c=Abr(i.settings);n.push({type:"openapi",absoluteFilepath:a,absoluteFilepathToOverrides:o,absoluteFilepathToOverlays:s,settings:{...c,audiences:i.audiences??[]},source:{type:"openapi",file:a},namespace:t})}return n}async function DLt({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:n,lenient:i}){let[o,s]=await Promise.all([zM({absolutePathToWorkspace:e,context:t,lenient:i}),TWc({absolutePathToWorkspace:e}).catch(()=>{})]);if(o?.api!=null&&o?.api.type==="conjure")return{didSucceed:!0,workspace:new CHe({workspaceName:n,absoluteFilePath:e,generatorsConfiguration:o,changelog:s,cliVersion:r,context:t,relativePathToConjureDirectory:Be.of(o.api.pathToConjureDefinition)})};if(o?.api!=null&&(o.api.type==="singleNamespace"&&o.api.definitions.length>0||o.api.type==="multiNamespace")){let u=[];if(o.api.type==="singleNamespace"){let p=await S0o({absolutePathToWorkspace:e,namespace:void 0,definitions:o.api.definitions});if(!Array.isArray(p))return p;u.push(...p)}else{let p=Object.entries(o.api.definitions),d=await Promise.all(p.map(([f,m])=>S0o({absolutePathToWorkspace:e,namespace:f,definitions:m})));for(let f of d){if(!Array.isArray(f))return f;u.push(...f)}if(o.api.rootDefinitions!=null){let f=await S0o({absolutePathToWorkspace:e,namespace:void 0,definitions:o.api.rootDefinitions});if(!Array.isArray(f))return f;u.push(...f)}}let l={didSucceed:!0,workspace:new kf({specs:u.filter(p=>!(p.type==="openrpc"||p.type==="protobuf"&&!p.fromOpenAPI)),allSpecs:u.filter(p=>!(p.type==="protobuf"&&p.fromOpenAPI)),workspaceName:n,absoluteFilePath:e,generatorsConfiguration:o,changelog:s,cliVersion:r})};return await l.workspace.processGraphQLSpecs(t),l}if(await ar(Ke(e,Be.of(AA))))return{didSucceed:!0,workspace:new OB({absoluteFilePath:e,generatorsConfiguration:o,workspaceName:n,changelog:s,context:t,cliVersion:r,loadAPIWorkspace:DLt})};if(await hKt(Ke(e,Be.of(AA)))){let u=e.split("/").pop();t.logger.warn(`Detected empty API definition: ${u}. Remove to resolve error.`)}let a=[];return o==null?a.push(`No ${ef} was found.`):o.api==null?a.push(`${ef} was found but does not contain an "api" section.`):a.push(`${ef} has an "api" section but no valid API specs could be resolved from it.`),await ar(Ke(e,Be.of(AA)))||a.push(`No "${AA}/" directory was found.`),a.length>0&&t.logger.debug(`Workspace diagnostic: ${a.join(" ")}`),{didSucceed:!1,failures:{[Be.of(Mxt)]:{type:Ol.MISCONFIGURED_DIRECTORY}}}}Pt();Jt();var OWc=require("fs/promises");var T0o={};$(T0o,{additionalProperties:()=>Abm,default:()=>bbm,definitions:()=>ybm,properties:()=>hbm,required:()=>gbm,type:()=>mbm});var mbm="object",hbm={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},libraries:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.LibraryConfiguration"}},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},products:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ProductConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},languages:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.Language"}},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-search":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-examples":{oneOf:[{$ref:"#/definitions/docs.AiExamplesConfig"},{type:"null"}]},agents:{oneOf:[{$ref:"#/definitions/docs.AgentsConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},check:{oneOf:[{$ref:"#/definitions/docs.CheckConfig"},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},settings:{oneOf:[{$ref:"#/definitions/docs.DocsSettingsConfig"},{type:"null"}]},theme:{oneOf:[{$ref:"#/definitions/docs.ThemeConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]},header:{oneOf:[{type:"string"},{type:"null"}]},footer:{oneOf:[{type:"string"},{type:"null"}]}},gbm=["instances"],Abm=!1,ybm={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageLaunch":{type:"string",enum:["github","dashboard"]},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]},launch:{oneOf:[{$ref:"#/definitions/docs.EditThisPageLaunch"},{type:"null"}]}},additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.Audience":{anyOf:[{$ref:"#/definitions/docs.AudienceId"},{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}}]},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.GitLibraryInputSchema":{type:"object",properties:{git:{type:"string"},subpath:{oneOf:[{type:"string"},{type:"null"}]}},required:["git"],additionalProperties:!1},"docs.PathLibraryInputSchema":{type:"object",properties:{path:{type:"string"}},required:["path"],additionalProperties:!1},"docs.LibraryInputConfiguration":{anyOf:[{$ref:"#/definitions/docs.GitLibraryInputSchema"},{$ref:"#/definitions/docs.PathLibraryInputSchema"}]},"docs.LibraryOutputConfiguration":{type:"object",properties:{path:{type:"string"}},required:["path"],additionalProperties:!1},"docs.LibraryLanguage":{type:"string",enum:["python","cpp"]},"docs.LibraryConfig":{type:"object",properties:{doxyfile:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.LibraryConfiguration":{type:"object",properties:{input:{$ref:"#/definitions/docs.LibraryInputConfiguration"},output:{$ref:"#/definitions/docs.LibraryOutputConfiguration"},lang:{$ref:"#/definitions/docs.LibraryLanguage"},config:{oneOf:[{$ref:"#/definitions/docs.LibraryConfig"},{type:"null"}]}},required:["input","output","lang"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.Target":{type:"string",enum:["_blank","_self","_parent","_top"]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.InternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.ExternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},href:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["display-name","href"],additionalProperties:!1},"docs.ProductConfig":{anyOf:[{$ref:"#/definitions/docs.InternalProduct"},{$ref:"#/definitions/docs.ExternalProduct"}]},"docs.Availability":{type:"string",enum:["stable","generally-available","in-development","pre-release","deprecated","beta"]},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.CollapsedStringValue":{type:"string",enum:["open-by-default"]},"docs.CollapsedValue":{anyOf:[{type:"boolean"},{$ref:"#/definitions/docs.CollapsedStringValue"}]},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},collapsible:{oneOf:[{type:"boolean"},{type:"null"}]},"collapsed-by-default":{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},php:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},swift:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},rust:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{hidden:{oneOf:[{type:"boolean"},{type:"null"}]},environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},collapsible:{oneOf:[{type:"boolean"},{type:"null"}]},"collapsed-by-default":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.ApiReferenceOperationConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},operation:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["operation"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.ApiReferenceOperationConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},"tag-description-pages":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},postman:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.LibraryName":{type:"string"},"docs.LibraryReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},library:{$ref:"#/definitions/docs.LibraryName"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]}},required:["library"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.TitleSource":{type:"string",enum:["frontmatter","filename"]},"docs.FolderConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},folder:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},"title-source":{oneOf:[{$ref:"#/definitions/docs.TitleSource"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},collapsible:{oneOf:[{type:"boolean"},{type:"null"}]},"collapsed-by-default":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["folder"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LibraryReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"},{$ref:"#/definitions/docs.FolderConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItemWithLayout":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabVariant":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},layout:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","layout"],additionalProperties:!1},"docs.TabbedNavigationItemWithVariants":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},variants:{type:"array",items:{$ref:"#/definitions/docs.TabVariant"}}},required:["tab","variants"],additionalProperties:!1},"docs.TabbedNavigationItem":{anyOf:[{$ref:"#/definitions/docs.TabbedNavigationItemWithLayout"},{$ref:"#/definitions/docs.TabbedNavigationItemWithVariants"}]},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfigWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},url:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.NavbarGithubConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.NavbarGithubConfigWithOptions"}]},"docs.NavbarLinkConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","dropdown","primary","secondary"]}},oneOf:[{properties:{type:{const:"filled"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"dropdown"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},links:{type:"array",items:{$ref:"#/definitions/docs.NavbarLinkConfig"}},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type","links"]},{properties:{type:{const:"primary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionOption":{type:"string",enum:["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]},"docs.CustomPageAction":{type:"object",properties:{title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","url"],additionalProperties:!1},"docs.PageActionOptions":{type:"object",properties:{"copy-page":{oneOf:[{type:"boolean"},{type:"null"}]},"view-as-markdown":{oneOf:[{type:"boolean"},{type:"null"}]},"ask-ai":{oneOf:[{type:"boolean"},{type:"null"}]},chatgpt:{oneOf:[{type:"boolean"},{type:"null"}]},claude:{oneOf:[{type:"boolean"},{type:"null"}]},cursor:{oneOf:[{type:"boolean"},{type:"null"}]},vscode:{oneOf:[{type:"boolean"},{type:"null"}]},custom:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.CustomPageAction"}},{type:"null"}]}},additionalProperties:!1},"docs.PageActionsConfig":{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/docs.PageActionOption"},{type:"null"}]},options:{oneOf:[{$ref:"#/definitions/docs.PageActionOptions"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]},"dynamic-snippets":{oneOf:[{type:"boolean"},{type:"null"}]},"ai-examples":{oneOf:[{type:"boolean"},{type:"null"}]},"ai-example-style-instructions":{oneOf:[{type:"string"},{type:"null"}]},"exclude-apis":{oneOf:[{type:"boolean"},{type:"null"}]},"basepath-aware":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.Language":{type:"string",enum:["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]},"docs.AIChatModel":{type:"string",enum:["claude-3.7","claude-4","command-a"]},"docs.AIChatLocation":{type:"string",enum:["docs","slack","discord"]},"docs.AIChatWebsiteDatasource":{type:"object",properties:{url:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.AIChatDatasource":{anyOf:[{$ref:"#/definitions/docs.AIChatWebsiteDatasource"}]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]},location:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatLocation"}},{type:"null"}]},datasources:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatDatasource"}},{type:"null"}]}},additionalProperties:!1},"docs.AiExamplesConfig":{type:"object",properties:{enabled:{oneOf:[{type:"boolean"},{type:"null"}]},style:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageDescriptionSource":{type:"string",enum:["description","subtitle"]},"docs.AgentsConfig":{type:"object",properties:{"page-directive":{oneOf:[{type:"string"},{type:"null"}]},"page-description-source":{oneOf:[{$ref:"#/definitions/docs.PageDescriptionSource"},{type:"null"}]},"llms-txt":{oneOf:[{type:"string"},{type:"null"}]},"llms-full-txt":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]},"og:dynamic":{oneOf:[{type:"boolean"},{type:"null"}]},"og:background-image":{oneOf:[{type:"string"},{type:"null"}]},"canonical-host":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.CheckRuleSeverity":{type:"string",enum:["warn","error"]},"docs.CheckRulesConfig":{type:"object",properties:{"example-validation":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"broken-links":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"no-non-component-refs":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"valid-local-references":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"no-circular-redirects":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"valid-docs-endpoints":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"missing-redirects":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]}},additionalProperties:!1},"docs.CheckConfig":{type:"object",properties:{rules:{oneOf:[{$ref:"#/definitions/docs.CheckRulesConfig"},{type:"null"}]}},additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},"right-text":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-1":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-2":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-3":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-4":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-5":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-6":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-7":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-8":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-9":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-10":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-11":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-12":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.SwitcherPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"switcher-placement":{oneOf:[{$ref:"#/definitions/docs.SwitcherPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-nav-links":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-feedback":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.HttpSnippetLanguage":{type:"string",enum:["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]},"docs.HttpSnippetsConfig":{anyOf:[{type:"boolean"},{type:"array",items:{$ref:"#/definitions/docs.HttpSnippetLanguage"}}]},"docs.DocsSettingsConfig":{type:"object",properties:{"search-text":{oneOf:[{type:"string"},{type:"null"}]},"disable-search":{oneOf:[{type:"boolean"},{type:"null"}]},"dark-mode-code":{oneOf:[{type:"boolean"},{type:"null"}]},"default-search-filters":{oneOf:[{type:"boolean"},{type:"null"}]},"http-snippets":{oneOf:[{$ref:"#/definitions/docs.HttpSnippetsConfig"},{type:"null"}]},"hide-404-page":{oneOf:[{type:"boolean"},{type:"null"}]},"use-javascript-as-typescript":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-explorer-proxy":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-analytics":{oneOf:[{type:"boolean"},{type:"null"}]},language:{oneOf:[{$ref:"#/definitions/docs.Language"},{type:"null"}]},"folder-title-source":{oneOf:[{$ref:"#/definitions/docs.TitleSource"},{type:"null"}]},"substitute-env-vars":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.SidebarThemeConfig":{type:"string",enum:["default","minimal"]},"docs.BodyThemeConfig":{type:"string",enum:["default","canvas"]},"docs.TabsThemeStyle":{type:"string",enum:["default","bubble"]},"docs.TabsAlignment":{type:"string",enum:["left","center"]},"docs.TabsThemeObjectConfig":{type:"object",properties:{style:{oneOf:[{$ref:"#/definitions/docs.TabsThemeStyle"},{type:"null"}]},alignment:{oneOf:[{$ref:"#/definitions/docs.TabsAlignment"},{type:"null"}]},placement:{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]}},additionalProperties:!1},"docs.TabsThemeConfig":{anyOf:[{$ref:"#/definitions/docs.TabsThemeStyle"},{$ref:"#/definitions/docs.TabsThemeObjectConfig"}]},"docs.PageActionsThemeConfig":{type:"string",enum:["default","toolbar"]},"docs.FooterNavThemeConfig":{type:"string",enum:["default","minimal"]},"docs.LanguageSwitcherThemeConfig":{type:"string",enum:["default","minimal"]},"docs.ProductSwitcherThemeConfig":{type:"string",enum:["default","toggle"]},"docs.ThemeConfig":{type:"object",properties:{sidebar:{oneOf:[{$ref:"#/definitions/docs.SidebarThemeConfig"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/docs.BodyThemeConfig"},{type:"null"}]},tabs:{oneOf:[{$ref:"#/definitions/docs.TabsThemeConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsThemeConfig"},{type:"null"}]},"footer-nav":{oneOf:[{$ref:"#/definitions/docs.FooterNavThemeConfig"},{type:"null"}]},"language-switcher":{oneOf:[{$ref:"#/definitions/docs.LanguageSwitcherThemeConfig"},{type:"null"}]},"product-switcher":{oneOf:[{$ref:"#/definitions/docs.ProductSwitcherThemeConfig"},{type:"null"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]},context7:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},bbm={type:mbm,properties:hbm,required:gbm,additionalProperties:Abm,definitions:ybm};async function O0o({fernDirectory:e,context:t}){let r=Ke(e,Be.of(rh));if(!await ar(r))return;let n=await Ebm({absolutePathToDocsDefinition:e,context:t});if(n!=null)return{type:"docs",absoluteFilePath:e,config:n,workspaceName:void 0,absoluteFilepathToDocsConfig:Ke(e,Be.of(rh))}}async function Ebm({absolutePathToDocsDefinition:e,context:t}){if(!await ar(e))return;let r=Ke(e,Be.of(rh));return await vbm({absolutePathOfConfiguration:r,context:t})}async function vbm({absolutePathOfConfiguration:e,context:t}){let r=await(0,OWc.readFile)(e),n=Rr.load(r.toString()),i=u4(n,T0o,{filePath:e});if(i.success){let o=[];t.logger.debug("About to sanitize docs configuration JSON structure");let s=lM(n,[],o);o.length>0?t.logger.warn(`docs.yml contained null/undefined sections that were ignored: ${o.map(a=>a.join(".")).join(", ")}`):t.logger.debug("No null/undefined values found during sanitization");try{return t.logger.debug("Attempting to parse sanitized docs configuration"),c_.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(s)}catch(a){throw t.logger.error(`Parsing failed even after sanitization: ${Ai(a)}`),t.logger.debug(`Sanitized JSON structure: ${JSON.stringify(s,null,2)}`),new Error(`Failed to parse ${e}: ${Ai(a)}`)}}else throw new Error(`Failed to parse docs.yml:
|
|
2297
|
+
For more information, see https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder`);break;case Ol.FILE_READ:r.error("Failed to open file: "+e);break;case Ol.FILE_MISSING:r.error("Missing file: "+e);break;case Ol.FILE_PARSE:t.error instanceof o_t?r.error(Nz({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case Ol.STRUCTURE_VALIDATION:for(let n of t.error.issues)for(let{title:i,subtitle:o}of fbm(n))r.error(Nz({title:i,subtitle:o,breadcrumbs:[e,...n.path]}));break;case Ol.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case Ol.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${csr}: `+t.dependencyName);break;case Ol.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case Ol.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case Ol.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let n=t.error.error.instancePath.split("/").filter(i=>i!=="").map(lbm);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?n.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&n.push(t.error.error.params.additionalProperty),r.error(Nz({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...n]}))}break;default:Ie(t)}}function fbm(e){switch(e.code){case bn.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${we.underline(e.expected)} but received ${we.underline(e.received)}`}];case bn.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${we.underline(t)}`}));case bn.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>we.underline(t)).join(", ")}`}];case bn.invalid_union:case bn.invalid_arguments:case bn.invalid_return_type:case bn.invalid_date:case bn.invalid_string:case bn.too_small:case bn.too_big:case bn.invalid_intersection_types:case bn.not_multiple_of:case bn.custom:default:return[{title:e.message}]}}Jt();Jt();Jt();var _Wc=require("fs/promises");async function SWc(e,t){let r=[];for(let n of await qC(e,t))r.push(await dbm({relativeFilepath:Js(e,n),absoluteFilepath:n}));return r}async function dbm({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,_Wc.readFile)(t)).toString()}}async function TWc({absolutePathToWorkspace:e}){let t=Ke(e,Be.of(EUs));if(!await ar(t))return;let n=await SWc(t,"{md,mdx}");return{files:await Promise.all(n.map(i=>({absoluteFilepath:i.absoluteFilepath,contents:i.fileContents})))}}async function S0o({absolutePathToWorkspace:e,namespace:t,definitions:r}){let n=[];for(let i of r){let o;i.overrides!=null&&(Array.isArray(i.overrides)?o=i.overrides.map(u=>Ke(e,Be.of(u))):o=Ke(e,Be.of(i.overrides)));let s=i.overlays!=null?Ke(e,Be.of(i.overlays)):void 0;if(i.schema.type==="protobuf"){let u=Be.of(i.schema.root),l=Ke(e,u);if(!await ar(l))return{didSucceed:!1,failures:{[Be.of(i.schema.root)]:{type:Ol.FILE_MISSING}}};let p=i.schema.target.length===0?void 0:Ke(e,Be.of(i.schema.target));if(p!=null&&!await ar(p))return{didSucceed:!1,failures:{[Be.of(i.schema.target)]:{type:Ol.FILE_MISSING}}};let d=Abr(i.settings);n.push({type:"protobuf",absoluteFilepathToProtobufRoot:l,absoluteFilepathToProtobufTarget:p,absoluteFilepathToOverrides:o,relativeFilepathToProtobufRoot:u,dependencies:i.schema.dependencies,generateLocally:i.schema.localGeneration,fromOpenAPI:i.schema.fromOpenAPI,settings:{...d,audiences:i.audiences??[]}});continue}if(i.schema.type==="openrpc"){let u=Be.of(i.schema.path),l=Ke(e,u);n.push({type:"openrpc",absoluteFilepath:l,absoluteFilepathToOverrides:o,namespace:t});continue}if(i.schema.type==="graphql"){let u=Be.of(i.schema.path),l=Ke(e,u);if(!await ar(l))return{didSucceed:!1,failures:{[u]:{type:Ol.FILE_MISSING}}};n.push({type:"graphql",absoluteFilepath:l,absoluteFilepathToOverrides:o,namespace:t});continue}let a=Ke(e,Be.of(i.schema.path));if(!await ar(a))return{didSucceed:!1,failures:{[Be.of(i.schema.path)]:{type:Ol.FILE_MISSING}}};if(i.overrides!=null&&o!=null){let u=Array.isArray(o)?o:[o],l=Array.isArray(i.overrides)?i.overrides:[i.overrides];for(let p=0;p<u.length;p++){let d=u[p],f=l[p];if(d!=null&&f!=null&&!await ar(d))return{didSucceed:!1,failures:{[Be.of(f)]:{type:Ol.FILE_MISSING}}}}}if(i.overlays!=null&&s!=null&&!await ar(s))return{didSucceed:!1,failures:{[Be.of(i.overlays)]:{type:Ol.FILE_MISSING}}};let c=Abr(i.settings);n.push({type:"openapi",absoluteFilepath:a,absoluteFilepathToOverrides:o,absoluteFilepathToOverlays:s,settings:{...c,audiences:i.audiences??[]},source:{type:"openapi",file:a},namespace:t})}return n}async function DLt({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:n,lenient:i}){let[o,s]=await Promise.all([zM({absolutePathToWorkspace:e,context:t,lenient:i}),TWc({absolutePathToWorkspace:e}).catch(()=>{})]);if(o?.api!=null&&o?.api.type==="conjure")return{didSucceed:!0,workspace:new CHe({workspaceName:n,absoluteFilePath:e,generatorsConfiguration:o,changelog:s,cliVersion:r,context:t,relativePathToConjureDirectory:Be.of(o.api.pathToConjureDefinition)})};if(o?.api!=null&&(o.api.type==="singleNamespace"&&o.api.definitions.length>0||o.api.type==="multiNamespace")){let u=[];if(o.api.type==="singleNamespace"){let p=await S0o({absolutePathToWorkspace:e,namespace:void 0,definitions:o.api.definitions});if(!Array.isArray(p))return p;u.push(...p)}else{let p=Object.entries(o.api.definitions),d=await Promise.all(p.map(([f,m])=>S0o({absolutePathToWorkspace:e,namespace:f,definitions:m})));for(let f of d){if(!Array.isArray(f))return f;u.push(...f)}if(o.api.rootDefinitions!=null){let f=await S0o({absolutePathToWorkspace:e,namespace:void 0,definitions:o.api.rootDefinitions});if(!Array.isArray(f))return f;u.push(...f)}}let l={didSucceed:!0,workspace:new kf({specs:u.filter(p=>!(p.type==="openrpc"||p.type==="protobuf"&&!p.fromOpenAPI)),allSpecs:u.filter(p=>!(p.type==="protobuf"&&p.fromOpenAPI)),workspaceName:n,absoluteFilePath:e,generatorsConfiguration:o,changelog:s,cliVersion:r})};return await l.workspace.processGraphQLSpecs(t),l}if(await ar(Ke(e,Be.of(AA))))return{didSucceed:!0,workspace:new OB({absoluteFilePath:e,generatorsConfiguration:o,workspaceName:n,changelog:s,context:t,cliVersion:r,loadAPIWorkspace:DLt})};if(await hKt(Ke(e,Be.of(AA)))){let u=e.split("/").pop();t.logger.warn(`Detected empty API definition: ${u}. Remove to resolve error.`)}let a=[];return o==null?a.push(`No ${ef} was found.`):o.api==null?a.push(`${ef} was found but does not contain an "api" section.`):a.push(`${ef} has an "api" section but no valid API specs could be resolved from it.`),await ar(Ke(e,Be.of(AA)))||a.push(`No "${AA}/" directory was found.`),a.length>0&&t.logger.debug(`Workspace diagnostic: ${a.join(" ")}`),{didSucceed:!1,failures:{[Be.of(Mxt)]:{type:Ol.MISCONFIGURED_DIRECTORY}}}}Pt();Jt();var OWc=require("fs/promises");var T0o={};$(T0o,{additionalProperties:()=>Abm,default:()=>bbm,definitions:()=>ybm,properties:()=>hbm,required:()=>gbm,type:()=>mbm});var mbm="object",hbm={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},libraries:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.LibraryConfiguration"}},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},products:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ProductConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},languages:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.Language"}},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-search":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-examples":{oneOf:[{$ref:"#/definitions/docs.AiExamplesConfig"},{type:"null"}]},agents:{oneOf:[{$ref:"#/definitions/docs.AgentsConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},check:{oneOf:[{$ref:"#/definitions/docs.CheckConfig"},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},settings:{oneOf:[{$ref:"#/definitions/docs.DocsSettingsConfig"},{type:"null"}]},theme:{oneOf:[{$ref:"#/definitions/docs.ThemeConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]},header:{oneOf:[{type:"string"},{type:"null"}]},footer:{oneOf:[{type:"string"},{type:"null"}]}},gbm=["instances"],Abm=!1,ybm={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageLaunch":{type:"string",enum:["github","dashboard"]},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]},launch:{oneOf:[{$ref:"#/definitions/docs.EditThisPageLaunch"},{type:"null"}]}},additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.Audience":{anyOf:[{$ref:"#/definitions/docs.AudienceId"},{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}}]},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.GitLibraryInputSchema":{type:"object",properties:{git:{type:"string"},subpath:{oneOf:[{type:"string"},{type:"null"}]}},required:["git"],additionalProperties:!1},"docs.PathLibraryInputSchema":{type:"object",properties:{path:{type:"string"}},required:["path"],additionalProperties:!1},"docs.LibraryInputConfiguration":{anyOf:[{$ref:"#/definitions/docs.GitLibraryInputSchema"},{$ref:"#/definitions/docs.PathLibraryInputSchema"}]},"docs.LibraryOutputConfiguration":{type:"object",properties:{path:{type:"string"}},required:["path"],additionalProperties:!1},"docs.LibraryLanguage":{type:"string",enum:["python","cpp"]},"docs.LibraryConfig":{type:"object",properties:{doxyfile:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.LibraryConfiguration":{type:"object",properties:{input:{$ref:"#/definitions/docs.LibraryInputConfiguration"},output:{$ref:"#/definitions/docs.LibraryOutputConfiguration"},lang:{$ref:"#/definitions/docs.LibraryLanguage"},config:{oneOf:[{$ref:"#/definitions/docs.LibraryConfig"},{type:"null"}]}},required:["input","output","lang"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.Target":{type:"string",enum:["_blank","_self","_parent","_top"]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.InternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.ExternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},href:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["display-name","href"],additionalProperties:!1},"docs.ProductConfig":{anyOf:[{$ref:"#/definitions/docs.InternalProduct"},{$ref:"#/definitions/docs.ExternalProduct"}]},"docs.Availability":{type:"string",enum:["stable","generally-available","in-development","pre-release","deprecated","beta"]},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.CollapsedStringValue":{type:"string",enum:["open-by-default"]},"docs.CollapsedValue":{anyOf:[{type:"boolean"},{$ref:"#/definitions/docs.CollapsedStringValue"}]},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},collapsible:{oneOf:[{type:"boolean"},{type:"null"}]},"collapsed-by-default":{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},php:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},swift:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},rust:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{hidden:{oneOf:[{type:"boolean"},{type:"null"}]},environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},collapsible:{oneOf:[{type:"boolean"},{type:"null"}]},"collapsed-by-default":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.ApiReferenceOperationConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},operation:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["operation"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.ApiReferenceOperationConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},"tag-description-pages":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},postman:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.LibraryName":{type:"string"},"docs.LibraryReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},library:{$ref:"#/definitions/docs.LibraryName"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]}},required:["library"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.TitleSource":{type:"string",enum:["frontmatter","filename"]},"docs.FolderConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},folder:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},"title-source":{oneOf:[{$ref:"#/definitions/docs.TitleSource"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{$ref:"#/definitions/docs.CollapsedValue"},{type:"null"}]},collapsible:{oneOf:[{type:"boolean"},{type:"null"}]},"collapsed-by-default":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["folder"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LibraryReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"},{$ref:"#/definitions/docs.FolderConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItemWithLayout":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabVariant":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},layout:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","layout"],additionalProperties:!1},"docs.TabbedNavigationItemWithVariants":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},variants:{type:"array",items:{$ref:"#/definitions/docs.TabVariant"}}},required:["tab","variants"],additionalProperties:!1},"docs.TabbedNavigationItem":{anyOf:[{$ref:"#/definitions/docs.TabbedNavigationItemWithLayout"},{$ref:"#/definitions/docs.TabbedNavigationItemWithVariants"}]},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfigWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},url:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.NavbarGithubConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.NavbarGithubConfigWithOptions"}]},"docs.NavbarLinkConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","dropdown","primary","secondary"]}},oneOf:[{properties:{type:{const:"filled"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"dropdown"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},links:{type:"array",items:{$ref:"#/definitions/docs.NavbarLinkConfig"}},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type","links"]},{properties:{type:{const:"primary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionOption":{type:"string",enum:["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]},"docs.CustomPageAction":{type:"object",properties:{title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","url"],additionalProperties:!1},"docs.PageActionOptions":{type:"object",properties:{"copy-page":{oneOf:[{type:"boolean"},{type:"null"}]},"view-as-markdown":{oneOf:[{type:"boolean"},{type:"null"}]},"ask-ai":{oneOf:[{type:"boolean"},{type:"null"}]},chatgpt:{oneOf:[{type:"boolean"},{type:"null"}]},claude:{oneOf:[{type:"boolean"},{type:"null"}]},cursor:{oneOf:[{type:"boolean"},{type:"null"}]},vscode:{oneOf:[{type:"boolean"},{type:"null"}]},custom:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.CustomPageAction"}},{type:"null"}]}},additionalProperties:!1},"docs.PageActionsConfig":{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/docs.PageActionOption"},{type:"null"}]},options:{oneOf:[{$ref:"#/definitions/docs.PageActionOptions"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]},"dynamic-snippets":{oneOf:[{type:"boolean"},{type:"null"}]},"ai-examples":{oneOf:[{type:"boolean"},{type:"null"}]},"ai-example-style-instructions":{oneOf:[{type:"string"},{type:"null"}]},"exclude-apis":{oneOf:[{type:"boolean"},{type:"null"}]},"basepath-aware":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.Language":{type:"string",enum:["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]},"docs.AIChatModel":{type:"string",enum:["claude-3.7","claude-4","command-a"]},"docs.AIChatLocation":{type:"string",enum:["docs","slack","discord"]},"docs.AIChatWebsiteDatasource":{type:"object",properties:{url:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.AIChatDatasource":{anyOf:[{$ref:"#/definitions/docs.AIChatWebsiteDatasource"}]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]},location:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatLocation"}},{type:"null"}]},datasources:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatDatasource"}},{type:"null"}]}},additionalProperties:!1},"docs.AiExamplesConfig":{type:"object",properties:{enabled:{oneOf:[{type:"boolean"},{type:"null"}]},style:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageDescriptionSource":{type:"string",enum:["description","subtitle"]},"docs.AgentsConfig":{type:"object",properties:{"page-directive":{oneOf:[{type:"string"},{type:"null"}]},"page-description-source":{oneOf:[{$ref:"#/definitions/docs.PageDescriptionSource"},{type:"null"}]},"llms-txt":{oneOf:[{type:"string"},{type:"null"}]},"llms-full-txt":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]},"og:dynamic":{oneOf:[{type:"boolean"},{type:"null"}]},"og:background-image":{oneOf:[{type:"string"},{type:"null"}]},"canonical-host":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.CheckRuleSeverity":{type:"string",enum:["warn","error"]},"docs.CheckRulesConfig":{type:"object",properties:{"example-validation":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"broken-links":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"no-non-component-refs":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"valid-local-references":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"no-circular-redirects":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"valid-docs-endpoints":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]},"missing-redirects":{oneOf:[{$ref:"#/definitions/docs.CheckRuleSeverity"},{type:"null"}]}},additionalProperties:!1},"docs.CheckConfig":{type:"object",properties:{rules:{oneOf:[{$ref:"#/definitions/docs.CheckRulesConfig"},{type:"null"}]}},additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},"right-text":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-1":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-2":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-3":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-4":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-5":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-6":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-7":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-8":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-9":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-10":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-11":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"accent-12":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.SwitcherPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"switcher-placement":{oneOf:[{$ref:"#/definitions/docs.SwitcherPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-nav-links":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-feedback":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.HttpSnippetLanguage":{type:"string",enum:["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]},"docs.HttpSnippetsConfig":{anyOf:[{type:"boolean"},{type:"array",items:{$ref:"#/definitions/docs.HttpSnippetLanguage"}}]},"docs.DocsSettingsConfig":{type:"object",properties:{"search-text":{oneOf:[{type:"string"},{type:"null"}]},"disable-search":{oneOf:[{type:"boolean"},{type:"null"}]},"dark-mode-code":{oneOf:[{type:"boolean"},{type:"null"}]},"default-search-filters":{oneOf:[{type:"boolean"},{type:"null"}]},"http-snippets":{oneOf:[{$ref:"#/definitions/docs.HttpSnippetsConfig"},{type:"null"}]},"hide-404-page":{oneOf:[{type:"boolean"},{type:"null"}]},"use-javascript-as-typescript":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-explorer-proxy":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-environment-editing":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-analytics":{oneOf:[{type:"boolean"},{type:"null"}]},language:{oneOf:[{$ref:"#/definitions/docs.Language"},{type:"null"}]},"folder-title-source":{oneOf:[{$ref:"#/definitions/docs.TitleSource"},{type:"null"}]},"substitute-env-vars":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.SidebarThemeConfig":{type:"string",enum:["default","minimal"]},"docs.BodyThemeConfig":{type:"string",enum:["default","canvas"]},"docs.TabsThemeStyle":{type:"string",enum:["default","bubble"]},"docs.TabsAlignment":{type:"string",enum:["left","center"]},"docs.TabsThemeObjectConfig":{type:"object",properties:{style:{oneOf:[{$ref:"#/definitions/docs.TabsThemeStyle"},{type:"null"}]},alignment:{oneOf:[{$ref:"#/definitions/docs.TabsAlignment"},{type:"null"}]},placement:{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]}},additionalProperties:!1},"docs.TabsThemeConfig":{anyOf:[{$ref:"#/definitions/docs.TabsThemeStyle"},{$ref:"#/definitions/docs.TabsThemeObjectConfig"}]},"docs.PageActionsThemeConfig":{type:"string",enum:["default","toolbar"]},"docs.FooterNavThemeConfig":{type:"string",enum:["default","minimal"]},"docs.LanguageSwitcherThemeConfig":{type:"string",enum:["default","minimal"]},"docs.ProductSwitcherThemeConfig":{type:"string",enum:["default","toggle"]},"docs.ThemeConfig":{type:"object",properties:{sidebar:{oneOf:[{$ref:"#/definitions/docs.SidebarThemeConfig"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/docs.BodyThemeConfig"},{type:"null"}]},tabs:{oneOf:[{$ref:"#/definitions/docs.TabsThemeConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsThemeConfig"},{type:"null"}]},"footer-nav":{oneOf:[{$ref:"#/definitions/docs.FooterNavThemeConfig"},{type:"null"}]},"language-switcher":{oneOf:[{$ref:"#/definitions/docs.LanguageSwitcherThemeConfig"},{type:"null"}]},"product-switcher":{oneOf:[{$ref:"#/definitions/docs.ProductSwitcherThemeConfig"},{type:"null"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]},context7:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},bbm={type:mbm,properties:hbm,required:gbm,additionalProperties:Abm,definitions:ybm};async function O0o({fernDirectory:e,context:t}){let r=Ke(e,Be.of(rh));if(!await ar(r))return;let n=await Ebm({absolutePathToDocsDefinition:e,context:t});if(n!=null)return{type:"docs",absoluteFilePath:e,config:n,workspaceName:void 0,absoluteFilepathToDocsConfig:Ke(e,Be.of(rh))}}async function Ebm({absolutePathToDocsDefinition:e,context:t}){if(!await ar(e))return;let r=Ke(e,Be.of(rh));return await vbm({absolutePathOfConfiguration:r,context:t})}async function vbm({absolutePathOfConfiguration:e,context:t}){let r=await(0,OWc.readFile)(e),n=Rr.load(r.toString()),i=u4(n,T0o,{filePath:e});if(i.success){let o=[];t.logger.debug("About to sanitize docs configuration JSON structure");let s=lM(n,[],o);o.length>0?t.logger.warn(`docs.yml contained null/undefined sections that were ignored: ${o.map(a=>a.join(".")).join(", ")}`):t.logger.debug("No null/undefined values found during sanitization");try{return t.logger.debug("Attempting to parse sanitized docs configuration"),c_.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(s)}catch(a){throw t.logger.error(`Parsing failed even after sanitization: ${Ai(a)}`),t.logger.debug(`Sanitized JSON structure: ${JSON.stringify(s,null,2)}`),new Error(`Failed to parse ${e}: ${Ai(a)}`)}}else throw new Error(`Failed to parse docs.yml:
|
|
2298
2298
|
${i.error?.message??"Unknown error"}`)}Jt();var BWc=require("fs"),jzn=require("fs/promises"),PWc=require("stream/promises");async function RWc({snippetsS3PreSignedReadUrl:e,absolutePathToLocalSnippetJSON:t,context:r}){try{await Ibm({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(we.green(`Downloaded to ${t}`))}catch{r.logger.debug(we.yellow("Failed to download snippet.json from output."))}}async function Ibm({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await ry.get(e,{responseType:"stream"});await ar(t)&&await(0,jzn.rm)(t,{recursive:!0}),await(0,jzn.mkdir)(Pn(t),{recursive:!0}),await(0,PWc.pipeline)(r.data,(0,BWc.createWriteStream)(t))}Jt();async function DWc({generatorInvocation:e,context:t}){if(e.absolutePathToLocalOutput==null)return;let r=Ke(e.absolutePathToLocalOutput,Be.of(YO));if(await ar(r))return t.logger.debug(`Auto-discovered ${YO} at ${r}`),r}Pt();hg();Jt();var kWc=ve(VPt(),1),Qzn=require("fs/promises");var NWc=ve(ym(),1),jWc=require("util"),QWc=require("zlib");var EQe=class e extends Error{constructor(){super("Received 429 Too Many Requests"),Object.setPrototypeOf(this,e.prototype)}};async function FWc({fn:e,retryRateLimited:t,logger:r,onRateLimitedWithoutRetry:n,delayFn:i=o=>new Promise(s=>setTimeout(s,o))}){if(!t)try{return await e()}catch(o){if(o instanceof EQe)return n();throw o}for(let o=0;o<=3;o++)try{return await e()}catch(s){if(s instanceof EQe&&o<3){let a=Math.min(2e3*2**o,12e4),c=1+(Math.random()-.5)*.2,u=Math.round(a*c);r.warn(`Received 429 Too Many Requests. Retrying in ${(u/1e3).toFixed(1)}s (attempt ${o+1}/3)...`),await i(u)}else throw s}throw new Error("Exceeded maximum retries for 429 Too Many Requests.")}var wbm=(0,jWc.promisify)(QWc.gzip);async function MWc({projectConfig:e,workspace:t,organization:r,intermediateRepresentation:n,generatorInvocation:i,version:o,context:s,shouldLogS3Url:a,token:c,whitelabel:u,irVersionOverride:l,absolutePathToPreview:p,fiddlePreview:d,pushPreviewBranch:f,fernignorePath:m,skipFernignore:h,retryRateLimited:g,automationMode:A,autoMerge:b}){let v;if(h)v="";else if(m!=null)try{v=await(0,Qzn.readFile)(m,"utf-8")}catch(I){s.failAndThrow(`Failed to read fernignore file at ${m}: ${I}`)}let E=await FWc({fn:()=>xbm({projectConfig:e,workspace:t,organization:r,generatorInvocation:i,version:o,context:s,shouldLogS3Url:a,token:c,whitelabel:u,absolutePathToPreview:p,fiddlePreview:d,pushPreviewBranch:f,fernignoreContents:v,automationMode:A,autoMerge:b}),retryRateLimited:g,logger:s.logger,onRateLimitedWithoutRetry:()=>s.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.")});return await Cbm({intermediateRepresentation:n,job:E,context:s,generatorInvocation:i,irVersionOverride:l}),E}async function xbm({projectConfig:e,workspace:t,organization:r,generatorInvocation:n,version:i,context:o,shouldLogS3Url:s,token:a,whitelabel:c,absolutePathToPreview:u,fiddlePreview:l,pushPreviewBranch:p,fernignoreContents:d}){let f=Lce({token:a.value}),m={id:n.name,version:n.version,outputMode:n.outputMode,customConfig:n.config,publishMetadata:n.publishMetadata},h=await f.remoteGen.createJobV3({apiName:t.definition.rootApiFile.contents.name,version:i,organizationName:r,generators:[m],uploadToS3:Tbm({outputMode:n.outputMode,generatorInvocation:n,absolutePathToPreview:u,shouldLogS3Url:s}),whitelabel:c,preview:l??u!=null,pushPreviewBranch:p,fernignoreContents:d});if(!h.ok){let g=h.error;if(g?.content?.reason==="status-code"&&g.content.statusCode===429)throw new EQe;return Sbm(g)._visit({illegalApiNameError:()=>o.failAndThrow("API name is invalid: "+t.definition.rootApiFile.contents.name),illegalApiVersionError:()=>o.failAndThrow("API version is invalid: "+i),cannotPublishToNpmScope:({validScope:A,invalidScope:b})=>o.failAndThrow(`You do not have permission to publish to ${b} (expected ${A})`),cannotPublishToMavenGroup:({validGroup:A,invalidGroup:b})=>o.failAndThrow(`You do not have permission to publish to ${b} (expected ${A})`),cannotPublishPypiPackage:({validPrefix:A,invalidPackageName:b})=>o.failAndThrow(`You do not have permission to publish to ${b} (expected ${A})`),generatorsDoNotExistError:A=>o.failAndThrow("Generators do not exist: "+A.nonExistentGenerators.map(b=>`${b.id}@${b.version}`).join(", ")),insufficientPermissions:()=>o.failAndThrow(`You do not have permission to run this generator for organization '${r}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
2299
2299
|
|
|
2300
2300
|
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`),orgNotConfiguredForWhitelabel:()=>o.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com."),branchDoesNotExist:A=>o.failAndThrow(`Branch ${A.branch} does not exist in repository ${A.repositoryOwner}/${A.repositoryName}`),rateLimitExceeded:()=>{throw new EQe},_other:A=>{o.logger.debug(`Failed to create job: ${JSON.stringify(A)}`);let b=_bm(A);return b!=null?o.failAndThrow(b):o.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.")}})}return h.body}async function Cbm({intermediateRepresentation:e,generatorInvocation:t,job:r,context:n,irVersionOverride:i}){let o=await Eke(t).then(f=>f==null?void 0:"v"+f.toString()),s=i??o,a=s==null?await Hjt({intermediateRepresentation:e,context:n,targetGenerator:{name:t.name,version:t.version}}):await dlo({intermediateRepresentation:e,context:n,irVersion:s,targetGenerator:{name:t.name,version:t.version}}),c=new kWc.default,u=await $Kt(a,{onWrite:f=>{n.logger.debug("Wrote IR to disk: "+f)}}),l=new TextEncoder().encode(u),p=await wbm(l);n.logger.debug(`Compressed IR from ${l.byteLength} bytes to ${p.length} bytes (${((1-p.length/l.byteLength)*100).toFixed(1)}% reduction)`),c.append("file",p,{filename:"ir.json",contentType:"application/octet-stream"});let d=(0,NWc.default)(vke(),`/api/remote-gen/jobs/${r.jobId}/start`);try{await ry.post(d,c,{headers:c.getHeaders(),maxBodyLength:1/0})}catch(f){let m=f instanceof K9a?f.response?.data:f;n.logger.debug(`POST ${d} failed with ${JSON.stringify(f)}`),n.failAndThrow("Failed to start job",m)}}function _bm(e){let t=e?.content?.reason==="status-code"?e.content.body:void 0;if(typeof t?.content?.message=="string")return t.content.message;if(typeof t?.message=="string")return t.message}function Sbm(e){if(e?.content?.reason==="status-code"){let t=e.content.body;switch(t?.error){case"IllegalApiNameError":return Gr.remoteGen.createJobV3.Error.illegalApiNameError();case"IllegalApiVersionError":return Gr.remoteGen.createJobV3.Error.illegalApiVersionError(t.content);case"GeneratorsDoNotExistError":return Gr.remoteGen.createJobV3.Error.generatorsDoNotExistError(t.content);case"CannotPublishToNpmScope":return Gr.remoteGen.createJobV3.Error.cannotPublishToNpmScope(t.content);case"CannotPublishToMavenScope":return Gr.remoteGen.createJobV3.Error.cannotPublishToMavenGroup(t.content);case"CannotPublishPypiPackage":return Gr.remoteGen.createJobV3.Error.cannotPublishPypiPackage(t.content);case"InsufficientPermissions":return Gr.remoteGen.createJobV3.Error.insufficientPermissions(t.content);case"OrgNotConfiguredForWhitelabel":return Gr.remoteGen.createJobV3.Error.orgNotConfiguredForWhitelabel(t.content);case"BranchDoesNotExist":return Gr.remoteGen.createJobV3.Error.branchDoesNotExist(t.content)}}return e}function Tbm({outputMode:e,generatorInvocation:t,absolutePathToPreview:r,shouldLogS3Url:n}){return e.type==="downloadFiles"||t.absolutePathToLocalSnippets!=null||r!=null||n}var LWc=Lce();var Obm=3;function UWc({job:e,taskId:t,taskHandler:r,context:n}){let i=0,o=async()=>{let s=await LWc.remoteGen.getJobStatus(e.jobId);if(s.ok)return s.body[t];n.logger.debug("Failed to get job status.",JSON.stringify(s.error.content))};return new Promise((s,a)=>{c();async function c(){try{let u=await o();if(u==null)i++,i===Obm&&n.failAndThrow(`Failed to get job status after ${i} attempts.`),setTimeout(c,2e3+1e3*i);else{i=0;let l=await r.processUpdate(u);r.isFinished?s(l):setTimeout(c,2e3)}}catch(u){a(u)}}})}Pt();Jt();var Uzn=require("fs"),Nj=require("fs/promises"),vQe=ve(require("path"),1),R0o=require("stream/promises");var Mzn=ve(qWc(),1);function cpe(e,t,{target:r="stdout",...n}={}){return Mzn.default[r]?SHe.link(e,t):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,t):`${e} (\u200B${t}\u200B)`}cpe.isSupported=Mzn.default.stdout;cpe.stderr=(e,t,r={})=>cpe(e,t,{target:"stderr",...r});cpe.stderr.isSupported=Mzn.default.stderr;var zzn=ve(WC(),1),GWc=ve(uzn(),1),Lzn=class{context;generatorInvocation;absolutePathToPreview;lengthOfLastLogs=0;constructor({interactiveTaskContext:t,generatorInvocation:r,absolutePathToPreview:n}){this.context=t,this.generatorInvocation=r,this.absolutePathToPreview=n}async processUpdate(t){t==null&&this.context.failAndThrow("Task is missing on job status");let r=t.packages.map(i=>i.coordinate._visit({npm:o=>`${o.name}@${o.version}`,maven:o=>`${o.group}:${o.artifact}:${o.version}`,pypi:o=>`${o.name} ${o.version}`,ruby:o=>`${o.name}:${o.version}`,nuget:o=>`${o.name} ${o.version}`,crates:o=>`${o.name} ${o.version}`,_other:()=>"<unknown package>"}));t.packages.length>0&&this.#n==null&&(this.#n=t.packages[0]?.coordinate._visit({npm:i=>i.version,maven:i=>i.version,pypi:i=>i.version,ruby:i=>i.version,nuget:i=>i.version,crates:i=>i.version,_other:()=>{}})),this.absolutePathToPreview==null&&this.context.setSubtitle(r.length>0?r.map(i=>`\u25E6 ${i}`).join(`
|
|
@@ -2306,7 +2306,7 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
2306
2306
|
|
|
2307
2307
|
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`:r}function kEm(e,t){return t!=null&&t.includes("Invalid authorization token")?"Your authentication token is invalid or expired. Please run 'fern login' to re-authenticate.":`You are not authorized to publish docs under organization '${e}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
2308
2308
|
|
|
2309
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}function NEm(e){if(e==null)return{code:void 0,message:void 0};let t=e.body;if(t!=null&&typeof t=="object"){let n=typeof t.code=="string"?t.code:void 0,i=typeof t.message=="string"?t.message:void 0;return{code:n,message:i}}return{code:void 0,message:typeof t=="string"&&t.length>0?t:typeof e.errorMessage=="string"?e.errorMessage:typeof e.message=="string"?e.message:void 0}}function jEm(e){try{return new URL(MF(e)).pathname}catch{return}}async function QEm({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await MEm({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let s=await e.api.v1.register.checkSdkDynamicIrExists({orgId:Fr.OrgId(r),snippetConfiguration:o});if(!s.ok||!s.body){n.logger.debug("[SDK Dynamic IR] API call failed or returned empty body");return}let a=s.body.existingDynamicIrs;if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let c={};for(let[u,l]of Object.entries(a))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${u}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();c[u]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${u}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${u}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${u}: ${p}`)}return Object.keys(c).length>0?c:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function eEo(e){return e.replace(/^https:\/\//,"")}async function MEm({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package,explicitVersion:r.typescriptSdk?.version},{language:"python",snippetName:r.pythonSdk?.package,explicitVersion:r.pythonSdk?.version},{language:"java",snippetName:r.javaSdk?.coordinate,explicitVersion:r.javaSdk?.version},{language:"go",snippetName:r.goSdk?.githubRepo&&eEo(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version},{language:"csharp",snippetName:r.csharpSdk?.package,explicitVersion:r.csharpSdk?.version},{language:"ruby",snippetName:r.rubySdk?.gem,explicitVersion:r.rubySdk?.version},{language:"php",snippetName:r.phpSdk?.package,explicitVersion:r.phpSdk?.version},{language:"swift",snippetName:r.swiftSdk?.package,explicitVersion:r.swiftSdk?.version},{language:"rust",snippetName:r.rustSdk?.package,explicitVersion:r.rustSdk?.version}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion;a||(a=(await LEm({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function LEm({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,c;if(t.generatorsConfiguration?.groups){let u=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=kn.getPackageName({generatorInvocation:p});d&&u.push(d),!a&&d&&(a=d,c=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let u=await e.sdks.versions.computeSemanticVersion({githubRepository:s,language:o,package:a});if(!u.ok){i.logger.debug(`[SDK Dynamic IR] ${r}: version computation failed for package "${a}"`);return}return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${u.body.version} for package "${a}"`),{version:u.body.version,generatorPackage:a}}catch(u){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${u}`);return}}async function UEm({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&eEo(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let c of a.generators){let u=yQe({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),l="";if(u?.outputConfig.type==="publish")switch(u.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=u.outputConfig.value.packageName;break;case"maven":l=u.outputConfig.value.coordinate;break;case"go":l=u.outputConfig.value.repoUrl;break;case"swift":l=u.outputConfig.value.repoUrl;break;case"crates":l=u.outputConfig.value.packageName;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(l=c.config.packageName??""),c.language==="go"&&l&&(l=eEo(l)),!!c.language){if(i.has(c.language)){r.logger.debug(`Skipping dynamic IR generation for ${c.language} (using existing SDK dynamic IR)`);continue}if(c.language&&s[c.language]===l){let p=yg({workspace:e,generationLanguage:c.language,keywords:void 0,smartCasing:c.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new lh(r,e),dynamicGeneratorConfig:u}),d=ike({ir:p,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:u});d?o[c.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${c.language}`)}}}for(let[a,c]of Object.entries(s))a&&c&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${c}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${c} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function zEm({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function VEm({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(we.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function qEm(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function K$c(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var NLt=[60*1e3,300*1e3,300*1e3];async function jLt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,previewId:c,disableTemplates:u,skipUpload:l,cliVersion:p,ciSource:d,deployerAuthor:f}){let m=a&&!n.config.settings?.substituteEnvVars;n.config=qA(n.config,{onError:v=>i.failAndThrow(v)},{substituteAsEmpty:m});let h=n.config.instances;if(h.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(h.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${h[0]?.url})`);return}let g=h.find(v=>v.url===s)??h[0];if(g==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`);return}let A=[];g.customDomain!=null&&(typeof g.customDomain=="string"?A.push(g.customDomain):Array.isArray(g.customDomain)&&A.push(...g.customDomain)),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${g.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let b;return await i.runInteractiveTask({name:g.url},async()=>{let v=performance.now(),E=()=>$$c({docsWorkspace:n,customDomains:A,domain:g.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:c,editThisPage:g.editThisPage,disableTemplates:u,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:g.audiences?Array.isArray(g.audiences)?g.audiences:[g.audiences]:void 0,docsUrl:g.url,cliVersion:p,ciSource:d,deployerAuthor:f});for(let x=0;;x++)try{b=await E();break}catch(C){if(!(C instanceof yft)||x>=NLt.length){if(C instanceof yft)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");throw C}let _=NLt[x]??NLt[NLt.length-1]??6e4,w=_/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${w} minute${w===1?"":"s"} (attempt ${x+1}/${NLt.length})...`),await new Promise(P=>setTimeout(P,_))}let I=performance.now()-v;i.logger.debug(`Docs publishing completed in ${I.toFixed(0)}ms`)}),b}var I5n=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,previewId:n,skipUpload:i}){let o=new Cg({context:this.context,task:this.task});try{let s=await jLt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:o,token:this.token,instanceUrl:t,preview:r,previewId:n,disableTemplates:void 0,skipUpload:i,cliVersion:"4.78.0"});return o.getResult()===Bf.Failure?{success:!1}:{success:!0,url:s}}catch(s){return{success:!1,error:Ai(s)}}}};Pt();var bft=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
|
|
2309
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}function NEm(e){if(e==null)return{code:void 0,message:void 0};let t=e.body;if(t!=null&&typeof t=="object"){let n=typeof t.code=="string"?t.code:void 0,i=typeof t.message=="string"?t.message:void 0;return{code:n,message:i}}return{code:void 0,message:typeof t=="string"&&t.length>0?t:typeof e.errorMessage=="string"?e.errorMessage:typeof e.message=="string"?e.message:void 0}}function jEm(e){try{return new URL(MF(e)).pathname}catch{return}}async function QEm({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await MEm({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let s=await e.api.v1.register.checkSdkDynamicIrExists({orgId:Fr.OrgId(r),snippetConfiguration:o});if(!s.ok||!s.body){n.logger.debug("[SDK Dynamic IR] API call failed or returned empty body");return}let a=s.body.existingDynamicIrs;if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let c={};for(let[u,l]of Object.entries(a))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${u}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();c[u]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${u}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${u}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${u}: ${p}`)}return Object.keys(c).length>0?c:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function eEo(e){return e.replace(/^https:\/\//,"")}async function MEm({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package,explicitVersion:r.typescriptSdk?.version},{language:"python",snippetName:r.pythonSdk?.package,explicitVersion:r.pythonSdk?.version},{language:"java",snippetName:r.javaSdk?.coordinate,explicitVersion:r.javaSdk?.version},{language:"go",snippetName:r.goSdk?.githubRepo&&eEo(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version},{language:"csharp",snippetName:r.csharpSdk?.package,explicitVersion:r.csharpSdk?.version},{language:"ruby",snippetName:r.rubySdk?.gem,explicitVersion:r.rubySdk?.version},{language:"php",snippetName:r.phpSdk?.package,explicitVersion:r.phpSdk?.version},{language:"swift",snippetName:r.swiftSdk?.package,explicitVersion:r.swiftSdk?.version},{language:"rust",snippetName:r.rustSdk?.package,explicitVersion:r.rustSdk?.version}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion;a||(a=(await LEm({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function LEm({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,c;if(t.generatorsConfiguration?.groups){let u=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=kn.getPackageName({generatorInvocation:p});d&&u.push(d),!a&&d&&(a=d,c=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let u=await e.sdks.versions.computeSemanticVersion({githubRepository:s,language:o,package:a});if(!u.ok){i.logger.debug(`[SDK Dynamic IR] ${r}: version computation failed for package "${a}"`);return}return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${u.body.version} for package "${a}"`),{version:u.body.version,generatorPackage:a}}catch(u){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${u}`);return}}async function UEm({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&eEo(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let c of a.generators){let u=yQe({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),l="";if(u?.outputConfig.type==="publish")switch(u.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=u.outputConfig.value.packageName;break;case"maven":l=u.outputConfig.value.coordinate;break;case"go":l=u.outputConfig.value.repoUrl;break;case"swift":l=u.outputConfig.value.repoUrl;break;case"crates":l=u.outputConfig.value.packageName;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(l=c.config.packageName??""),c.language==="go"&&l&&(l=eEo(l)),!!c.language){if(i.has(c.language)){r.logger.debug(`Skipping dynamic IR generation for ${c.language} (using existing SDK dynamic IR)`);continue}if(c.language&&s[c.language]===l){let p=yg({workspace:e,generationLanguage:c.language,keywords:void 0,smartCasing:c.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new lh(r,e),dynamicGeneratorConfig:u}),d=ike({ir:p,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:u});d?o[c.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${c.language}`)}}}for(let[a,c]of Object.entries(s))a&&c&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${c}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${c} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function zEm({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function VEm({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(we.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function qEm(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function K$c(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var NLt=[60*1e3,300*1e3,300*1e3];async function jLt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,previewId:c,disableTemplates:u,skipUpload:l,cliVersion:p,ciSource:d,deployerAuthor:f}){let m=a&&!n.config.settings?.substituteEnvVars;n.config=qA(n.config,{onError:v=>i.failAndThrow(v)},{substituteAsEmpty:m});let h=n.config.instances;if(h.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(h.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${h[0]?.url})`);return}let g=h.find(v=>v.url===s)??h[0];if(g==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`);return}let A=[];g.customDomain!=null&&(typeof g.customDomain=="string"?A.push(g.customDomain):Array.isArray(g.customDomain)&&A.push(...g.customDomain)),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${g.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let b;return await i.runInteractiveTask({name:g.url},async()=>{let v=performance.now(),E=()=>$$c({docsWorkspace:n,customDomains:A,domain:g.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:c,editThisPage:g.editThisPage,disableTemplates:u,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:g.audiences?Array.isArray(g.audiences)?g.audiences:[g.audiences]:void 0,docsUrl:g.url,cliVersion:p,ciSource:d,deployerAuthor:f});for(let x=0;;x++)try{b=await E();break}catch(C){if(!(C instanceof yft)||x>=NLt.length){if(C instanceof yft)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");throw C}let _=NLt[x]??NLt[NLt.length-1]??6e4,w=_/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${w} minute${w===1?"":"s"} (attempt ${x+1}/${NLt.length})...`),await new Promise(P=>setTimeout(P,_))}let I=performance.now()-v;i.logger.debug(`Docs publishing completed in ${I.toFixed(0)}ms`)}),b}var I5n=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,previewId:n,skipUpload:i}){let o=new Cg({context:this.context,task:this.task});try{let s=await jLt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:o,token:this.token,instanceUrl:t,preview:r,previewId:n,disableTemplates:void 0,skipUpload:i,cliVersion:"4.79.0"});return o.getResult()===Bf.Failure?{success:!1}:{success:!0,url:s}}catch(s){return{success:!1,error:Ai(s)}}}};Pt();var bft=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
|
|
2310
2310
|
`),this.stream.write(`${we.cyan("\u25C6")} ${we.bold(t.title)}
|
|
2311
2311
|
`),t.subtitle!=null&&this.stream.write(` ${we.dim(t.subtitle)}
|
|
2312
2312
|
`),this.stream.write(`
|
|
@@ -2641,7 +2641,7 @@ ${this.buffer}`:r+`
|
|
|
2641
2641
|
`);if(o.length<=1){t.write(this.escapeString(o[0]??"")),t.write('"""');return}n&&t.writeNoIndent(`\\
|
|
2642
2642
|
`),o.forEach((s,a)=>{t.writeNoIndent(this.escapeString(s)),a===o.length-1?i&&t.writeNoIndent(`\\
|
|
2643
2643
|
`):t.writeNoIndent(`
|
|
2644
|
-
`)}),t.writeNoIndent('"""')}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/'/g,"\\'").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r?"True":"False");return;case"string":t.write(`"${this.escapeString(r)}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("None");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownObject({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("[]");return}t.write("["),r.forEach((n,i)=>{i>0&&t.write(", "),t.writeNode(e.unknown(n))}),t.write("]")}writeUnknownObject({writer:t,value:r}){let n=Object.entries(r);if(n.length===0){t.write("{}");return}t.write("{"),n.forEach(([i,o],s)=>{s>0&&t.write(", "),t.write(`"${i}": `),t.writeNode(e.unknown(o))}),t.write("}")}};function Uhh({entries:e}){return e.filter(t=>!t1e.isNop(t.key)&&!t1e.isNop(t.value))}function zhh({entries:e}){return e.filter(t=>!t1e.isNop(t.value))}function nQo({values:e}){return e.filter(t=>!t1e.isNop(t))}function Vhh(e){return new Bmt(e)}function qhh(e){return new pGn(e)}function Ghh(e){return new Umt(e)}function Whh(e){return new JSe(e)}function $hh(e){return new Rmt(e)}function Hhh(e){return new Fmt(e)}function Khh(e){return new eie(e)}function Jhh(e){return new e1e(e)}function Yhh(e){return new YSe(e)}function Xhh(e){return new Vpe(e)}function Zhh(e){return new Dmt(e)}function egh(e){return new kmt(e)}function tgh(e){return new Nmt(e)}function rgh(e){return new ZSe(e)}function ngh(e){return new Pmt(e)}function igh(e){return new Mmt(e)}function ogh(e){return new XSe(e)}function sgh(e){return new Qmt(e)}function agh(e){return new Lmt(e)}Li();Pt();var cgh="value",dGn=class{context;constructor({context:t}){this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?fn.TypeInstantiation.none():(this.context.errors.add({severity:Br.Critical,message:"Expected non-null value, but got null"}),fn.TypeInstantiation.nop());if(t.value===void 0)return fn.TypeInstantiation.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let r=this.context.resolveNamedType({typeId:t.typeReference.value});return r==null?fn.TypeInstantiation.nop():this.convertNamed({named:r,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return fn.TypeInstantiation.unknown(t.value);default:Ie(t.typeReference)}}convertLiteral({literalType:t,value:r}){switch(t.type){case"boolean":{let n=this.context.getValueAsBoolean({value:r});return n==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.bool(n)}case"string":{let n=this.context.getValueAsString({value:r});return n==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.str(n)}default:Ie(t)}}convertList({list:t,value:r}){return Array.isArray(r)?fn.TypeInstantiation.list(r.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:Br.Critical,message:`Expected array but got: ${typeof r}`}),fn.TypeInstantiation.nop())}convertSet({set:t,value:r}){return Array.isArray(r)?fn.TypeInstantiation.list(r.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:Br.Critical,message:`Expected array but got: ${typeof r}`}),fn.TypeInstantiation.nop())}convertMap({map:t,value:r}){return typeof r!="object"||r==null?(this.context.errors.add({severity:Br.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),fn.TypeInstantiation.nop()):fn.TypeInstantiation.dict(Object.entries(r).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:t.key,value:n,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:t,value:r,as:n}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:r,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:r});case"enum":return this.convertEnum({enum_:t,value:r});case"object":return this.convertObject({object_:t,value:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:r});default:Ie(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:r}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:r});if(n==null)return fn.TypeInstantiation.nop();let i=n.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});if(o==null)return fn.TypeInstantiation.nop();let s=this.context.getDiscriminatedUnionVariantClassReference({unionDeclaration:t.declaration,discriminantValue:i.discriminantValue});return fn.TypeInstantiation.reference(fn.instantiateClass({classReference:s,arguments_:o.map(a=>fn.methodArgument({name:a.name,value:a.value})),multiline:!0}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:r}){let n=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:r});switch(r.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:r.typeId});if(i==null)return;if(i.type!=="object"){this.context.errors.add({severity:Br.Critical,message:"Internal error; expected union value to be an object"});return}let o=this.convertObjectEntries({object_:i,value:t.value}),s=new Set(n.map(c=>c.name)),a=o.filter(c=>!s.has(c.name));return[...n,...a]}case"singleProperty":try{this.context.errors.scope(r.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[...n,{name:cgh,value:this.convert({typeReference:r.typeReference,value:t.value})}]:[...n,{name:this.context.getPropertyName(r.discriminantValue.name),value:this.convert({typeReference:r.typeReference,value:i[r.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return n;default:Ie(r)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:r}){return this.context.associateByWireValue({parameters:r.properties??[],values:this.context.getRecord(t.value)??{},ignoreMissingParameters:!0}).map(i=>{this.context.errors.scope(i.name.wireValue);try{return{name:this.context.getPropertyName(i.name.name),value:this.convert(i)}}finally{this.context.errors.unscope()}})}convertObjectEntries({object_:t,value:r}){let n=this.context.getRecord(r)??{},i=this.context.associateByWireValue({parameters:t.properties,values:n}),o=new Set(Object.keys(n)),s=i.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}});for(let a of t.properties){if(o.has(a.name.wireValue)||this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let c=this.synthesizeDefaultValue(a.typeReference);fn.TypeInstantiation.isNop(c)||s.push({name:this.context.getPropertyName(a.name.name),value:c})}return s.filter(a=>!fn.TypeInstantiation.isNop(a.value))}convertObject({object_:t,value:r}){let n=this.convertObjectEntries({object_:t,value:r}),i=this.context.getTypeClassReference(t.declaration);return fn.TypeInstantiation.reference(fn.instantiateClass({classReference:i,arguments_:n.map(o=>fn.methodArgument({name:o.name,value:o.value})),multiline:!0}))}convertEnum({enum_:t,value:r}){let n=this.getEnumValue({enum_:t,value:r});if(n==null)return fn.TypeInstantiation.nop();let i=this.context.customConfig.pydantic_config?.enum_type;if(i==="python_enums"||i==="forward_compatible_python_enums"){let o=this.context.getTypeClassReference(t.declaration),s=n.name.screamingSnakeCase.safeName;return fn.TypeInstantiation.reference(fn.accessAttribute({lhs:o,rhs:fn.codeBlock(s)}))}return fn.TypeInstantiation.str(n.wireValue)}getEnumValue({enum_:t,value:r}){if(typeof r!="string"){this.context.errors.add({severity:Br.Critical,message:`Expected enum value string, got: ${typeof r}`});return}let n=t.values.find(i=>i.wireValue===r);if(n==null){this.context.errors.add({severity:Br.Critical,message:`An enum value named "${r}" does not exist in this context`});return}return n}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:r}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:r});return n??fn.TypeInstantiation.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:r}){for(let n of t.types){let i=this.context.errors.size();try{let o=this.convert({typeReference:n,value:r});if(fn.TypeInstantiation.isNop(o)||this.context.errors.size()>i){this.context.errors.truncate(i);continue}return o}catch{this.context.errors.truncate(i);continue}}this.context.errors.add({severity:Br.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof r}" value`})}synthesizeDefaultValue(t,r=new Set){switch(t.type){case"optional":case"nullable":return fn.TypeInstantiation.nop();case"primitive":return this.synthesizeDefaultPrimitive(t.value);case"literal":return this.synthesizeDefaultLiteral(t.value);case"list":return fn.TypeInstantiation.list([]);case"set":return fn.TypeInstantiation.list([]);case"map":return fn.TypeInstantiation.dict([]);case"named":{if(r.has(t.value))return fn.TypeInstantiation.nop();let n=this.context.resolveNamedType({typeId:t.value});return n==null?fn.TypeInstantiation.nop():this.synthesizeDefaultNamed({named:n,typeId:t.value,seen:r})}case"unknown":return fn.TypeInstantiation.nop();default:Ie(t)}}synthesizeDefaultPrimitive(t){switch(t){case"STRING":case"BASE_64":case"BIG_INTEGER":return fn.TypeInstantiation.str("string");case"INTEGER":case"LONG":case"UINT":case"UINT_64":return fn.TypeInstantiation.int(1);case"FLOAT":case"DOUBLE":return fn.TypeInstantiation.float(1.1);case"BOOLEAN":return fn.TypeInstantiation.bool(!0);case"DATE":return fn.TypeInstantiation.date("2024-01-15");case"DATE_TIME":case"DATE_TIME_RFC_2822":return fn.TypeInstantiation.datetime("2024-01-15T09:30:00Z");case"UUID":return fn.TypeInstantiation.uuid("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32");default:Ie(t)}}synthesizeDefaultLiteral(t){switch(t.type){case"boolean":return fn.TypeInstantiation.bool(t.value);case"string":return fn.TypeInstantiation.str(t.value);default:Ie(t)}}synthesizeDefaultNamed({named:t,typeId:r,seen:n}){let i=new Set(n);switch(i.add(r),t.type){case"alias":return this.synthesizeDefaultValue(t.typeReference,i);case"enum":{let o=t.values[0];if(o==null)return fn.TypeInstantiation.nop();let s=this.context.customConfig.pydantic_config?.enum_type;if(s==="python_enums"||s==="forward_compatible_python_enums"){let a=this.context.getTypeClassReference(t.declaration),c=o.name.screamingSnakeCase.safeName;return fn.TypeInstantiation.reference(fn.accessAttribute({lhs:a,rhs:fn.codeBlock(c)}))}return fn.TypeInstantiation.str(o.wireValue)}case"object":{let o=[];for(let a of t.properties){if(this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let c=this.synthesizeDefaultValue(a.typeReference,i);fn.TypeInstantiation.isNop(c)||o.push({name:this.context.getPropertyName(a.name.name),value:c})}let s=this.context.getTypeClassReference(t.declaration);return fn.TypeInstantiation.reference(fn.instantiateClass({classReference:s,arguments_:o.map(a=>fn.methodArgument({name:a.name,value:a.value})),multiline:!0}))}case"discriminatedUnion":case"undiscriminatedUnion":return fn.TypeInstantiation.nop();default:Ie(t)}}convertPrimitive({primitive:t,value:r,as:n}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:r,as:n});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.int(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:r,as:n});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.bool(i)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.str(i)}case"UUID":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.uuid(i)}case"DATE":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.date(i)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.datetime(i)}default:Ie(t)}}getValueAsNumber({value:t,as:r}){let n=r==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:t,as:r}){let n=r==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:n})}};Pt();var mGn=class{context;constructor({context:t}){this.context=t}getFilePropertyInfo({body:t,value:r}){let n={fileFields:[],bodyPropertyFields:[]},i=this.context.getRecord(r)??{};for(let o of t.properties)switch(o.type){case"file":{let s=this.getSingleFileProperty({property:o,record:i});if(fn.TypeInstantiation.isNop(s))break;n.fileFields.push({name:this.context.getPropertyName(o.name),value:s});break}case"fileArray":{let s=this.getArrayFileProperty({property:o,record:i});if(fn.TypeInstantiation.isNop(s))break;n.fileFields.push({name:this.context.getPropertyName(o.name),value:s});break}case"bodyProperty":{let s=this.getBodyProperty({property:o,record:i});if(fn.TypeInstantiation.isNop(s))break;n.bodyPropertyFields.push({name:this.context.getPropertyName(o.name.name),value:s});break}default:Ie(o)}return n}getSingleFileProperty({property:t,record:r}){let n=this.context.getSingleFileValue({property:t,record:r});return n==null&&(n=`example_${t.wireValue??"file"}`),this.context.getFileFromString(n)}getArrayFileProperty({property:t,record:r}){let n=this.context.getFileArrayValues({property:t,record:r});if(n==null){let i=`example_${t.wireValue??"files"}`;return fn.TypeInstantiation.list([this.context.getFileFromString(i)])}return fn.TypeInstantiation.list(n.map(i=>this.context.getFileFromString(i)))}getBodyProperty({property:t,record:r}){let n=r[t.name.wireValue];return n==null?fn.TypeInstantiation.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:n})}};var ugh=["list","set"],hGn=class e extends kI{ir;customConfig;dynamicTypeLiteralMapper;filePropertyMapper;constructor({ir:t,config:r}){super({ir:t,config:r}),this.ir=t,this.customConfig=r.customConfig??{},this.dynamicTypeLiteralMapper=new dGn({context:this}),this.filePropertyMapper=new mGn({context:this})}clone(){return new e({ir:this.ir,config:this.config})}getClassName(t){let r=t.pascalCase.safeName,n=this.getRootClientClassName();return r===n?`${n}Model`:r}getTypedDictClassName(t){return`${this.getClassName(t)}Params`}getPropertyName(t){let r=t.snakeCase.safeName;return r.startsWith("_")?"f_"+r.substring(r.lastIndexOf("_")+1):r}getMethodName(t){return ugh.includes(t.snakeCase.unsafeName)?t.snakeCase.unsafeName:t.snakeCase.safeName}getRootClientClassReference(){return fn.reference({name:this.getRootClientClassName(),modulePath:this.getRootModulePath()})}getTypeClassReference(t){let r=this.getClassName(t.name),n=[...this.getRootModulePath(),...t.fernFilepath.allParts.map(i=>i.snakeCase.safeName)];return fn.reference({name:r,modulePath:n})}getDiscriminatedUnionVariantClassReference({unionDeclaration:t,discriminantValue:r}){let n=this.getClassName(t.name),i=r.name.pascalCase.safeName,o=[...this.getRootModulePath(),...t.fernFilepath.allParts.map(s=>s.snakeCase.safeName)];return fn.reference({name:`${n}_${i}`,modulePath:o})}useTypedDictRequests(){return this.customConfig.use_typeddict_requests===!0}getRootClientClassName(){return this.customConfig.client?.exported_class_name!=null?this.customConfig.client.exported_class_name:this.customConfig.client_class_name!=null?this.customConfig.client_class_name:this.customConfig.client?.class_name!=null?this.customConfig.client.class_name:this.pascalCase(this.config.organization)+this.pascalCase(this.config.workspaceName)}getEnvironmentClassName(){return`${this.getRootClientClassName()}Environment`}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return fn.accessAttribute({lhs:this.getEnvironmentClassReference(),rhs:fn.codeBlock(this.getEnvironmentEnumName(r))})}getEnvironmentClassReference(){return fn.reference({name:this.getEnvironmentClassName(),modulePath:this.getEnvironmentModulePath()})}getEnvironmentEnumName(t){return t.screamingSnakeCase.safeName}isPrimitive(t){switch(t.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(t.value);case"named":{let r=this.resolveNamedType({typeId:t.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:Ie(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:Ie(t)}}getFileFromString(t){return fn.TypeInstantiation.str(t)}getRootModulePath(){if(this.customConfig.package_name!=null)return[this.customConfig.package_name];let t=this.cleanOrganizationName();if(this.customConfig.use_api_name_in_package)return[t,this.getApiName()];if(this.customConfig.package_path!=null){let r=this.customConfig.package_path.replace(/\//g,".").split(".");return[t,...r]}return[t]}getCoreModulePath(){return this.getRootModulePath().concat("core")}getEnvironmentModulePath(){return this.getRootModulePath().concat("environment")}shouldInlinePathParameters(){return!0}cleanOrganizationName(){return this.config.organization.replace(/[^a-zA-Z0-9]/g,"_")}getApiName(){return cBe(this.config.workspaceName)}pascalCase(t){let r=Zn(t);return r.charAt(0).toUpperCase()+r.slice(1)}};Pt();var lgh={type:"primitive",value:"STRING"},pgh=["example"],Rmu="client",zmt="request",gGn=class{context;constructor({context:t}){this.context=t}async generateSnippet({endpoint:t,request:r}){return this.buildPythonFile({endpoint:t,snippet:r}).toString()}generateSnippetSync({endpoint:t,request:r}){return this.buildPythonFile({endpoint:t,snippet:r}).toString()}async generateSnippetAst({endpoint:t,request:r}){return this.buildPythonFile({endpoint:t,snippet:r})}generateMethodCallSnippetAst({endpoint:t,request:r}){return this.callMethod({endpoint:t,snippet:r})}buildPythonFile({endpoint:t,snippet:r}){return fn.file({path:pgh,statements:[this.constructClient({endpoint:t,snippet:r}),this.callMethod({endpoint:t,snippet:r})]})}constructClient({endpoint:t,snippet:r}){return fn.assign({lhs:fn.reference({name:Rmu}),rhs:fn.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:t,snippet:r}).map(n=>fn.methodArgument({name:n.name,value:n.value})),multiline:!0})})}getConstructorArgs({endpoint:t,snippet:r}){let n=[],i=this.getConstructorEnvironmentArgs({baseUrl:r.baseURL,environment:r.environment});return i.length>0&&n.push(...i),t.auth!=null&&(r.auth!=null?n.push(...this.getConstructorAuthArgs({auth:t.auth,values:r.auth})):this.context.errors.add({severity:Br.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(Jo.PathParameters),this.context.ir.pathParameters!=null&&n.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:r})),this.context.errors.unscope(),this.context.errors.scope(Jo.Headers),this.context.ir.headers!=null&&r.headers!=null&&n.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:r.headers})),this.context.errors.unscope(),n}getConstructorEnvironmentArgs({baseUrl:t,environment:r}){let n=this.getEnvironmentValue({baseUrl:t,environment:r});return n==null?[]:r!=null&&this.context.isMultiEnvironmentValues(r)?[{name:"environment",value:n}]:[{name:this.getEnvironmentOptionName({environment:r}),value:n}]}getEnvironmentValue({baseUrl:t,environment:r}){if(t!=null&&r!=null){this.context.errors.add({severity:Br.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return fn.TypeInstantiation.str(t);if(r!=null){if(this.context.isSingleEnvironmentID(r)){let n=this.context.getEnvironmentTypeReferenceFromID(r);if(n==null){this.context.errors.add({severity:Br.Warning,message:`Environment ${JSON.stringify(r)} was not found`});return}return fn.TypeInstantiation.reference(n)}if(this.context.isMultiEnvironmentValues(r))return this.context.validateMultiEnvironmentUrlValues(r)?fn.TypeInstantiation.reference(fn.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(r).map(([n,i])=>({name:n,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:lgh,value:i})})).map(n=>fn.methodArgument({name:n.name,value:n.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:t,values:r}){switch(t.type){case"basic":return r.type!=="basic"?(this.addAuthMismatchError(t,r),[]):this.getConstructorBasicAuthArg({auth:t,values:r});case"bearer":return r.type!=="bearer"?(this.addAuthMismatchError(t,r),[]):this.getConstructorBearerAuthArgs({auth:t,values:r});case"header":return r.type!=="header"?(this.addAuthMismatchError(t,r),[]):this.getConstructorHeaderAuthArgs({auth:t,values:r});case"oauth":return r.type!=="oauth"?(this.addAuthMismatchError(t,r),[]):this.getConstructorOAuthArgs({auth:t,values:r});case"inferred":return r.type!=="inferred"?(this.addAuthMismatchError(t,r),[]):this.getConstructorInferredAuthArgs({auth:t,values:r});default:Ie(t)}}addAuthMismatchError(t,r){this.context.errors.add({severity:Br.Critical,message:this.context.newAuthMismatchError({auth:t,values:r}).message})}addWarning(t){this.context.errors.add({severity:Br.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:r}){return[{name:this.context.getPropertyName(t.username),value:fn.TypeInstantiation.str(r.username)},{name:this.context.getPropertyName(t.password),value:fn.TypeInstantiation.str(r.password)}]}getConstructorBearerAuthArgs({auth:t,values:r}){return[{name:this.context.getPropertyName(t.token),value:fn.TypeInstantiation.str(r.token)}]}getConstructorHeaderAuthArgs({auth:t,values:r}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:r.value})}]}getConstructorOAuthArgs({auth:t,values:r}){return[{name:this.context.getPropertyName(t.clientId),value:fn.TypeInstantiation.str(r.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:fn.TypeInstantiation.str(r.clientSecret)}]}getConstructorInferredAuthArgs({auth:t,values:r}){let n=t.parameters??[];if(n.length===0)return this.addWarning("Inferred auth scheme is missing parameters; cannot generate constructor arguments."),[];let i=r.values;if(i==null)return this.addWarning("Inferred auth values were not provided; cannot generate constructor arguments."),[];let o=[];for(let s of n){let a=s.name.wireValue;if(!Object.hasOwn(i,a)){this.addWarning(`Missing inferred auth value for ${a}`);continue}let c=i[a],u=this.context.dynamicTypeLiteralMapper.convert({typeReference:s.typeReference,value:c});fn.TypeInstantiation.isNop(u)||o.push({name:this.context.getPropertyName(s.name.name),value:u})}return o}getConstructorHeaderArgs({headers:t,values:r}){let n=[];for(let i of t){let o=r[i.name.wireValue],s=this.getConstructorHeaderArg({header:i,value:o});s!=null&&n.push(s)}return n}getConstructorHeaderArg({header:t,value:r}){let n=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r});if(!fn.TypeInstantiation.isNop(n))return{name:this.context.getPropertyName(t.name.name),value:n}}callMethod({endpoint:t,snippet:r}){return fn.invokeMethod({on:fn.reference({name:Rmu}),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:r}).filter(n=>!fn.TypeInstantiation.isNop(n.value)).map(n=>fn.methodArgument({name:n.name,value:n.value})),multiline:!0})}getMethodArgs({endpoint:t,snippet:r}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:r});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:r});default:Ie(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:r}){let n=[];this.context.errors.scope(Jo.PathParameters);let i=[...this.context.ir.pathParameters??[],...t.pathParameters??[]],o=new Set;if(t.body!=null){let s=this.getBodyRequestArgs({body:t.body,value:r.requestBody});if(o=new Set(s.map(a=>a.name)),t.body.type==="typeReference"){let a=t.body.value;if(a.type==="named"){let c=this.context.resolveNamedType({typeId:a.value});if(c!=null&&c.type==="object")for(let u of c.properties)this.resolvesToLiteralType(u.typeReference)||o.add(this.context.getPropertyName(u.name.name))}}}if(i.length>0){let a=this.getPathParameters({namedParameters:i,snippet:r}).map(c=>o.has(c.name)?{...c,name:c.name+"_"}:c);n.push(...a)}return this.context.errors.unscope(),this.context.errors.scope(Jo.RequestBody),t.body!=null&&n.push(...this.getBodyRequestArgs({body:t.body,value:r.requestBody})),this.context.errors.unscope(),n}getBodyRequestArgs({body:t,value:r}){switch(t.type){case"bytes":return[{name:zmt,value:this.getBytesBodyRequestTypeInstantiation({value:r})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:r});default:Ie(t)}}getBodyRequestArgsForTypeReference({typeReference:t,value:r}){switch(t.type){case"named":{let n=this.context.resolveNamedType({typeId:t.value});return n==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:t,named:n,value:r})}case"nullable":case"optional":{let n=t.value;return n.type==="named"&&this.context.resolveNamedType({typeId:n.value})?.type==="object"?[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:n,value:r})}]:this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:r})}case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:r})}];default:Ie(t)}}getBodyRequestArgsForNamedTypeReference({typeReference:t,named:r,value:n}){switch(r.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:r.typeReference,value:n});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:n})}];case"object":return this.context.customConfig.inline_request_params===!1?[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:n})}]:this.context.associateByWireValue({parameters:r.properties,values:this.context.getRecord(n)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference)).map(s=>({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)}));default:Ie(r)}}resolvesToLiteralType(t){switch(t.type){case"literal":return!0;case"optional":case"nullable":return this.resolvesToLiteralType(t.value);case"named":{let r=this.context.resolveNamedType({typeId:t.value});return r==null?!1:r.type==="alias"?this.resolvesToLiteralType(r.typeReference):!1}case"list":case"map":case"set":case"primitive":case"unknown":return!1;default:Ie(t)}}getBodyRequestArgsForBytes({body:t,value:r}){let n=this.getBytesBodyRequestTypeInstantiation({value:r});return fn.TypeInstantiation.isNop(n)?[]:[{name:zmt,value:n}]}getBytesBodyRequestTypeInstantiation({value:t}){return typeof t!="string"?(this.context.errors.add({severity:Br.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),fn.TypeInstantiation.nop()):fn.TypeInstantiation.bytes(t)}getBodyPropertyNamesForInlinedRequest(t){if(t.body==null)return new Set;switch(t.body.type){case"referenced":{let r=t.body.bodyType;if(r.type!=="typeReference")return new Set;let n=r.value;if(n.type!=="named")return new Set;let i=this.context.resolveNamedType({typeId:n.value});if(i==null||i.type!=="object")return new Set;let o=new Set;for(let s of i.properties)this.resolvesToLiteralType(s.typeReference)||o.add(this.context.getPropertyName(s.name.name));return o}case"properties":return new Set(t.body.value.filter(r=>!this.resolvesToLiteralType(r.typeReference)).map(r=>this.context.getPropertyName(r.name.name)));case"fileUpload":return new Set(t.body.properties.filter(r=>r.type==="bodyProperty").map(r=>this.context.getPropertyName(r.name.name)));default:Ie(t.body)}}getMethodArgsForInlinedRequest({request:t,snippet:r}){let n=[],i=this.context.shouldInlinePathParameters();this.context.errors.scope(Jo.PathParameters);let o=[];t.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:r})),this.context.errors.unscope(),this.context.errors.scope(Jo.RequestBody);let s=this.getFilePropertyInfo({request:t,snippet:r});this.context.errors.unscope();let a=this.getBodyPropertyNamesForInlinedRequest(t),c=o.map(u=>a.has(u.name)?{...u,name:`${u.name}_`}:u);return this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||n.push(...c),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&n.push(...this.getInlinedRequestArgs({request:t,snippet:r,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?c:[],filePropertyInfo:s})),n}getFilePropertyInfo({request:t,snippet:r}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:r.requestBody})}getInlinedRequestArgs({request:t,snippet:r,pathParameterFields:n,filePropertyInfo:i}){this.context.errors.scope(Jo.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:r.queryParameters??{}}).map(l=>({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicTypeLiteralMapper.convert(l)}));this.context.errors.unscope(),this.context.errors.scope(Jo.Headers);let c=this.context.associateByWireValue({parameters:t.headers??[],values:r.headers??{}}).map(l=>({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicTypeLiteralMapper.convert(l)}));this.context.errors.unscope(),this.context.errors.scope(Jo.RequestBody);let u=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:r.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),[...n,...s,...c,...u]}getInlinedRequestBodyObjectFields({body:t,value:r,filePropertyInfo:n}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:r});case"referenced":return this.getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:r});case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:n});default:Ie(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:r}){let n=t.bodyType;switch(n.type){case"bytes":return this.getBodyRequestArgsForBytes({body:t,value:r});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:n.value,value:r});default:Ie(n)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:r}){let n=[],o=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(r)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference));for(let s of o)n.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return n}getPathParameters({namedParameters:t,snippet:r}){let n=[],i=t.filter(s=>!this.resolvesToLiteralType(s.typeReference)),o=this.context.associateByWireValue({parameters:i,values:r.pathParameters??{},ignoreMissingParameters:!0});for(let s of o)n.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return n}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(r=>this.context.getMethodName(r)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getEnvironmentOptionName({environment:t}){return t!=null?"environment":"base_url"}};var Ozt=class extends FI{constructor({ir:t,config:r}){super(new hGn({ir:t,config:r}))}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t,r={}){return super.generateSnippetAst(t,r)}generateMethodCallSnippetAst({request:t,options:r={}}){let n=this.resolveEndpointsForMethodCall({request:t,options:r});if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i;for(let o of n){let s=this.context.clone(),a=this.createSnippetGenerator(s);try{return a.generateMethodCallSnippetAst({endpoint:o,request:t})}catch(c){i=c}}throw i??new Error(`Failed to generate method call snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}resolveEndpointsForMethodCall({request:t,options:r}){if(r.endpointId!=null){let n=this.context.resolveEndpointById(r.endpointId);if(n==null)throw new Error(`No endpoint found with ID "${r.endpointId}"`);return[n]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}createSnippetGenerator(t){return new gGn({context:t})}};var yGn=require("fs/promises"),Dmu=ve(require("path"),1);var AGn=class{context;ir;generatorConfig;dynamicSnippetsGenerator;constructor(t,r,n){this.context=t,this.ir=r,this.generatorConfig=n,this.dynamicSnippetsGenerator=new Ozt({ir:a1(this.ir),config:this.generatorConfig})}async generateTests({outputDir:t,requests:r}){this.context.logger.debug("Generating dynamic snippet tests...");for(let[n,{endpointId:i,request:o}]of r.entries())try{let s=s1(o);if(s==null)continue;let a=await this.dynamicSnippetsGenerator.generate(s,{endpointId:i}),c=this.getTestFilePath({outputDir:t,idx:n});await(0,yGn.mkdir)(Dmu.default.dirname(c),{recursive:!0}),await(0,yGn.writeFile)(c,a.snippet)}catch(s){this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(o.endpoint)}: ${s}`)}this.context.logger.debug("Done generating dynamic snippet tests")}getTestFilePath({outputDir:t,idx:r}){return Ke(t,Be.of(`dynamic_snippets/example${r}.py`))}};Jt();var fgh=2,e6=class extends lC{customConfig;formatter;requires=new Set;_indentLevel=0;constructor({customConfig:t,formatter:r}){super(),this.customConfig=t,this.formatter=r??new nW}addRequire(t){this.requires.add(t)}get currentIndentLevel(){return this._indentLevel}indent(){this._indentLevel++,super.indent()}dedent(){this._indentLevel--,super.dedent()}writeNodeStatement(t){this.writeNode(t),this.writeNewLineIfLastLineNot()}getTabSize(){return fgh}};var Vmt=class extends e6{constructor({customConfig:t,formatter:r}){super({customConfig:t,formatter:r})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(r){throw new Error(`Failed to format Ruby file: ${r}
|
|
2644
|
+
`)}),t.writeNoIndent('"""')}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/'/g,"\\'").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r?"True":"False");return;case"string":t.write(`"${this.escapeString(r)}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("None");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownObject({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("[]");return}t.write("["),r.forEach((n,i)=>{i>0&&t.write(", "),t.writeNode(e.unknown(n))}),t.write("]")}writeUnknownObject({writer:t,value:r}){let n=Object.entries(r);if(n.length===0){t.write("{}");return}t.write("{"),n.forEach(([i,o],s)=>{s>0&&t.write(", "),t.write(`"${i}": `),t.writeNode(e.unknown(o))}),t.write("}")}};function Uhh({entries:e}){return e.filter(t=>!t1e.isNop(t.key)&&!t1e.isNop(t.value))}function zhh({entries:e}){return e.filter(t=>!t1e.isNop(t.value))}function nQo({values:e}){return e.filter(t=>!t1e.isNop(t))}function Vhh(e){return new Bmt(e)}function qhh(e){return new pGn(e)}function Ghh(e){return new Umt(e)}function Whh(e){return new JSe(e)}function $hh(e){return new Rmt(e)}function Hhh(e){return new Fmt(e)}function Khh(e){return new eie(e)}function Jhh(e){return new e1e(e)}function Yhh(e){return new YSe(e)}function Xhh(e){return new Vpe(e)}function Zhh(e){return new Dmt(e)}function egh(e){return new kmt(e)}function tgh(e){return new Nmt(e)}function rgh(e){return new ZSe(e)}function ngh(e){return new Pmt(e)}function igh(e){return new Mmt(e)}function ogh(e){return new XSe(e)}function sgh(e){return new Qmt(e)}function agh(e){return new Lmt(e)}Li();Pt();var cgh="value",dGn=class{context;constructor({context:t}){this.context=t}convert(t){if(t.value===null)return this.context.isNullable(t.typeReference)?fn.TypeInstantiation.none():(this.context.errors.add({severity:Br.Critical,message:"Expected non-null value, but got null"}),fn.TypeInstantiation.nop());if(t.value===void 0)return fn.TypeInstantiation.nop();switch(t.typeReference.type){case"list":return this.convertList({list:t.typeReference.value,value:t.value});case"literal":return this.convertLiteral({literalType:t.typeReference.value,value:t.value});case"map":return this.convertMap({map:t.typeReference,value:t.value});case"named":{let r=this.context.resolveNamedType({typeId:t.typeReference.value});return r==null?fn.TypeInstantiation.nop():this.convertNamed({named:r,value:t.value,as:t.as})}case"optional":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"nullable":return this.convert({typeReference:t.typeReference.value,value:t.value,as:t.as});case"primitive":return this.convertPrimitive({primitive:t.typeReference.value,value:t.value,as:t.as});case"set":return this.convertSet({set:t.typeReference.value,value:t.value});case"unknown":return fn.TypeInstantiation.unknown(t.value);default:Ie(t.typeReference)}}convertLiteral({literalType:t,value:r}){switch(t.type){case"boolean":{let n=this.context.getValueAsBoolean({value:r});return n==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.bool(n)}case"string":{let n=this.context.getValueAsString({value:r});return n==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.str(n)}default:Ie(t)}}convertList({list:t,value:r}){return Array.isArray(r)?fn.TypeInstantiation.list(r.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:Br.Critical,message:`Expected array but got: ${typeof r}`}),fn.TypeInstantiation.nop())}convertSet({set:t,value:r}){return Array.isArray(r)?fn.TypeInstantiation.list(r.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:t,value:n})}finally{this.context.errors.unscope()}}),{multiline:!0}):(this.context.errors.add({severity:Br.Critical,message:`Expected array but got: ${typeof r}`}),fn.TypeInstantiation.nop())}convertMap({map:t,value:r}){return typeof r!="object"||r==null?(this.context.errors.add({severity:Br.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),fn.TypeInstantiation.nop()):fn.TypeInstantiation.dict(Object.entries(r).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:t.key,value:n,as:"key"}),value:this.convert({typeReference:t.value,value:i})}}finally{this.context.errors.unscope()}}),{multiline:!0})}convertNamed({named:t,value:r,as:n}){switch(t.type){case"alias":return this.convert({typeReference:t.typeReference,value:r,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:t,value:r});case"enum":return this.convertEnum({enum_:t,value:r});case"object":return this.convertObject({object_:t,value:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:t,value:r});default:Ie(t)}}convertDiscriminatedUnion({discriminatedUnion:t,value:r}){let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:t,value:r});if(n==null)return fn.TypeInstantiation.nop();let i=n.singleDiscriminatedUnionType,o=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});if(o==null)return fn.TypeInstantiation.nop();let s=this.context.getDiscriminatedUnionVariantClassReference({unionDeclaration:t.declaration,discriminantValue:i.discriminantValue});return fn.TypeInstantiation.reference(fn.instantiateClass({classReference:s,arguments_:o.map(a=>fn.methodArgument({name:a.name,value:a.value})),multiline:!0}))}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:t,unionVariant:r}){let n=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:r});switch(r.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:r.typeId});if(i==null)return;if(i.type!=="object"){this.context.errors.add({severity:Br.Critical,message:"Internal error; expected union value to be an object"});return}let o=this.convertObjectEntries({object_:i,value:t.value}),s=new Set(n.map(c=>c.name)),a=o.filter(c=>!s.has(c.name));return[...n,...a]}case"singleProperty":try{this.context.errors.scope(r.discriminantValue.wireValue);let i=this.context.getRecord(t.value);return i==null?[...n,{name:cgh,value:this.convert({typeReference:r.typeReference,value:t.value})}]:[...n,{name:this.context.getPropertyName(r.discriminantValue.name),value:this.convert({typeReference:r.typeReference,value:i[r.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return n;default:Ie(r)}}getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:r}){return this.context.associateByWireValue({parameters:r.properties??[],values:this.context.getRecord(t.value)??{},ignoreMissingParameters:!0}).map(i=>{this.context.errors.scope(i.name.wireValue);try{return{name:this.context.getPropertyName(i.name.name),value:this.convert(i)}}finally{this.context.errors.unscope()}})}convertObjectEntries({object_:t,value:r}){let n=this.context.getRecord(r)??{},i=this.context.associateByWireValue({parameters:t.properties,values:n}),o=new Set(Object.keys(n)),s=i.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}});for(let a of t.properties){if(o.has(a.name.wireValue)||this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let c=this.synthesizeDefaultValue(a.typeReference);fn.TypeInstantiation.isNop(c)||s.push({name:this.context.getPropertyName(a.name.name),value:c})}return s.filter(a=>!fn.TypeInstantiation.isNop(a.value))}convertObject({object_:t,value:r}){let n=this.convertObjectEntries({object_:t,value:r}),i=this.context.getTypeClassReference(t.declaration);return fn.TypeInstantiation.reference(fn.instantiateClass({classReference:i,arguments_:n.map(o=>fn.methodArgument({name:o.name,value:o.value})),multiline:!0}))}convertEnum({enum_:t,value:r}){let n=this.getEnumValue({enum_:t,value:r});if(n==null)return fn.TypeInstantiation.nop();let i=this.context.customConfig.pydantic_config?.enum_type;if(i==="python_enums"||i==="forward_compatible_python_enums"){let o=this.context.getTypeClassReference(t.declaration),s=n.name.screamingSnakeCase.safeName;return fn.TypeInstantiation.reference(fn.accessAttribute({lhs:o,rhs:fn.codeBlock(s)}))}return fn.TypeInstantiation.str(n.wireValue)}getEnumValue({enum_:t,value:r}){if(typeof r!="string"){this.context.errors.add({severity:Br.Critical,message:`Expected enum value string, got: ${typeof r}`});return}let n=t.values.find(i=>i.wireValue===r);if(n==null){this.context.errors.add({severity:Br.Critical,message:`An enum value named "${r}" does not exist in this context`});return}return n}convertUndiscriminatedUnion({undiscriminatedUnion:t,value:r}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:r});return n??fn.TypeInstantiation.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:t,value:r}){for(let n of t.types){let i=this.context.errors.size();try{let o=this.convert({typeReference:n,value:r});if(fn.TypeInstantiation.isNop(o)||this.context.errors.size()>i){this.context.errors.truncate(i);continue}return o}catch{this.context.errors.truncate(i);continue}}this.context.errors.add({severity:Br.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof r}" value`})}synthesizeDefaultValue(t,r=new Set){switch(t.type){case"optional":case"nullable":return fn.TypeInstantiation.nop();case"primitive":return this.synthesizeDefaultPrimitive(t.value);case"literal":return this.synthesizeDefaultLiteral(t.value);case"list":return fn.TypeInstantiation.list([]);case"set":return fn.TypeInstantiation.list([]);case"map":return fn.TypeInstantiation.dict([]);case"named":{if(r.has(t.value))return fn.TypeInstantiation.nop();let n=this.context.resolveNamedType({typeId:t.value});return n==null?fn.TypeInstantiation.nop():this.synthesizeDefaultNamed({named:n,typeId:t.value,seen:r})}case"unknown":return fn.TypeInstantiation.nop();default:Ie(t)}}synthesizeDefaultPrimitive(t){switch(t){case"STRING":case"BASE_64":case"BIG_INTEGER":return fn.TypeInstantiation.str("string");case"INTEGER":case"LONG":case"UINT":case"UINT_64":return fn.TypeInstantiation.int(1);case"FLOAT":case"DOUBLE":return fn.TypeInstantiation.float(1.1);case"BOOLEAN":return fn.TypeInstantiation.bool(!0);case"DATE":return fn.TypeInstantiation.date("2024-01-15");case"DATE_TIME":case"DATE_TIME_RFC_2822":return fn.TypeInstantiation.datetime("2024-01-15T09:30:00Z");case"UUID":return fn.TypeInstantiation.uuid("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32");default:Ie(t)}}synthesizeDefaultLiteral(t){switch(t.type){case"boolean":return fn.TypeInstantiation.bool(t.value);case"string":return fn.TypeInstantiation.str(t.value);default:Ie(t)}}synthesizeDefaultNamed({named:t,typeId:r,seen:n}){let i=new Set(n);switch(i.add(r),t.type){case"alias":return this.synthesizeDefaultValue(t.typeReference,i);case"enum":{let o=t.values[0];if(o==null)return fn.TypeInstantiation.nop();let s=this.context.customConfig.pydantic_config?.enum_type;if(s==="python_enums"||s==="forward_compatible_python_enums"){let a=this.context.getTypeClassReference(t.declaration),c=o.name.screamingSnakeCase.safeName;return fn.TypeInstantiation.reference(fn.accessAttribute({lhs:a,rhs:fn.codeBlock(c)}))}return fn.TypeInstantiation.str(o.wireValue)}case"object":{let o=[];for(let a of t.properties){if(this.context.isOptional(a.typeReference)||this.context.isNullable(a.typeReference))continue;let c=this.synthesizeDefaultValue(a.typeReference,i);fn.TypeInstantiation.isNop(c)||o.push({name:this.context.getPropertyName(a.name.name),value:c})}let s=this.context.getTypeClassReference(t.declaration);return fn.TypeInstantiation.reference(fn.instantiateClass({classReference:s,arguments_:o.map(a=>fn.methodArgument({name:a.name,value:a.value})),multiline:!0}))}case"discriminatedUnion":case"undiscriminatedUnion":return fn.TypeInstantiation.nop();default:Ie(t)}}convertPrimitive({primitive:t,value:r,as:n}){switch(t){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:r,as:n});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.int(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:r,as:n});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.bool(i)}case"BASE_64":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.str(i)}case"UUID":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.uuid(i)}case"DATE":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.date(i)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let i=this.context.getValueAsString({value:r});return i==null?fn.TypeInstantiation.nop():fn.TypeInstantiation.datetime(i)}default:Ie(t)}}getValueAsNumber({value:t,as:r}){let n=r==="key"&&typeof t=="string"?Number(t):t;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:t,as:r}){let n=r==="key"?typeof t=="string"?t==="true":t==="false"?!1:t:t;return this.context.getValueAsBoolean({value:n})}};Pt();var mGn=class{context;constructor({context:t}){this.context=t}getFilePropertyInfo({body:t,value:r}){let n={fileFields:[],bodyPropertyFields:[]},i=this.context.getRecord(r)??{};for(let o of t.properties)switch(o.type){case"file":{let s=this.getSingleFileProperty({property:o,record:i});if(fn.TypeInstantiation.isNop(s))break;n.fileFields.push({name:this.context.getPropertyName(o.name),value:s});break}case"fileArray":{let s=this.getArrayFileProperty({property:o,record:i});if(fn.TypeInstantiation.isNop(s))break;n.fileFields.push({name:this.context.getPropertyName(o.name),value:s});break}case"bodyProperty":{let s=this.getBodyProperty({property:o,record:i});if(fn.TypeInstantiation.isNop(s))break;n.bodyPropertyFields.push({name:this.context.getPropertyName(o.name.name),value:s});break}default:Ie(o)}return n}getSingleFileProperty({property:t,record:r}){let n=this.context.getSingleFileValue({property:t,record:r});return n==null&&(n=`example_${t.wireValue??"file"}`),this.context.getFileFromString(n)}getArrayFileProperty({property:t,record:r}){let n=this.context.getFileArrayValues({property:t,record:r});if(n==null){let i=`example_${t.wireValue??"files"}`;return fn.TypeInstantiation.list([this.context.getFileFromString(i)])}return fn.TypeInstantiation.list(n.map(i=>this.context.getFileFromString(i)))}getBodyProperty({property:t,record:r}){let n=r[t.name.wireValue];return n==null?fn.TypeInstantiation.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:n})}};var ugh=["list","set"],hGn=class e extends kI{ir;customConfig;dynamicTypeLiteralMapper;filePropertyMapper;constructor({ir:t,config:r}){super({ir:t,config:r}),this.ir=t,this.customConfig=r.customConfig??{},this.dynamicTypeLiteralMapper=new dGn({context:this}),this.filePropertyMapper=new mGn({context:this})}clone(){return new e({ir:this.ir,config:this.config})}getClassName(t){let r=t.pascalCase.safeName,n=this.getRootClientClassName();return r===n?`${n}Model`:r}getTypedDictClassName(t){return`${this.getClassName(t)}Params`}getPropertyName(t){let r=t.snakeCase.safeName;return r.startsWith("_")?"f_"+r.substring(r.lastIndexOf("_")+1):r}getMethodName(t){return ugh.includes(t.snakeCase.unsafeName)?t.snakeCase.unsafeName:t.snakeCase.safeName}getRootClientClassReference(){return fn.reference({name:this.getRootClientClassName(),modulePath:this.getRootModulePath()})}getTypeClassReference(t){let r=this.getClassName(t.name),n=[...this.getRootModulePath(),...t.fernFilepath.allParts.map(i=>i.snakeCase.safeName)];return fn.reference({name:r,modulePath:n})}getDiscriminatedUnionVariantClassReference({unionDeclaration:t,discriminantValue:r}){let n=this.getClassName(t.name),i=r.name.pascalCase.safeName,o=[...this.getRootModulePath(),...t.fernFilepath.allParts.map(a=>a.snakeCase.safeName)],s=this.customConfig.pydantic_config?.union_naming==="v1"?`${i}${n}`:`${n}_${i}`;return fn.reference({name:s,modulePath:o})}useTypedDictRequests(){return this.customConfig.use_typeddict_requests===!0}getRootClientClassName(){return this.customConfig.client?.exported_class_name!=null?this.customConfig.client.exported_class_name:this.customConfig.client_class_name!=null?this.customConfig.client_class_name:this.customConfig.client?.class_name!=null?this.customConfig.client.class_name:this.pascalCase(this.config.organization)+this.pascalCase(this.config.workspaceName)}getEnvironmentClassName(){return`${this.getRootClientClassName()}Environment`}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return fn.accessAttribute({lhs:this.getEnvironmentClassReference(),rhs:fn.codeBlock(this.getEnvironmentEnumName(r))})}getEnvironmentClassReference(){return fn.reference({name:this.getEnvironmentClassName(),modulePath:this.getEnvironmentModulePath()})}getEnvironmentEnumName(t){return t.screamingSnakeCase.safeName}isPrimitive(t){switch(t.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(t.value);case"named":{let r=this.resolveNamedType({typeId:t.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:Ie(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:Ie(t)}}getFileFromString(t){return fn.TypeInstantiation.str(t)}getRootModulePath(){if(this.customConfig.package_name!=null)return[this.customConfig.package_name];let t=this.cleanOrganizationName();if(this.customConfig.use_api_name_in_package)return[t,this.getApiName()];if(this.customConfig.package_path!=null){let r=this.customConfig.package_path.replace(/\//g,".").split(".");return[t,...r]}return[t]}getCoreModulePath(){return this.getRootModulePath().concat("core")}getEnvironmentModulePath(){return this.getRootModulePath().concat("environment")}shouldInlinePathParameters(){return!0}cleanOrganizationName(){return this.config.organization.replace(/[^a-zA-Z0-9]/g,"_")}getApiName(){return cBe(this.config.workspaceName)}pascalCase(t){let r=Zn(t);return r.charAt(0).toUpperCase()+r.slice(1)}};Pt();var lgh={type:"primitive",value:"STRING"},pgh=["example"],Rmu="client",zmt="request",gGn=class{context;constructor({context:t}){this.context=t}async generateSnippet({endpoint:t,request:r}){return this.buildPythonFile({endpoint:t,snippet:r}).toString()}generateSnippetSync({endpoint:t,request:r}){return this.buildPythonFile({endpoint:t,snippet:r}).toString()}async generateSnippetAst({endpoint:t,request:r}){return this.buildPythonFile({endpoint:t,snippet:r})}generateMethodCallSnippetAst({endpoint:t,request:r}){return this.callMethod({endpoint:t,snippet:r})}buildPythonFile({endpoint:t,snippet:r}){return fn.file({path:pgh,statements:[this.constructClient({endpoint:t,snippet:r}),this.callMethod({endpoint:t,snippet:r})]})}constructClient({endpoint:t,snippet:r}){return fn.assign({lhs:fn.reference({name:Rmu}),rhs:fn.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:t,snippet:r}).map(n=>fn.methodArgument({name:n.name,value:n.value})),multiline:!0})})}getConstructorArgs({endpoint:t,snippet:r}){let n=[],i=this.getConstructorEnvironmentArgs({baseUrl:r.baseURL,environment:r.environment});return i.length>0&&n.push(...i),t.auth!=null&&(r.auth!=null?n.push(...this.getConstructorAuthArgs({auth:t.auth,values:r.auth})):this.context.errors.add({severity:Br.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(Jo.PathParameters),this.context.ir.pathParameters!=null&&n.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:r})),this.context.errors.unscope(),this.context.errors.scope(Jo.Headers),this.context.ir.headers!=null&&r.headers!=null&&n.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:r.headers})),this.context.errors.unscope(),n}getConstructorEnvironmentArgs({baseUrl:t,environment:r}){let n=this.getEnvironmentValue({baseUrl:t,environment:r});return n==null?[]:r!=null&&this.context.isMultiEnvironmentValues(r)?[{name:"environment",value:n}]:[{name:this.getEnvironmentOptionName({environment:r}),value:n}]}getEnvironmentValue({baseUrl:t,environment:r}){if(t!=null&&r!=null){this.context.errors.add({severity:Br.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return fn.TypeInstantiation.str(t);if(r!=null){if(this.context.isSingleEnvironmentID(r)){let n=this.context.getEnvironmentTypeReferenceFromID(r);if(n==null){this.context.errors.add({severity:Br.Warning,message:`Environment ${JSON.stringify(r)} was not found`});return}return fn.TypeInstantiation.reference(n)}if(this.context.isMultiEnvironmentValues(r))return this.context.validateMultiEnvironmentUrlValues(r)?fn.TypeInstantiation.reference(fn.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(r).map(([n,i])=>({name:n,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:lgh,value:i})})).map(n=>fn.methodArgument({name:n.name,value:n.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:t,values:r}){switch(t.type){case"basic":return r.type!=="basic"?(this.addAuthMismatchError(t,r),[]):this.getConstructorBasicAuthArg({auth:t,values:r});case"bearer":return r.type!=="bearer"?(this.addAuthMismatchError(t,r),[]):this.getConstructorBearerAuthArgs({auth:t,values:r});case"header":return r.type!=="header"?(this.addAuthMismatchError(t,r),[]):this.getConstructorHeaderAuthArgs({auth:t,values:r});case"oauth":return r.type!=="oauth"?(this.addAuthMismatchError(t,r),[]):this.getConstructorOAuthArgs({auth:t,values:r});case"inferred":return r.type!=="inferred"?(this.addAuthMismatchError(t,r),[]):this.getConstructorInferredAuthArgs({auth:t,values:r});default:Ie(t)}}addAuthMismatchError(t,r){this.context.errors.add({severity:Br.Critical,message:this.context.newAuthMismatchError({auth:t,values:r}).message})}addWarning(t){this.context.errors.add({severity:Br.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:r}){return[{name:this.context.getPropertyName(t.username),value:fn.TypeInstantiation.str(r.username)},{name:this.context.getPropertyName(t.password),value:fn.TypeInstantiation.str(r.password)}]}getConstructorBearerAuthArgs({auth:t,values:r}){return[{name:this.context.getPropertyName(t.token),value:fn.TypeInstantiation.str(r.token)}]}getConstructorHeaderAuthArgs({auth:t,values:r}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:r.value})}]}getConstructorOAuthArgs({auth:t,values:r}){return[{name:this.context.getPropertyName(t.clientId),value:fn.TypeInstantiation.str(r.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:fn.TypeInstantiation.str(r.clientSecret)}]}getConstructorInferredAuthArgs({auth:t,values:r}){let n=t.parameters??[];if(n.length===0)return this.addWarning("Inferred auth scheme is missing parameters; cannot generate constructor arguments."),[];let i=r.values;if(i==null)return this.addWarning("Inferred auth values were not provided; cannot generate constructor arguments."),[];let o=[];for(let s of n){let a=s.name.wireValue;if(!Object.hasOwn(i,a)){this.addWarning(`Missing inferred auth value for ${a}`);continue}let c=i[a],u=this.context.dynamicTypeLiteralMapper.convert({typeReference:s.typeReference,value:c});fn.TypeInstantiation.isNop(u)||o.push({name:this.context.getPropertyName(s.name.name),value:u})}return o}getConstructorHeaderArgs({headers:t,values:r}){let n=[];for(let i of t){let o=r[i.name.wireValue],s=this.getConstructorHeaderArg({header:i,value:o});s!=null&&n.push(s)}return n}getConstructorHeaderArg({header:t,value:r}){let n=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:r});if(!fn.TypeInstantiation.isNop(n))return{name:this.context.getPropertyName(t.name.name),value:n}}callMethod({endpoint:t,snippet:r}){return fn.invokeMethod({on:fn.reference({name:Rmu}),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:r}).filter(n=>!fn.TypeInstantiation.isNop(n.value)).map(n=>fn.methodArgument({name:n.name,value:n.value})),multiline:!0})}getMethodArgs({endpoint:t,snippet:r}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:r});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:r});default:Ie(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:r}){let n=[];this.context.errors.scope(Jo.PathParameters);let i=[...this.context.ir.pathParameters??[],...t.pathParameters??[]],o=new Set;if(t.body!=null){let s=this.getBodyRequestArgs({body:t.body,value:r.requestBody});if(o=new Set(s.map(a=>a.name)),t.body.type==="typeReference"){let a=t.body.value;if(a.type==="named"){let c=this.context.resolveNamedType({typeId:a.value});if(c!=null&&c.type==="object")for(let u of c.properties)this.resolvesToLiteralType(u.typeReference)||o.add(this.context.getPropertyName(u.name.name))}}}if(i.length>0){let a=this.getPathParameters({namedParameters:i,snippet:r}).map(c=>o.has(c.name)?{...c,name:c.name+"_"}:c);n.push(...a)}return this.context.errors.unscope(),this.context.errors.scope(Jo.RequestBody),t.body!=null&&n.push(...this.getBodyRequestArgs({body:t.body,value:r.requestBody})),this.context.errors.unscope(),n}getBodyRequestArgs({body:t,value:r}){switch(t.type){case"bytes":return[{name:zmt,value:this.getBytesBodyRequestTypeInstantiation({value:r})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:r});default:Ie(t)}}getBodyRequestArgsForTypeReference({typeReference:t,value:r}){switch(t.type){case"named":{let n=this.context.resolveNamedType({typeId:t.value});return n==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:t,named:n,value:r})}case"nullable":case"optional":{let n=t.value;return n.type==="named"&&this.context.resolveNamedType({typeId:n.value})?.type==="object"?[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:n,value:r})}]:this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:r})}case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:r})}];default:Ie(t)}}getBodyRequestArgsForNamedTypeReference({typeReference:t,named:r,value:n}){switch(r.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:r.typeReference,value:n});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:n})}];case"object":return this.context.customConfig.inline_request_params===!1?[{name:zmt,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:n})}]:this.context.associateByWireValue({parameters:r.properties,values:this.context.getRecord(n)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference)).map(s=>({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)}));default:Ie(r)}}resolvesToLiteralType(t){switch(t.type){case"literal":return!0;case"optional":case"nullable":return this.resolvesToLiteralType(t.value);case"named":{let r=this.context.resolveNamedType({typeId:t.value});return r==null?!1:r.type==="alias"?this.resolvesToLiteralType(r.typeReference):!1}case"list":case"map":case"set":case"primitive":case"unknown":return!1;default:Ie(t)}}getBodyRequestArgsForBytes({body:t,value:r}){let n=this.getBytesBodyRequestTypeInstantiation({value:r});return fn.TypeInstantiation.isNop(n)?[]:[{name:zmt,value:n}]}getBytesBodyRequestTypeInstantiation({value:t}){return typeof t!="string"?(this.context.errors.add({severity:Br.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),fn.TypeInstantiation.nop()):fn.TypeInstantiation.bytes(t)}getBodyPropertyNamesForInlinedRequest(t){if(t.body==null)return new Set;switch(t.body.type){case"referenced":{let r=t.body.bodyType;if(r.type!=="typeReference")return new Set;let n=r.value;if(n.type!=="named")return new Set;let i=this.context.resolveNamedType({typeId:n.value});if(i==null||i.type!=="object")return new Set;let o=new Set;for(let s of i.properties)this.resolvesToLiteralType(s.typeReference)||o.add(this.context.getPropertyName(s.name.name));return o}case"properties":return new Set(t.body.value.filter(r=>!this.resolvesToLiteralType(r.typeReference)).map(r=>this.context.getPropertyName(r.name.name)));case"fileUpload":return new Set(t.body.properties.filter(r=>r.type==="bodyProperty").map(r=>this.context.getPropertyName(r.name.name)));default:Ie(t.body)}}getMethodArgsForInlinedRequest({request:t,snippet:r}){let n=[],i=this.context.shouldInlinePathParameters();this.context.errors.scope(Jo.PathParameters);let o=[];t.pathParameters!=null&&o.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:r})),this.context.errors.unscope(),this.context.errors.scope(Jo.RequestBody);let s=this.getFilePropertyInfo({request:t,snippet:r});this.context.errors.unscope();let a=this.getBodyPropertyNamesForInlinedRequest(t),c=o.map(u=>a.has(u.name)?{...u,name:`${u.name}_`}:u);return this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||n.push(...c),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&n.push(...this.getInlinedRequestArgs({request:t,snippet:r,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?c:[],filePropertyInfo:s})),n}getFilePropertyInfo({request:t,snippet:r}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:r.requestBody})}getInlinedRequestArgs({request:t,snippet:r,pathParameterFields:n,filePropertyInfo:i}){this.context.errors.scope(Jo.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:t.queryParameters??[],values:r.queryParameters??{}}).map(l=>({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicTypeLiteralMapper.convert(l)}));this.context.errors.unscope(),this.context.errors.scope(Jo.Headers);let c=this.context.associateByWireValue({parameters:t.headers??[],values:r.headers??{}}).map(l=>({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicTypeLiteralMapper.convert(l)}));this.context.errors.unscope(),this.context.errors.scope(Jo.RequestBody);let u=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:r.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),[...n,...s,...c,...u]}getInlinedRequestBodyObjectFields({body:t,value:r,filePropertyInfo:n}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:r});case"referenced":return this.getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:r});case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:n});default:Ie(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:r}){let n=t.bodyType;switch(n.type){case"bytes":return this.getBodyRequestArgsForBytes({body:t,value:r});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:n.value,value:r});default:Ie(n)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:r}){let n=[],o=this.context.associateByWireValue({parameters:t,values:this.context.getRecord(r)??{}}).filter(s=>!this.resolvesToLiteralType(s.typeReference));for(let s of o)n.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return n}getPathParameters({namedParameters:t,snippet:r}){let n=[],i=t.filter(s=>!this.resolvesToLiteralType(s.typeReference)),o=this.context.associateByWireValue({parameters:i,values:r.pathParameters??{},ignoreMissingParameters:!0});for(let s of o)n.push({name:this.context.getPropertyName(s.name.name),value:this.context.dynamicTypeLiteralMapper.convert(s)});return n}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(r=>this.context.getMethodName(r)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getEnvironmentOptionName({environment:t}){return t!=null?"environment":"base_url"}};var Ozt=class extends FI{constructor({ir:t,config:r}){super(new hGn({ir:t,config:r}))}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t,r={}){return super.generateSnippetAst(t,r)}generateMethodCallSnippetAst({request:t,options:r={}}){let n=this.resolveEndpointsForMethodCall({request:t,options:r});if(n.length===0)throw new Error(`No endpoints found that match "${t.endpoint.method} ${t.endpoint.path}"`);let i;for(let o of n){let s=this.context.clone(),a=this.createSnippetGenerator(s);try{return a.generateMethodCallSnippetAst({endpoint:o,request:t})}catch(c){i=c}}throw i??new Error(`Failed to generate method call snippet AST for endpoint: ${t.endpoint.method} ${t.endpoint.path}`)}resolveEndpointsForMethodCall({request:t,options:r}){if(r.endpointId!=null){let n=this.context.resolveEndpointById(r.endpointId);if(n==null)throw new Error(`No endpoint found with ID "${r.endpointId}"`);return[n]}return this.context.resolveEndpointLocationOrThrow(t.endpoint)}createSnippetGenerator(t){return new gGn({context:t})}};var yGn=require("fs/promises"),Dmu=ve(require("path"),1);var AGn=class{context;ir;generatorConfig;dynamicSnippetsGenerator;constructor(t,r,n){this.context=t,this.ir=r,this.generatorConfig=n,this.dynamicSnippetsGenerator=new Ozt({ir:a1(this.ir),config:this.generatorConfig})}async generateTests({outputDir:t,requests:r}){this.context.logger.debug("Generating dynamic snippet tests...");for(let[n,{endpointId:i,request:o}]of r.entries())try{let s=s1(o);if(s==null)continue;let a=await this.dynamicSnippetsGenerator.generate(s,{endpointId:i}),c=this.getTestFilePath({outputDir:t,idx:n});await(0,yGn.mkdir)(Dmu.default.dirname(c),{recursive:!0}),await(0,yGn.writeFile)(c,a.snippet)}catch(s){this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(o.endpoint)}: ${s}`)}this.context.logger.debug("Done generating dynamic snippet tests")}getTestFilePath({outputDir:t,idx:r}){return Ke(t,Be.of(`dynamic_snippets/example${r}.py`))}};Jt();var fgh=2,e6=class extends lC{customConfig;formatter;requires=new Set;_indentLevel=0;constructor({customConfig:t,formatter:r}){super(),this.customConfig=t,this.formatter=r??new nW}addRequire(t){this.requires.add(t)}get currentIndentLevel(){return this._indentLevel}indent(){this._indentLevel++,super.indent()}dedent(){this._indentLevel--,super.dedent()}writeNodeStatement(t){this.writeNode(t),this.writeNewLineIfLastLineNot()}getTabSize(){return fgh}};var Vmt=class extends e6{constructor({customConfig:t,formatter:r}){super({customConfig:t,formatter:r})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(r){throw new Error(`Failed to format Ruby file: ${r}
|
|
2645
2645
|
${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(r){throw new Error(`Failed to format Ruby file: ${r}
|
|
2646
2646
|
${t}`)}return t}getContent(){let t=this.stringifyRequires();return t.length>0?`${t}
|
|
2647
2647
|
|
|
@@ -3831,7 +3831,7 @@ For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides
|
|
|
3831
3831
|
`),h="";return c&&(h=l.style.error(c)),[`${p} ${f} ${s}`,[m,h].filter(Boolean).join(`
|
|
3832
3832
|
`)]});var Yjh=KI((e,t)=>{let{validate:r=()=>!0}=e,n=xE(e.theme),[i,o]=ru("idle"),[s,a]=ru(),[c,u]=ru(""),l=$I({status:i,theme:n});HI(async(h,g)=>{if(i==="idle")if(WI(h)){let A=c;o("loading");let b=await r(A);b===!0?(u(A),o("done"),t(A)):(g.write(c),a(b||"You must provide a valid value"),o("idle"))}else u(g.line),a(void 0)});let p=n.style.message(e.message,i),d="",f;e.mask?d=(typeof e.mask=="string"?e.mask:"*").repeat(c.length):i!=="done"&&(f=`${n.style.help("[input is masked]")}${xyt}`),i==="done"&&(d=n.style.answer(d));let m="";return s&&(m=n.style.error(s)),[[l,p,e.mask?d:f].join(" "),m]});var a4e=ve(rC(),1);var Xjh={icon:{cursor:Uw.pointer},style:{disabled:e=>a4e.default.dim(`- ${e}`),searchTerm:e=>a4e.default.cyan(e),description:e=>a4e.default.cyan(e),keysHelpTip:e=>e.map(([t,r])=>`${a4e.default.bold(t)} ${a4e.default.dim(r)}`).join(a4e.default.dim(" \u2022 "))},helpMode:"always"};function iqo(e){return!id.isSeparator(e)&&!e.disabled}function Zjh(e){return e.map(t=>{if(id.isSeparator(t))return t;if(typeof t=="string")return{value:t,name:t,short:t,disabled:!1};let r=t.name??String(t.value),n={value:t.value,name:r,short:t.short??r,disabled:t.disabled??!1};return t.description&&(n.description=t.description),n})}var eQh=KI((e,t)=>{let{pageSize:r=7,validate:n=()=>!0}=e,i=xE(Xjh,e.theme),[o,s]=ru("loading"),[a,c]=ru(""),[u,l]=ru([]),[p,d]=ru(),f=$I({status:o,theme:i}),m=CQ(()=>{let P=u.findIndex(iqo),z=u.findLastIndex(iqo);return{first:P,last:z}},[u]),[h=m.first,g]=ru();uU(()=>{let P=new AbortController;return s("loading"),d(void 0),(async()=>{try{let q=await e.source(a||void 0,{signal:P.signal});P.signal.aborted||(g(void 0),d(void 0),l(Zjh(q)),s("idle"))}catch(q){!P.signal.aborted&&q instanceof Error&&d(q.message)}})(),()=>{P.abort()}},[a]);let A=u[h];HI(async(P,z)=>{if(WI(P))if(A){s("loading");let q=await n(A.value);s("idle"),q===!0?(s("done"),t(A.value)):A.name===a?d(q||"You must provide a valid value"):(z.write(A.name),c(A.name))}else z.write(a);else if(Dfe(P)&&A)z.clearLine(0),z.write(A.name),c(A.name);else if(o!=="loading"&&(yO(P)||xQ(P))){if(z.clearLine(0),yO(P)&&h!==m.first||xQ(P)&&h!==m.last){let q=yO(P)?-1:1,V=h;do V=(V+q+u.length)%u.length;while(!iqo(u[V]));g(V)}}else c(z.line)});let b=i.style.message(e.message,o),v;if(i.helpMode!=="never")if(e.instructions){let{pager:P,navigation:z}=e.instructions;v=i.style.help(u.length>r?P:z)}else v=i.style.keysHelpTip([["\u2191\u2193","navigate"],["\u23CE","select"]]);let E=n4e({items:u,active:h,renderItem({item:P,isActive:z}){if(id.isSeparator(P))return` ${P.separator}`;if(P.disabled){let X=typeof P.disabled=="string"?P.disabled:"(disabled)";return i.style.disabled(`${P.name} ${X}`)}let q=z?i.style.highlight:X=>X,V=z?i.icon.cursor:" ";return q(`${V} ${P.name}`)},pageSize:r,loop:!1}),I;p?I=i.style.error(p):u.length===0&&a!==""&&o==="idle"&&(I=i.style.error("No results found"));let x;if(o==="done"&&A)return[f,b,i.style.answer(A.short)].filter(Boolean).join(" ").trimEnd();x=i.style.searchTerm(a);let C=A?.description,_=[f,b,x].filter(Boolean).join(" ").trimEnd(),w=[I??E," ",C?i.style.description(C):"",v].filter(Boolean).join(`
|
|
3833
3833
|
`).trimEnd();return[_,w]});var _yt=ve(rC(),1);var tQh={icon:{cursor:Uw.pointer},style:{disabled:e=>_yt.default.dim(`- ${e}`),description:e=>_yt.default.cyan(e),keysHelpTip:e=>e.map(([t,r])=>`${_yt.default.bold(t)} ${_yt.default.dim(r)}`).join(_yt.default.dim(" \u2022 "))},helpMode:"always",indexMode:"hidden",keybindings:[]};function Cyt(e){return!id.isSeparator(e)&&!e.disabled}function rQh(e){return e.map(t=>{if(id.isSeparator(t))return t;if(typeof t=="string")return{value:t,name:t,short:t,disabled:!1};let r=t.name??String(t.value),n={value:t.value,name:r,short:t.short??r,disabled:t.disabled??!1};return t.description&&(n.description=t.description),n})}var oqo=KI((e,t)=>{let{loop:r=!0,pageSize:n=7}=e,i=xE(tQh,e.theme),{keybindings:o}=i,[s,a]=ru("idle"),c=$I({status:s,theme:i}),u=r4e(),l=!o.includes("vim"),p=CQ(()=>rQh(e.choices),[e.choices]),d=CQ(()=>{let C=p.findIndex(Cyt),_=p.findLastIndex(Cyt);if(C===-1)throw new Bie("[select prompt] No selectable choices. All choices are disabled.");return{first:C,last:_}},[p]),f=CQ(()=>"default"in e?p.findIndex(C=>Cyt(C)&&C.value===e.default):-1,[e.default,p]),[m,h]=ru(f===-1?d.first:f),g=p[m];HI((C,_)=>{if(clearTimeout(u.current),WI(C))a("done"),t(g.value);else if(yO(C,o)||xQ(C,o)){if(_.clearLine(0),r||yO(C,o)&&m!==d.first||xQ(C,o)&&m!==d.last){let w=yO(C,o)?-1:1,P=m;do P=(P+w+p.length)%p.length;while(!Cyt(p[P]));h(P)}}else if(O3t(C)&&!Number.isNaN(Number(_.line))){let w=Number(_.line)-1,P=-1,z=p.findIndex(V=>id.isSeparator(V)?!1:(P++,P===w)),q=p[z];q!=null&&Cyt(q)&&h(z),u.current=setTimeout(()=>{_.clearLine(0)},700)}else if(ZUe(C))_.clearLine(0);else if(l){let w=_.line.toLowerCase(),P=p.findIndex(z=>id.isSeparator(z)||!Cyt(z)?!1:z.name.toLowerCase().startsWith(w));P!==-1&&h(P),u.current=setTimeout(()=>{_.clearLine(0)},700)}}),uU(()=>()=>{clearTimeout(u.current)},[]);let A=i.style.message(e.message,s),b;if(i.helpMode!=="never")if(e.instructions){let{pager:C,navigation:_}=e.instructions;b=i.style.help(p.length>n?C:_)}else b=i.style.keysHelpTip([["\u2191\u2193","navigate"],["\u23CE","select"]]);let v=0,E=n4e({items:p,active:m,renderItem({item:C,isActive:_,index:w}){if(id.isSeparator(C))return v++,` ${C.separator}`;let P=i.indexMode==="number"?`${w+1-v}. `:"";if(C.disabled){let V=typeof C.disabled=="string"?C.disabled:"(disabled)";return i.style.disabled(`${P}${C.name} ${V}`)}let z=_?i.style.highlight:V=>V,q=_?i.icon.cursor:" ";return z(`${q} ${P}${C.name}`)},pageSize:n,loop:r});if(s==="done")return[c,A,i.style.answer(g.short)].filter(Boolean).join(" ");let{description:I}=g;return`${[[c,A].filter(Boolean).join(" "),E," ",I?i.style.description(I):"",b].filter(Boolean).join(`
|
|
3834
|
-
`).trimEnd()}${xyt}`});Li();function SYn(e,t,r){if(t instanceof Of)return;let n=tBe(t,r?.code);e.instrumentPostHogEvent({command:process.argv.join(" "),properties:{failed:!0,errorCode:n}}),uIt(n)&&e.captureException(t??new Ae({message:r?.message??"",code:n}),n)}var TYn=class{sentry;constructor({release:t}){let r=process.env.FERN_DISABLE_TELEMETRY!=="true",n="";if(r&&n!=null&&n.length>0){let i="production";if(i==null||i.length===0)throw new Ae({message:"SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",code:Ae.Code.ConfigError});this.sentry=rIt({dsn:n,release:t,environment:i,defaultIntegrations:!1,integrations:[r5e()],tracesSampleRate:0}),nIt()}}captureException(t,r){if(this.sentry!=null)try{this.sentry.captureException(t,r!=null?{captureContext:{tags:{"error.code":r}}}:void 0)}catch{}}async flush(){this.sentry!=null&&await Promise.resolve(this.sentry.flush(2e3)).catch(()=>{})}};var OYn=class{originalWrite;redirected=!1;redirect(){if(this.redirected)throw new Ae({message:"StdoutRedirector: already redirected \u2014 did you forget to restore()?",code:Ae.Code.InternalError});this.originalWrite=process.stdout.write,process.stdout.write=process.stderr.write.bind(process.stderr),this.redirected=!0}restore(){!this.redirected||this.originalWrite==null||(process.stdout.write=this.originalWrite,this.originalWrite=void 0,this.redirected=!1)}async withRedirect(t){this.redirect();try{return await t()}finally{this.restore()}}};Pt();var D3t=class{result=Bf.Success;logImmediately;logPrefix;subtasks=[];shouldBufferLogs;bufferedLogs=[];status="notStarted";onResult;instrumentPostHogEventImpl;captureExceptionImpl;constructor({logImmediately:t,logPrefix:r,takeOverTerminal:n,onResult:i,shouldBufferLogs:o,instrumentPostHogEvent:s,captureException:a}){this.logImmediately=t,this.logPrefix=r??"",this.takeOverTerminal=n,this.onResult=i,this.shouldBufferLogs=o,this.instrumentPostHogEventImpl=s,this.captureExceptionImpl=a}start(){return this.status="running",this}isStarted(){return this.status!=="notStarted"}finish(){this.status="finished",this.flushLogs(),this.onResult?.(this.getResult())}isFinished(){return this.status==="finished"}takeOverTerminal;failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),this.finish(),new Of}failWithoutThrowing(t,r,n){this.result=Bf.Failure,!(r instanceof Of)&&(xPt({message:t,error:r,logger:this.logger}),SYn(this,r,{...n,message:t}))}captureException(t,r){this.captureExceptionImpl?.(t,r)}getResult(){return this.result}instrumentPostHogEvent(t){this.instrumentPostHogEventImpl(t)}logAtLevel(t,...r){this.logAtLevelWithOverrides(t,r)}logAtLevelWithOverrides(t,r,n={}){this.log({parts:r,level:t,time:new Date,...n})}log(t){this.bufferedLogs.push({...t,prefix:this.logPrefix}),this.shouldBufferLogs||this.flushLogs()}flushLogs(){this.logImmediately(this.bufferedLogs),this.bufferedLogs=[]}logger=P1(this.logAtLevel.bind(this));addInteractiveTask({name:t,subtitle:r}){let n=new sqo({name:t,subtitle:r,logImmediately:i=>this.logImmediately(i),logPrefix:`${this.logPrefix}${we.blackBright(t)} `,takeOverTerminal:this.takeOverTerminal,onResult:this.onResult,shouldBufferLogs:this.shouldBufferLogs,instrumentPostHogEvent:i=>this.instrumentPostHogEventImpl(i),captureException:this.captureExceptionImpl});return this.subtasks.push(n),n}async runInteractiveTask(t,r){let n=this.addInteractiveTask(t).start();try{await r(n)}catch(i){n.failWithoutThrowing(void 0,i)}finally{n.finish()}return n.getResult()===Bf.Success}printInteractiveTasks({spinner:t}){return this.subtasks.map(r=>r.print({spinner:t})).join(`
|
|
3834
|
+
`).trimEnd()}${xyt}`});Li();function SYn(e,t,r){if(t instanceof Of)return;let n=tBe(t,r?.code);e.instrumentPostHogEvent({command:process.argv.join(" "),properties:{failed:!0,errorCode:n}}),uIt(n)&&e.captureException(t??new Ae({message:r?.message??"",code:n}),n)}var TYn=class{sentry;constructor({release:t}){let r=process.env.FERN_DISABLE_TELEMETRY!=="true",n="https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";if(r&&n!=null&&n.length>0){let i="production";if(i==null||i.length===0)throw new Ae({message:"SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",code:Ae.Code.ConfigError});this.sentry=rIt({dsn:n,release:t,environment:i,defaultIntegrations:!1,integrations:[r5e()],tracesSampleRate:0}),nIt()}}captureException(t,r){if(this.sentry!=null)try{this.sentry.captureException(t,r!=null?{captureContext:{tags:{"error.code":r}}}:void 0)}catch{}}async flush(){this.sentry!=null&&await Promise.resolve(this.sentry.flush(2e3)).catch(()=>{})}};var OYn=class{originalWrite;redirected=!1;redirect(){if(this.redirected)throw new Ae({message:"StdoutRedirector: already redirected \u2014 did you forget to restore()?",code:Ae.Code.InternalError});this.originalWrite=process.stdout.write,process.stdout.write=process.stderr.write.bind(process.stderr),this.redirected=!0}restore(){!this.redirected||this.originalWrite==null||(process.stdout.write=this.originalWrite,this.originalWrite=void 0,this.redirected=!1)}async withRedirect(t){this.redirect();try{return await t()}finally{this.restore()}}};Pt();var D3t=class{result=Bf.Success;logImmediately;logPrefix;subtasks=[];shouldBufferLogs;bufferedLogs=[];status="notStarted";onResult;instrumentPostHogEventImpl;captureExceptionImpl;constructor({logImmediately:t,logPrefix:r,takeOverTerminal:n,onResult:i,shouldBufferLogs:o,instrumentPostHogEvent:s,captureException:a}){this.logImmediately=t,this.logPrefix=r??"",this.takeOverTerminal=n,this.onResult=i,this.shouldBufferLogs=o,this.instrumentPostHogEventImpl=s,this.captureExceptionImpl=a}start(){return this.status="running",this}isStarted(){return this.status!=="notStarted"}finish(){this.status="finished",this.flushLogs(),this.onResult?.(this.getResult())}isFinished(){return this.status==="finished"}takeOverTerminal;failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),this.finish(),new Of}failWithoutThrowing(t,r,n){this.result=Bf.Failure,!(r instanceof Of)&&(xPt({message:t,error:r,logger:this.logger}),SYn(this,r,{...n,message:t}))}captureException(t,r){this.captureExceptionImpl?.(t,r)}getResult(){return this.result}instrumentPostHogEvent(t){this.instrumentPostHogEventImpl(t)}logAtLevel(t,...r){this.logAtLevelWithOverrides(t,r)}logAtLevelWithOverrides(t,r,n={}){this.log({parts:r,level:t,time:new Date,...n})}log(t){this.bufferedLogs.push({...t,prefix:this.logPrefix}),this.shouldBufferLogs||this.flushLogs()}flushLogs(){this.logImmediately(this.bufferedLogs),this.bufferedLogs=[]}logger=P1(this.logAtLevel.bind(this));addInteractiveTask({name:t,subtitle:r}){let n=new sqo({name:t,subtitle:r,logImmediately:i=>this.logImmediately(i),logPrefix:`${this.logPrefix}${we.blackBright(t)} `,takeOverTerminal:this.takeOverTerminal,onResult:this.onResult,shouldBufferLogs:this.shouldBufferLogs,instrumentPostHogEvent:i=>this.instrumentPostHogEventImpl(i),captureException:this.captureExceptionImpl});return this.subtasks.push(n),n}async runInteractiveTask(t,r){let n=this.addInteractiveTask(t).start();try{await r(n)}catch(i){n.failWithoutThrowing(void 0,i)}finally{n.finish()}return n.getResult()===Bf.Success}printInteractiveTasks({spinner:t}){return this.subtasks.map(r=>r.print({spinner:t})).join(`
|
|
3835
3835
|
`)}},sqo=class extends D3t{name;subtitle;constructor({name:t,subtitle:r,...n}){super(n),this.name=t,this.subtitle=r}start(){return super.start(),this.logAtLevelWithOverrides(ri.Info,["Started."],{omitOnTTY:!0}),this.flushLogs(),this}isStarted(){return this.status!=="notStarted"}finish(){this.result===Bf.Success?this.logAtLevelWithOverrides(ri.Info,["Finished."],{omitOnTTY:!0}):this.logAtLevelWithOverrides(ri.Error,["Failed."],{omitOnTTY:!0}),super.finish()}setSubtitle(t){this.subtitle=t}print({spinner:t}){let r=[this.name];return this.subtitle!=null&&r.push(we.dim(this.subtitle)),r.push(...this.subtasks.map(n=>n.print({spinner:t}))),ZU({prefix:`${this.getIcon({spinner:t}).padEnd(t.length)} `,content:r.join(`
|
|
3836
3836
|
`)})}printInteractiveTasks({spinner:t}){return this.print({spinner:t})}getIcon({spinner:t}){switch(this.status){case"notStarted":return we.dim("\u25E6");case"running":return t;case"finished":switch(this.getResult()){case Bf.Success:return we.green("\u2713");case Bf.Failure:return we.red("x")}}}getResult(){if(this.result===Bf.Failure)return Bf.Failure;for(let t of this.subtasks)if(t.getResult()===Bf.Failure)return Bf.Failure;return Bf.Success}};var dRu=ve(V$e(),1);function mRu(e){return e.filter(t=>t.isUpgradeAvailable).length>0}function nQh(e){return(e.cliUpgradeInfo?.isUpgradeAvailable??!1)||mRu(e.generatorUpgradeInfo)}async function hRu({cliEnvironment:e,upgradeInfo:t}){if(!nQh(t)||e.packageVersion==t.cliUpgradeInfo?.latestVersion)return;let r=`${we.underline("Upgrades available")}
|
|
3837
3837
|
|
|
@@ -3840,7 +3840,7 @@ For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides
|
|
|
3840
3840
|
Run ${we.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
3841
3841
|
Run ${we.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),UYe(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function aqo({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!mRu(e))return;let i=t??"",o=e.filter(a=>a.isUpgradeAvailable);r!=null&&(o=o.slice(0,r+1));let s=o.sort((a,c)=>a.generatorName.localeCompare(c.generatorName)||a.currentVersion.localeCompare(c.currentVersion));for(let a of s)i+=`
|
|
3842
3842
|
${await iQh(a.generatorName)} (${a.apiName!=null?"API: "+a.apiName+", ":""}Group: ${a.generatorGroup}) `+we.dim(a.currentVersion)+we.reset(" \u2192 ")+we.green(a.latestVersion);return i+=`
|
|
3843
|
-
`,n?UYe(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function iQh(e){let r=await new dRu.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Ae({message:`Generator ${e} not found`,code:Ae.Code.InternalError});return r.body.displayName}async function oQh({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await gRu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,u,l,p)=>{a.versions[u]==null&&(a.versions[u]={});let d=xFe(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await IB({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[u][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await gRu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,c,u,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][c]==null&&(s.versions[a][c]={});let p=xFe(u.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${u.name}`);return}let d=await IB({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][c][u.name]={previousVersion:u.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function gRu({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await zM({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let c=n!=null?U0(n):void 0;for(let u of a.groups)if(!(i!=null&&u.groupName!==i))for(let l of u.generators)c!=null&&l.name!==c||await r(o.workspaceName,u.groupName,l,s)})}))}function ARu(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let c=t2(a.latestVersion,a.previousVersion);r.debug(`Latest version: ${a.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function BYn({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await oQh({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[c,u]of Object.entries(a.versions))s.push(...ARu(u,c,t.logger));else s.push(...ARu(a.versions,void 0,t.logger))}return s}async function Ffe({cliEnvironment:e,includePreReleases:t=!1}){if(e.packageName!=="fern-api"||e.packageVersion==="0.0.0")return e.packageVersion;try{return await jxt(e.packageName,{version:t?"prerelease":"latest"})}catch(r){throw new Ae({message:`Failed to resolve latest CLI version: ${r instanceof Error?r.message:String(r)}`,code:Ae.Code.NetworkError})}}var yRu=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],PYn=class e{environment;sentryClient;posthogManager;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=ri.Info;isLocal;stdoutRedirector=new OYn;jsonMode=!1;static async create(t,r,{isLocal:n}){let i=await DNt();return new e(t,r,{isLocal:n,posthogManager:i})}constructor(t,r,{isLocal:n,posthogManager:i}){this.ttyAwareLogger=new bke(t,r),this.isLocal=n??!1,this.posthogManager=i;let o=this.getPackageName(),s=this.getPackageVersion(),a=this.getCliName();(o==null||s==null||a==null)&&this.exitProgram(),this.environment={packageName:o,packageVersion:s,cliName:a},this.sentryClient=new TYn({release:`cli@${this.environment.packageVersion}`})}getPackageName(){return"fern-api"}getPackageVersion(){return"4.
|
|
3843
|
+
`,n?UYe(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function iQh(e){let r=await new dRu.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Ae({message:`Generator ${e} not found`,code:Ae.Code.InternalError});return r.body.displayName}async function oQh({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await gRu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,u,l,p)=>{a.versions[u]==null&&(a.versions[u]={});let d=xFe(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await IB({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[u][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await gRu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,c,u,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][c]==null&&(s.versions[a][c]={});let p=xFe(u.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${u.name}`);return}let d=await IB({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][c][u.name]={previousVersion:u.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function gRu({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await zM({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let c=n!=null?U0(n):void 0;for(let u of a.groups)if(!(i!=null&&u.groupName!==i))for(let l of u.generators)c!=null&&l.name!==c||await r(o.workspaceName,u.groupName,l,s)})}))}function ARu(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let c=t2(a.latestVersion,a.previousVersion);r.debug(`Latest version: ${a.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function BYn({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await oQh({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[c,u]of Object.entries(a.versions))s.push(...ARu(u,c,t.logger));else s.push(...ARu(a.versions,void 0,t.logger))}return s}async function Ffe({cliEnvironment:e,includePreReleases:t=!1}){if(e.packageName!=="fern-api"||e.packageVersion==="0.0.0")return e.packageVersion;try{return await jxt(e.packageName,{version:t?"prerelease":"latest"})}catch(r){throw new Ae({message:`Failed to resolve latest CLI version: ${r instanceof Error?r.message:String(r)}`,code:Ae.Code.NetworkError})}}var yRu=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],PYn=class e{environment;sentryClient;posthogManager;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=ri.Info;isLocal;stdoutRedirector=new OYn;jsonMode=!1;static async create(t,r,{isLocal:n}){let i=await DNt();return new e(t,r,{isLocal:n,posthogManager:i})}constructor(t,r,{isLocal:n,posthogManager:i}){this.ttyAwareLogger=new bke(t,r),this.isLocal=n??!1,this.posthogManager=i;let o=this.getPackageName(),s=this.getPackageVersion(),a=this.getCliName();(o==null||s==null||a==null)&&this.exitProgram(),this.environment={packageName:o,packageVersion:s,cliName:a},this.sentryClient=new TYn({release:`cli@${this.environment.packageVersion}`})}getPackageName(){return"fern-api"}getPackageVersion(){return"4.79.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${we.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),new Of}failWithoutThrowing(t,r,n){this.didSucceed=!1,!(r instanceof Of)&&(xPt({message:t,error:r,logger:this.logger}),SYn(this,r,{...n,message:t}))}enableJsonMode(){this.jsonMode||(this.jsonMode=!0,this.stdoutRedirector.redirect())}get isJsonMode(){return this.jsonMode}writeJsonToStdout(t){this.stdoutRedirector.restore(),process.stdout.write(JSON.stringify(t,null,2)+`
|
|
3844
3844
|
`),this.jsonMode&&this.stdoutRedirector.redirect()}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish();try{await this.posthogManager.flush()}catch{}await this.sentryClient.flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await hRu({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
3845
3845
|
`)||(r+=`
|
|
3846
3846
|
`),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=$li(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new D3t(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(o){throw n.failWithoutThrowing(void 0,o),new Of}finally{n.finish()}return i}instrumentPostHogEvent(t){this.isLocal||this.posthogManager.sendEvent(t)}captureException(t,r){this.sentryClient.captureException(t,r)}logger=P1((t,...r)=>this.log(t,...r));stderr=P1((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=bRu(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?bRu(this.longestWorkspaceName):r).length,i=r.padEnd(n),o=yRu[this.numTasks++%yRu.length],s=we.hex(o)(i);return{...this.constructTaskInit(),logPrefix:s}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===Bf.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:t=>{this.instrumentPostHogEvent(t)},shouldBufferLogs:!1,captureException:(t,r)=>{this.sentryClient.captureException(t,r)}}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>B1.indexOf(i.level)>=B1.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===ri.Debug,stderr:r||this.jsonMode})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await Ffe({cliEnvironment:this.environment,includePreReleases:t}),n=t2(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},o=await BYn({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:o}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await oqo({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:we.yellow("?"),style:{answer:i=>we.cyan(i),message:i=>we.bold(i),highlight:i=>we.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`
|