fern-api 0.56.17 → 0.56.19

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.
Files changed (2) hide show
  1. package/cli.cjs +5 -5
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1692,7 +1692,7 @@ ${c.indent}`:""}${uWf(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
1692
1692
  `}),r.replaceAll(/\n$/g,"")}function nNS(e){return e?k_.green(l7.radioOn):l7.radioOff}var rOo=yi(gSe(),1);function $rp(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var rsa=class extends y2{_run(t){this.done=t;let r=ZU(this.rl),i=r.line.pipe((0,rOo.map)(this.filterInput.bind(this))),n=this.handleSubmitEvents(i);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,rOo.takeUntil)(n.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),i="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(i=`
1693
1693
  `+k_.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?k_.cyan($rp(t,this.opt.mask)):k_.italic.dim("[hidden]"):this.opt.mask?$rp(t,this.opt.mask):k_.italic.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 ynp=yi(vTs(),1),vnp=yi(gSe(),1);var dsa=class extends y2{_run(t){this.done=t,this.editorResult=new vnp.Subject;let r=ZU(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let i=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,i?this.render():this.startExternalEditor(),this}render(t){let r="",i=this.getQuestion();i+=this.status==="answered"?k_.dim("Received"):k_.dim("Press <enter> to launch your preferred editor."),t&&(r=k_.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,ynp.editAsync)(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 Snp=yi(Onp(),1);var jnp=yi(require("readline"),1),wnp=yi(Pnp(),1),Yxi=class{constructor(t){this.rl||=jnp.default.createInterface(JNS(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 JNS(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let n=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw n.isTtyError=!0,n}let r=new wnp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var psa=class extends Yxi{constructor(t={}){super(t),this.log=(0,Snp.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return Jua(this.rl,this.bottomBar.split(`
1694
1694
  `).length),this}updateBottomBar(t){return Jua(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+`
1695
- `}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&&Zgo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var Inp=yi(Mnp(),1),znp=yi(SAs(),1),Rnp=yi(Bnp(),1),LA=yi(gSe(),1),Nnp=yi(iua(),1);var POo=yi(gSe(),1),xnp=yi(iua(),1),jOo=function(e,t,r){return typeof e[t]!="function"?(0,POo.of)(e):(0,POo.from)((0,xnp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var _sa={isPlainObject:Inp.default,set:Rnp.default,get:znp.default},zOn=class extends Yxi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=_sa.isPlainObject(r)?{...r}:{},_sa.isPlainObject(t)&&(t=Object.values(t).every(n=>_sa.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,LA.from)(t):t;return this.process=i.pipe((0,LA.concatMap)(this.processQuestion.bind(this)),(0,LA.publish)()),this.process.connect(),this.process.pipe((0,LA.reduce)((n,a)=>(_sa.set(n,a.name,a.answer),n),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,LA.defer)(()=>(0,LA.of)(t).pipe((0,LA.concatMap)(this.setDefaultType.bind(this)),(0,LA.concatMap)(this.filterIfRunnable.bind(this)),(0,LA.concatMap)(()=>jOo(t,"message",this.answers)),(0,LA.concatMap)(()=>jOo(t,"default",this.answers)),(0,LA.concatMap)(()=>jOo(t,"choices",this.answers)),(0,LA.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,LA.defer)(()=>(0,LA.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,LA.defer)(()=>(0,LA.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&_sa.get(this.answers,t.name)!==void 0)return(0,LA.empty)();if(t.when===!1)return(0,LA.empty)();if(typeof t.when!="function")return(0,LA.of)(t);let{answers:r}=this;return(0,LA.defer)(()=>(0,LA.from)((0,Nnp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,LA.filter)(i=>i!=null)))}};function Fnp(e){let t=function(r,i){let n;try{n=new zOn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",Yua),this.registerPrompt("input",Vxi),this.registerPrompt("number",Xua),this.registerPrompt("confirm",Zua),this.registerPrompt("rawlist",kua),this.registerPrompt("expand",esa),this.registerPrompt("checkbox",tsa),this.registerPrompt("password",rsa),this.registerPrompt("editor",dsa)},t.restoreDefaultPrompts(),t}var OTs=Fnp();function dFS(e,t){OTs.registerPrompt(e,t)}function pFS(){OTs.restoreDefaultPrompts()}var _FS={prompt:OTs,ui:{BottomBar:psa,Prompt:zOn},createPromptModule:Fnp,registerPrompt:dFS,restoreDefaultPrompts:pFS,Separator:oie},wOo=_FS;var Yap=yi(Lnp()),U7S="4.2.1",$8t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})($8t||($8t={}));function V7S(e,t){if(!e)throw new Error(t)}function W7S(e){return e?.replace(/\/+$/,"")}async function H7S(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function $7S(){return new Date().getTime()}function Vap(){return new Date().toISOString()}function Xap(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Ssa=String.fromCharCode,Wap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",FOo={};function G7S(e,t){if(!FOo[e]){FOo[e]={};for(let r=0;r<e.length;r++)FOo[e][e.charAt(r)]=r}return FOo[e][t]}var Dsa={compressToBase64:function(e){if(e==null)return"";let t=Dsa._compress(e,6,function(r){return Wap.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:Dsa._decompress(e.length,32,function(t){return G7S(Wap,e.charAt(t))})},compress:function(e){return Dsa._compress(e,16,function(t){return Ssa(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(d=e.charAt(w),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:Dsa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,w;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=Ssa(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=Ssa(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(w=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=Ssa(b),w=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=Ssa(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[w])s=i[w];else if(w===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},nCs=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(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var LOo="0123456789abcdef",UOo=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}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}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=LOo.charAt(this.bytes[r]>>>4),t+=LOo.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=LOo.charAt(this.bytes[r]>>>4),t+=LOo.charAt(this.bytes[r]&15);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 i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},aCs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??Q7S()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}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)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return UOo.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}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,UOo.ofInner(t)}},Q7S=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),Hap,$ap=()=>J7S().toString(),J7S=()=>(Hap||(Hap=new aCs)).generate(),VOo=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},Esa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function Gap(e){return typeof e=="object"&&(e instanceof VOo||e instanceof Esa)}var oCs=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new nCs,this._isInitialized=!1,V7S(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=W7S(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.captureMode=r?.captureMode||"json",this.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:Gap},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty($8t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty($8t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty($8t.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=$ap();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:Vap(),uuid:i?.uuid?i.uuid:$ap()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty($8t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty($8t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Xap(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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($8t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty($8t.Queue)||[];this.setPersistedProperty($8t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:Vap()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${$7S()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(Dsa.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof Esa||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await H7S(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new Esa(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new VOo(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty($8t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!Gap(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},uCs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},sCs=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!sCs){let e=Uap();sCs=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var Zap=sCs,K7S=1152921504606847e3,Y7S=["is_not"],WOo=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},v2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},cCs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||Zap,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof v2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async d=>{try{let s=this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof v2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new v2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new v2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof v2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new v2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=eop(l,n,this.cohorts,this.debugMode):s=kap(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&Qap(t.key,r)>a/100)}getMatchingVariant(t,r){let i=Qap(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new WOo("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof WOo&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=Xap(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Qap(e,t,r=""){let i=(0,Yap.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/K7S}function kap(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new v2("Operator is_not_set is not supported")}else throw new v2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!Y7S.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return Jap(String(n))&&String(u).match(String(n))!==null;case"not_regex":return Jap(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=X7S(String(n));if(s==null&&(s=Kap(n)),s==null)throw new v2(`Invalid date: ${n}`);let o=Kap(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new v2(`Unknown operator: ${a}`)}}function eop(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new v2("can't match cohort without a given cohort property value");let a=r[n];return top(a,t,r,i)}function top(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=top(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof v2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new v2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=eop(l,t,r,i):d=kap(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof v2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new v2("can't match cohort without a given cohort property value");return n==="AND"}}function Jap(e){try{return new RegExp(e),!0}catch{return!1}}function Kap(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 v2(`${e} is in an invalid date format`)}else throw new v2(`The date provided ${e} must be a string, number, or date object`)}function X7S(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var Z7S=30*1e3,k7S=50*1e3,WOn=class extends oCs{constructor(t,r={}){super(t,r),this._memoryStorage=new uCs,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new cCs({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:Z7S,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||k7S}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):Zap(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return U7S}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,w]of Object.entries(b))g[`$feature/${m}`]=w;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},lCs=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};lCs.POSTHOG_ID_TAG="posthog_distinct_id";var HOo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new WOn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.56.17",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Msa=class{async sendEvent(){}async identify(){}async flush(){}};var HOn=require("fs/promises"),aop=require("os"),oop=require("path");var rop=yi(require("crypto")),GOo=new Uint8Array(256),$Oo=GOo.length;function fCs(){return $Oo>GOo.length-16&&(rop.default.randomFillSync(GOo),$Oo=0),GOo.slice($Oo,$Oo+=16)}var tV=[];for(let e=0;e<256;++e)tV.push((e+256).toString(16).slice(1));function iop(e,t=0){return tV[e[t+0]]+tV[e[t+1]]+tV[e[t+2]]+tV[e[t+3]]+"-"+tV[e[t+4]]+tV[e[t+5]]+"-"+tV[e[t+6]]+tV[e[t+7]]+"-"+tV[e[t+8]]+tV[e[t+9]]+"-"+tV[e[t+10]]+tV[e[t+11]]+tV[e[t+12]]+tV[e[t+13]]+tV[e[t+14]]+tV[e[t+15]]}var nop=yi(require("crypto")),dCs={randomUUID:nop.default.randomUUID};function e6S(e,t,r){if(dCs.randomUUID&&!t&&!e)return dCs.randomUUID();e=e||{};let i=e.random||(e.rng||fCs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return iop(i)}var fie=e6S;var t6S="id",r6S=".fern",Asa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new WOn(r),this.userId=t==null?void 0:M1s(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.56.17",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Xu(Wl.of((0,aop.homedir)()),Xa.of(r6S),Xa.of(t6S));await Cf(t)||(await(0,HOn.mkdir)((0,oop.dirname)(t),{recursive:!0}),await(0,HOn.writeFile)(t,fie())),this.persistedDistinctId=(await(0,HOn.readFile)(t)).toString()}return this.persistedDistinctId}};var pCs;async function $On(){return pCs==null&&(pCs=await i6S()),pCs}async function i6S(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Msa;let r=await Z_o();return r!=null?new Asa({token:r,posthogApiKey:e}):await X_o()!=null?new HOo({posthogApiKey:e}):new Asa({token:void 0,posthogApiKey:e})}catch{return new Msa}}function qsa(e,t){return function(){return e.apply(t,arguments)}}var{toString:n6S}=Object.prototype,{getPrototypeOf:hCs}=Object,JOo=(e=>t=>{let r=n6S.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),G8t=e=>(e=e.toLowerCase(),t=>JOo(t)===e),KOo=e=>t=>typeof t===e,{isArray:GOn}=Array,Tsa=KOo("undefined");function a6S(e){return e!==null&&!Tsa(e)&&e.constructor!==null&&!Tsa(e.constructor)&&mSe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var sop=G8t("ArrayBuffer");function o6S(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&sop(e.buffer),t}var u6S=KOo("string"),mSe=KOo("function"),cop=KOo("number"),YOo=e=>e!==null&&typeof e=="object",s6S=e=>e===!0||e===!1,QOo=e=>{if(JOo(e)!=="object")return!1;let t=hCs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},c6S=G8t("Date"),l6S=G8t("File"),f6S=G8t("Blob"),d6S=G8t("FileList"),p6S=e=>YOo(e)&&mSe(e.pipe),_6S=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||mSe(e.append)&&((t=JOo(e))==="formdata"||t==="object"&&mSe(e.toString)&&e.toString()==="[object FormData]"))},h6S=G8t("URLSearchParams"),[y6S,v6S,b6S,g6S]=["ReadableStream","Request","Response","Headers"].map(G8t),O6S=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Csa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),GOn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function lop(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var tIi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fop=e=>!Tsa(e)&&e!==tIi;function _Cs(){let{caseless:e}=fop(this)&&this||{},t={},r=(i,n)=>{let a=e&&lop(t,n)||n;QOo(t[a])&&QOo(i)?t[a]=_Cs(t[a],i):QOo(i)?t[a]=_Cs({},i):GOn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&Csa(arguments[i],r);return t}var m6S=(e,t,r,{allOwnKeys:i}={})=>(Csa(t,(n,a)=>{r&&mSe(n)?e[a]=qsa(n,r):e[a]=n},{allOwnKeys:i}),e),P6S=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),j6S=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},w6S=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&hCs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},S6S=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},D6S=e=>{if(!e)return null;if(GOn(e))return e;let t=e.length;if(!cop(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},E6S=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&hCs(Uint8Array)),M6S=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},A6S=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},q6S=G8t("HTMLFormElement"),T6S=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),uop=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),C6S=G8t("RegExp"),dop=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};Csa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},B6S=e=>{dop(e,(t,r)=>{if(mSe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(mSe(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},x6S=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return GOn(e)?i(e):i(String(e).split(t)),r},I6S=()=>{},z6S=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function R6S(e){return!!(e&&mSe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var N6S=e=>{let t=new Array(10),r=(i,n)=>{if(YOo(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=GOn(i)?[]:{};return Csa(i,(u,l)=>{let d=r(u,n+1);!Tsa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},F6S=G8t("AsyncFunction"),L6S=e=>e&&(YOo(e)||mSe(e))&&mSe(e.then)&&mSe(e.catch),pop=((e,t)=>e?setImmediate:t?((r,i)=>(tIi.addEventListener("message",({source:n,data:a})=>{n===tIi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),tIi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",mSe(tIi.postMessage)),U6S=typeof queueMicrotask<"u"?queueMicrotask.bind(tIi):typeof process<"u"&&process.nextTick||pop,ds={isArray:GOn,isArrayBuffer:sop,isBuffer:a6S,isFormData:_6S,isArrayBufferView:o6S,isString:u6S,isNumber:cop,isBoolean:s6S,isObject:YOo,isPlainObject:QOo,isReadableStream:y6S,isRequest:v6S,isResponse:b6S,isHeaders:g6S,isUndefined:Tsa,isDate:c6S,isFile:l6S,isBlob:f6S,isRegExp:C6S,isFunction:mSe,isStream:p6S,isURLSearchParams:h6S,isTypedArray:E6S,isFileList:d6S,forEach:Csa,merge:_Cs,extend:m6S,trim:O6S,stripBOM:P6S,inherits:j6S,toFlatObject:w6S,kindOf:JOo,kindOfTest:G8t,endsWith:S6S,toArray:D6S,forEachEntry:M6S,matchAll:A6S,isHTMLForm:q6S,hasOwnProperty:uop,hasOwnProp:uop,reduceDescriptors:dop,freezeMethods:B6S,toObjectSet:x6S,toCamelCase:T6S,noop:I6S,toFiniteNumber:z6S,findKey:lop,global:tIi,isContextDefined:fop,isSpecCompliantForm:R6S,toJSONObject:N6S,isAsyncFn:F6S,isThenable:L6S,setImmediate:pop,asap:U6S};function QOn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}ds.inherits(QOn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ds.toJSONObject(this.config),code:this.code,status:this.status}}});var _op=QOn.prototype,hop={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{hop[e]={value:e}});Object.defineProperties(QOn,hop);Object.defineProperty(_op,"isAxiosError",{value:!0});QOn.from=(e,t,r,i,n,a)=>{let u=Object.create(_op);return ds.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),QOn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var wp=QOn;var yop=yi(ora(),1),XOo=yop.default;function yCs(e){return ds.isPlainObject(e)||ds.isArray(e)}function bop(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function vop(e,t,r){return e?e.concat(t).map(function(n,a){return n=bop(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function V6S(e){return ds.isArray(e)&&!e.some(yCs)}var W6S=ds.toFlatObject(ds,{},null,function(t){return/^is[A-Z]/.test(t)});function H6S(e,t,r){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new(XOo||FormData),r=ds.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!ds.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ds.isSpecCompliantForm(t);if(!ds.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ds.isDate(O))return O.toISOString();if(!d&&ds.isBlob(O))throw new wp("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(O)||ds.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(ds.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ds.isArray(O)&&V6S(O)||(ds.isFileList(O)||ds.endsWith(m,"[]"))&&(E=ds.toArray(O)))return m=bop(m),E.forEach(function(q,D){!(ds.isUndefined(q)||q===null)&&t.append(u===!0?vop([m],D,a):u===null?m:m+"[]",s(q))}),!1}return yCs(O)?!0:(t.append(vop(w,m,a),s(O)),!1)}let c=[],b=Object.assign(W6S,{defaultVisitor:o,convertValue:s,isVisitable:yCs});function g(O,m){if(!ds.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),ds.forEach(O,function(E,A){(!(ds.isUndefined(E)||E===null)&&n.call(t,E,ds.isString(A)?A.trim():A,m,b))===!0&&g(E,m?m.concat(A):[A])}),c.pop()}}if(!ds.isObject(e))throw new TypeError("data must be an object");return g(e),t}var xli=H6S;function gop(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Oop(e,t){this._pairs=[],e&&xli(e,this,t)}var mop=Oop.prototype;mop.append=function(t,r){this._pairs.push([t,r])};mop.toString=function(t){let r=t?function(i){return t.call(this,i,gop)}:gop;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var Pop=Oop;function $6S(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function rIi(e,t,r){if(!t)return e;let i=r&&r.encode||$6S;ds.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ds.isURLSearchParams(t)?t.toString():new Pop(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var vCs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ds.forEach(this.handlers,function(i){i!==null&&t(i)})}},bCs=vCs;var JOn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Dop=yi(require("crypto"),1);var jop=yi(require("url"),1),wop=jop.default.URLSearchParams;var gCs="abcdefghijklmnopqrstuvwxyz",Sop="0123456789",Eop={DIGIT:Sop,ALPHA:gCs,ALPHA_DIGIT:gCs+gCs.toUpperCase()+Sop},G6S=(e=16,t=Eop.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);Dop.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},Mop={isNode:!0,classes:{URLSearchParams:wop,FormData:XOo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Eop,generateString:G6S,protocols:["http","https","file","data"]};var PCs={};Co(PCs,{hasBrowserEnv:()=>mCs,hasStandardBrowserEnv:()=>Q6S,hasStandardBrowserWebWorkerEnv:()=>J6S,navigator:()=>OCs,origin:()=>K6S});var mCs=typeof window<"u"&&typeof document<"u",OCs=typeof navigator=="object"&&navigator||void 0,Q6S=mCs&&(!OCs||["ReactNative","NativeScript","NS"].indexOf(OCs.product)<0),J6S=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",K6S=mCs&&window.location.href||"http://localhost";var PM={...PCs,...Mop};function jCs(e,t){return xli(e,new PM.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return PM.isNode&&ds.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function Y6S(e){return ds.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function X6S(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function Z6S(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&ds.isArray(n)?n.length:u,d?(ds.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!ds.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ds.isArray(n[u])&&(n[u]=X6S(n[u])),!l)}if(ds.isFormData(e)&&ds.isFunction(e.entries)){let r={};return ds.forEachEntry(e,(i,n)=>{t(Y6S(i),n,r,0)}),r}return null}var ZOo=Z6S;function k6S(e,t,r){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var wCs={transitional:JOn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ds.isObject(t);if(a&&ds.isHTMLForm(t)&&(t=new FormData(t)),ds.isFormData(t))return n?JSON.stringify(ZOo(t)):t;if(ds.isArrayBuffer(t)||ds.isBuffer(t)||ds.isStream(t)||ds.isFile(t)||ds.isBlob(t)||ds.isReadableStream(t))return t;if(ds.isArrayBufferView(t))return t.buffer;if(ds.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return jCs(t,this.formSerializer).toString();if((l=ds.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return xli(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),k6S(t)):t}],transformResponse:[function(t){let r=this.transitional||wCs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ds.isResponse(t)||ds.isReadableStream(t))return t;if(t&&ds.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?wp.from(l,wp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:PM.classes.FormData,Blob:PM.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch"],e=>{wCs.headers[e]={}});var KOn=wCs;var e2S=ds.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Aop=e=>{let t={},r,i,n;return e&&e.split(`
1695
+ `}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&&Zgo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var Inp=yi(Mnp(),1),znp=yi(SAs(),1),Rnp=yi(Bnp(),1),LA=yi(gSe(),1),Nnp=yi(iua(),1);var POo=yi(gSe(),1),xnp=yi(iua(),1),jOo=function(e,t,r){return typeof e[t]!="function"?(0,POo.of)(e):(0,POo.from)((0,xnp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var _sa={isPlainObject:Inp.default,set:Rnp.default,get:znp.default},zOn=class extends Yxi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=_sa.isPlainObject(r)?{...r}:{},_sa.isPlainObject(t)&&(t=Object.values(t).every(n=>_sa.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,LA.from)(t):t;return this.process=i.pipe((0,LA.concatMap)(this.processQuestion.bind(this)),(0,LA.publish)()),this.process.connect(),this.process.pipe((0,LA.reduce)((n,a)=>(_sa.set(n,a.name,a.answer),n),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,LA.defer)(()=>(0,LA.of)(t).pipe((0,LA.concatMap)(this.setDefaultType.bind(this)),(0,LA.concatMap)(this.filterIfRunnable.bind(this)),(0,LA.concatMap)(()=>jOo(t,"message",this.answers)),(0,LA.concatMap)(()=>jOo(t,"default",this.answers)),(0,LA.concatMap)(()=>jOo(t,"choices",this.answers)),(0,LA.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,LA.defer)(()=>(0,LA.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,LA.defer)(()=>(0,LA.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&_sa.get(this.answers,t.name)!==void 0)return(0,LA.empty)();if(t.when===!1)return(0,LA.empty)();if(typeof t.when!="function")return(0,LA.of)(t);let{answers:r}=this;return(0,LA.defer)(()=>(0,LA.from)((0,Nnp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,LA.filter)(i=>i!=null)))}};function Fnp(e){let t=function(r,i){let n;try{n=new zOn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",Yua),this.registerPrompt("input",Vxi),this.registerPrompt("number",Xua),this.registerPrompt("confirm",Zua),this.registerPrompt("rawlist",kua),this.registerPrompt("expand",esa),this.registerPrompt("checkbox",tsa),this.registerPrompt("password",rsa),this.registerPrompt("editor",dsa)},t.restoreDefaultPrompts(),t}var OTs=Fnp();function dFS(e,t){OTs.registerPrompt(e,t)}function pFS(){OTs.restoreDefaultPrompts()}var _FS={prompt:OTs,ui:{BottomBar:psa,Prompt:zOn},createPromptModule:Fnp,registerPrompt:dFS,restoreDefaultPrompts:pFS,Separator:oie},wOo=_FS;var Yap=yi(Lnp()),U7S="4.2.1",$8t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})($8t||($8t={}));function V7S(e,t){if(!e)throw new Error(t)}function W7S(e){return e?.replace(/\/+$/,"")}async function H7S(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function $7S(){return new Date().getTime()}function Vap(){return new Date().toISOString()}function Xap(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Ssa=String.fromCharCode,Wap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",FOo={};function G7S(e,t){if(!FOo[e]){FOo[e]={};for(let r=0;r<e.length;r++)FOo[e][e.charAt(r)]=r}return FOo[e][t]}var Dsa={compressToBase64:function(e){if(e==null)return"";let t=Dsa._compress(e,6,function(r){return Wap.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:Dsa._decompress(e.length,32,function(t){return G7S(Wap,e.charAt(t))})},compress:function(e){return Dsa._compress(e,16,function(t){return Ssa(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(d=e.charAt(w),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:Dsa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,w;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=Ssa(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=Ssa(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(w=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=Ssa(b),w=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=Ssa(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[w])s=i[w];else if(w===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},nCs=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(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var LOo="0123456789abcdef",UOo=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}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}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=LOo.charAt(this.bytes[r]>>>4),t+=LOo.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=LOo.charAt(this.bytes[r]>>>4),t+=LOo.charAt(this.bytes[r]&15);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 i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},aCs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??Q7S()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}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)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return UOo.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}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,UOo.ofInner(t)}},Q7S=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),Hap,$ap=()=>J7S().toString(),J7S=()=>(Hap||(Hap=new aCs)).generate(),VOo=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},Esa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function Gap(e){return typeof e=="object"&&(e instanceof VOo||e instanceof Esa)}var oCs=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new nCs,this._isInitialized=!1,V7S(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=W7S(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.captureMode=r?.captureMode||"json",this.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:Gap},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty($8t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty($8t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty($8t.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=$ap();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:Vap(),uuid:i?.uuid?i.uuid:$ap()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty($8t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty($8t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Xap(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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($8t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty($8t.Queue)||[];this.setPersistedProperty($8t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:Vap()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${$7S()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(Dsa.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof Esa||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await H7S(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new Esa(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new VOo(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty($8t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!Gap(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},uCs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},sCs=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!sCs){let e=Uap();sCs=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var Zap=sCs,K7S=1152921504606847e3,Y7S=["is_not"],WOo=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},v2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},cCs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||Zap,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof v2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async d=>{try{let s=this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof v2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new v2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new v2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof v2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new v2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=eop(l,n,this.cohorts,this.debugMode):s=kap(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&Qap(t.key,r)>a/100)}getMatchingVariant(t,r){let i=Qap(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new WOo("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof WOo&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=Xap(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Qap(e,t,r=""){let i=(0,Yap.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/K7S}function kap(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new v2("Operator is_not_set is not supported")}else throw new v2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!Y7S.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return Jap(String(n))&&String(u).match(String(n))!==null;case"not_regex":return Jap(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=X7S(String(n));if(s==null&&(s=Kap(n)),s==null)throw new v2(`Invalid date: ${n}`);let o=Kap(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new v2(`Unknown operator: ${a}`)}}function eop(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new v2("can't match cohort without a given cohort property value");let a=r[n];return top(a,t,r,i)}function top(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=top(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof v2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new v2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=eop(l,t,r,i):d=kap(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof v2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new v2("can't match cohort without a given cohort property value");return n==="AND"}}function Jap(e){try{return new RegExp(e),!0}catch{return!1}}function Kap(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 v2(`${e} is in an invalid date format`)}else throw new v2(`The date provided ${e} must be a string, number, or date object`)}function X7S(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var Z7S=30*1e3,k7S=50*1e3,WOn=class extends oCs{constructor(t,r={}){super(t,r),this._memoryStorage=new uCs,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new cCs({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:Z7S,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||k7S}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):Zap(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return U7S}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,w]of Object.entries(b))g[`$feature/${m}`]=w;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},lCs=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};lCs.POSTHOG_ID_TAG="posthog_distinct_id";var HOo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new WOn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.56.19",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Msa=class{async sendEvent(){}async identify(){}async flush(){}};var HOn=require("fs/promises"),aop=require("os"),oop=require("path");var rop=yi(require("crypto")),GOo=new Uint8Array(256),$Oo=GOo.length;function fCs(){return $Oo>GOo.length-16&&(rop.default.randomFillSync(GOo),$Oo=0),GOo.slice($Oo,$Oo+=16)}var tV=[];for(let e=0;e<256;++e)tV.push((e+256).toString(16).slice(1));function iop(e,t=0){return tV[e[t+0]]+tV[e[t+1]]+tV[e[t+2]]+tV[e[t+3]]+"-"+tV[e[t+4]]+tV[e[t+5]]+"-"+tV[e[t+6]]+tV[e[t+7]]+"-"+tV[e[t+8]]+tV[e[t+9]]+"-"+tV[e[t+10]]+tV[e[t+11]]+tV[e[t+12]]+tV[e[t+13]]+tV[e[t+14]]+tV[e[t+15]]}var nop=yi(require("crypto")),dCs={randomUUID:nop.default.randomUUID};function e6S(e,t,r){if(dCs.randomUUID&&!t&&!e)return dCs.randomUUID();e=e||{};let i=e.random||(e.rng||fCs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return iop(i)}var fie=e6S;var t6S="id",r6S=".fern",Asa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new WOn(r),this.userId=t==null?void 0:M1s(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.56.19",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Xu(Wl.of((0,aop.homedir)()),Xa.of(r6S),Xa.of(t6S));await Cf(t)||(await(0,HOn.mkdir)((0,oop.dirname)(t),{recursive:!0}),await(0,HOn.writeFile)(t,fie())),this.persistedDistinctId=(await(0,HOn.readFile)(t)).toString()}return this.persistedDistinctId}};var pCs;async function $On(){return pCs==null&&(pCs=await i6S()),pCs}async function i6S(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Msa;let r=await Z_o();return r!=null?new Asa({token:r,posthogApiKey:e}):await X_o()!=null?new HOo({posthogApiKey:e}):new Asa({token:void 0,posthogApiKey:e})}catch{return new Msa}}function qsa(e,t){return function(){return e.apply(t,arguments)}}var{toString:n6S}=Object.prototype,{getPrototypeOf:hCs}=Object,JOo=(e=>t=>{let r=n6S.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),G8t=e=>(e=e.toLowerCase(),t=>JOo(t)===e),KOo=e=>t=>typeof t===e,{isArray:GOn}=Array,Tsa=KOo("undefined");function a6S(e){return e!==null&&!Tsa(e)&&e.constructor!==null&&!Tsa(e.constructor)&&mSe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var sop=G8t("ArrayBuffer");function o6S(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&sop(e.buffer),t}var u6S=KOo("string"),mSe=KOo("function"),cop=KOo("number"),YOo=e=>e!==null&&typeof e=="object",s6S=e=>e===!0||e===!1,QOo=e=>{if(JOo(e)!=="object")return!1;let t=hCs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},c6S=G8t("Date"),l6S=G8t("File"),f6S=G8t("Blob"),d6S=G8t("FileList"),p6S=e=>YOo(e)&&mSe(e.pipe),_6S=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||mSe(e.append)&&((t=JOo(e))==="formdata"||t==="object"&&mSe(e.toString)&&e.toString()==="[object FormData]"))},h6S=G8t("URLSearchParams"),[y6S,v6S,b6S,g6S]=["ReadableStream","Request","Response","Headers"].map(G8t),O6S=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Csa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),GOn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function lop(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var tIi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fop=e=>!Tsa(e)&&e!==tIi;function _Cs(){let{caseless:e}=fop(this)&&this||{},t={},r=(i,n)=>{let a=e&&lop(t,n)||n;QOo(t[a])&&QOo(i)?t[a]=_Cs(t[a],i):QOo(i)?t[a]=_Cs({},i):GOn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&Csa(arguments[i],r);return t}var m6S=(e,t,r,{allOwnKeys:i}={})=>(Csa(t,(n,a)=>{r&&mSe(n)?e[a]=qsa(n,r):e[a]=n},{allOwnKeys:i}),e),P6S=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),j6S=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},w6S=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&hCs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},S6S=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},D6S=e=>{if(!e)return null;if(GOn(e))return e;let t=e.length;if(!cop(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},E6S=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&hCs(Uint8Array)),M6S=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},A6S=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},q6S=G8t("HTMLFormElement"),T6S=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),uop=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),C6S=G8t("RegExp"),dop=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};Csa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},B6S=e=>{dop(e,(t,r)=>{if(mSe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(mSe(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},x6S=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return GOn(e)?i(e):i(String(e).split(t)),r},I6S=()=>{},z6S=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function R6S(e){return!!(e&&mSe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var N6S=e=>{let t=new Array(10),r=(i,n)=>{if(YOo(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=GOn(i)?[]:{};return Csa(i,(u,l)=>{let d=r(u,n+1);!Tsa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},F6S=G8t("AsyncFunction"),L6S=e=>e&&(YOo(e)||mSe(e))&&mSe(e.then)&&mSe(e.catch),pop=((e,t)=>e?setImmediate:t?((r,i)=>(tIi.addEventListener("message",({source:n,data:a})=>{n===tIi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),tIi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",mSe(tIi.postMessage)),U6S=typeof queueMicrotask<"u"?queueMicrotask.bind(tIi):typeof process<"u"&&process.nextTick||pop,ds={isArray:GOn,isArrayBuffer:sop,isBuffer:a6S,isFormData:_6S,isArrayBufferView:o6S,isString:u6S,isNumber:cop,isBoolean:s6S,isObject:YOo,isPlainObject:QOo,isReadableStream:y6S,isRequest:v6S,isResponse:b6S,isHeaders:g6S,isUndefined:Tsa,isDate:c6S,isFile:l6S,isBlob:f6S,isRegExp:C6S,isFunction:mSe,isStream:p6S,isURLSearchParams:h6S,isTypedArray:E6S,isFileList:d6S,forEach:Csa,merge:_Cs,extend:m6S,trim:O6S,stripBOM:P6S,inherits:j6S,toFlatObject:w6S,kindOf:JOo,kindOfTest:G8t,endsWith:S6S,toArray:D6S,forEachEntry:M6S,matchAll:A6S,isHTMLForm:q6S,hasOwnProperty:uop,hasOwnProp:uop,reduceDescriptors:dop,freezeMethods:B6S,toObjectSet:x6S,toCamelCase:T6S,noop:I6S,toFiniteNumber:z6S,findKey:lop,global:tIi,isContextDefined:fop,isSpecCompliantForm:R6S,toJSONObject:N6S,isAsyncFn:F6S,isThenable:L6S,setImmediate:pop,asap:U6S};function QOn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}ds.inherits(QOn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ds.toJSONObject(this.config),code:this.code,status:this.status}}});var _op=QOn.prototype,hop={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{hop[e]={value:e}});Object.defineProperties(QOn,hop);Object.defineProperty(_op,"isAxiosError",{value:!0});QOn.from=(e,t,r,i,n,a)=>{let u=Object.create(_op);return ds.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),QOn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var wp=QOn;var yop=yi(ora(),1),XOo=yop.default;function yCs(e){return ds.isPlainObject(e)||ds.isArray(e)}function bop(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function vop(e,t,r){return e?e.concat(t).map(function(n,a){return n=bop(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function V6S(e){return ds.isArray(e)&&!e.some(yCs)}var W6S=ds.toFlatObject(ds,{},null,function(t){return/^is[A-Z]/.test(t)});function H6S(e,t,r){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new(XOo||FormData),r=ds.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!ds.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ds.isSpecCompliantForm(t);if(!ds.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ds.isDate(O))return O.toISOString();if(!d&&ds.isBlob(O))throw new wp("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(O)||ds.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(ds.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ds.isArray(O)&&V6S(O)||(ds.isFileList(O)||ds.endsWith(m,"[]"))&&(E=ds.toArray(O)))return m=bop(m),E.forEach(function(q,D){!(ds.isUndefined(q)||q===null)&&t.append(u===!0?vop([m],D,a):u===null?m:m+"[]",s(q))}),!1}return yCs(O)?!0:(t.append(vop(w,m,a),s(O)),!1)}let c=[],b=Object.assign(W6S,{defaultVisitor:o,convertValue:s,isVisitable:yCs});function g(O,m){if(!ds.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),ds.forEach(O,function(E,A){(!(ds.isUndefined(E)||E===null)&&n.call(t,E,ds.isString(A)?A.trim():A,m,b))===!0&&g(E,m?m.concat(A):[A])}),c.pop()}}if(!ds.isObject(e))throw new TypeError("data must be an object");return g(e),t}var xli=H6S;function gop(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Oop(e,t){this._pairs=[],e&&xli(e,this,t)}var mop=Oop.prototype;mop.append=function(t,r){this._pairs.push([t,r])};mop.toString=function(t){let r=t?function(i){return t.call(this,i,gop)}:gop;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var Pop=Oop;function $6S(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function rIi(e,t,r){if(!t)return e;let i=r&&r.encode||$6S;ds.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ds.isURLSearchParams(t)?t.toString():new Pop(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var vCs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ds.forEach(this.handlers,function(i){i!==null&&t(i)})}},bCs=vCs;var JOn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Dop=yi(require("crypto"),1);var jop=yi(require("url"),1),wop=jop.default.URLSearchParams;var gCs="abcdefghijklmnopqrstuvwxyz",Sop="0123456789",Eop={DIGIT:Sop,ALPHA:gCs,ALPHA_DIGIT:gCs+gCs.toUpperCase()+Sop},G6S=(e=16,t=Eop.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);Dop.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},Mop={isNode:!0,classes:{URLSearchParams:wop,FormData:XOo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Eop,generateString:G6S,protocols:["http","https","file","data"]};var PCs={};Co(PCs,{hasBrowserEnv:()=>mCs,hasStandardBrowserEnv:()=>Q6S,hasStandardBrowserWebWorkerEnv:()=>J6S,navigator:()=>OCs,origin:()=>K6S});var mCs=typeof window<"u"&&typeof document<"u",OCs=typeof navigator=="object"&&navigator||void 0,Q6S=mCs&&(!OCs||["ReactNative","NativeScript","NS"].indexOf(OCs.product)<0),J6S=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",K6S=mCs&&window.location.href||"http://localhost";var PM={...PCs,...Mop};function jCs(e,t){return xli(e,new PM.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return PM.isNode&&ds.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function Y6S(e){return ds.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function X6S(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function Z6S(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&ds.isArray(n)?n.length:u,d?(ds.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!ds.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ds.isArray(n[u])&&(n[u]=X6S(n[u])),!l)}if(ds.isFormData(e)&&ds.isFunction(e.entries)){let r={};return ds.forEachEntry(e,(i,n)=>{t(Y6S(i),n,r,0)}),r}return null}var ZOo=Z6S;function k6S(e,t,r){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var wCs={transitional:JOn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ds.isObject(t);if(a&&ds.isHTMLForm(t)&&(t=new FormData(t)),ds.isFormData(t))return n?JSON.stringify(ZOo(t)):t;if(ds.isArrayBuffer(t)||ds.isBuffer(t)||ds.isStream(t)||ds.isFile(t)||ds.isBlob(t)||ds.isReadableStream(t))return t;if(ds.isArrayBufferView(t))return t.buffer;if(ds.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return jCs(t,this.formSerializer).toString();if((l=ds.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return xli(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),k6S(t)):t}],transformResponse:[function(t){let r=this.transitional||wCs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ds.isResponse(t)||ds.isReadableStream(t))return t;if(t&&ds.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?wp.from(l,wp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:PM.classes.FormData,Blob:PM.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch"],e=>{wCs.headers[e]={}});var KOn=wCs;var e2S=ds.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Aop=e=>{let t={},r,i,n;return e&&e.split(`
1696
1696
  `).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&e2S[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var qop=Symbol("internals");function Bsa(e){return e&&String(e).trim().toLowerCase()}function kOo(e){return e===!1||e==null?e:ds.isArray(e)?e.map(kOo):String(e)}function t2S(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var r2S=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function SCs(e,t,r,i,n){if(ds.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!ds.isString(t)){if(ds.isString(i))return t.indexOf(i)!==-1;if(ds.isRegExp(i))return i.test(t)}}function i2S(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function n2S(e,t){let r=ds.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,u){return this[i].call(this,t,n,a,u)},configurable:!0})})}var YOn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,d,s){let o=Bsa(d);if(!o)throw new Error("header name must be a non-empty string");let c=ds.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||d]=kOo(l))}let u=(l,d)=>ds.forEach(l,(s,o)=>a(s,o,d));if(ds.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(ds.isString(t)&&(t=t.trim())&&!r2S(t))u(Aop(t),r);else if(ds.isHeaders(t))for(let[l,d]of t.entries())a(d,l,i);else t!=null&&a(r,t,i);return this}get(t,r){if(t=Bsa(t),t){let i=ds.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return t2S(n);if(ds.isFunction(r))return r.call(this,n,i);if(ds.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Bsa(t),t){let i=ds.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||SCs(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=Bsa(u),u){let l=ds.findKey(i,u);l&&(!r||SCs(i,i[l],l,r))&&(delete i[l],n=!0)}}return ds.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||SCs(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return ds.forEach(this,(n,a)=>{let u=ds.findKey(i,a);if(u){r[u]=kOo(n),delete r[a];return}let l=t?i2S(a):String(a).trim();l!==a&&delete r[a],r[l]=kOo(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return ds.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&ds.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
1697
1697
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[qop]=this[qop]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=Bsa(u);i[l]||(n2S(n,u),i[l]=!0)}return ds.isArray(t)?t.forEach(a):a(t),this}};YOn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ds.reduceDescriptors(YOn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});ds.freezeMethods(YOn);var ez=YOn;function xsa(e,t){let r=this||KOn,i=t||r,n=ez.from(i.headers),a=i.data;return ds.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function Isa(e){return!!(e&&e.__CANCEL__)}function Top(e,t,r){wp.call(this,e??"canceled",wp.ERR_CANCELED,t,r),this.name="CanceledError"}ds.inherits(Top,wp,{__CANCEL__:!0});var PSe=Top;function pYt(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new wp("Request failed with status code "+r.status,[wp.ERR_BAD_REQUEST,wp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function DCs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ECs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function iIi(e,t,r){let i=!DCs(t);return e&&i||r==!1?ECs(e,t):t}var Qop=yi(ysa(),1),Jop=yi(require("http"),1),Kop=yi(require("https"),1),Yop=yi(require("util"),1),Xop=yi(xTs(),1),oJr=yi(require("zlib"),1);var nIi="1.8.2";function zsa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var a2S=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function MCs(e,t,r){let i=r&&r.Blob||PM.classes.Blob,n=zsa(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=a2S.exec(e);if(!a)throw new wp("Invalid URL",wp.ERR_INVALID_URL);let u=a[1],l=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),l?"base64":"utf8");if(t){if(!i)throw new wp("Blob is not supported",wp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new wp("Unsupported protocol "+n,wp.ERR_NOT_SUPPORT)}var aIi=yi(require("stream"),1);var Cop=yi(require("stream"),1);var ACs=Symbol("internals"),qCs=class extends Cop.default.Transform{constructor(t){t=ds.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!ds.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[ACs]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[ACs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[ACs],a=n.maxRate,u=this.readableHighWaterMark,l=n.timeWindow,d=1e3/l,s=a/d,o=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,c=(g,O)=>{let m=Buffer.byteLength(g);n.bytesSeen+=m,n.bytes+=m,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(g)?process.nextTick(O):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(O)}},b=(g,O)=>{let m=Buffer.byteLength(g),w=null,E=u,A,q=0;if(a){let D=Date.now();(!n.ts||(q=D-n.ts)>=l)&&(n.ts=D,A=s-n.bytes,n.bytes=A<0?-A:0,q=0),A=s-n.bytes}if(a){if(A<=0)return setTimeout(()=>{O(null,g)},l-q);A<E&&(E=A)}E&&m>E&&m-E>o&&(w=g.subarray(E),g=g.subarray(0,E)),c(g,w?()=>{process.nextTick(O,null,w)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},TCs=qCs;var Zop=require("events");var xop=yi(require("util"),1),Iop=require("stream");var{asyncIterator:Bop}=Symbol,o2S=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[Bop]?yield*e[Bop]():yield e},emo=o2S;var u2S=PM.ALPHABET.ALPHA_DIGIT+"-_",Rsa=typeof TextEncoder=="function"?new TextEncoder:new xop.default.TextEncoder,Ili=`\r
1698
1698
  `,s2S=Rsa.encode(Ili),c2S=2,CCs=class{constructor(t,r){let{escapeName:i}=this.constructor,n=ds.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${Ili}`;n?r=Rsa.encode(String(r).replace(/\r?\n|\r\n?/g,Ili)):a+=`Content-Type: ${r.type||"application/octet-stream"}${Ili}`,this.headers=Rsa.encode(a+Ili),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+c2S,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;ds.isTypedArray(t)?yield t:yield*emo(t),yield s2S}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},l2S=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+PM.generateString(n,u2S)}=r||{};if(!ds.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=Rsa.encode("--"+a+Ili),l=Rsa.encode("--"+a+"--"+Ili+Ili),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new CCs(c,b);return d+=g.size,g});d+=u.byteLength*s.length,d=ds.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),Iop.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},zop=l2S;var Rop=yi(require("stream"),1),BCs=class extends Rop.default.Transform{__transform(t,r,i){this.push(t),i()}_transform(t,r,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,r)}this.__transform(t,r,i)}},Nop=BCs;var f2S=(e,t)=>ds.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,Fop=f2S;function d2S(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,u;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),o=i[a];u||(u=s),r[n]=d,i[n]=s;let c=a,b=0;for(;c!==n;)b+=r[c++],c=c%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-u<t)return;let g=o&&s-o;return g?Math.round(b*1e3/g):void 0}}var Lop=d2S;function p2S(e,t){let r=0,i=1e3/t,n,a,u=(s,o=Date.now())=>{r=o,n=null,a&&(clearTimeout(a),a=null),e.apply(null,s)};return[(...s)=>{let o=Date.now(),c=o-r;c>=i?u(s,o):(n=s,a||(a=setTimeout(()=>{a=null,u(n)},i-c)))},()=>n&&u(n)]}var Uop=p2S;var aJr=(e,t,r=3)=>{let i=0,n=Lop(50,250);return Uop(a=>{let u=a.loaded,l=a.lengthComputable?a.total:void 0,d=u-i,s=n(d),o=u<=l;i=u;let c={loaded:u,total:l,progress:l?u/l:void 0,bytes:d,rate:s||void 0,estimated:s&&l&&o?(l-u)/s:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(c)},r)},XOn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},ZOn=e=>(...t)=>ds.asap(()=>e(...t));var Vop={flush:oJr.default.constants.Z_SYNC_FLUSH,finishFlush:oJr.default.constants.Z_SYNC_FLUSH},_2S={flush:oJr.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:oJr.default.constants.BROTLI_OPERATION_FLUSH},Wop=ds.isFunction(oJr.default.createBrotliDecompress),{http:h2S,https:y2S}=Xop.default,v2S=/https:?/,Hop=PM.protocols.map(e=>e+":"),$op=(e,[t,r])=>(e.on("end",r).on("error",r),t);function b2S(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function kop(e,t,r){let i=t;if(!i&&i!==!1){let n=Qop.default.getProxyForUrl(r);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let a=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let n=i.hostname||i.host;e.hostname=n,e.host=n,e.port=i.port,e.path=r,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(a){kop(a,t,a.href)}}var g2S=typeof process<"u"&&ds.kindOf(process)==="process",O2S=e=>new Promise((t,r)=>{let i,n,a=(d,s)=>{n||(n=!0,i&&i(d,s))},u=d=>{a(d),t(d)},l=d=>{a(d,!0),r(d)};e(u,l,d=>i=d).catch(l)}),m2S=({address:e,family:t})=>{if(!ds.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},Gop=(e,t)=>m2S(ds.isObject(e)?e:{address:e,family:t}),eup=g2S&&function(t){return O2S(async function(i,n,a){let{data:u,lookup:l,family:d}=t,{responseType:s,responseEncoding:o}=t,c=t.method.toUpperCase(),b,g=!1,O;if(l){let we=Fop(l,Ze=>ds.isArray(Ze)?Ze:[Ze]);l=(Ze,Mt,De)=>{we(Ze,Mt,(Te,xt,Ee)=>{if(Te)return De(Te);let It=ds.isArray(xt)?xt.map(st=>Gop(st)):[Gop(xt,Ee)];Mt.all?De(Te,It):De(Te,It[0].address,It[0].family)})}}let m=new Zop.EventEmitter,w=()=>{t.cancelToken&&t.cancelToken.unsubscribe(E),t.signal&&t.signal.removeEventListener("abort",E),m.removeAllListeners()};a((we,Ze)=>{b=!0,Ze&&(g=!0,w())});function E(we){m.emit("abort",!we||we.type?new PSe(null,t,O):we)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(E),t.signal&&(t.signal.aborted?E():t.signal.addEventListener("abort",E)));let A=iIi(t.baseURL,t.url,t.allowAbsoluteUrls),q=new URL(A,PM.hasBrowserEnv?PM.origin:void 0),D=q.protocol||Hop[0];if(D==="data:"){let we;if(c!=="GET")return pYt(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{we=MCs(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Ze){throw wp.from(Ze,wp.ERR_BAD_REQUEST,t)}return s==="text"?(we=we.toString(o),(!o||o==="utf8")&&(we=ds.stripBOM(we))):s==="stream"&&(we=aIi.default.Readable.from(we)),pYt(i,n,{data:we,status:200,statusText:"OK",headers:new ez,config:t})}if(Hop.indexOf(D)===-1)return n(new wp("Unsupported protocol "+D,wp.ERR_BAD_REQUEST,t));let C=ez.from(t.headers).normalize();C.set("User-Agent","axios/"+nIi,!1);let{onUploadProgress:R,onDownloadProgress:$}=t,I=t.maxRate,U,H;if(ds.isSpecCompliantForm(u)){let we=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=zop(u,Ze=>{C.set(Ze)},{tag:`axios-${nIi}-boundary`,boundary:we&&we[1]||void 0})}else if(ds.isFormData(u)&&ds.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let we=await Yop.default.promisify(u.getLength).call(u);Number.isFinite(we)&&we>=0&&C.setContentLength(we)}catch{}}else if(ds.isBlob(u)||ds.isFile(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=aIi.default.Readable.from(emo(u));else if(u&&!ds.isStream(u)){if(!Buffer.isBuffer(u))if(ds.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(ds.isString(u))u=Buffer.from(u,"utf-8");else return n(new wp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",wp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new wp("Request body larger than maxBodyLength limit",wp.ERR_BAD_REQUEST,t))}let k=ds.toFiniteNumber(C.getContentLength());ds.isArray(I)?(U=I[0],H=I[1]):U=H=I,u&&(R||U)&&(ds.isStream(u)||(u=aIi.default.Readable.from(u,{objectMode:!1})),u=aIi.default.pipeline([u,new TCs({maxRate:ds.toFiniteNumber(U)})],ds.noop),R&&u.on("progress",$op(u,XOn(k,aJr(ZOn(R),!1,3)))));let K;if(t.auth){let we=t.auth.username||"",Ze=t.auth.password||"";K=we+":"+Ze}if(!K&&q.username){let we=q.username,Ze=q.password;K=we+":"+Ze}K&&C.delete("authorization");let ee;try{ee=rIi(q.pathname+q.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(we){let Ze=new Error(we.message);return Ze.config=t,Ze.url=t.url,Ze.exists=!0,n(Ze)}C.set("Accept-Encoding","gzip, compress, deflate"+(Wop?", br":""),!1);let fe={path:ee,method:c,headers:C.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:K,protocol:D,family:d,beforeRedirect:b2S,beforeRedirects:{}};!ds.isUndefined(l)&&(fe.lookup=l),t.socketPath?fe.socketPath=t.socketPath:(fe.hostname=q.hostname.startsWith("[")?q.hostname.slice(1,-1):q.hostname,fe.port=q.port,kop(fe,t.proxy,D+"//"+q.hostname+(q.port?":"+q.port:"")+fe.path));let me,ge=v2S.test(fe.protocol);if(fe.agent=ge?t.httpsAgent:t.httpAgent,t.transport?me=t.transport:t.maxRedirects===0?me=ge?Kop.default:Jop.default:(t.maxRedirects&&(fe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(fe.beforeRedirects.config=t.beforeRedirect),me=ge?y2S:h2S),t.maxBodyLength>-1?fe.maxBodyLength=t.maxBodyLength:fe.maxBodyLength=1/0,t.insecureHTTPParser&&(fe.insecureHTTPParser=t.insecureHTTPParser),O=me.request(fe,function(Ze){if(O.destroyed)return;let Mt=[Ze],De=+Ze.headers["content-length"];if($||H){let st=new TCs({maxRate:ds.toFiniteNumber(H)});$&&st.on("progress",$op(st,XOn(De,aJr(ZOn($),!0,3)))),Mt.push(st)}let Te=Ze,xt=Ze.req||O;if(t.decompress!==!1&&Ze.headers["content-encoding"])switch((c==="HEAD"||Ze.statusCode===204)&&delete Ze.headers["content-encoding"],(Ze.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Mt.push(oJr.default.createUnzip(Vop)),delete Ze.headers["content-encoding"];break;case"deflate":Mt.push(new Nop),Mt.push(oJr.default.createUnzip(Vop)),delete Ze.headers["content-encoding"];break;case"br":Wop&&(Mt.push(oJr.default.createBrotliDecompress(_2S)),delete Ze.headers["content-encoding"])}Te=Mt.length>1?aIi.default.pipeline(Mt,ds.noop):Mt[0];let Ee=aIi.default.finished(Te,()=>{Ee(),w()}),It={status:Ze.statusCode,statusText:Ze.statusMessage,headers:new ez(Ze.headers),config:t,request:xt};if(s==="stream")It.data=Te,pYt(i,n,It);else{let st=[],ve=0;Te.on("data",function(Ot){st.push(Ot),ve+=Ot.length,t.maxContentLength>-1&&ve>t.maxContentLength&&(g=!0,Te.destroy(),n(new wp("maxContentLength size of "+t.maxContentLength+" exceeded",wp.ERR_BAD_RESPONSE,t,xt)))}),Te.on("aborted",function(){if(g)return;let Ot=new wp("stream has been aborted",wp.ERR_BAD_RESPONSE,t,xt);Te.destroy(Ot),n(Ot)}),Te.on("error",function(Ot){O.destroyed||n(wp.from(Ot,null,t,xt))}),Te.on("end",function(){try{let Ot=st.length===1?st[0]:Buffer.concat(st);s!=="arraybuffer"&&(Ot=Ot.toString(o),(!o||o==="utf8")&&(Ot=ds.stripBOM(Ot))),It.data=Ot}catch(Ot){return n(wp.from(Ot,null,t,It.request,It))}pYt(i,n,It)})}m.once("abort",st=>{Te.destroyed||(Te.emit("error",st),Te.destroy())})}),m.once("abort",we=>{n(we),O.destroy(we)}),O.on("error",function(Ze){n(wp.from(Ze,null,t,O))}),O.on("socket",function(Ze){Ze.setKeepAlive(!0,1e3*60)}),t.timeout){let we=parseInt(t.timeout,10);if(Number.isNaN(we)){n(new wp("error trying to parse `config.timeout` to int",wp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(we,function(){if(b)return;let Mt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",De=t.transitional||JOn;t.timeoutErrorMessage&&(Mt=t.timeoutErrorMessage),n(new wp(Mt,De.clarifyTimeoutError?wp.ETIMEDOUT:wp.ECONNABORTED,t,O)),E()})}if(ds.isStream(u)){let we=!1,Ze=!1;u.on("end",()=>{we=!0}),u.once("error",Mt=>{Ze=!0,O.destroy(Mt)}),u.on("close",()=>{!we&&!Ze&&E(new PSe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var tup=PM.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,PM.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(PM.origin),PM.navigator&&/(msie|trident)/i.test(PM.navigator.userAgent)):()=>!0;var rup=PM.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];ds.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),ds.isString(i)&&u.push("path="+i),ds.isString(n)&&u.push("domain="+n),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var iup=e=>e instanceof ez?{...e}:e;function Q8t(e,t){t=t||{};let r={};function i(s,o,c,b){return ds.isPlainObject(s)&&ds.isPlainObject(o)?ds.merge.call({caseless:b},s,o):ds.isPlainObject(o)?ds.merge({},o):ds.isArray(o)?o.slice():o}function n(s,o,c,b){if(ds.isUndefined(o)){if(!ds.isUndefined(s))return i(void 0,s,c,b)}else return i(s,o,c,b)}function a(s,o){if(!ds.isUndefined(o))return i(void 0,o)}function u(s,o){if(ds.isUndefined(o)){if(!ds.isUndefined(s))return i(void 0,s)}else return i(void 0,o)}function l(s,o,c){if(c in t)return i(s,o);if(c in e)return i(void 0,s)}let d={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(s,o,c)=>n(iup(s),iup(o),c,!0)};return ds.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=d[o]||n,b=c(e[o],t[o],o);ds.isUndefined(b)&&c!==l||(r[o]=b)}),r}var tmo=e=>{let t=Q8t({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=ez.from(u),t.url=rIi(iIi(t.baseURL,t.url),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(ds.isFormData(r)){if(PM.hasStandardBrowserEnv||PM.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((d=u.getContentType())!==!1){let[s,...o]=d?d.split(";").map(c=>c.trim()).filter(Boolean):[];u.setContentType([s||"multipart/form-data",...o].join("; "))}}if(PM.hasStandardBrowserEnv&&(i&&ds.isFunction(i)&&(i=i(t)),i||i!==!1&&tup(t.url))){let s=n&&a&&rup.read(a);s&&u.set(n,s)}return t};var P2S=typeof XMLHttpRequest<"u",nup=P2S&&function(e){return new Promise(function(r,i){let n=tmo(e),a=n.data,u=ez.from(n.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:s}=n,o,c,b,g,O;function m(){g&&g(),O&&O(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let w=new XMLHttpRequest;w.open(n.method.toUpperCase(),n.url,!0),w.timeout=n.timeout;function E(){if(!w)return;let q=ez.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:q,config:e,request:w};pYt(function($){r($),m()},function($){i($),m()},C),w=null}"onloadend"in w?w.onloadend=E:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(E)},w.onabort=function(){w&&(i(new wp("Request aborted",wp.ECONNABORTED,e,w)),w=null)},w.onerror=function(){i(new wp("Network Error",wp.ERR_NETWORK,e,w)),w=null},w.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||JOn;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new wp(D,C.clarifyTimeoutError?wp.ETIMEDOUT:wp.ECONNABORTED,e,w)),w=null},a===void 0&&u.setContentType(null),"setRequestHeader"in w&&ds.forEach(u.toJSON(),function(D,C){w.setRequestHeader(C,D)}),ds.isUndefined(n.withCredentials)||(w.withCredentials=!!n.withCredentials),l&&l!=="json"&&(w.responseType=n.responseType),s&&([b,O]=aJr(s,!0),w.addEventListener("progress",b)),d&&w.upload&&([c,g]=aJr(d),w.upload.addEventListener("progress",c),w.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=q=>{w&&(i(!q||q.type?new PSe(null,e,w):q),w.abort(),w=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let A=zsa(n.url);if(A&&PM.protocols.indexOf(A)===-1){i(new wp("Unsupported protocol "+A+":",wp.ERR_BAD_REQUEST,e));return}w.send(a||null)})};var j2S=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,l();let o=s instanceof Error?s:this.reason;i.abort(o instanceof wp?o:new PSe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new wp(`timeout ${t} of ms exceeded`,wp.ETIMEDOUT))},t),l=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=i;return d.unsubscribe=()=>ds.asap(l),d}},aup=j2S;var w2S=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let i=0,n;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},S2S=async function*(e,t){for await(let r of D2S(e))yield*w2S(r,t)},D2S=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:i}=await t.read();if(r)break;yield i}}finally{await t.cancel()}},xCs=(e,t,r,i)=>{let n=S2S(e,t),a=0,u,l=d=>{u||(u=!0,i&&i(d))};return new ReadableStream({async pull(d){try{let{done:s,value:o}=await n.next();if(s){l(),d.close();return}let c=o.byteLength;if(r){let b=a+=c;r(b)}d.enqueue(new Uint8Array(o))}catch(s){throw l(s),s}},cancel(d){return l(d),n.return()}},{highWaterMark:2})};var imo=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",uup=imo&&typeof ReadableStream=="function",E2S=imo&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),sup=(e,...t)=>{try{return!!e(...t)}catch{return!1}},M2S=uup&&sup(()=>{let e=!1,t=new Request(PM.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),oup=64*1024,ICs=uup&&sup(()=>ds.isReadableStream(new Response("").body)),rmo={stream:ICs&&(e=>e.body)};imo&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!rmo[t]&&(rmo[t]=ds.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new wp(`Response type '${t}' is not supported`,wp.ERR_NOT_SUPPORT,i)})})})(new Response);var A2S=async e=>{if(e==null)return 0;if(ds.isBlob(e))return e.size;if(ds.isSpecCompliantForm(e))return(await new Request(PM.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ds.isArrayBufferView(e)||ds.isArrayBuffer(e))return e.byteLength;if(ds.isURLSearchParams(e)&&(e=e+""),ds.isString(e))return(await E2S(e)).byteLength},q2S=async(e,t)=>{let r=ds.toFiniteNumber(e.getContentLength());return r??A2S(t)},cup=imo&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:d,responseType:s,headers:o,withCredentials:c="same-origin",fetchOptions:b}=tmo(e);s=s?(s+"").toLowerCase():"text";let g=aup([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),w;try{if(d&&M2S&&r!=="get"&&r!=="head"&&(w=await q2S(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),R;if(ds.isFormData(i)&&(R=C.headers.get("content-type"))&&o.setContentType(R),C.body){let[$,I]=XOn(w,aJr(ZOn(d)));i=xCs(C.body,oup,$,I)}}ds.isString(c)||(c=c?"include":"omit");let E="credentials"in Request.prototype;O=new Request(t,{...b,signal:g,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:i,duplex:"half",credentials:E?c:void 0});let A=await fetch(O),q=ICs&&(s==="stream"||s==="response");if(ICs&&(l||q&&m)){let C={};["status","statusText","headers"].forEach(U=>{C[U]=A[U]});let R=ds.toFiniteNumber(A.headers.get("content-length")),[$,I]=l&&XOn(R,aJr(ZOn(l),!0))||[];A=new Response(xCs(A.body,oup,$,()=>{I&&I(),m&&m()}),C)}s=s||"text";let D=await rmo[ds.findKey(rmo,s)||"text"](A,e);return!q&&m&&m(),await new Promise((C,R)=>{pYt(C,R,{data:D,headers:ez.from(A.headers),status:A.status,statusText:A.statusText,config:e,request:O})})}catch(E){throw m&&m(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new wp("Network Error",wp.ERR_NETWORK,e,O),{cause:E.cause||E}):wp.from(E,E&&E.code,e,O)}});var zCs={http:eup,xhr:nup,fetch:cup};ds.forEach(zCs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var lup=e=>`- ${e}`,T2S=e=>ds.isFunction(e)||e===null||e===!1,nmo={getAdapter:e=>{e=ds.isArray(e)?e:[e];let{length:t}=e,r,i,n={};for(let a=0;a<t;a++){r=e[a];let u;if(i=r,!T2S(r)&&(i=zCs[(u=String(r)).toLowerCase()],i===void 0))throw new wp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
@@ -1930,11 +1930,11 @@ ${q}${A}${D}${Zxp.default.cursorHide}`});var Tpa=yi(lBi(),1);function q8s(e,t){i
1930
1930
  Run ${Js.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1931
1931
  Run ${Js.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),emn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function U8s({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!PIp(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,d)=>l.generatorName.localeCompare(d.generatorName)||l.currentVersion.localeCompare(d.currentVersion));for(let l of u)n+=`
1932
1932
  ${await BmD(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Js.dim(l.currentVersion)+Js.reset(" \u2192 ")+Js.green(l.latestVersion);return n+=`
1933
- `,i?emn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function BmD(e){let r=await new mIp.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Error(`Generator ${e} not found`);return r.body.displayName}async function xmD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await wIp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=lsi(o.name,c),g=await MQt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await wIp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=lsi(s.name,o),b=await MQt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function wIp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await v8t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function SIp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Pie(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function oAo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await xmD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...SIp(s,d,t.logger));else u.push(...SIp(l.versions,void 0,t.logger))}return u}var Fpa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var Qwn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Jwn=e=>e!==null&&typeof e=="object";var Lpa=(...e)=>{for(let t of e)if((!Jwn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return H8s({},...e)},V8s=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function uAo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:H8s(e[r]??[],t[r]??[])}var W8s=(e={},t={})=>({beforeRequest:uAo(e,t,"beforeRequest"),beforeRetry:uAo(e,t,"beforeRetry"),afterResponse:uAo(e,t,"afterResponse"),beforeError:uAo(e,t,"beforeError")}),H8s=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Jwn(n)){for(let[a,u]of Object.entries(n))Jwn(u)&&a in t&&(u=H8s(t[a],u)),t={...t,[a]:u};Jwn(n.hooks)&&(i=W8s(i,n.hooks),t.hooks=i),Jwn(n.headers)&&(r=V8s(r,n.headers),t.headers=r)}return t};var DIp=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),EIp=typeof globalThis.AbortController=="function",MIp=typeof globalThis.ReadableStream=="function",AIp=typeof globalThis.FormData=="function",sAo=["get","post","put","patch","head","delete"],ImD=()=>{};ImD();var qIp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},cAo=2147483647,lAo=Symbol("stop"),TIp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},CIp={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var xIp=e=>sAo.includes(e)?e.toUpperCase():e,zmD=["get","put","head","delete","options","trace"],RmD=[408,413,429,500,502,503,504],NmD=[413,429,503],BIp={limit:2,methods:zmD,statusCodes:RmD,afterStatusCodes:NmD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},IIp=(e={})=>{if(typeof e=="number")return{...BIp,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...BIp,...e}};async function $8s(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new Qwn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function G8s(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var zIp=(e,t)=>{let r={};for(let i in t)!(i in CIp)&&!(i in TIp)&&!(i in e)&&(r[i]=t[i]);return r};var Upa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>cAo)throw new RangeError(`The \`timeout\` option cannot be greater than ${cAo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new Fpa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!MIp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(qIp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:V8s(this._input.headers,r.headers),hooks:W8s({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:xIp(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:IIp(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(EIp){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(DIp&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(AIp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Qwn)throw t;if(t instanceof Fpa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),cAo);if(this._retryCount<1)throw r;await G8s(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===lAo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=zIp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):$8s(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var Q8s=e=>{let t=(r,i)=>Upa.create(r,Lpa(e,i));for(let r of sAo)t[r]=(i,n)=>Upa.create(i,Lpa(e,n,{method:r}));return t.create=r=>Q8s(Lpa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Q8s(Lpa(e,r))),t.stop=lAo,t},FmD=Q8s(),RIp=FmD;var ozp=yi(azp(),1);function Z8s(e){let t=(0,ozp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var eRp=yi(kzp(),1),tRp=yi(lBi(),1),d5s=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},p5s=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function _5s(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Z8s(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,eRp.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await RIp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new d5s(e):c}if(t.allVersions)return s;let o=new p5s(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=tRp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function Qpa(e,t){let{version:r}=await _5s(e.toLowerCase(),t);return r}async function adi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Qpa(e.packageName,{version:t?"prerelease":"latest"})}var rRp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],PAo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=V0.Info;constructor(t){this.ttyAwareLogger=new aAo(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.56.17"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Js.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Ute}failWithoutThrowing(t,r){this.didSucceed=!1,tAo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await $On()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await jIp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1933
+ `,i?emn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function BmD(e){let r=await new mIp.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Error(`Generator ${e} not found`);return r.body.displayName}async function xmD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await wIp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=lsi(o.name,c),g=await MQt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await wIp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=lsi(s.name,o),b=await MQt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function wIp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await v8t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function SIp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Pie(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function oAo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await xmD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...SIp(s,d,t.logger));else u.push(...SIp(l.versions,void 0,t.logger))}return u}var Fpa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var Qwn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Jwn=e=>e!==null&&typeof e=="object";var Lpa=(...e)=>{for(let t of e)if((!Jwn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return H8s({},...e)},V8s=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function uAo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:H8s(e[r]??[],t[r]??[])}var W8s=(e={},t={})=>({beforeRequest:uAo(e,t,"beforeRequest"),beforeRetry:uAo(e,t,"beforeRetry"),afterResponse:uAo(e,t,"afterResponse"),beforeError:uAo(e,t,"beforeError")}),H8s=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Jwn(n)){for(let[a,u]of Object.entries(n))Jwn(u)&&a in t&&(u=H8s(t[a],u)),t={...t,[a]:u};Jwn(n.hooks)&&(i=W8s(i,n.hooks),t.hooks=i),Jwn(n.headers)&&(r=V8s(r,n.headers),t.headers=r)}return t};var DIp=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),EIp=typeof globalThis.AbortController=="function",MIp=typeof globalThis.ReadableStream=="function",AIp=typeof globalThis.FormData=="function",sAo=["get","post","put","patch","head","delete"],ImD=()=>{};ImD();var qIp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},cAo=2147483647,lAo=Symbol("stop"),TIp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},CIp={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var xIp=e=>sAo.includes(e)?e.toUpperCase():e,zmD=["get","put","head","delete","options","trace"],RmD=[408,413,429,500,502,503,504],NmD=[413,429,503],BIp={limit:2,methods:zmD,statusCodes:RmD,afterStatusCodes:NmD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},IIp=(e={})=>{if(typeof e=="number")return{...BIp,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...BIp,...e}};async function $8s(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new Qwn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function G8s(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var zIp=(e,t)=>{let r={};for(let i in t)!(i in CIp)&&!(i in TIp)&&!(i in e)&&(r[i]=t[i]);return r};var Upa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>cAo)throw new RangeError(`The \`timeout\` option cannot be greater than ${cAo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new Fpa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!MIp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(qIp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:V8s(this._input.headers,r.headers),hooks:W8s({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:xIp(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:IIp(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(EIp){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(DIp&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(AIp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Qwn)throw t;if(t instanceof Fpa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),cAo);if(this._retryCount<1)throw r;await G8s(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===lAo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=zIp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):$8s(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var Q8s=e=>{let t=(r,i)=>Upa.create(r,Lpa(e,i));for(let r of sAo)t[r]=(i,n)=>Upa.create(i,Lpa(e,n,{method:r}));return t.create=r=>Q8s(Lpa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Q8s(Lpa(e,r))),t.stop=lAo,t},FmD=Q8s(),RIp=FmD;var ozp=yi(azp(),1);function Z8s(e){let t=(0,ozp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var eRp=yi(kzp(),1),tRp=yi(lBi(),1),d5s=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},p5s=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function _5s(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Z8s(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,eRp.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await RIp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new d5s(e):c}if(t.allVersions)return s;let o=new p5s(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=tRp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function Qpa(e,t){let{version:r}=await _5s(e.toLowerCase(),t);return r}async function adi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Qpa(e.packageName,{version:t?"prerelease":"latest"})}var rRp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],PAo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=V0.Info;constructor(t){this.ttyAwareLogger=new aAo(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.56.19"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Js.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Ute}failWithoutThrowing(t,r){this.didSucceed=!1,tAo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await $On()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await jIp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1934
1934
  `)||(r+=`
1935
1935
  `),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=lds(t.map(i=>i.type==="docs"?"docs":i.workspaceName??"api"),i=>i.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 Cpa(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 i=this.addTaskWithInit(t).start(),n;try{n=await r(i)}catch(a){throw a.message.includes("globalThis")?(i.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),i.failWithoutThrowing()):i.failWithoutThrowing(void 0,a),new Ute}finally{i.finish()}return n}async instrumentPostHogEvent(t){(await $On()).sendEvent(t)}logger=FGr(this.log.bind(this));constructTaskInitForWorkspace(t){let r=iRp(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?iRp(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=rRp[this.numTasks++%rRp.length],u=Js.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===wC.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logImmediately(t){let r=t.filter(i=>Dui.indexOf(i.level)>=Dui.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===V0.Debug})}_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 adi({cliEnvironment:this.environment,includePreReleases:t}),i=Pie(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await oAo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await w8s({message:t,default:r})}async getInput(t){return await S8s({message:t.message,default:t.default})}};function iRp(e){return`[${e}]:`}var jYp=require("fs/promises");function jie({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Js.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Js.dim(r)),i.join(`
1936
1936
  `)}var xHp=require("fs/promises");var D5t=class e{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;type=e.Type;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};var USe=class extends D5t{definition;sources;constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var Jpa=class{context;constructor(t){this.context=t}};var jAo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?sy.of(`${n}${N4t}${u}`):sy.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${N4t}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(N4t))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[sy.of(t[0])]??={};let[r,...i]=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(i)}};var hRi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new jAo,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":i,"display-name":n,docs:a}){let u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),i!=null&&(u.service["base-path"]=i),n!=null&&(u.service["display-name"]=n),a!=null&&(u.docs=a)}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 pQr(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 i of Object.values(this.rootApiFile["auth-schemes"]))HPD(i)&&t.push(i.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}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:i}){if(t===r)return;let n=i??Dg((DBe(r)+"/"+_Ci(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===sy.of(Q3))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=Rka(DBe(Zhn.of(`/${t}`)),Zhn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=Rka(DBe(Zhn.of(`/${t}`)),Zhn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(l=>F1e(l,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=PR(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}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(([n,a])=>[n,{...a,path:PR(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:PR(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===X1?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 HPD(e){return e?.header!=null}var wie={openapi:e=>({...e,type:"openapi",_visit:function(t){return wie._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return wie._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 t1n={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return t1n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var g5={basic:e=>({...e,type:"basic",_visit:function(t){return g5._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return g5._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return g5._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return g5._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return g5._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 rg={primitive:e=>({value:e,type:"primitive",_visit:function(t){return rg._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return rg._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return rg._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return rg._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return rg._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return rg._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return rg._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return rg._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"unknown":return t.unknown(e.value);default:return t._other(e)}}};var u_={int:e=>({value:e,type:"int",_visit:function(t){return u_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return u_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return u_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return u_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return u_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return u_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return u_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return u_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return u_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return u_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return u_._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"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 r1n={boolean:e=>({value:e,type:"boolean",_visit:function(t){return r1n._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return r1n._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 odi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return odi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return odi._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 pV={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case pV.GenerallyAvailable:return t.generallyAvailable();case pV.Beta:return t.beta();case pV.Deprecated:return t.deprecated();default:return t._other()}}};var hze={cursor:e=>({...e,type:"cursor",_visit(t){return hze._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit(t){return hze._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit(t){return hze._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);default:return t._other(e)}}};var kJr={language:e=>({...e,type:"language",_visit:function(t){return kJr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return kJr._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 _V={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",_visit:(e,t)=>{switch(e){case _V.Curl:return t.curl();case _V.Python:return t.python();case _V.Javascript:return t.javascript();case _V.Typescript:return t.typescript();case _V.Go:return t.go();case _V.Ruby:return t.ruby();case _V.Csharp:return t.csharp();case _V.Java:return t.java();case _V.Js:return t.js();case _V.Node:return t.node();case _V.Ts:return t.ts();case _V.Nodets:return t.nodets();case _V.Golang:return t.golang();case _V.Dotnet:return t.dotnet();case _V.Jvm:return t.jvm();default:return t._other()}}};var E5t={unknown:e=>({value:e,type:"unknown",_visit:function(t){return E5t._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return E5t._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 yze={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return yze._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return yze._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 pG={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case pG.Get:return t.get();case pG.Post:return t.post();case pG.Put:return t.put();case pG.Patch:return t.patch();case pG.Delete:return t.delete();case pG.Head:return t.head();case pG.Options:return t.options();case pG.Trace:return t.trace();default:return t._other()}}};var udi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return udi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return udi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return udi._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);default:return t._other(e)}}};var vze={file:e=>({...e,type:"file",_visit:function(t){return vze._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return vze._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 Sie={file:e=>({...e,type:"file",_visit:function(t){return Sie._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Sie._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Sie._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Sie._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Sie._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Sie._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"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var gy={primitive:e=>({...e,type:"primitive",_visit:function(t){return gy._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return gy._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return gy._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return gy._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return gy._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return gy._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return gy._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return gy._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return gy._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return gy._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return gy._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 vj={int:e=>({...e,type:"int",_visit:function(t){return vj._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return vj._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return vj._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return vj._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return vj._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return vj._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return vj._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return vj._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return vj._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return vj._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return vj._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"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var cx={boolean:e=>({value:e,type:"boolean",_visit:function(t){return cx._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return cx._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 eKr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return eKr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return eKr._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 VSe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return VSe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return VSe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return VSe._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);default:return t._other(e)}}};var lx={file:e=>({...e,type:"file",_visit:function(t){return lx._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return lx._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return lx._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return lx._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return lx._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return lx._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"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var El={primitive:e=>({...e,type:"primitive",_visit:function(t){return El._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return El._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return El._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return El._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return El._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return El._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return El._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return El._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return El._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return El._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return El._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 QY={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return QY._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return QY._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 Xd={int:e=>({...e,type:"int",_visit:function(t){return Xd._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Xd._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Xd._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Xd._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Xd._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Xd._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Xd._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Xd._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Xd._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Xd._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Xd._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"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var uv={};Co(uv,{AllOfPropertyConflict:()=>w1n,ArraySchema:()=>Rqo,ArraySchemaWithExample:()=>fTo,Availability:()=>BAo,Base64WithExample:()=>oTo,BasicSecurityScheme:()=>zAo,BearerSecurityScheme:()=>RAo,BooleanSchema:()=>Tqo,BooleanWithExample:()=>uTo,CasingOverrides:()=>LAo,CommonProperty:()=>$qo,CommonPropertyWithExample:()=>OTo,CursorPagination:()=>yqo,CustomCodeSample:()=>_qo,CustomCodeSampleLanguage:()=>fqo,CustomCodeSampleSdk:()=>pqo,CustomPagination:()=>bqo,DateWithExample:()=>aTo,DatetimeWithExample:()=>nTo,DiscriminatedOneOfSchema:()=>Wqo,DiscriminatedOneOfSchemaWithExample:()=>bTo,DoubleSchema:()=>Aqo,DoubleWithExample:()=>rTo,Encoding:()=>CAo,Endpoint:()=>gqo,EndpointExample:()=>g1n,EndpointResponseExample:()=>lqo,EndpointSdkName:()=>nXt,EndpointWithExample:()=>BRp,EnumSchema:()=>o1n,EnumSchemaWithExample:()=>cTo,EnumValue:()=>ldi,ErrorExample:()=>aqo,FernExample:()=>uqo,FileResponse:()=>_1n,FileSchema:()=>ZAo,FloatWithExample:()=>tTo,FullEndpointExample:()=>hqo,FullExample:()=>WA,FullObjectExample:()=>QAo,FullOneOfExample:()=>KAo,GlobalHeader:()=>Bqo,Header:()=>ddi,HeaderExample:()=>b1n,HeaderSecurityScheme:()=>NAo,HeaderWithExample:()=>hdi,HttpEndpointServer:()=>y1n,HttpError:()=>oqo,HttpErrorWithExample:()=>Yqo,HttpMethod:()=>c1n,IdempotencyHeader:()=>xqo,Int64WithExample:()=>Zqo,IntSchema:()=>Eqo,IntWithExample:()=>Xqo,JsonRequest:()=>rqo,JsonRequestWithExample:()=>Qqo,JsonResponse:()=>h1n,JsonResponseWithExample:()=>E1n,KeyValuePair:()=>JAo,LiteralExample:()=>GAo,LiteralSchema:()=>j1n,LiteralSchemaValue:()=>Iqo,LongSchema:()=>Mqo,MapSchema:()=>Nqo,MapSchemaWithExample:()=>dTo,MultipartRequest:()=>p1n,MultipartRequestProperty:()=>tqo,MultipartRequestPropertyEncoding:()=>eqo,MultipartSchema:()=>kAo,NamedFullExample:()=>oXt,Namespace:()=>UAo,NamespaceId:()=>$Ao,NullableSchema:()=>Lqo,NullableSchemaWithExample:()=>_To,OauthSecurityScheme:()=>WAo,ObjectProperty:()=>Vqo,ObjectPropertyConflictInfo:()=>S1n,ObjectPropertyWithExample:()=>vTo,ObjectSchema:()=>zqo,ObjectSchemaWithExample:()=>hTo,OctetStreamRequest:()=>d1n,OffsetPagination:()=>vqo,OneOfSchema:()=>Uqo,OneOfSchemaWithExample:()=>yTo,OpenApiIntermediateRepresentation:()=>TRp,OpenApiSource:()=>MAo,OptionalSchema:()=>Fqo,OptionalSchemaWithExample:()=>pTo,Pagination:()=>O1n,PathParameter:()=>l1n,PathParameterExample:()=>sqo,PathParameterWithExample:()=>Gqo,PrimitiveExample:()=>s1n,PrimitiveSchema:()=>_di,PrimitiveSchemaValue:()=>Cqo,PrimitiveSchemaValueWithExample:()=>sTo,PrimitiveSchemaWithExample:()=>M1n,PropertyKey:()=>u1n,ProtobufEncoding:()=>TAo,ProtobufSource:()=>AAo,QueryParameter:()=>f1n,QueryParameterExample:()=>v1n,QueryParameterWithExample:()=>D1n,QuerySecurityScheme:()=>FAo,ReferencedSchema:()=>aXt,Request:()=>iqo,RequestWithExample:()=>Jqo,Response:()=>nqo,ResponseWithExample:()=>Kqo,Schema:()=>IO,SchemaId:()=>JY,SchemaWithExample:()=>EM,Schemas:()=>Dqo,SdkGroup:()=>VAo,SdkGroupInfo:()=>YAo,SdkGroupName:()=>fdi,SecurityScheme:()=>HAo,SecuritySchemeId:()=>IAo,Server:()=>Zpa,Source:()=>qAo,StatusCode:()=>tXt,StreamingResponseExample:()=>cqo,StringSchema:()=>qqo,StringSchemaWithExample:()=>iTo,SupportedSdkLanguage:()=>dqo,Tag:()=>xAo,TagId:()=>KY,Tags:()=>XAo,TextResponse:()=>pdi,Uint64WithExample:()=>eTo,UintWithExample:()=>kqo,UnDiscriminatedOneOfSchema:()=>Hqo,UnDiscriminatedOneOfSchemaWithExample:()=>gTo,UnknownSchemaWithExample:()=>lTo,Webhook:()=>Oqo,WebhookExampleCall:()=>P1n,WebhookHttpMethod:()=>m1n,WebhookWithExample:()=>xRp,WebsocketChannel:()=>Sqo,WebsocketHandshake:()=>mqo,WebsocketHandshakeWithExample:()=>CRp,WebsocketMessageExample:()=>jqo,WebsocketServer:()=>Pqo,WebsocketSessionExample:()=>wqo,WithAvailability:()=>dh,WithDescription:()=>_f,WithEncoding:()=>Die,WithInline:()=>uE,WithName:()=>s0,WithNamespace:()=>iXt,WithSdkGroupName:()=>xO,WithSource:()=>ly,WithStatusCode:()=>rXt,WithTitle:()=>BO,commons:()=>g5s,example:()=>O5s,finalIr:()=>m5s,parseIr:()=>P5s});var g5s={};Co(g5s,{BasicSecurityScheme:()=>zAo,BearerSecurityScheme:()=>RAo,Encoding:()=>CAo,HeaderSecurityScheme:()=>NAo,Namespace:()=>UAo,NamespaceId:()=>$Ao,OauthSecurityScheme:()=>WAo,OpenApiSource:()=>MAo,ProtobufEncoding:()=>TAo,ProtobufSource:()=>AAo,QuerySecurityScheme:()=>FAo,SchemaId:()=>JY,SdkGroup:()=>VAo,SdkGroupName:()=>fdi,SecurityScheme:()=>HAo,SecuritySchemeId:()=>IAo,Server:()=>Zpa,Source:()=>qAo,StatusCode:()=>tXt,Tag:()=>xAo,TagId:()=>KY,WithAvailability:()=>dh,WithDescription:()=>_f,WithEncoding:()=>Die,WithInline:()=>uE,WithName:()=>s0,WithNamespace:()=>iXt,WithSdkGroupName:()=>xO,WithSource:()=>ly,WithStatusCode:()=>rXt,WithTitle:()=>BO});var At={};Co(At,{JsonError:()=>i1n,ParseError:()=>n1n,any:()=>bRp,bigint:()=>aRp,boolean:()=>gRp,booleanLiteral:()=>vRp,date:()=>oRp,discriminant:()=>MRp,enum_:()=>SAo,getObjectLikeUtils:()=>M5t,getObjectUtils:()=>yRi,getSchemaUtils:()=>VA,isProperty:()=>cdi,lazy:()=>uRp,lazyObject:()=>_Rp,list:()=>EAo,number:()=>ORp,object:()=>DAo,objectWithoutOptionalProperties:()=>pRp,optional:()=>h5s,property:()=>cRp,record:()=>wRp,set:()=>SRp,string:()=>mRp,stringLiteral:()=>yRp,transform:()=>y5s,undiscriminatedUnion:()=>ERp,union:()=>qRp,unknown:()=>PRp,withParsedProperties:()=>b5s});var JP={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",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function DM(e,t){return`Expected ${t}. Received ${$PD(e)}.`}function $PD(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 O5(e){return{...e,json:nRp(e.json),parse:nRp(e.parse)}}function nRp(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
1937
- `)),{ok:!0,value:t}):i}}function wAo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var i1n=class e extends Error{errors;constructor(t){super(t.map(wAo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var n1n=class e extends Error{errors;constructor(t){super(t.map(wAo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function VA(e){return{optional:()=>h5s(e),transform:t=>y5s(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new n1n(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new i1n(i.errors)}}}function h5s(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>JP.OPTIONAL};return{...t,...VA(t)}}function y5s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...VA(r)}}function aRp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:DM(t,"string")}]}:{ok:!0,value:BigInt(t)},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t.toString()}:{ok:!1,errors:[{path:r,message:DM(t,"bigint")}]},getType:()=>JP.BIGINT};return{...O5(e),...VA(e)}}var GPD=/^([+-]?\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 oRp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:DM(t,"string")}]}:GPD.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:DM(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:DM(t,"Date object")}]},getType:()=>JP.DATE};return{...O5(e),...VA(e)}}function _G(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...O5(r),...VA(r)}}}function SAo(e){let t=new Set(e);return _G(JP.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:DM(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:DM(i,"enum")}]}:{ok:!0,value:i})()}function uRp(e){let t=v5s(e);return{...t,...VA(t)}}function v5s(e){return{parse:(t,r)=>a1n(e).parse(t,r),json:(t,r)=>a1n(e).json(t,r),getType:()=>a1n(e).getType()}}function a1n(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function Kpa(e){return Object.entries(e)}function Ypa(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function sdi(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 Xpa(e){return Object.keys(e)}function sRp(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function M5t(e){return{withParsedProperties:t=>b5s(e,t)}}function b5s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let u=Object.entries(t).reduce((l,[d,s])=>({...l,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(i,n)=>{if(!sdi(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:DM(i,"object")}]};let a=new Set(Object.keys(t)),u=Ypa(i,Object.keys(i).filter(l=>!a.has(l)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...VA(r),...M5t(r)}}function cRp(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function cdi(e){return e.isProperty}function DAo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>cdi(i)?i.rawKey:r),_getParsedProperties:()=>Xpa(e),parse:(r,i)=>{let n={},a=[];for(let[u,l]of Kpa(e)){let d=cdi(l)?l.rawKey:u,s=cdi(l)?l.valueSchema:l,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,dRp(s)&&a.push(d)}return lRp({value:r,requiredKeys:a,getProperty:u=>{let l=n[u];if(l!=null)return{transformedKey:l.parsedKey,transform:d=>l.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,u]of Kpa(e)){let l=cdi(u)?u.valueSchema:u;dRp(l)&&n.push(a)}return lRp({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return cdi(u)?{transformedKey:u.rawKey,transform:l=>u.valueSchema.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:l=>u.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>JP.OBJECT};return{...O5(t),...VA(t),...M5t(t),...yRi(t)}}function lRp({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!sdi(e))return{ok:!1,errors:[{path:a,message:DM(e,"object")}]};let u=new Set(t),l=[],d={};for(let[s,o]of Object.entries(e)){let c=r(s);if(c!=null){u.delete(s);let b=c.transform(o);b.ok?d[c.transformedKey]=b.value:(d[s]=o,l.push(...b.errors))}else switch(i){case"fail":l.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=o;break}}return l.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),l.length===0||n?{ok:!0,value:d}:{ok:!1,errors:l}}function yRi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>fRp({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>fRp({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>JP.OBJECT};return{...r,...VA(r),...M5t(r),...yRi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>JP.OBJECT};return{...t,...VA(t),...M5t(t),...yRi(t)}}}}function fRp({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=sRp(Xpa(t),s=>n.has(s)),l=r(Ypa(t,u)),d=i(Ypa(t,a));return l.ok&&d.ok?{ok:!0,value:{...l.value,...d.value}}:{ok:!1,errors:[...l.ok?[]:l.errors,...d.ok?[]:d.errors]}}function dRp(e){return!QPD(e)}function QPD(e){switch(e.getType()){case JP.ANY:case JP.UNKNOWN:case JP.OPTIONAL:return!0;default:return!1}}function pRp(e){return DAo(e)}function _Rp(e){let t={...v5s(e),_getRawProperties:()=>a1n(e)._getRawProperties(),_getParsedProperties:()=>a1n(e)._getParsedProperties()};return{...t,...VA(t),...M5t(t),...yRi(t)}}function EAo(e){let t={parse:(r,i)=>hRp(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>hRp(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>JP.LIST};return{...O5(t),...VA(t)}}function hRp(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:DM(e,"list"),path:[]}]}}function yRp(e){return _G(JP.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:DM(r,`"${e}"`)}]})()}function vRp(e){return _G(JP.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:DM(r,`${e.toString()}`)}]})()}var bRp=_G(JP.ANY,e=>({ok:!0,value:e}));var gRp=_G(JP.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DM(e,"boolean")}]});var ORp=_G(JP.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DM(e,"number")}]});var mRp=_G(JP.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DM(e,"string")}]});var PRp=_G(JP.UNKNOWN,e=>({ok:!0,value:e}));function wRp(e,t){let r={parse:(i,n)=>jRp({value:i,isKeyNumeric:e.getType()===JP.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>jRp({value:i,isKeyNumeric:e.getType()===JP.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>JP.RECORD};return{...O5(r),...VA(r)}}function jRp({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return sdi(e)?Kpa(e).reduce((a,[u,l])=>{if(l==null)return a;let d=a,s=u;if(t){let g=u.length>0?Number(u):NaN;isNaN(g)||(s=g)}let o=r(s),c=i(l,s);if(d.ok&&o.ok&&c.ok)return{ok:!0,value:{...d.value,[o.value]:c.value}};let b=[];return d.ok||b.push(...d.errors),o.ok||b.push(...o.errors),c.ok||b.push(...c.errors),{ok:!1,errors:b}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:DM(e,"object")}]}}function SRp(e){let t=EAo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:DM(i,"Set")}]},getType:()=>JP.SET};return{...O5(r),...VA(r)}}function ERp(e){let t={parse:(r,i)=>DRp((n,a)=>n.parse(r,a),e,i),json:(r,i)=>DRp((n,a)=>n.json(r,a),e,i),getType:()=>JP.UNDISCRIMINATED_UNION};return{...O5(t),...VA(t)}}function DRp(e,t,r){let i=[];for(let[n,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let l of u.errors)i.push({path:l.path,message:`[Variant ${n}] ${l.message}`})}return{ok:!1,errors:i}}function MRp(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function qRp(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=SAo(Xpa(t)),a={parse:(u,l)=>ARp({value:u,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.parse(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),json:(u,l)=>ARp({value:u,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),getType:()=>JP.UNION};return{...O5(a),...VA(a),...M5t(a)}}function ARp({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:l=[]}){if(!sdi(e))return{ok:!1,errors:[{path:l,message:DM(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:l,message:`Missing discriminant ("${t}")`}]};let o=i(d);if(!o.ok)return{ok:!1,errors:o.errors};let c=n(o.value);if(c==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...l,t],message:"Unexpected discriminant value"}]};let b=u(s,c);return b.ok?{ok:!0,value:{[r]:d,...b.value}}:b}var BO=At.objectWithoutOptionalProperties({title:At.string().optional()});var MAo=At.objectWithoutOptionalProperties({file:At.string()});var AAo=At.objectWithoutOptionalProperties({file:At.string()});var qAo=At.union("type",{openapi:MAo,protobuf:AAo}).transform({transform:e=>{switch(e.type){case"openapi":return wie.openapi(e);case"protobuf":return wie.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var ly=At.objectWithoutOptionalProperties({source:qAo.optional()});var TAo=At.objectWithoutOptionalProperties({typeName:At.string()});var CAo=At.union("type",{protobuf:TAo}).transform({transform:e=>{switch(e.type){case"protobuf":return t1n.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Die=At.objectWithoutOptionalProperties({encoding:CAo.optional()});var _f=At.objectWithoutOptionalProperties({description:At.string().optional()});var BAo=At.enum_(["GenerallyAvailable","Beta","Deprecated"]);var dh=At.objectWithoutOptionalProperties({availability:BAo.optional()});var tXt=At.number();var rXt=At.objectWithoutOptionalProperties({statusCode:tXt.optional()});var s0=At.objectWithoutOptionalProperties({nameOverride:At.string().optional(),generatedName:At.string()});var uE=At.objectWithoutOptionalProperties({inline:At.boolean().optional()});var JY=At.string();var KY=At.string();var xAo=At.objectWithoutOptionalProperties({id:KY}).extend(_f);var IAo=At.string();var zAo=At.objectWithoutOptionalProperties({usernameVariableName:At.string().optional(),usernameEnvVar:At.string().optional(),passwordVariableName:At.string().optional(),passwordEnvVar:At.string().optional()});var RAo=At.objectWithoutOptionalProperties({tokenVariableName:At.string().optional(),tokenEnvVar:At.string().optional()});var NAo=At.objectWithoutOptionalProperties({headerName:At.string(),prefix:At.string().optional(),headerVariableName:At.string().optional(),headerEnvVar:At.string().optional()});var FAo=At.objectWithoutOptionalProperties({queryParameterName:At.string()});var LAo=At.objectWithoutOptionalProperties({snake:At.string().optional(),camel:At.string().optional(),screamingSnake:At.string().optional(),pascal:At.string().optional()});var ldi=At.objectWithoutOptionalProperties({nameOverride:At.string().optional(),generatedName:At.string(),value:At.string(),casing:LAo.optional()}).extend(_f).extend(dh);var UAo=At.objectWithoutOptionalProperties({type:At.stringLiteral("namespace"),name:At.string()});var VAo=At.undiscriminatedUnion([At.string(),UAo]);var fdi=At.list(VAo);var xO=At.objectWithoutOptionalProperties({groupName:fdi.optional()});var o1n=At.objectWithoutOptionalProperties({default:ldi.optional(),values:At.list(ldi)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var WAo=At.objectWithoutOptionalProperties({scopesEnum:o1n.optional()});var HAo=At.union("type",{basic:zAo,bearer:RAo,header:NAo,query:FAo,oauth:WAo}).transform({transform:e=>{switch(e.type){case"basic":return g5.basic(e);case"bearer":return g5.bearer(e);case"header":return g5.header(e);case"query":return g5.query(e);case"oauth":return g5.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var Zpa=At.objectWithoutOptionalProperties({name:At.string().optional(),url:At.string(),audiences:At.list(At.string()).optional()}).extend(_f);var $Ao=At.string();var iXt=At.objectWithoutOptionalProperties({namespace:At.string().optional()});var O5s={};Co(O5s,{FullExample:()=>WA,FullObjectExample:()=>QAo,FullOneOfExample:()=>KAo,KeyValuePair:()=>JAo,LiteralExample:()=>GAo,PrimitiveExample:()=>s1n,PropertyKey:()=>u1n});var u1n=At.string();var s1n=At.union("type",{int:At.object({value:At.number()}),int64:At.object({value:At.number()}),uint:At.object({value:At.number()}),uint64:At.object({value:At.number()}),float:At.object({value:At.number()}),double:At.object({value:At.number()}),string:At.object({value:At.string()}),datetime:At.object({value:At.string()}),date:At.object({value:At.string()}),base64:At.object({value:At.string()}),boolean:At.object({value:At.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return u_.int(e.value);case"int64":return u_.int64(e.value);case"uint":return u_.uint(e.value);case"uint64":return u_.uint64(e.value);case"float":return u_.float(e.value);case"double":return u_.double(e.value);case"string":return u_.string(e.value);case"datetime":return u_.datetime(e.value);case"date":return u_.date(e.value);case"base64":return u_.base64(e.value);case"boolean":return u_.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var GAo=At.union("type",{boolean:At.object({value:At.boolean()}),string:At.object({value:At.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return r1n.boolean(e.value);case"string":return r1n.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var WA=At.union("type",{primitive:At.object({value:s1n}),object:At.lazyObject(()=>QAo),array:At.object({value:At.list(At.lazy(()=>WA))}),map:At.object({value:At.list(At.lazyObject(()=>JAo))}),enum:At.object({value:At.string()}),literal:At.object({value:GAo}),oneOf:At.object({value:At.lazy(()=>KAo)}),unknown:At.object({value:At.lazy(()=>WA)})}).transform({transform:e=>{switch(e.type){case"primitive":return rg.primitive(e.value);case"object":return rg.object(e);case"array":return rg.array(e.value);case"map":return rg.map(e.value);case"enum":return rg.enum(e.value);case"literal":return rg.literal(e.value);case"oneOf":return rg.oneOf(e.value);case"unknown":return rg.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var QAo=At.objectWithoutOptionalProperties({properties:At.record(u1n,At.lazy(()=>WA))});var JAo=At.objectWithoutOptionalProperties({key:s1n,value:At.lazy(()=>WA)});var KAo=At.union("type",{discriminated:At.object({value:At.record(u1n,At.lazy(()=>WA))}),undiscriminated:At.object({value:At.lazy(()=>WA)})}).transform({transform:e=>{switch(e.type){case"discriminated":return odi.discriminated(e.value);case"undiscriminated":return odi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var m5s={};Co(m5s,{AllOfPropertyConflict:()=>w1n,ArraySchema:()=>Rqo,Availability:()=>BAo,BooleanSchema:()=>Tqo,CasingOverrides:()=>LAo,CommonProperty:()=>$qo,CursorPagination:()=>yqo,CustomCodeSample:()=>_qo,CustomCodeSampleLanguage:()=>fqo,CustomCodeSampleSdk:()=>pqo,CustomPagination:()=>bqo,DiscriminatedOneOfSchema:()=>Wqo,DoubleSchema:()=>Aqo,Endpoint:()=>gqo,EndpointExample:()=>g1n,EndpointResponseExample:()=>lqo,EndpointSdkName:()=>nXt,EnumSchema:()=>o1n,EnumValue:()=>ldi,ErrorExample:()=>aqo,FernExample:()=>uqo,FileResponse:()=>_1n,FileSchema:()=>ZAo,FullEndpointExample:()=>hqo,GlobalHeader:()=>Bqo,Header:()=>ddi,HeaderExample:()=>b1n,HttpEndpointServer:()=>y1n,HttpError:()=>oqo,HttpMethod:()=>c1n,IdempotencyHeader:()=>xqo,IntSchema:()=>Eqo,JsonRequest:()=>rqo,JsonResponse:()=>h1n,LiteralSchema:()=>j1n,LiteralSchemaValue:()=>Iqo,LongSchema:()=>Mqo,MapSchema:()=>Nqo,MultipartRequest:()=>p1n,MultipartRequestProperty:()=>tqo,MultipartRequestPropertyEncoding:()=>eqo,MultipartSchema:()=>kAo,NullableSchema:()=>Lqo,ObjectProperty:()=>Vqo,ObjectPropertyConflictInfo:()=>S1n,ObjectSchema:()=>zqo,OctetStreamRequest:()=>d1n,OffsetPagination:()=>vqo,OneOfSchema:()=>Uqo,OpenApiIntermediateRepresentation:()=>TRp,OptionalSchema:()=>Fqo,Pagination:()=>O1n,PathParameter:()=>l1n,PathParameterExample:()=>sqo,PrimitiveSchema:()=>_di,PrimitiveSchemaValue:()=>Cqo,QueryParameter:()=>f1n,QueryParameterExample:()=>v1n,ReferencedSchema:()=>aXt,Request:()=>iqo,Response:()=>nqo,Schema:()=>IO,Schemas:()=>Dqo,SdkGroupInfo:()=>YAo,StreamingResponseExample:()=>cqo,StringSchema:()=>qqo,SupportedSdkLanguage:()=>dqo,Tags:()=>XAo,TextResponse:()=>pdi,UnDiscriminatedOneOfSchema:()=>Hqo,Webhook:()=>Oqo,WebhookExampleCall:()=>P1n,WebhookHttpMethod:()=>m1n,WebsocketChannel:()=>Sqo,WebsocketHandshake:()=>mqo,WebsocketMessageExample:()=>jqo,WebsocketServer:()=>Pqo,WebsocketSessionExample:()=>wqo});var YAo=At.objectWithoutOptionalProperties({summary:At.string().optional(),description:At.string().optional()});var XAo=At.objectWithoutOptionalProperties({tagsById:At.record(KY,xAo),orderedTagIds:At.list(KY).optional()});var c1n=At.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var l1n=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>IO),variableReference:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var f1n=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>IO),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var ddi=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>IO),env:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var nXt=At.objectWithoutOptionalProperties({groupName:fdi,methodName:At.string()});var d1n=At.objectWithoutOptionalProperties({}).extend(_f).extend(ly);var ZAo=At.objectWithoutOptionalProperties({isOptional:At.boolean(),isArray:At.boolean()}).extend(_f);var kAo=At.union("type",{file:ZAo,json:At.object({value:At.lazy(()=>IO)})}).transform({transform:e=>{switch(e.type){case"file":return vze.file(e);case"json":return vze.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var eqo=At.enum_(["json","form"]);var tqo=At.objectWithoutOptionalProperties({key:At.string(),schema:kAo,contentType:At.string().optional(),exploded:At.boolean().optional(),encoding:eqo.optional()}).extend(_f);var p1n=At.objectWithoutOptionalProperties({name:At.string().optional(),properties:At.list(tqo)}).extend(_f).extend(ly);var rqo=At.objectWithoutOptionalProperties({schema:At.lazy(()=>IO),contentType:At.string().optional(),additionalProperties:At.boolean()}).extend(_f).extend(ly);var iqo=At.union("type",{octetStream:d1n,multipart:p1n,json:rqo}).transform({transform:e=>{switch(e.type){case"octetStream":return udi.octetStream(e);case"multipart":return udi.multipart(e);case"json":return udi.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var _1n=At.objectWithoutOptionalProperties({}).extend(_f).extend(ly).extend(rXt);var h1n=At.objectWithoutOptionalProperties({schema:At.lazy(()=>IO),responseProperty:At.string().optional()}).extend(_f).extend(ly).extend(rXt);var pdi=At.objectWithoutOptionalProperties({}).extend(_f).extend(ly).extend(rXt);var nqo=At.union("type",{file:_1n,json:h1n,text:pdi,streamingSse:h1n,streamingText:pdi,streamingJson:h1n}).transform({transform:e=>{switch(e.type){case"file":return Sie.file(e);case"json":return Sie.json(e);case"text":return Sie.text(e);case"streamingSse":return Sie.streamingSse(e);case"streamingText":return Sie.streamingText(e);case"streamingJson":return Sie.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var aqo=At.objectWithoutOptionalProperties({name:At.string().optional(),description:At.string().optional(),example:At.lazy(()=>WA)});var oqo=At.objectWithoutOptionalProperties({schema:At.lazy(()=>IO).optional(),examples:At.list(aqo).optional()}).extend(_f).extend(s0).extend(ly);var y1n=At.objectWithoutOptionalProperties({name:At.string().optional(),url:At.string().optional(),audiences:At.list(At.string()).optional()});var uqo=At.unknown();var sqo=At.objectWithoutOptionalProperties({name:At.string(),parameterNameOverride:At.string().optional(),value:At.lazy(()=>WA)});var v1n=At.objectWithoutOptionalProperties({name:At.string(),value:At.lazy(()=>WA)});var b1n=At.objectWithoutOptionalProperties({name:At.string(),value:At.lazy(()=>WA)});var cqo=At.objectWithoutOptionalProperties({sse:At.boolean(),events:At.list(At.lazy(()=>WA))});var lqo=At.union("type",{withStreaming:cqo,withoutStreaming:At.object({value:At.lazy(()=>WA)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return yze.withStreaming(e);case"withoutStreaming":return yze.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var fqo=At.objectWithoutOptionalProperties({name:At.string().optional(),language:At.string(),code:At.string(),install:At.string().optional()}).extend(_f);var dqo=At.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var pqo=At.objectWithoutOptionalProperties({name:At.string().optional(),sdk:dqo,code:At.string()}).extend(_f);var _qo=At.union("type",{language:fqo,sdk:pqo}).transform({transform:e=>{switch(e.type){case"language":return kJr.language(e);case"sdk":return kJr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var hqo=At.objectWithoutOptionalProperties({name:At.string().optional(),pathParameters:At.list(sqo).optional(),queryParameters:At.list(v1n).optional(),headers:At.list(b1n).optional(),request:At.lazy(()=>WA).optional(),response:lqo.optional(),codeSamples:At.list(_qo)}).extend(_f);var g1n=At.union("type",{unknown:At.object({value:uqo}),full:hqo}).transform({transform:e=>{switch(e.type){case"unknown":return E5t.unknown(e.value);case"full":return E5t.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var yqo=At.objectWithoutOptionalProperties({cursor:At.string(),nextCursor:At.property("next_cursor",At.string()),results:At.string()});var vqo=At.objectWithoutOptionalProperties({offset:At.string(),results:At.string(),step:At.string().optional(),hasNextPage:At.string().optional()});var bqo=At.objectWithoutOptionalProperties({results:At.string()});var O1n=At.union("type",{cursor:yqo,offset:vqo,custom:bqo}).transform({transform:e=>{switch(e.type){case"cursor":return hze.cursor(e);case"offset":return hze.offset(e);case"custom":return hze.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var gqo=At.objectWithoutOptionalProperties({authed:At.boolean(),internal:At.boolean().optional(),idempotent:At.boolean().optional(),method:c1n,audiences:At.list(At.string()),path:At.string(),summary:At.string().optional(),operationId:At.string().optional(),tags:At.list(KY),pathParameters:At.list(l1n),queryParameters:At.list(f1n),headers:At.list(ddi),sdkName:nXt.optional(),generatedRequestName:At.string(),requestNameOverride:At.string().optional(),request:iqo.optional(),response:nqo.optional(),errors:At.record(tXt,oqo),servers:At.list(y1n),examples:At.list(g1n),pagination:O1n.optional()}).extend(_f).extend(dh).extend(ly).extend(iXt);var m1n=At.enum_(["GET","POST"]);var P1n=At.objectWithoutOptionalProperties({name:At.string().optional(),payload:At.lazy(()=>WA)}).extend(_f);var Oqo=At.objectWithoutOptionalProperties({sdkName:nXt.optional(),method:m1n,summary:At.string().optional(),operationId:At.string(),tags:At.list(KY),headers:At.list(ddi),generatedPayloadName:At.string(),payload:At.lazy(()=>IO),examples:At.list(P1n)}).extend(_f).extend(ly).extend(iXt);var mqo=At.objectWithoutOptionalProperties({queryParameters:At.list(f1n),headers:At.list(ddi),pathParameters:At.list(l1n)});var Pqo=At.objectWithoutOptionalProperties({name:At.string(),url:At.string()});var jqo=At.objectWithoutOptionalProperties({messageType:At.string(),payload:At.lazy(()=>WA)}).extend(_f);var wqo=At.objectWithoutOptionalProperties({name:At.string().optional(),queryParameters:At.list(v1n).optional(),headers:At.list(b1n).optional(),messages:At.list(jqo)}).extend(_f);var Sqo=At.objectWithoutOptionalProperties({audiences:At.list(At.string()),path:At.string(),groupName:fdi,summary:At.string().optional(),handshake:mqo,publish:At.lazy(()=>IO).optional(),subscribe:At.lazy(()=>IO).optional(),servers:At.list(Pqo),examples:At.list(wqo)}).extend(_f).extend(ly);var Dqo=At.objectWithoutOptionalProperties({rootSchemas:At.record(JY,At.lazy(()=>IO)),namespacedSchemas:At.record($Ao,At.record(JY,At.lazy(()=>IO)))});var Eqo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional()});var Mqo=At.objectWithoutOptionalProperties({default:At.number().optional()});var Aqo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional()});var qqo=At.objectWithoutOptionalProperties({default:At.string().optional(),pattern:At.string().optional(),format:At.string().optional(),minLength:At.number().optional(),maxLength:At.number().optional()});var Tqo=At.objectWithoutOptionalProperties({default:At.boolean().optional()});var Cqo=At.union("type",{int:Eqo,int64:Mqo,uint:At.object({}),uint64:At.object({}),float:At.object({}),double:Aqo,string:qqo,datetime:At.object({}),date:At.object({}),base64:At.object({}),boolean:Tqo}).transform({transform:e=>{switch(e.type){case"int":return vj.int(e);case"int64":return vj.int64(e);case"uint":return vj.uint();case"uint64":return vj.uint64();case"float":return vj.float();case"double":return vj.double(e);case"string":return vj.string(e);case"datetime":return vj.datetime();case"date":return vj.date();case"base64":return vj.base64();case"boolean":return vj.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var _di=At.objectWithoutOptionalProperties({schema:Cqo}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO);var Bqo=At.objectWithoutOptionalProperties({header:At.string(),name:At.string().optional(),optional:At.boolean().optional(),env:At.string().optional(),schema:At.lazy(()=>IO).optional()});var xqo=At.objectWithoutOptionalProperties({header:At.string(),name:At.string().optional(),env:At.string().optional(),schema:At.lazy(()=>IO).optional()});var TRp=At.objectWithoutOptionalProperties({apiVersion:At.unknown().optional(),title:At.string().optional(),description:At.string().optional(),basePath:At.string().optional(),servers:At.list(Zpa),websocketServers:At.list(Zpa),groups:At.record(At.string(),YAo),tags:XAo,hasEndpointsMarkedInternal:At.boolean(),endpoints:At.list(gqo),webhooks:At.list(Oqo),channels:At.record(At.string(),Sqo),groupedSchemas:Dqo,variables:At.record(At.string(),_di),nonRequestReferencedSchemas:At.set(JY),securitySchemes:At.record(IAo,HAo),globalHeaders:At.list(Bqo).optional(),idempotencyHeaders:At.list(xqo).optional()});var aXt=At.objectWithoutOptionalProperties({schema:JY}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO);var Iqo=At.union("type",{boolean:At.object({value:At.boolean()}),string:At.object({value:At.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return cx.boolean(e.value);case"string":return cx.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var j1n=At.objectWithoutOptionalProperties({value:Iqo}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO);var IO=At.union("type",{primitive:_di,object:At.lazyObject(()=>zqo),array:At.lazyObject(()=>Rqo),map:At.lazyObject(()=>Nqo),optional:At.lazyObject(()=>Fqo),enum:o1n,reference:aXt,literal:j1n,oneOf:At.object({value:At.lazy(()=>Uqo)}),nullable:At.lazyObject(()=>Lqo),unknown:s0}).transform({transform:e=>{switch(e.type){case"primitive":return gy.primitive(e);case"object":return gy.object(e);case"array":return gy.array(e);case"map":return gy.map(e);case"optional":return gy.optional(e);case"enum":return gy.enum(e);case"reference":return gy.reference(e);case"literal":return gy.literal(e);case"oneOf":return gy.oneOf(e.value);case"nullable":return gy.nullable(e);case"unknown":return gy.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var w1n=At.objectWithoutOptionalProperties({propertyKey:At.string(),allOfSchemaIds:At.list(JY),conflictingTypeSignatures:At.boolean()});var zqo=At.objectWithoutOptionalProperties({allOf:At.list(aXt),properties:At.list(At.lazyObject(()=>Vqo)),allOfPropertyConflicts:At.list(w1n),additionalProperties:At.boolean()}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var S1n=At.objectWithoutOptionalProperties({differentSchema:At.boolean()});var Vqo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>IO),readonly:At.boolean().optional(),writeonly:At.boolean().optional(),conflict:At.record(JY,S1n),generatedName:At.string(),nameOverride:At.string().optional(),audiences:At.list(At.string())}).extend(dh);var Rqo=At.objectWithoutOptionalProperties({value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO).extend(uE);var Nqo=At.objectWithoutOptionalProperties({key:_di,value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(BO).extend(uE);var Fqo=At.objectWithoutOptionalProperties({value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO).extend(uE);var Lqo=At.objectWithoutOptionalProperties({value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO).extend(uE);var Uqo=At.union("type",{discriminated:At.lazyObject(()=>Wqo),undiscriminated:At.lazyObject(()=>Hqo)}).transform({transform:e=>{switch(e.type){case"discriminated":return eKr.discriminated(e);case"undiscriminated":return eKr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Wqo=At.objectWithoutOptionalProperties({discriminantProperty:At.string(),commonProperties:At.list(At.lazyObject(()=>$qo)),schemas:At.record(At.string(),At.lazy(()=>IO))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var $qo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>IO)});var Hqo=At.objectWithoutOptionalProperties({schemas:At.list(At.lazy(()=>IO))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var P5s={};Co(P5s,{ArraySchemaWithExample:()=>fTo,Base64WithExample:()=>oTo,BooleanWithExample:()=>uTo,CommonPropertyWithExample:()=>OTo,DateWithExample:()=>aTo,DatetimeWithExample:()=>nTo,DiscriminatedOneOfSchemaWithExample:()=>bTo,DoubleWithExample:()=>rTo,EndpointWithExample:()=>BRp,EnumSchemaWithExample:()=>cTo,FloatWithExample:()=>tTo,HeaderWithExample:()=>hdi,HttpErrorWithExample:()=>Yqo,Int64WithExample:()=>Zqo,IntWithExample:()=>Xqo,JsonRequestWithExample:()=>Qqo,JsonResponseWithExample:()=>E1n,MapSchemaWithExample:()=>dTo,NamedFullExample:()=>oXt,NullableSchemaWithExample:()=>_To,ObjectPropertyWithExample:()=>vTo,ObjectSchemaWithExample:()=>hTo,OneOfSchemaWithExample:()=>yTo,OptionalSchemaWithExample:()=>pTo,PathParameterWithExample:()=>Gqo,PrimitiveSchemaValueWithExample:()=>sTo,PrimitiveSchemaWithExample:()=>M1n,QueryParameterWithExample:()=>D1n,RequestWithExample:()=>Jqo,ResponseWithExample:()=>Kqo,SchemaWithExample:()=>EM,StringSchemaWithExample:()=>iTo,Uint64WithExample:()=>eTo,UintWithExample:()=>kqo,UnDiscriminatedOneOfSchemaWithExample:()=>gTo,UnknownSchemaWithExample:()=>lTo,WebhookWithExample:()=>xRp,WebsocketHandshakeWithExample:()=>CRp});var oXt=At.objectWithoutOptionalProperties({name:At.string().optional(),value:At.unknown()}).extend(_f);var D1n=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>EM),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var hdi=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>EM),env:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var CRp=At.objectWithoutOptionalProperties({queryParameters:At.list(D1n),headers:At.list(hdi)});var Gqo=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>EM),variableReference:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var Qqo=At.objectWithoutOptionalProperties({schema:At.lazy(()=>EM),contentType:At.string().optional(),fullExamples:At.list(oXt).optional(),additionalProperties:At.boolean()}).extend(_f).extend(ly);var Jqo=At.union("type",{octetStream:d1n,multipart:p1n,json:Qqo}).transform({transform:e=>{switch(e.type){case"octetStream":return VSe.octetStream(e);case"multipart":return VSe.multipart(e);case"json":return VSe.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var E1n=At.objectWithoutOptionalProperties({schema:At.lazy(()=>EM),responseProperty:At.string().optional(),fullExamples:At.list(oXt).optional()}).extend(_f).extend(ly).extend(rXt);var Kqo=At.union("type",{file:_1n,json:E1n,text:pdi,streamingSse:E1n,streamingText:pdi,streamingJson:E1n}).transform({transform:e=>{switch(e.type){case"file":return lx.file(e);case"json":return lx.json(e);case"text":return lx.text(e);case"streamingSse":return lx.streamingSse(e);case"streamingText":return lx.streamingText(e);case"streamingJson":return lx.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Yqo=At.objectWithoutOptionalProperties({statusCode:tXt,schema:At.lazy(()=>EM),fullExamples:At.list(oXt).optional()}).extend(_f).extend(s0).extend(ly);var BRp=At.objectWithoutOptionalProperties({authed:At.boolean(),internal:At.boolean().optional(),idempotent:At.boolean().optional(),method:c1n,audiences:At.list(At.string()),path:At.string(),summary:At.string().optional(),operationId:At.string().optional(),tags:At.list(KY),pathParameters:At.list(Gqo),queryParameters:At.list(D1n),headers:At.list(hdi),sdkName:nXt.optional(),generatedRequestName:At.string(),requestNameOverride:At.string().optional(),request:Jqo.optional(),response:Kqo.optional(),errors:At.record(tXt,Yqo),servers:At.list(y1n),examples:At.list(g1n),pagination:O1n.optional()}).extend(_f).extend(dh).extend(ly).extend(iXt);var xRp=At.objectWithoutOptionalProperties({sdkName:nXt.optional(),method:m1n,summary:At.string().optional(),operationId:At.string(),tags:At.list(KY),headers:At.list(hdi),generatedPayloadName:At.string(),payload:At.lazy(()=>EM),examples:At.list(P1n)}).extend(_f).extend(ly).extend(iXt);var Xqo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional(),example:At.number().optional()});var Zqo=At.objectWithoutOptionalProperties({default:At.number().optional(),example:At.number().optional()});var kqo=At.objectWithoutOptionalProperties({default:At.number().optional(),example:At.number().optional()});var eTo=At.objectWithoutOptionalProperties({default:At.number().optional(),example:At.number().optional()});var tTo=At.objectWithoutOptionalProperties({example:At.number().optional()});var rTo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional(),example:At.number().optional()});var iTo=At.objectWithoutOptionalProperties({default:At.string().optional(),pattern:At.string().optional(),format:At.string().optional(),minLength:At.number().optional(),maxLength:At.number().optional(),example:At.string().optional()});var nTo=At.objectWithoutOptionalProperties({example:At.string().optional()});var aTo=At.objectWithoutOptionalProperties({example:At.string().optional()});var oTo=At.objectWithoutOptionalProperties({example:At.string().optional()});var uTo=At.objectWithoutOptionalProperties({default:At.boolean().optional(),example:At.boolean().optional()});var sTo=At.union("type",{int:Xqo,int64:Zqo,uint:kqo,uint64:eTo,float:tTo,double:rTo,string:iTo,datetime:nTo,date:aTo,base64:oTo,boolean:uTo}).transform({transform:e=>{switch(e.type){case"int":return Xd.int(e);case"int64":return Xd.int64(e);case"uint":return Xd.uint(e);case"uint64":return Xd.uint64(e);case"float":return Xd.float(e);case"double":return Xd.double(e);case"string":return Xd.string(e);case"datetime":return Xd.datetime(e);case"date":return Xd.date(e);case"base64":return Xd.base64(e);case"boolean":return Xd.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var M1n=At.objectWithoutOptionalProperties({schema:sTo}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO);var cTo=At.objectWithoutOptionalProperties({default:ldi.optional(),values:At.list(ldi),example:At.string().optional()}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var lTo=At.objectWithoutOptionalProperties({example:At.unknown()}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO);var EM=At.union("type",{primitive:M1n,object:At.lazyObject(()=>hTo),array:At.lazyObject(()=>fTo),map:At.lazyObject(()=>dTo),optional:At.lazyObject(()=>pTo),enum:cTo,reference:aXt,literal:j1n,oneOf:At.object({value:At.lazy(()=>yTo)}),nullable:At.lazyObject(()=>_To),unknown:lTo}).transform({transform:e=>{switch(e.type){case"primitive":return El.primitive(e);case"object":return El.object(e);case"array":return El.array(e);case"map":return El.map(e);case"optional":return El.optional(e);case"enum":return El.enum(e);case"reference":return El.reference(e);case"literal":return El.literal(e);case"oneOf":return El.oneOf(e.value);case"nullable":return El.nullable(e);case"unknown":return El.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var fTo=At.objectWithoutOptionalProperties({value:At.lazy(()=>EM),example:At.list(At.unknown()).optional()}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO).extend(uE);var dTo=At.objectWithoutOptionalProperties({key:M1n,value:At.lazy(()=>EM),example:At.unknown().optional()}).extend(xO).extend(s0).extend(_f).extend(dh).extend(Die).extend(BO).extend(uE);var pTo=At.objectWithoutOptionalProperties({value:At.lazy(()=>EM)}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO).extend(uE);var _To=At.objectWithoutOptionalProperties({value:At.lazy(()=>EM)}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO).extend(uE);var hTo=At.objectWithoutOptionalProperties({allOf:At.list(aXt),properties:At.list(At.lazyObject(()=>vTo)),allOfPropertyConflicts:At.list(w1n),fullExamples:At.list(oXt).optional(),additionalProperties:At.boolean()}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var vTo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>EM),readonly:At.boolean().optional(),writeonly:At.boolean().optional(),audiences:At.list(At.string()),conflict:At.record(JY,S1n),nameOverride:At.string().optional(),generatedName:At.string()}).extend(dh);var yTo=At.union("type",{discriminated:At.lazyObject(()=>bTo),undiscriminated:At.lazyObject(()=>gTo)}).transform({transform:e=>{switch(e.type){case"discriminated":return QY.discriminated(e);case"undiscriminated":return QY.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var bTo=At.objectWithoutOptionalProperties({discriminantProperty:At.string(),commonProperties:At.list(At.lazyObject(()=>OTo)),schemas:At.record(At.string(),At.lazy(()=>EM))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var OTo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>EM)});var gTo=At.objectWithoutOptionalProperties({schemas:At.list(At.lazy(()=>EM))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var IRp=/^(\d+)/,A1n=/^[a-zA-Z][a-zA-Z0-9_]*$/,zRp={"<":"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 ydi(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","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 u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${ydi(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${ydi(a)}`}function kpa(e){let t=e.match(IRp);if(t&&t[0]!=null){let r=t[0],i=e.substring(r.length),n=parseFloat(r);if(!isNaN(n)&&isFinite(n)){let a=ydi(n);return i.length>0?`${a}_${i}`:a}}}function q1n(e){let t=kpa(e),r=zRp[e];return t!=null?G3(Dg(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":G3(Dg(e)))}function Eie(e,t){return e.type==="primitive"&&t.type==="primitive"?RRp(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?JPD(e.values,t.values):e.type==="array"&&t.type==="array"?Eie(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"?Eie(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?KPD(e.value,t.value):e.type==="object"&&t.type==="object"?YPD(e,t):e.type==="map"&&t.type==="map"?RRp(e.key.schema,t.key.schema)&&Eie(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function RRp(e,t){return e.type===t.type}function JPD(e,t){let r=new Set(...e.map(n=>n.value)),i=new Set(...t.map(n=>n.value));return F1e(r,i)}function KPD(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,i])=>{let n=t.schemas[r];return n==null?!1:Eie(i,n)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,i)=>{let n=t.schemas[i];return n==null?!1:Eie(r,n)}):!1}function YPD(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(i=>[i.key,i.schema]));return Object.entries(t.properties).every(([i,n])=>{let a=r[i];return a==null?!1:Eie(a,n.schema)})}var j2;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(j2||(j2={}));var mTo=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:i,environmentOverrides:n,globalHeaderOverrides:a,authOverrides:u}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=n,this.authOverrides=u,this.globalHeaderOverrides=a,this.detectGlobalHeaders=i?.detectGlobalHeaders??!0,this.objectQueryParameters=i?.objectQueryParameters??!1,this.respectReadonlySchemas=i?.respectReadonlySchemas??!1,this.respectNullableSchemas=i?.respectNullableSchemas??!1,this.onlyIncludeReferencedSchemas=i?.onlyIncludeReferencedSchemas??!1,this.inlinePathParameters=i?.inlinePathParameters??!1,this.referencedSchemaIds=i?.onlyIncludeReferencedSchemas?new Set:void 0,this.enableUniqueErrorsPerEndpoint=i?.enableUniqueErrorsPerEndpoint??!1,this.builder=new hRi(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let l={};if(!this.enableUniqueErrorsPerEndpoint)for(let d of r.endpoints)for(let[s,o]of Object.entries(d.errors)){let c=parseInt(s),b=l[c];b==null&&o.schema!=null?l[c]=o.schema:b!=null&&o.schema!=null&&Eie(b,o.schema)||this.unknownSchema.add(c)}}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}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.onlyIncludeReferencedSchemas&&this.isInAnyState(j2.Channel,j2.Endpoint,j2.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:Fo(t)}}markObjectSchemaAsReferenced(t,r){for(let i of t.allOf)this.markSchemaIdAsReferenced(i.schema,r);for(let i of t.properties)this.markSchemaAsReferenced(i.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let i of Object.values(t.schemas))this.markSchemaAsReferenced(i,r);return;case"undiscriminated":for(let i of t.schemas)this.markSchemaAsReferenced(i,r);return;default:Fo(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let i=this.getSchema(t,r);i!=null&&this.markSchemaAsReferenced(i,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function fI(e){switch(e){case pV.Deprecated:return"deprecated";case pV.Beta:return"pre-release";case pV.GenerallyAvailable:return"generally-available";default:return}}function XPD(e){let t=e.find(i=>typeof i=="object"&&i.type==="namespace"),r=e.filter(i=>typeof i=="string"||i.type!=="namespace");return t?[t,...r]:r}function NRp(e){let t=e?XPD(e):void 0;if(t==null||t.length===0)return JTi;let r=[];for(let[i,n]of t.entries())if(typeof n=="string")r.push(Dg(n));else if(typeof n=="object")switch(n.type){case"namespace":{i<t.length-1?r.push(Dg(n.name)):r.push(n.name,JTi);break}default:Fo(n.type)}else Fo(n);return r.join("/")}function T1n(e){return sy.of(`${NRp(e)}.yml`)}function j5s({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?JTi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(i=>typeof i=="string"||i.type!=="namespace")]:r=e.groupName,NRp(r))}function FRp({sdkName:e,namespaceOverride:t}){return sy.of(`${j5s({sdkName:e,namespaceOverride:t})}.yml`)}function LRp({location:e,namespaceOverride:t}){return t!=null?PR(sy.of(t),e):e}function PTo(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Fo(e.type)}}function C1n(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;case"unknown":return;default:Fo(e)}}function MM(e){return typeof e=="string"?e:e.type}function B1n(e){if(typeof e!="string")return e.docs}function e_a(e){if(typeof e!="string")return e.default}function w5s(e){if(typeof e!="string")return e.validation}var ZPD=-2147483648,kPD=2147483647,ejD=-17976931348623157e292,tjD=17976931348623157e292;function H0({schema:e,fileContainingReference:t,declarationFile:r=t,context:i,namespace:n,declarationDepth:a}){switch(i.shouldMarkSchemaAsReferenced()&&i.markSchemaAsReferenced(e,n),e.type){case"primitive":return jTo(e);case"array":return E5s({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"map":return M5s({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"reference":return D5s({schema:e,fileContainingReference:t,context:i,namespace:n});case"unknown":return q5s();case"optional":return wTo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"nullable":return A5s({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"enum":return ljD({schema:e,fileContainingReference:t,context:i,declarationFile:r,declarationDepth:a});case"literal":return e.value,T5s(e);case"object":return fjD({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"oneOf":return djD({schema:e.value,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});default:Fo(e)}}function jTo(e){switch(e.schema.type){case"string":return njD({description:e.description,schema:e.schema});case"int":return ajD({description:e.description,schema:e.schema});case"float":return ojD({description:e.description,schema:e.schema});case"double":return ujD({description:e.description,schema:e.schema});case"boolean":return rjD({description:e.description,schema:e.schema});case"int64":return ijD({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",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:fI(e.availability)}:{}}}function rjD({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function ijD({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function njD({description:e,schema:t}){let r="string",i=sjD(t);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function ajD({description:e,schema:t}){let r="integer",i=VRp(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function ojD({description:e,schema:t}){let r="float";if(e==null)return r;let i={type:r};return e!=null&&(i.docs=e),i}function ujD({description:e,schema:t}){let r="double",i=VRp(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function sjD(e){if(e==null)return;let{format:t,pattern:r,minLength:i,maxLength:n}=e,a=cjD(t);if(!(a==null&&r==null&&i==null&&n==null))return{format:a,pattern:r,minLength:i,maxLength:n}}function cjD(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 VRp(e,t){if(e==null)return;let{minimum:r,maximum:i,multipleOf:n}=e,{exclusiveMinimum:a,exclusiveMaximum:u}=e;if(r=S5s(r,t),i=S5s(i,t),n=S5s(n,t),!(r==null&&i==null&&a==null&&u==null&&n==null))return{min:r,max:i,exclusiveMin:a,exclusiveMax:u,multipleOf:n}}function S5s(e,t){if(e===void 0)return;let[r,i]=t==="integer"?[ZPD,kPD]:[ejD,tjD];return e<r||e>i?void 0:e}function D5s({schema:e,fileContainingReference:t,context:r,namespace:i}){let n=r.getSchema(e.schema,i);if(n==null)return"unknown";let a=pjD(n)??e.schema,u=C1n(n),l=_jD(n),d=STo({context:r,fileContainingReference:t,declarationFile:T1n(u),type:a}),s=n.type==="nullable"?`optional<${d}>`:d;return e.description==null&&l==null?s:{type:n.type==="nullable"?`optional<${d}>`:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function E5s({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=`list<${MM(u)}>`;return e.description==null&&e.title==null?l:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{},type:l}}function M5s({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=jTo(e.key),l=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),d=e.encoding!=null?PTo(e.encoding):void 0,s=`map<${MM(u)}, ${MM(l)}>`;if(e.description==null&&d==null&&e.title==null)return s;let o={type:s};return e.description!=null&&(o.docs=e.description),e.encoding!=null&&(o.encoding=d),e.availability!=null&&(o.availability=fI(e.availability)),o}function A5s({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){if(!i.respectNullableSchemas)return wTo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});let u=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=MM(u),d=B1n(u),s=e_a(u),o=w5s(u),c=l.startsWith("nullable<")?l:`nullable<${l}>`;if(e.availability==null&&e.description==null&&d==null&&s==null&&o==null&&e.title==null)return URp({typeReference:c,itemType:l});let b={type:c};return(e.description!=null||d!=null)&&(b.docs=e.description??d),s!=null&&(b.default=s),o!=null&&(b.validation=o),e.availability!=null&&(b.availability=fI(e.availability)),URp({typeReference:b,itemType:l})}function wTo({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=MM(u),d=B1n(u),s=e_a(u),o=w5s(u),c=l.startsWith("optional<")?l:`optional<${l}>`;if(e.availability==null&&e.description==null&&d==null&&s==null&&o==null&&e.title==null)return c;let b={type:c};return(e.description!=null||d!=null)&&(b.docs=e.description??d),s!=null&&(b.default=s),o!=null&&(b.validation=o),e.availability!=null&&(b.availability=fI(e.availability)),b}function q5s(){return"unknown"}function T5s(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Fo(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function ljD({schema:e,fileContainingReference:t,declarationFile:r,context:i,declarationDepth:n}){let a=t_a(e,n),u=e.nameOverride??e.generatedName;i.builder.addType(r,{name:u,schema:a.schema});let l=STo({type:u,fileContainingReference:t,declarationFile:r,context:i});if(e.description==null&&e.default==null&&e.title==null)return l;let d={type:l};return e.description!=null&&(d.docs=e.description),e.default!=null&&(d.default=e.default.value),e.availability!=null&&(d.availability=fI(e.availability)),d}function fjD({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=C5s({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=e.nameOverride??e.generatedName;i.builder.addType(r,{name:l,schema:u.schema});let d=STo({type:l,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?d:{type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function djD({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=B5s({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=e.nameOverride??e.generatedName;i.builder.addType(r,{name:l,schema:u.schema});let d=STo({type:l,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?d:{...e.title!=null?{"display-name":e.title}:{},type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function STo({type:e,fileContainingReference:t,declarationFile:r,context:i}){if(r===t)return e;let n=i.builder.addImport({file:t,fileToImport:r});return n!=null?`${n}.${e}`:e}function pjD(e){return gy._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 _jD(e){return gy._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:()=>{}})}function URp({typeReference:e,itemType:t}){return t.startsWith("optional<")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}function tKr(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Fo(e)}}function HRp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a;switch(e.type){case"primitive":a=vjD(e);break;case"array":a=hjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"map":a=yjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"reference":a=bjD({schema:e,context:t,declarationFile:r,namespace:i});break;case"unknown":a=OjD(e.nameOverride,e.generatedName);break;case"optional":a=$Rp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"nullable":a=gjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"enum":a=t_a(e,n);break;case"literal":a=mjD(e,e.nameOverride,e.generatedName);break;case"object":a=C5s({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"oneOf":a=B5s({schema:e.value,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;default:Fo(e)}return a}function C5s({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=t.isInState(j2.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),u=!1,l={},d=new Set;for(let g of e.properties){if(g.readonly&&(u=!0),a&&g.readonly)continue;if(Object.keys(g.conflict).length>0){if(Object.entries(g.conflict).every(([D,C])=>!C.differentSchema))continue;Object.entries(g.conflict).forEach(([D])=>{x5s({property:g.key,schemaId:D,context:t,namespace:i}).forEach(R=>{d.add(R)})})}let O=H0({schema:g.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}),m=g.audiences,w=g.nameOverride,E=fI(g.availability),A=SjD(g);l[g.key]=wjD({typeReference:O,audiences:m,name:w,availability:E,propertyAccess:A})}let s=new Set;for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(O=>d.add(O)),g.conflictingTypeSignatures&&s.add(g.propertyKey);let o=[];for(let g of e.allOf){let O=GRp({schema:g.schema,context:t,namespace:i});if(O==null||d.has(g.schema)||d.has(O))continue;let m=H0({schema:gy.reference(g),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});o.push(MM(m))}for(let g of d){let O=I5s(t,g,i);for(let m of O.properties)l[m.key]==null&&(s.has(m.key)&&(l[m.key]="unknown"),l[m.key]=H0({schema:m.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}));for(let m of O.allOf){if(d.has(m.schema))continue;let w=H0({schema:gy.reference(m),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});o.push(MM(w))}}let c={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(l).map(([g,O])=>jjD(g)?[g,typeof O=="string"?{type:O,name:`_${g}`}:{...O,name:`_${g}`}]:[g,O]))};o.length>0&&(c.extends=o),e.additionalProperties&&(c["extra-properties"]=!0),e.availability!=null&&(c.availability=fI(e.availability)),e.source!=null&&(c.source=tKr(e.source)),c.inline=z5s(e,n);let b=e.nameOverride??e.generatedName;return{name:u&&t.respectReadonlySchemas&&!a?`${b}Read`:b,schema:c}}function x5s({property:e,schemaId:t,context:r,namespace:i}){let n=r.getSchema(t,i);if(n==null)return[];if(n.type==="reference")return x5s({property:e,schemaId:n.schema,context:r,namespace:i});if(n.type==="object"){let{properties:a,allOf:u}=I5s(r,t,i),l=a.some(s=>s.key===e),d=[...u.flatMap(s=>x5s({property:e,context:r,schemaId:s.schema,namespace:i}))];if(l||d.length>0)return[t,...d]}return[]}function I5s(e,t,r){let i=e.getSchema(t,r);if(i==null)return{properties:[],allOf:[]};if(i.type==="object")return{properties:i.properties,allOf:i.allOf};if(i.type==="reference")return I5s(e,i.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${i.type}`)}function hjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:E5s({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function yjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:M5s({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function vjD(e){let t=jTo(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...i}=t;return{name:e.nameOverride??e.generatedName,schema:{...i}}}function WRp(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function t_a(e,t){let r={enum:e.values.map(a=>{let u=a.nameOverride??a.generatedName,l=a.value;if(u===l&&a.description==null&&(a.casing==null||WRp(a.casing)))return u;let d={value:a.value};if(u!==l&&(d.name=u),a.description!=null&&(d.docs=a.description),a.casing!=null&&!WRp(a.casing)){let s={},o=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,o=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,o=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,o=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,o=!0),o&&(d.casing=s)}return d})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=z5s(e,t);let i=new Set,n={...r,enum:[],source:e.source!=null?tKr(e.source):void 0};for(let a of r.enum){let u=typeof a=="string"?a:a.name??a.value;i.has(u.toLowerCase())||(n.enum.push(a),i.add(u.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:n}}function bjD({schema:e,context:t,declarationFile:r,namespace:i}){return{name:e.nameOverride??e.generatedName,schema:D5s({schema:e,context:t,fileContainingReference:r,namespace:i})}}function gjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:A5s({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}:$Rp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n})}function $Rp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:wTo({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}}function OjD(e,t){return{name:e??t,schema:q5s()}}function mjD(e,t,r){return{name:t??r,schema:T5s(e)}}function B5s({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=e.encoding!=null?PTo(e.encoding):void 0;if(e.type==="discriminated"){let l={};for(let s of e.commonProperties)l[s.key]=H0({schema:s.schema,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1});let d={};for(let[s,o]of Object.entries(e.schemas))d[s]=H0({schema:o,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":l,docs:e.description??void 0,availability:e.availability!=null?fI(e.availability):void 0,union:d,encoding:a,source:e.source!=null?tKr(e.source):void 0}}}let u=[];for(let l of e.schemas)u.push(H0({schema:l,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:u,encoding:a,source:e.source!=null?tKr(e.source):void 0,inline:z5s(e,n)}}}var PjD=/^[0-9]/;function jjD(e){return PjD.test(e)}function GRp({schema:e,context:t,namespace:r}){let i=t.getSchema(e,r);if(i!=null)return i.type==="reference"?GRp({context:t,schema:i.schema,namespace:r}):e}function wjD({typeReference:e,audiences:t,name:r,availability:i,propertyAccess:n}){return t.length===0&&r==null&&i==null&&n==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...i!=null?{availability:i}:{},...n!=null?{access:n}:{}}}function z5s(e,t){return e.inline===!0||t>0?!0:void 0}function SjD(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return l2.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return l2.ObjectPropertyAccess.WriteOnly}}function QRp(e){let t=e.replace(/^x-|^X-/,"");return Dg(t)}var JRp="BasicAuthScheme",DTo="BearerAuthScheme";function KRp(e){if(e.authOverrides!=null){for(let[r,i]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:i});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,i]of Object.entries(e.ir.securitySchemes))if(i.type==="basic"){let n={scheme:"basic"};i.usernameVariableName!=null&&(n.username===void 0?n.username={name:i.usernameVariableName}:n.username.name=i.usernameVariableName),i.usernameEnvVar!=null&&(n.username===void 0?n.username={env:i.usernameEnvVar}:n.username.env=i.usernameEnvVar),i.passwordVariableName!=null&&(n.password===void 0?n.password={name:i.passwordVariableName}:n.password.name=i.passwordVariableName),i.passwordEnvVar!=null&&(n.password===void 0?n.password={env:i.passwordEnvVar}:n.password.env=i.passwordEnvVar),e.builder.addAuthScheme({name:JRp,schema:n}),t||(e.builder.setAuth(JRp),t=!0)}else if(i.type==="bearer"){let n={scheme:"bearer"};i.tokenVariableName!=null&&(n.token===void 0?n.token={name:i.tokenVariableName}:n.token.name=i.tokenVariableName),i.tokenEnvVar!=null&&(n.token===void 0?n.token={env:i.tokenEnvVar}:n.token.env=i.tokenEnvVar),e.builder.addAuthScheme({name:DTo,schema:n}),t||(e.builder.setAuth(DTo),t=!0)}else if(i.type==="header")if(t)e.builder.addGlobalHeader({name:i.headerName,schema:{type:"string",name:i.headerVariableName??QRp(i.headerName),env:i.headerEnvVar}});else{let n={header:i.headerName,name:i.headerVariableName??"apiKey",type:"string"};i.headerEnvVar!=null&&(n.env=i.headerEnvVar),i.prefix!=null&&(n.prefix=i.prefix),e.builder.addAuthScheme({name:r,schema:n}),e.builder.setAuth(r),t=!0}else if(i.type==="oauth"){let n={scheme:"bearer"};e.builder.addAuthScheme({name:DTo,schema:n}),t||(e.builder.setAuth(DTo),t=!0),i.scopesEnum!=null&&i.scopesEnum.values.length>0&&e.builder.addType(sy.of("__package__.yml"),{name:"OauthScope",schema:t_a(i.scopesEnum,0).schema})}}function uXt({header:e,context:t,fileContainingReference:r,namespace:i}){let n=H0({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),a=MM(n),u=e.name.replace(/^x-|^X-/,""),l=e.parameterNameOverride!=null?e.parameterNameOverride:Dg(u);if(e.description==null&&e.name===l&&e.env==null&&e.availability==null)return a;let d={type:a};return l!==e.name&&(d.name=l),e.description!=null&&(d.docs=e.description),e.env!=null&&(d.env=e.env),e.availability!=null&&(d.availability=fI(e.availability)),d}function ETo({pathParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=H0({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return MM(n);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:MM(n)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=fI(e.availability)),a}function ATo({queryParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=R5s({schema:e.schema,context:t,fileContainingReference:r,namespace:i});if(n==null)return;let a=MM(n.value),u=e_a(n.value);if(a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>"),e.description==null&&!n.allowMultiple&&u==null&&e.parameterNameOverride==null&&e.availability==null)return a;let l={type:a};return u!=null&&(l.default=u),n.allowMultiple&&(l["allow-multiple"]=!0),e.description!=null&&(l.docs=e.description),e.parameterNameOverride!=null&&(l.name=e.parameterNameOverride),e.availability!=null&&(l.availability=fI(e.availability)),DjD(n.value)&&n.value.validation!==void 0&&(l.validation=n.value.validation),l}function R5s({schema:e,context:t,fileContainingReference:r,namespace:i}){if(e.type==="reference"){let n=t.getSchema(e.schema,i);if(n==null)return;if(n.type==="array")return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,groupName:void 0,inline:void 0}),context:t,declarationFile:sy.of(X1),fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(n.type==="oneOf"&&n.value.type==="undiscriminated"){let a=[];for(let[u,l]of Object.entries(n.value.schemas))l.type==="literal"&&l.value.type==="string"&&(A1n.test(l.value.value)?a.push(l.value.value):a.push({value:l.value.value,name:q1n(l.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),{value:e.generatedName,allowMultiple:!1};if(n.value.schemas.length===2){let[u,l]=n.value.schemas;if(u!=null&&l!=null&&MTo({array:u,primitive:l}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:l,description:e.description,availability:e.availability,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(u!=null&&l!=null&&MTo({array:u,primitive:l}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0}}for(let[u,l]of Object.entries(n.value.schemas))return R5s({schema:l,context:t,fileContainingReference:r,namespace:i})}else if(t.objectQueryParameters)return{value:H0({schema:e,context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let n=t.getSchema(e.value.schema,i);if(n==null)return;if(n.type==="array")return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:H0({schema:e,context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let n=[];for(let[a,u]of Object.entries(e.value.value.schemas))u.type==="literal"&&u.value.type==="string"&&(A1n.test(u.value.value)?n.push(u.value.value):n.push({value:u.value.value,name:q1n(u.value.value)}));if(n.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:n}}),{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,u]=e.value.value.schemas;if(a!=null&&u!=null&&MTo({array:a,primitive:u}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(a!=null&&u!=null&&MTo({array:u,primitive:a}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0}}for(let[a,u]of Object.entries(e.value.value.schemas))return R5s({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:void 0,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i})}else if(e.value.type==="object")return t.objectQueryParameters?{value:H0({schema:e,context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:H0({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0}:{value:H0({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}function MTo({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function DjD(e){return e.type!=null}function YRp({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"]=EjD(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=MjD({context:t,namedFullExamples:e.headers}));for(let i of e.messages){let n=vdi(i.payload);n!=null&&r.messages.push({type:i.messageType,body:n})}return r}function EjD(e){let t={};return e.forEach(r=>{let i=vdi(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function MjD({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),i={};return t.forEach(n=>{let a=vdi(n.value);r.has(n.name)||a!=null&&(i[n.name]=a)}),i}function vdi(e){switch(e.type){case"primitive":return XRp(e.value);case"object":return ZRp(e.properties);case"array":return AjD(e.value);case"map":return qjD(e.value);case"oneOf":return TjD(e.value);case"enum":return e.value;case"literal":return CjD(e.value);case"unknown":return vdi(e.value);default:Fo(e)}}function XRp(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"date":return e.value;case"base64":case"boolean":return e.value;default:Fo(e)}}function ZRp(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,vdi(r)]))}function AjD(e){return e.map(t=>vdi(t))}function qjD(e){return Object.fromEntries(e.map(t=>[XRp(t.key),vdi(t.value)]))}function TjD(e){return e.type==="discriminated"?ZRp(e.value):vdi(e.value)}function CjD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Fo(e)}}function rKr(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function qTo(e,t){return t??(e?.groupName!=null?rKr(e.groupName):void 0)}function kRp({channel:e,context:t,declarationFile:r}){let i={path:e.path,url:e.servers[0]?.name,auth:!1};e.audiences!=null&&e.audiences.length>0&&(i.audiences=e.audiences),e.summary!=null&&(i["display-name"]=e.summary),e.description!=null&&(i.docs=e.description);let n=rKr(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let d of e.handshake.pathParameters)a[d.name]=ETo({pathParameter:d,context:t,fileContainingReference:r,namespace:n});Object.keys(a).length>0&&(i["path-parameters"]=a);let u={};if(e.handshake.queryParameters.length>0)for(let d of e.handshake.queryParameters){let s=ATo({queryParameter:d,context:t,fileContainingReference:r,namespace:n});s!=null&&(u[d.name]=s)}Object.keys(u).length>0&&(i["query-parameters"]=u);let l={};if(e.handshake.headers.length>0)for(let d of e.handshake.headers){let s=uXt({header:d,context:t,fileContainingReference:r,namespace:n});l[d.name]=s}Object.keys(l).length>0&&(i.headers=l),t.builder.addChannel(r,{channel:i}),e.subscribe!=null&&t.builder.addChannelMessage(r,{messageId:"subscribe",message:{origin:"server",body:H0({schema:e.subscribe,context:t,fileContainingReference:r,namespace:n,declarationDepth:0})}}),e.publish!=null&&t.builder.addChannelMessage(r,{messageId:"publish",message:{origin:"client",body:H0({schema:e.publish,context:t,fileContainingReference:r,namespace:n,declarationDepth:0})}});for(let d of e.examples){let s=YRp({context:t,websocketExample:d});t.builder.addChannelExample(r,{example:s})}}var iKr="Base",BjD="Default";function bdi(e){return Object.entries(e).reduce((t,[r,i])=>(Dbn(i)?Object.entries(i.urls).forEach(([n,a])=>{t[n]=a}):t[r]=typeof i=="string"?i:i.url,t),{})}function eNp(e){if(e.environmentOverrides!=null){for(let[g,O]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:g,schema:O});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=[];for(let g of e.ir.servers){let O=g.audiences?{url:g.url,audiences:g.audiences}:g.url;if(g.name==null){r.push(O);continue}t[g.name]=O}let i={},n=[];for(let g of e.ir.endpoints)for(let O of g.servers){if(O.url==null)continue;let m=O.audiences?{url:O.url,audiences:O.audiences}:O.url;if(O.name==null){n.push(m);continue}i[O.name]=m}let a={},u=[];for(let g of e.ir.websocketServers){let O=g.audiences?{url:g.url,audiences:g.audiences}:g.url;if(g.name==null){u.push(O);continue}a[g.name]=O}let l=Object.keys(t).length,d=l>0,s=Object.keys(i).length>0,o=Object.keys(a).length>0;if(!d&&!s&&o&&e.ir.servers.length===0){for(let[g,O]of Object.entries(a))e.builder.addEnvironment({name:g,schema:O});e.builder.setDefaultEnvironment(Object.keys(a)[0]),e.builder.setDefaultUrl(iKr);return}if(n.length>0&&e.logger.error(`Skipping endpoint level servers ${n.map(g=>typeof g=="string"?g:g.url).join(", ")} because x-fern-server-name was not provided.`),!d){let g=e.ir.servers[0]?.url,O=e.ir.servers[0]?.audiences;if(g!=null){let m=O?{url:g,audiences:O}:g;t[BjD]=m}}let c=Object.values(t).map(g=>typeof g=="string"?g:g.url),b=r.filter(g=>{let O=typeof g=="string"?g:g.url;return!c.includes(O)});if(b.length>0&&e.logger.error(`Skipping top level servers ${b.map(g=>typeof g=="string"?g:g.url).join(", ")} because x-fern-server-name was not provided.`),s)if(l===1){let g=Object.keys(t)[0],O=Object.values(t)[0],m=typeof O=="string"?O:O.url;e.builder.addEnvironment({name:g,schema:{urls:{[iKr]:m,...bdi(i),...bdi(a)}}}),e.builder.setDefaultEnvironment(g),e.builder.setDefaultUrl(iKr)}else{let g=!0;for(let[O,m]of Object.entries(t))g?(e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(i),...bdi(a)}}}),e.builder.setDefaultEnvironment(O),g=!1):e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(i),...bdi(a)}}});e.builder.setDefaultUrl(iKr)}else{let g=!0;for(let[O,m]of Object.entries(t))g?(o?e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(a)}}}):e.builder.addEnvironment({name:O,schema:m}),e.builder.setDefaultEnvironment(O),g=!1):o?e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(a)}}}):e.builder.addEnvironment({name:O,schema:m});o&&e.builder.setDefaultUrl(iKr)}}function TTo(e){return MM(e).startsWith("optional")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}var N5s=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},xjD=.75,IjD=new Set("authorization");function tNp(e){if(e.globalHeaderOverrides!=null){for(let[r,i]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:i});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,i]of Object.entries(t)){let n="optional<string>";if(i.name==null&&i.env==null&&typeof i.schema=="string")n=i.schema;else if(i!=null){let a=i.schema?C1n(i.schema):void 0,u=a!=null?rKr(a):void 0,l=sy.of("api.yml");n={name:i.name,env:i.env,type:i.schema!=null?MM(H0({schema:i.schema,context:e,fileContainingReference:u?PR(sy.of(Dg(u)),l):l,namespace:u,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:n})}if(e.detectGlobalHeaders){let r={};for(let n of e.ir.endpoints)for(let a of n.headers){if(IjD.has(a.name.toLowerCase()))continue;let u=r[a.name];if(u==null){let l=t[a.name],d=uXt({header:{...a,schema:l?.schema??a.schema,name:l?.name??a.name},fileContainingReference:sy.of(Q3),context:e,namespace:void 0});u=new N5s(d),r[a.name]=u}u.increment()}let i=e.ir.endpoints.length*xjD;for(let[n,a]of Object.entries(r)){let u=t[n],l=a.count===e.ir.endpoints.length,d=a.count>=i;u==null&&(l?e.builder.addGlobalHeader({name:n,schema:a.schema}):d&&e.builder.addGlobalHeader({name:n,schema:TTo(a.schema)}))}}}function rNp(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?C1n(t.schema):void 0,i=r!=null?rKr(r):void 0,n=uXt({header:{...t,schema:t.schema??gy.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,groupName:void 0,nameOverride:void 0,schema:vj.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},fileContainingReference:sy.of(Q3),context:e,namespace:i});e.builder.addIdempotencyHeader({name:t.header,schema:TTo(n)})}}function hG(e){switch(e.type){case"primitive":return nNp(e.value);case"object":return aNp(e.properties);case"array":return oNp(e.value);case"map":return RjD(e.value);case"oneOf":return NjD(e.value);case"enum":return e.value;case"literal":return FjD(e.value);case"unknown":return hG(e.value);default:Fo(e)}}function iNp(e){switch(e.type){case"withStreaming":return e.sse?{stream:zjD(e.events)}:{stream:oNp(e.events)};case"withoutStreaming":return{body:hG(e.value)};default:Fo(e)}}function nNp(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!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"date":return e.value;case"base64":case"boolean":return e.value;default:Fo(e)}}function aNp(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,hG(r)]))}function zjD(e){return e.map(t=>({event:"",data:hG(t)}))}function oNp(e){return e.map(t=>hG(t))}function RjD(e){return Object.fromEntries(e.map(t=>[nNp(t.key),hG(t.value)]))}function NjD(e){return e.type==="discriminated"?aNp(e.value):hG(e.value)}function FjD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Fo(e)}}function uNp({endpointExample:e,context:t}){let r={};return e.type!=="full"?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"]=LjD(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=UjD(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=VjD({context:t,namedFullExamples:e.headers})),e.request!=null&&(r.request=hG(e.request)),e.response!=null&&(r.response=iNp(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(i=>i.type==="language"?{name:i.name??void 0,docs:i.description??void 0,language:i.language,code:i.code,install:i.install??void 0}:{name:i.name??void 0,docs:i.description??void 0,sdk:i.sdk,code:i.code}).filter(Qb)),r)}function LjD(e){let t={};return e.forEach(r=>{let i=hG(r.value);i!=null&&(t[r.parameterNameOverride??r.name]=i)}),t}function UjD(e){let t={};return e.forEach(r=>{let i=hG(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function VjD({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),i={};return t.forEach(n=>{let a=hG(n.value);r.has(n.name)||a!=null&&(i[n.name]=a)}),i}function sNp(e){return pG._visit(e,{get:()=>l2.HttpMethodSchema.Get,post:()=>l2.HttpMethodSchema.Post,put:()=>l2.HttpMethodSchema.Put,patch:()=>l2.HttpMethodSchema.Patch,delete:()=>l2.HttpMethodSchema.Delete,head:()=>{throw new Error("HEAD is unsupported")},options:()=>{throw new Error("HEAD is unsupported")},trace:()=>{throw new Error("HEAD is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function cNp(e){return e==="POST"||e==="PUT"||e==="PATCH"}function lNp({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:i}=r.ir,n=[],a=new Set,u=e.path,l=qTo(e.sdkName,e.namespace),d={};for(let m of e.pathParameters)m.parameterNameOverride&&(u=u.replace(m.name,m.parameterNameOverride)),d[m.parameterNameOverride??m.name]=ETo({pathParameter:m,context:r,fileContainingReference:t,namespace:l}),a.add(m.name);let s={};for(let m of e.queryParameters){let w=ATo({queryParameter:m,context:r,fileContainingReference:t,namespace:l});w!=null&&(s[m.name]=w,a.add(m.name))}let o;if(e.pagination!=null)switch(e.pagination.type){case"cursor":o={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":o={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":o={type:"custom",results:e.pagination.results};break;default:Fo(e.pagination)}let c={path:u,method:sNp(e.method),auth:e.authed,docs:e.description??void 0,pagination:o,source:e.source!=null?tKr(e.source):void 0};!$jD({context:r,request:e.request})&&Object.keys(d).length>0&&(c["path-parameters"]=d),e.summary!=null&&(c["display-name"]=e.summary);let b={},g=r.builder.getGlobalHeaderNames(),O=e.headers.filter(m=>!g.has(m.name));for(let m of O){let w=uXt({header:m,context:r,fileContainingReference:t,namespace:l});b[m.name]=w,a.add(typeof w=="string"?m.name:w.name??m.name)}if(e.request!=null){r.setInState(j2.Request);let m=HjD({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s:void 0,nonRequestReferencedSchemas:Array.from(i),headers:Object.keys(b).length>0?b:void 0,usedNames:a,namespace:l});c.request=m.value,n=[...n,...m.schemaIdsToExclude??[]],r.unsetInState(j2.Request)}else{let m=r.inlinePathParameters&&Object.keys(d).length>0,w=Object.keys(s).length>0,E=Object.keys(b).length>0,A={};(m||w||E)&&(A.name=e.requestNameOverride??e.generatedRequestName),m&&(A["path-parameters"]=d),w&&(A["query-parameters"]=s),E&&(A.headers=b),Object.keys(A).length>0&&(c.request=A)}if(e.response!=null&&e.response._visit({json:m=>{let w=H0({schema:m.schema,context:r,fileContainingReference:t,namespace:l,declarationDepth:0});c.response={docs:m.description??void 0,type:MM(w)},m.statusCode!=null&&(c.response["status-code"]=m.statusCode),m.responseProperty!=null&&(c.response.property=m.responseProperty)},streamingJson:m=>{let w=H0({schema:m.schema,context:r,fileContainingReference:t,namespace:l,declarationDepth:0});c["response-stream"]={docs:m.description??void 0,type:MM(w),format:"json"}},streamingSse:m=>{let w=H0({schema:m.schema,context:r,fileContainingReference:t,namespace:l,declarationDepth:0});c["response-stream"]={docs:m.description??void 0,type:MM(w),format:"sse"}},file:m=>{c.response={docs:m.description??void 0,type:"file","status-code":m.statusCode}},streamingText:m=>{c["response-stream"]={docs:m.description??void 0,type:"text"}},text:m=>{c.response={docs:m.description??void 0,type:"text","status-code":m.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let m=r.getDefaultServerName(),w=e.servers[0];w==null?m!=null&&(c.url=m):c.url=w.name??void 0}return e.idempotent&&(c.idempotent=!0),e.availability!=null&&(c.availability=fI(e.availability)),Object.entries(e.errors).forEach(([m,w])=>{let E=w.generatedName,A=sy.of(X1);r.builder.enableUniqueErrorsPerEndpoint&&(E=`${e.generatedRequestName}${w.generatedName}`,w.schema!=null&&(w.schema.type!=="reference"&&w.schema.type!=="oneOf"?w.schema.generatedName=`${e.generatedRequestName}${w.schema.generatedName}`:w.schema.type==="oneOf"&&(w.schema.value.generatedName=`${e.generatedRequestName}${w.schema.value.generatedName}`)));let q={"status-code":parseInt(m)},D=LRp({location:fNp,namespaceOverride:l});if(w.schema!=null){let $=H0({schema:w.schema,context:r,fileContainingReference:D,declarationFile:D,namespace:l,declarationDepth:0});q.type=MM($),q.docs=w.description}r.builder.addError(D,{name:E,schema:r.isErrorUnknownSchema(parseInt(m))?{...q,type:"unknown"}:q}),c.errors==null&&(c.errors=[]);let C=r.builder.addImport({file:t,fileToImport:D});c.errors.push(C!=null?`${C}.${E}`:E),q.type!=null&&w.examples?.forEach($=>{let I={value:hG($.example),name:$.name,docs:$.description};r.builder.addErrorExample(D,{name:E,example:I})})}),e.examples.length>0&&(c.examples=WjD({endpointExamples:e.examples,context:r})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?c.audiences=[F5s,...e.audiences]:e.audiences.length>0&&(c.audiences=e.audiences),{value:c,schemaIdsToExclude:n}}function WjD({endpointExamples:e,context:t}){return e.map(r=>{try{return uNp({endpointExample:r,context:t})}catch(i){throw console.error(`Error building endpoint example: ${i}`),i}})}function HjD({endpoint:e,declarationFile:t,context:r,request:i,requestNameOverride:n,generatedRequestName:a,pathParameters:u,queryParameters:l,nonRequestReferencedSchemas:d,headers:s,usedNames:o,namespace:c}){if(i.type==="json"){let b=i.schema.type==="reference"?i.schema.schema:void 0,g=i.schema.type==="reference"?r.getSchema(i.schema.schema,c):i.schema;if(g?.type!=="object"||b!=null&&d.includes(b)){let A=H0({schema:i.schema,fileContainingReference:t,context:r,namespace:c,declarationDepth:0}),q={schemaIdsToExclude:[],value:{body:A}},D=Object.keys(u??{}).length>0,C=Object.keys(l??{}).length>0,R=Object.keys(s??{}).length>0;return D&&(q.value["path-parameters"]=u),C&&(q.value["query-parameters"]=l),R&&(q.value.headers=s),(D||C||R)&&(q.value.name=n??a),i.contentType!=null&&(q.value["content-type"]=i.contentType),i.description!=null&&(q.value.docs=i.description),q}let O=Object.fromEntries(g.properties.filter(A=>A.readonly==null?!0:!(cNp(e.method)&&A.readonly)).map(A=>{let q=H0({schema:A.schema,fileContainingReference:t,context:r,namespace:c,declarationDepth:1}),D=A.nameOverride??A.key,C=fI(A.availability);if(!o.has(D)&&A.audiences.length<=0)return o.add(D),A.nameOverride!=null?[A.key,{type:MM(q),docs:B1n(q),name:A.nameOverride,availability:C}]:[A.key,C?{...typeof q=="string"?{type:q}:q,availability:C}:q];let R={type:MM(q),docs:B1n(q)};return o.has(D)&&(R.name=A.generatedName),A.audiences.length>0&&(R.audiences=A.audiences),C!=null&&(R.availability=C),o.add(D),[A.key,R]})),m=g.allOf.map(A=>{let q=H0({schema:gy.reference(A),fileContainingReference:t,context:r,namespace:c,declarationDepth:0});return MM(q)}),w={properties:O};m.length>0&&(w.extends=m),i.additionalProperties&&(w["extra-properties"]=!0);let E={name:n??g.nameOverride??g.generatedName,"path-parameters":u,"query-parameters":l,headers:s,body:w};return i.contentType!=null&&(E["content-type"]=i.contentType),i.description!=null&&(E.docs=i.description),{schemaIdsToExclude:b!=null?[b]:[],value:E}}else{if(i.type==="octetStream")return{schemaIdsToExclude:[],value:{body:"bytes","content-type":JB.APPLICATION_OCTET_STREAM,...i.description?{docs:i.description}:{}}};if(i.type==="multipart"){let b=Object.fromEntries(i.properties.map(g=>{if(g.schema.type==="file"){let O=g.schema.isArray?"list<file>":"file";if(O=g.schema.isOptional?`optional<${O}>`:O,g.description!=null||g.contentType!=null){let m={type:O};if(g.description!=null&&(m.docs=g.description),g.contentType!=null){let w=g.contentType.split(",")[0];m["content-type"]=w}return[g.key,m]}return[g.key,O]}else{let O=H0({schema:g.schema.value,fileContainingReference:t,context:r,namespace:c,declarationDepth:1});if(g.contentType!=null||g.exploded||g.encoding==="form"){let m=typeof O=="string"?{type:O}:O;g.contentType!=null&&(m["content-type"]=g.contentType),g.encoding==="form"?m.style="form":g.exploded&&(m.style="exploded"),O=m}return[g.key,O]}}));return{schemaIdsToExclude:i.name==null?[]:[i.name],value:{name:n??i.name??a,"path-parameters":u,"query-parameters":l,headers:s,body:{properties:b},"content-type":JB.MULTIPART_FORM_DATA,...i.description?{docs:i.description}:{}}}}else Fo(i)}}function $jD({context:e,request:t}){if(!e.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;default:Fo(t)}}function GjD({location:e,namespaceOverride:t}){return t!=null?{...e,file:PR(sy.of(t),e.file)}:e}function QjD(e){let t=e.namespace,r=e.tags.filter(d=>d!==t)[0],i=e.operationId;if(i==null)return r!=null?{file:sy.of(`${Dg(r)}.yml`),endpointId:e.summary!=null?Dg(e.summary):Dg(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:sy.of(X1),endpointId:Dg(e.summary)}:{file:sy.of(X1),endpointId:Dg(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:sy.of(X1),endpointId:i};let n=r_a(r),a=r_a(i);if(F1e(n,a))return{file:sy.of("__package__.yml"),endpointId:r};let u=YjD({operationId:i,tag:r,path:e.path,method:e.method});if(u!=null)return u;let l=[];for(let d=0;d<n.length;++d){let s=n[d];if(s!=null&&s===a[d])l.push(s);else{let o=Dg(r);return{file:sy.of(`${o}.yml`),endpointId:i,tag:r}}}if(l.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:sy.of(Dg(l.join("_"))+".yml"),endpointId:Dg(a.slice(l.length).join("_")),tag:r}}function i_a(e){let t=e.tags[0];if(e.sdkName!=null){let r=j5s({sdkName:e.sdkName,namespaceOverride:e.namespace}),i=`${r}.yml`,n=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:sy.of(i),endpointId:e.sdkName.methodName,tag:n?t:void 0}}return GjD({namespaceOverride:e.namespace,location:QjD(e)})}function r_a(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=vBe(t),t}var JjD=new RegExp("[^a-zA-Z0-9{}]+"),KjD=new RegExp("[{}]","g");function YjD({operationId:e,tag:t,path:r,method:i}){let a=`${r.split(JjD).join("_").replaceAll(KjD,"_")}_${i.toLowerCase()}`;if(e.endsWith(a))return{file:sy.of(Dg(t)+".yml"),endpointId:Dg(e.slice(0,-1*a.length)),tag:t}}function dNp(e){let t=new Set,{endpoints:r,tags:i}=e.ir,n=[];for(let a of r){let{endpointId:u,file:l,tag:d}=i_a(a),s=l.split(".")[0];s!=null&&t.add(s);let o;if(a.sdkName!=null){let g=e.ir.groups;for(let O of a.sdkName.groupName){let m=typeof O=="string"?O:O.name,w=g[m];if(w==null)break;if(w.summary!=null||w.description!=null){o=g[m];break}}}let c=d==null?void 0:i.tagsById[d];e.setInState(j2.Endpoint),e.setEndpointMethod(a.method);let b=lNp({context:e,endpoint:a,declarationFile:l});e.unsetEndpointMethod(),e.unsetInState(j2.Endpoint),n=[...n,...b.schemaIdsToExclude],e.builder.addEndpoint(l,{name:u,schema:b.value,source:a.source!=null?tKr(a.source):void 0}),(c?.id!=null||c?.description!=null)&&e.builder.setServiceInfo(l,{"display-name":o?.summary??c?.id,docs:o?.description??c?.description??void 0})}return{schemaIdsToExclude:n,sdkGroups:t}}function pNp(e){for(let[t,r]of Object.entries(e.ir.variables)){let i=r.groupName!=null?rKr(r.groupName):void 0,n=H0({schema:gy.primitive(r),context:e,fileContainingReference:sy.of(X1),namespace:i,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:MM(n),docs:r.description??void 0}})}}function _Np(e){for(let t of e.ir.webhooks){let r=kjD({webhook:t,context:e});if(r==null)continue;let i=qTo(t.sdkName,t.namespace),n={};for(let u of t.headers)n[u.name]=uXt({header:u,context:e,fileContainingReference:r.file,namespace:i});let a={method:t.method,"display-name":t.summary??void 0,headers:n,payload:H0({schema:t.payload,context:e,fileContainingReference:r.file,namespace:i,declarationDepth:0}),examples:t.examples!=null?t.examples.map(u=>({docs:u.description,name:u.name,payload:hG(u.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function XjD({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:PR(sy.of(t),e.file)}:e}function ZjD({webhook:e,context:t}){let r=e.tags[0],i=e.operationId;if(r==null)return{file:sy.of(X1),endpointId:i};let n=r_a(r),a=r_a(i);if(F1e(n,a))return{file:sy.of("__package__.yml"),endpointId:r};let u=[];for(let l=0;l<n.length;++l){let d=n[l];if(d!=null&&d===a[l])u.push(d);else{let s=Dg(r);return{file:sy.of(`${s}.yml`),endpointId:i,tag:r}}}if(u.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:sy.of(Dg(u.join("_"))+".yml"),endpointId:Dg(a.slice(u.length).join("_")),tag:r}}function kjD({webhook:e,context:t}){return e.sdkName!=null?{file:FRp({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:XjD({namespaceOverride:e.namespace,location:ZjD({webhook:e,context:t})})}var ewD=sy.of(X1);function hNp(e){switch(e.type){case"object":return sXt(e.groupName);case"enum":return sXt(e.groupName);case"oneOf":return sXt(e.value.groupName);case"array":return sXt(e.groupName);case"map":return sXt(e.groupName);case"reference":return sXt(e.groupName);case"literal":return sXt(e.groupName);case"optional":return sXt(e.groupName);case"nullable":return sXt(e.groupName);case"primitive":return sXt(e.groupName);case"unknown":return ewD;default:Fo(e)}}function sXt(e){return T1n(e)}var F5s="external",fNp=sy.of(X1);function yNp({schemas:e,schemaIdsToExclude:t,namespace:r,context:i}){for(let[n,a]of Object.entries(e)){if(t.includes(n))continue;let u=hNp(a),l=HRp({schema:a,context:i,declarationFile:u,namespace:r,declarationDepth:0});if(Jsi(l.schema)){let d=MM(l.schema);if(d===(l.name??n)||d===`optional<${l.name??n}>`)continue}i.builder.addType(u,{name:l.name??n,schema:l.schema})}}function vNp(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),eNp(e),tNp(e),rNp(e),KRp(e),pNp(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(F5s);let t=dNp(e),r=t.sdkGroups;e.setInState(j2.Webhook),_Np(e),e.unsetInState(j2.Webhook),e.setInState(j2.Channel);for(let n of Object.values(e.ir.channels)){let a=T1n(n.groupName);kRp({channel:n,context:e,declarationFile:a})}e.unsetInState(j2.Channel);let i=twD({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});yNp({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:i,namespace:void 0,context:e});for(let[n,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))yNp({schemas:a,schemaIdsToExclude:i,namespace:n,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(a=>r.has(a))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.build()}function twD({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let i=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),n=new Set(t);for(let a of i)r.includes(a)||n.add(a);return Array.from(n)}function L5s(e){let t=new mTo(e);return vNp(t)}var vRi={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1};function U5s({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??vRi.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??vRi.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??vRi.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??vRi.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??vRi.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??vRi.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??vRi.inlinePathParameters}}var CTo=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:i,absoluteFilePath:n}){let a=L5s({taskContext:t,ir:r,options:U5s({overrides:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.args.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.args.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.args.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.args.objectQueryParameters}}),authOverrides:this.args.generatorsConfiguration?.api?.auth!=null?{...this.args.generatorsConfiguration?.api}:void 0,environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.args.generatorsConfiguration?.api?.headers!=null?{...this.args.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:n??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Kd.dump(a.rootApiFile)},namedDefinitionFiles:{...rd(a.definitionFiles,u=>({absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Kd.dump(u),contents:u})),[sy.of(X1)]:{absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Kd.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var n_a=class extends D5t{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;exampleGeneration;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.exampleGeneration=t.exampleGeneration,this.converter=new CTo(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:i},n){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:i},n);return this.converter.convert({context:t,ir:a,settings:n,absoluteFilePath:r})}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new USe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion})}};function x1n(e){if(e.settings==null)return;let t={detectGlobalHeaders:!0};return e.settings.unions==="v1"&&(t.discriminatedUnionV2=!0),t}var OLp=yi(Bxo(),1);var mV={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};var nha={of(e){return e}};var W5p={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},TWs={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:W5p,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},fd={SOURCE:nha.of("source"),SDK_METHOD_NAME:nha.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:nha.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:nha.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport"};var OG={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!0,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,preserveSchemaIds:!1,objectQueryParameters:!1,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!1,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json"};function CWs({options:e,overrides:t}){return{disableExamples:t?.disableExamples??OG.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??OG.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??OG.useTitlesAsName,audiences:t?.audiences??e?.audiences??OG.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??OG.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??OG.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??OG.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??OG.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??OG.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??OG.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??OG.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??OG.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??OG.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??OG.objectQueryParameters,filter:t?.filter??e?.filter??OG.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??OG.asyncApiNaming,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0}}var H5p={naming:"v1"};function yf(e,t){let r=Array.isArray(t)?t:[t];for(let i of r){let n=e[i];if(n!=null)return n}}function aha(e,t,r,i,n=[]){try{let a=yf(e,t);if(a!=null)return r.parse(a)}catch{let u=vBe(n).join(" -> ");i.error(`${u.length>0?`${u}: `:""}Failed to parse ${t}`)}}function QRi(e){let t=yf(e,"examples");return t!=null&&Array.isArray(t)?t:[]}function $5p({schema:e,logger:t}){return yf(e,fd.ENCODING)??void 0}function G5p(e){return yf(e,fd.FERN_ENUM)}function Q5p({nameOverride:e,generatedName:t,title:r,schema:i,description:n,availability:a}){let u=yf(i,fd.SDK_GROUP_NAME),l=yf(i,fd.TYPE_DEFINITION);if(l!=null)return oha({fernType:l,nameOverride:e,generatedName:t,title:r,description:n,availability:a,groupName:typeof u=="string"?[u]:u})}function oha({fernType:e,nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u}){return NU({type:e,_default:void 0,validation:void 0,visitor:{primitive:l=>{switch(l.v1){case"BASE_64":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.base64({example:void 0})});case"BOOLEAN":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.boolean({default:void 0,example:void 0})});case"DATE":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.date({example:void 0})});case"DATE_TIME":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.datetime({example:void 0})});case"FLOAT":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.float({example:void 0})});case"DOUBLE":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.uint({default:void 0,example:void 0})});case"INTEGER":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.uint64({default:void 0,example:void 0})});case"LONG":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Fo(l.v1)}},unknown:()=>El.unknown({nameOverride:t,generatedName:r,title:i,example:void 0,description:n,availability:a,groupName:u}),map:({keyType:l,valueType:d})=>l?.type==="primitive"&&d!=null?El.map({nameOverride:t,generatedName:r,title:i,key:l,value:d,description:n,availability:a,groupName:u,encoding:void 0,example:void 0,inline:void 0}):void 0,list:l=>l!=null?El.array({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,example:void 0,inline:void 0}):void 0,optional:l=>l!=null?El.optional({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,inline:void 0}):void 0,nullable:l=>l!=null?El.nullable({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,inline:void 0}):void 0,set:l=>l!=null?El.array({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,example:void 0,inline:void 0}):void 0,literal:l=>El.literal({nameOverride:t,generatedName:r,title:i,value:l._visit({string:d=>cx.string(d),boolean:d=>cx.boolean(d),_other:()=>{throw new Error("Unexpected literal type")}}),description:n,availability:a,groupName:u}),named:()=>{}}})}function J5p(e){let t=yf(e,fd.SOURCE);if(t!=null)return t.endsWith(".proto")?wie.protobuf({file:t}):wie.openapi({file:t})}function JRi(e){if(e!=null&&typeof e=="boolean")return e}function Zd(e){return e.$ref!=null}function K5p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,additionalProperties:n,description:a,availability:u,wrapAsNullable:l,context:d,groupName:s,example:o,encoding:c,source:b,namespace:g}){return typeof n=="boolean"||SSn(n)?xxo({nameOverride:e,generatedName:t,title:r,wrapAsNullable:l,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:El.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:void 0}),groupName:s,example:o,encoding:c}):xxo({nameOverride:e,generatedName:t,title:r,wrapAsNullable:l,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:Y5p(qb(n,d.options.optionalAdditionalProperties?l:!1,d,[...i,"Value"],b,g,void 0,void 0,void 0)),groupName:s,example:o,encoding:c})}function Y5p(e){switch(e.type){case"array":case"enum":case"map":case"object":e.inline=!0;break;case"literal":case"primitive":case"reference":case"unknown":break;case"nullable":case"optional":e.inline=!0,e.value=Y5p(e.value);break;case"oneOf":e.value.inline=!0;break;default:Fo(e)}return e}function xxo({nameOverride:e,generatedName:t,title:r,keySchema:i,valueSchema:n,wrapAsNullable:a,description:u,availability:l,groupName:d,example:s,encoding:o}){return a?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.map({nameOverride:e,generatedName:t,title:r,description:u,availability:i.availability,key:i,value:n,groupName:d,encoding:o,example:s,inline:void 0}),description:u,availability:l,groupName:d,inline:void 0}):El.map({nameOverride:e,generatedName:t,title:r,description:u,availability:l,key:i,value:n,groupName:d,encoding:o,example:s,inline:void 0})}function SSn(e){return e==null?!1:typeof e=="boolean"?e:!Zd(e)&&Object.keys(e).length===0}function X5p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,item:n,description:a,availability:u,wrapAsNullable:l,context:d,groupName:s,example:o,source:c,namespace:b}){let g=n==null?El.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,groupName:s}):qb(n,!1,d,[...i,"Item"],c,b);return k4D({nameOverride:e,generatedName:t,title:r,groupName:s,itemSchema:g,wrapAsNullable:l,description:a,availability:u,example:o})}function k4D({nameOverride:e,generatedName:t,title:r,itemSchema:i,wrapAsNullable:n,description:a,availability:u,groupName:l,example:d}){return n?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.array({nameOverride:e,generatedName:t,title:r,value:i,description:a,availability:u,groupName:l,example:d,inline:void 0}),description:a,availability:u,groupName:l,inline:void 0}):El.array({nameOverride:e,generatedName:t,title:r,value:i,description:a,availability:u,groupName:l,example:d,inline:void 0})}function Bie(e){switch(yf(e,fd.AVAILABILITY)){case"deprecated":return pV.Deprecated;case"beta":return pV.Beta;case"generally-available":return pV.GenerallyAvailable;default:break}if(!Zd(e)&&e.deprecated)return pV.Deprecated}function BWs({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:u,required:l,wrapAsNullable:d,discriminator:s,context:o,groupName:c,encoding:b,source:g,namespace:O}){let m=s.propertyName,w=Object.fromEntries(Object.entries(s.mapping??{}).map(([A,q])=>{let D=DSn({$ref:q},!1,o,[q],b,g,O);return o.markReferencedByDiscriminatedUnion({$ref:q},m,1),[A,D]})),E=Object.entries(n).filter(([A])=>A!==m).map(([A,q])=>{let D=l!=null&&l.includes(A),C=qb(q,!D,o,[...i,A],g,O);return{key:A,schema:C}});return Z5p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:E,description:a,availability:u,discriminant:m,subtypes:w,groupName:c,source:g})}function xWs({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:u,required:l,wrapAsNullable:d,discriminant:s,variants:o,context:c,groupName:b,encoding:g,source:O,namespace:m}){let w=Object.fromEntries(Object.entries(o).map(([A,q])=>{if(Zd(q)){let D=DSn(q,!1,c,[q.$ref],g,O,m);return c.markReferencedByDiscriminatedUnion(q,s,1),[A,D]}else{let D=ESn(q,!1,c,[...i,A],g,O,m,new Set([s]));return[A,D]}})),E=Object.entries(n).filter(([A])=>A!==s).map(([A,q])=>{let D=l!=null&&l.includes(A),C=qb(q,!D,c,[...i,A],O,m);return{key:A,schema:C}});return Z5p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:E,description:a,availability:u,discriminant:s,subtypes:w,groupName:b,source:O})}function Z5p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,properties:n,description:a,availability:u,discriminant:l,subtypes:d,groupName:s,source:o}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.oneOf(QY.discriminated({description:a,availability:u,discriminantProperty:l,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:n,groupName:s,encoding:void 0,source:o,inline:void 0})),groupName:s,description:a,availability:u,inline:void 0}):El.oneOf(QY.discriminated({description:a,availability:u,discriminantProperty:l,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:n,groupName:s,encoding:void 0,source:o,inline:void 0}))}function k5p(e){if(e.proto!=null)return t1n.protobuf({typeName:e.proto.type})}function bXt({nameOverride:e,generatedName:t,title:r,fernEnum:i,enumVarNames:n,enumValues:a,_default:u,description:l,availability:d,wrapAsNullable:s,groupName:o,context:c,source:b,inline:g}){let O=t8D(n??[]),m=new Set(a),w=Array.from(m).map((A,q)=>{let D=i?.[A],C=O[q],R=A1n.test(A),$=D?.name??C,I=R?A:q1n(A);return $!=null&&!A1n.test($)&&(c?.logger.warn(`Enum name override ${$} is not a valid name. Falling back on ${I}.`),$=void 0),{nameOverride:$,generatedName:I,value:A,description:D?.description,availability:d,casing:{snake:D?.casing?.snake??void 0,pascal:D?.casing?.pascal??void 0,screamingSnake:D?.casing?.screamingSnake??void 0,camel:D?.casing?.camel??void 0}}}),E=u!=null?w.find(A=>A.value===u):void 0;return e8D({wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:w,_default:E,description:l,availability:d,groupName:o,source:b,inline:g})}function e8D({wrapAsNullable:e,nameOverride:t,generatedName:r,title:i,values:n,_default:a,description:u,availability:l,groupName:d,source:s,inline:o}){return e?El.nullable({nameOverride:t,generatedName:r,title:i,value:El.enum({nameOverride:t,generatedName:r,title:i,values:n,description:u,default:a,availability:l,example:void 0,groupName:d,source:s,inline:o}),description:u,availability:l,groupName:d,inline:o}):El.enum({nameOverride:t,generatedName:r,title:i,values:n,description:u,availability:l,default:a,example:void 0,groupName:d,source:s,inline:o})}function t8D(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(i=>i[r]===t[r]);)r++;return e.map(i=>i.substring(r))}function e9p({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,description:o,availability:c,wrapAsNullable:b,example:g,groupName:O}){return i==="int64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint32"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int({default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O})}function t9p(e){return typeof e=="string"?cx.string(e):typeof e=="boolean"?cx.boolean(e):cx.string(`${e}`)}function r9p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,value:n,description:a,availability:u,groupName:l}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.literal({nameOverride:e,generatedName:t,title:r,value:t9p(n),description:a,availability:u,groupName:l}),description:a,availability:u,groupName:l,inline:void 0}):El.literal({nameOverride:e,generatedName:t,title:r,value:t9p(n),description:a,availability:u,groupName:l})}function IWs({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,description:o,availability:c,wrapAsNullable:b,example:g,groupName:O}){return i==null||i==="double"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.double({default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="float"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.float({example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="int32"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int({default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="int64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint32"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="time-delta"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.float({example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.float({example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O})}var r8D={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},i8D={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},n8D={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},a8D={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},o8D={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},u8D={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},s8D={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},c8D={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function Ixo(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],i=[r8D,i8D,n8D,a8D,o8D,u8D,s8D,c8D],n;do{n=t;for(let a of i)if(a.isApplicable(t)){let{refUnderProcessing:u,newBreadcrumbs:l}=a.applyStrategy(t);t=u,r=[...r,...l]}}while(t.join("")!==n.join(""));return r}function D2(e,t){let i=e.map(n=>/^[^a-zA-Z0-9]+$/.test(n)?n:G3(Dg(n))).join("");return/^\d/.test(i)?kpa(i)??i:i}function zWs(e){let t=e.join("_");return Dg(t)}function cE(e){switch(e.type){case"object":return gy.object({allOf:e.allOf,properties:e.properties.map(t=>f8D(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:e.inline});case"array":return gy.array({description:e.description,availability:e.availability,value:cE(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,inline:e.inline});case"enum":return gy.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return gy.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"nullable":return gy.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:cE(e.value),groupName:e.groupName,inline:e.inline});case"optional":return gy.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:cE(e.value),groupName:e.groupName,inline:e.inline});case"primitive":return gy.primitive({description:e.description,availability:e.availability,schema:i9p(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return gy.map({description:e.description,availability:e.availability,key:gy.primitive({description:e.key.description,availability:e.key.availability,schema:i9p(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,groupName:e.groupName}),value:cE(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,encoding:e.encoding,inline:e.inline});case"reference":return gy.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return gy.oneOf(l8D(e.value));case"unknown":return gy.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Fo(e)}}function l8D(e){switch(e.type){case"discriminated":return eKr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:cE(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,cE(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return eKr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>cE(t)),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:Fo(e)}}function i9p(e){switch(e.type){case"string":return vj.string(e);case"base64":return vj.base64();case"boolean":return vj.boolean(e);case"date":return vj.date();case"datetime":return vj.datetime();case"double":return vj.double(e);case"float":return vj.float();case"int":return vj.int(e);case"int64":return vj.int64(e);case"uint":return vj.uint();case"uint64":return vj.uint64();default:Fo(e)}}function f8D(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:cE(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function zxo(e,t){return Eie(cE(e),cE(t))}function n9p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,required:u,wrapAsNullable:l,allOf:d,context:s,propertiesToExclude:o,groupName:c,fullExamples:b,additionalProperties:g,availability:O,encoding:m,source:w,namespace:E}){let A=[...u??[]],q={...n},D=[],C=[];for(let U of d)if(Zd(U)){let H=s.resolveSchemaReference(U);if(H.discriminator!=null&&H.discriminator.mapping!=null)continue;if(H.oneOf!=null){for(let K of H.oneOf){let ee=Zd(K)?s.resolveSchemaReference(K):K,fe=qb(ee,!1,s.DUMMY,i,w,E);fe.type==="object"&&D.push(...fe.properties.map(me=>me.schema.type!=="optional"&&me.schema.type!=="nullable"?{...me,schema:El.optional({nameOverride:void 0,generatedName:"",title:void 0,value:me.schema,description:void 0,availability:me.availability,groupName:void 0,inline:void 0})}:me))}continue}let k=Wdi(U);if(k==null)continue;C.push({schemaId:k,convertedSchema:RWs(U,[k],w,s.options.preserveSchemaIds),properties:a9p({schema:U,context:s,breadcrumbs:i,source:w,namespace:E})}),s.markSchemaAsReferencedByNonRequest(k)}else{let H=qb(U,!1,s,i,w,E);H.type==="object"&&D.push(...H.properties)}let R={};for(let U of C)for(let[H,k]of Object.entries(U.properties)){let K=R[H];K!=null?(K.schemaIds.push(U.schemaId),K.schemas.some(fe=>zxo(fe,k))||K.schemas.push(k)):R[H]={schemaIds:[U.schemaId],schemas:[k]}}let $=[];for(let[U,H]of Object.entries(R))H.schemaIds.length>1&&$.push({propertyKey:U,allOfSchemaIds:H.schemaIds,conflictingTypeSignatures:H.schemas.length>1});let I=Object.entries(q).map(([U,H])=>{let k=A.includes(U),K=yf(H,fd.AUDIENCES)??[],ee=Bie(H),fe=Zd(H)?!1:H.readOnly,me=Zd(H)?!1:H.writeOnly,ge=yf(H,fd.FERN_PROPERTY_NAME),we=[...i,U],Ze=zWs(we),Mt=k?qb(H,!1,s,we,w,E):El.optional({nameOverride:e,generatedName:Ze,title:r,description:void 0,availability:ee,value:qb(H,!1,s,we,w,E),groupName:c,inline:void 0}),De={};for(let Te of C){let xt=Te.properties[U];xt!=null&&!zxo(Mt,xt)?De[Te.schemaId]={differentSchema:!0}:xt!=null&&(De[Te.schemaId]={differentSchema:!1})}return{key:U,schema:Mt,nameOverride:ge,audiences:K,conflict:De,generatedName:zWs([...i,U]),availability:ee,readonly:fe,writeonly:me}});return I.push(...D.map(U=>{let H=U.conflict;for(let k of C){let K=k.properties[U.key];K!=null&&!zxo(U.schema,K)?H[k.schemaId]={differentSchema:!0}:K!=null&&(H[k.schemaId]={differentSchema:!1})}return{...U,conflict:H}})),d8D({nameOverride:e,generatedName:t,title:r,wrapAsNullable:l,properties:I.filter(U=>!o.has(U.key)),description:a,allOf:C.map(U=>U.convertedSchema),allOfPropertyConflicts:$,groupName:c,fullExamples:b,additionalProperties:g,availability:O,source:w})}function d8D({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,properties:n,description:a,allOf:u,allOfPropertyConflicts:l,groupName:d,fullExamples:s,additionalProperties:o,availability:c,source:b}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.object({description:a,properties:n,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:l,groupName:d,fullExamples:s,additionalProperties:SSn(o),availability:void 0,source:b,inline:void 0}),description:a,availability:c,groupName:d,inline:void 0}):El.object({description:a,properties:n,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:l,groupName:d,fullExamples:s,additionalProperties:SSn(o),availability:c,source:b,inline:void 0})}function a9p({schema:e,context:t,breadcrumbs:r,source:i,namespace:n}){let a={},[u,l]=Zd(e)?[t.resolveSchemaReference(e),Ixo(e.$ref)]:[e,r];for(let d of u.allOf??[])a={...a,...a9p({schema:d,context:t,breadcrumbs:l,source:i,namespace:n})};for(let[d,s]of Object.entries(u.properties??{})){let o=qb(s,!1,t,[...l,d],i,n);a[d]=o}return a}function o9p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,description:n,availability:a,wrapAsNullable:u,context:l,subtypes:d,groupName:s,encoding:o,source:c,subtypePrefixOverrides:b,namespace:g}){let O=u9p(d);return s9p({uniqueSubtypes:O,nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:n,availability:a,groupName:s,context:l,encoding:o,source:c})}function MSn({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,description:n,availability:a,wrapAsNullable:u,context:l,subtypes:d,groupName:s,encoding:o,source:c,subtypePrefixOverrides:b,namespace:g}){let O=p8D({schemas:d}),m=d.flatMap((E,A)=>{if(!Zd(E)&&E.enum!=null&&l.options.coerceEnumsToLiterals&&E.type==="string")return E.enum.map(D=>El.literal({nameOverride:void 0,generatedName:D2([t,D],l.options.preserveSchemaIds),title:void 0,value:cx.string(String(D)),groupName:void 0,description:void 0,availability:D.availability}));let q=O[A];if(b!=null){let D=b[A];D!=null&&"name"in D&&(q=D.name)}return[qb(E,!1,l,[...i,q??`${A}`],c,g)]}),w=u9p(m);return s9p({uniqueSubtypes:w,nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:n,availability:a,groupName:s,context:l,encoding:o,source:c})}function u9p(e){let t=[];for(let r=0;r<e.length;++r){let i=e[r],n=!1;for(let a=r+1;a<e.length;++a){let u=e[a];if(i!=null&&u!=null&&Eie(i,u)){n=!0;break}}i!=null&&!n&&t.push(i)}return t}function s9p({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,groupName:l,context:d,encoding:s,source:o}){if(Object.entries(e).every(([b,g])=>g.type==="literal")){let b={},g=[];return Object.entries(e).forEach(([O,m])=>{m.type==="literal"&&m.value.type==="string"&&(g.push(m.value.value),m.description!=null&&(b[m.value.value]={description:m.description}))}),bXt({nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,fernEnum:b,enumVarNames:void 0,enumValues:g,_default:void 0,groupName:l,context:d,source:o,inline:void 0})}return e.length===1&&e[0]!=null?e[0]:c9p({nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,subtypes:e,groupName:l,encoding:s,source:o})}function NWs({nameOverride:e,generatedName:t,title:r,description:i,availability:n,wrapAsNullable:a,context:u,groupName:l,discriminator:d,encoding:s,source:o,namespace:c}){let b=Object.entries(d.mapping??{}).map(([m,w],E)=>{let A={$ref:w},q=DSn(A,!1,u,[w],s,o,c);return u.markSchemaWithDiscriminantValue(A,d.propertyName,m),q.type==="object"&&(q.properties={[d.propertyName]:El.literal({nameOverride:void 0,generatedName:D2([t,m],u.options.preserveSchemaIds),title:void 0,value:cx.string(m),groupName:void 0,description:void 0,availability:void 0}),...q.properties.filter(D=>D.key!==d.propertyName)}),q}),g=[];for(let m=0;m<b.length;++m){let w=b[m],E=!1;for(let A=m+1;A<b.length;++A){let q=b[A];if(w!=null&&q!=null&&Eie(w,q)){E=!0;break}}w!=null&&!E&&g.push(w)}if(Object.entries(g).every(([m,w])=>w.type==="literal")){let m={},w=[];return Object.entries(g).forEach(([E,A])=>{A.type==="literal"&&A.value.type==="string"&&(w.push(A.value.value),A.description!=null&&(m[A.value.value]={description:A.description}))}),bXt({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:i,availability:n,fernEnum:m,enumVarNames:void 0,enumValues:w,_default:void 0,groupName:l,context:u,source:o,inline:void 0})}return g.length===1&&g[0]!=null?g[0]:c9p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:i,availability:n,subtypes:g,groupName:l,encoding:s,source:o})}function p8D({schemas:e}){let t={},r=0;for(let a of e){if(!Zd(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let u=Object.keys(a.properties),l={},d=u;for(let[s,o]of Object.entries(t)){let c=nYa(o,u);d=nYa(d,o),l[s]=c}l[r]=d,t=l}}r++}let i=[],n=0;for(let a of e){let u=t[n];if(u!=null&&u.length>0){let l=u.sort();if(l[0]!=null){i.push(l[0]),++n;continue}}Zd(a)?i.push(ydi(n)??`${n}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?i.push(""):i.push(ydi(n)??`${n}`),++n}return i}function c9p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,description:n,availability:a,subtypes:u,groupName:l,encoding:d,source:s}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.oneOf(QY.undiscriminated({description:n,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:l,encoding:d,source:s,inline:void 0})),description:n,availability:a,groupName:l,inline:void 0}):El.oneOf(QY.undiscriminated({description:n,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:l,encoding:d,source:s,inline:void 0}))}function ASn(e){if(e.default!=null&&typeof e.default=="string")return e.default}function Rxo({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let i=QRi(e);for(let n of i??[])if(typeof n=="number")return n;if(r&&typeof r=="number")return r}function l9p({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let i=QRi(e);for(let n of i??[])if(typeof n=="boolean")return n;if(r&&typeof r=="boolean")return r}function _Kr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let i=QRi(e);for(let n of i??[])if(typeof n=="string")return n;if(r&&typeof r=="string")return r}function f9p({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let i=QRi(e);for(let n of i??[])if(Array.isArray(n))return n;if(r&&Array.isArray(r))return r}var KRi="#/components/schemas/";function qb(e,t,r,i,n,a,u=!1,l=new Set,d){let s=J5p(e)??n,o=m8D({schema:e,logger:r.logger});if(Zd(e)){let c=Wdi(e);return c!=null?(u?r.markSchemaAsReferencedByRequest(c):r.markSchemaAsReferencedByNonRequest(c),DSn(e,t,r,i,o,s,a)):ESn(r.resolveSchemaReference(e),t,r,Ixo(e.$ref),o,s,a,l,u,d)}return ESn(e,t,r,i,o,s,a,l,u,d)}function DSn(e,t,r,i,n,a,u){let l=e.$ref.includes("properties")?ESn(r.resolveSchemaReference(e),t,r,i,n,a,u,new Set):El.reference(RWs(e,i,a,r.options.preserveSchemaIds));return t?El.nullable({title:void 0,nameOverride:void 0,generatedName:D2(i,r.options.preserveSchemaIds),value:l,description:void 0,availability:void 0,groupName:void 0,inline:void 0}):l}function _8D(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function ESn(e,t,r,i,n,a,u,l=new Set,d=!1,s){typeof e=="string"&&(e={type:e});let o=yf(e,fd.TYPE_NAME)??(r.options.useTitlesAsName?_8D(e.title):void 0),c=yf(e,fd.SDK_GROUP_NAME)??yf(e,mV.TAGS)?.[0],b=(typeof c=="string"?[c]:c)??[];b=r.resolveGroupName(b);let g=D2(i,r.options.preserveSchemaIds),O=e.title,m=e.description,w=Bie(e),E=[];e.example!=null&&E.push({name:void 0,value:e.example,description:void 0});let A=yf(e,mV.EXAMPLES);A!=null&&Object.keys(A).length>0&&E.push(...Object.entries(A).map(([C,R])=>({name:R?.summary??C,value:R.value,description:R.description})));let q=QRi(e);q!=null&&Object.keys(q).length>0&&E.push(...q.map(C=>({name:void 0,value:C,description:void 0})));let D=Q5p({schema:e,description:m,title:O,nameOverride:o,generatedName:g,availability:w});if(D!=null)return D;if(Array.isArray(e.type)){let C=e.type.indexOf("null"),R=C!==-1;e.type.length===1?e.type=e.type[0]:e.type.length===2&&R?(e.type.splice(C,1),e.type=e.type[0],e.nullable=!0):(R&&(e.type.splice(C,1),e.nullable=!0),e.oneOf==null?e.oneOf=e.type:e.oneOf.push(...e.type))}if(!t&&e.nullable===!0)return ESn(e,!0,r,i,n,a,u,l,d,s);if(e.enum!=null&&(e.type==="string"||e.type==null)){if(!Lxo(e.enum))return w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.string({default:ASn(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:_Kr({schema:e,logger:r.logger,fallback:s})}),groupName:b,wrapAsNullable:t,description:m,availability:w});let C=G5p(e);return e.enum.length===1&&e.enum[0]!=null&&C==null?r9p({nameOverride:o,generatedName:g,title:O,wrapAsNullable:t,value:e.enum[0],description:m,availability:w,groupName:b}):bXt({nameOverride:o,generatedName:g,title:O,fernEnum:C,enumVarNames:yf(e,[mV.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:m,availability:w,wrapAsNullable:t,groupName:b,context:r,source:a,inline:void 0})}if(Lxo(e.type)&&e.type.length>1){let C=e.type.includes("null"),R=e.type.filter($=>$!=="null").map($=>({type:$,nullable:C}));return MSn({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,wrapAsNullable:t,context:r,subtypes:R,groupName:b,encoding:n,source:a,namespace:u})}if(e.type==="boolean"){let C=yf(e,fd.BOOLEAN_LITERAL);return C!=null?d9p({nameOverride:o,generatedName:g,title:O,literal:cx.boolean(C),wrapAsNullable:t,description:m,availability:w,groupName:b}):w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.boolean({default:h8D(e.default),example:l9p({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:m,availability:w,groupName:b})}if(e.type==="number")return IWs({nameOverride:o,generatedName:g,title:O,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:JRi(e.exclusiveMinimum),exclusiveMaximum:JRi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:w,wrapAsNullable:t,example:Rxo({schema:e,logger:r.logger,fallback:s}),groupName:b});if(e.type==="integer")return e9p({nameOverride:o,generatedName:g,title:O,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:JRi(e.exclusiveMinimum),exclusiveMaximum:JRi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:w,wrapAsNullable:t,example:Rxo({schema:e,logger:r.logger,fallback:s}),groupName:b});if(e.type==="float")return IWs({nameOverride:o,generatedName:g,title:O,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:JRi(e.exclusiveMinimum),exclusiveMaximum:JRi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:w,wrapAsNullable:t,example:Rxo({schema:e,logger:r.logger,fallback:s}),groupName:b});if(e.type==="string"){if(e.format==="date-time")return w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.datetime({example:_Kr({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:m,availability:w,groupName:b});if(e.format==="json-string")return El.unknown({nameOverride:o,generatedName:g,title:O,description:m,availability:w,groupName:b,example:void 0});let C=h9p(e,"const");return C!=null?d9p({nameOverride:o,generatedName:g,title:O,literal:cx.string(C),wrapAsNullable:t,description:m,availability:w,groupName:b}):w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.string({default:ASn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:_Kr({schema:e,logger:r.logger,fallback:s})}),groupName:b,wrapAsNullable:t,description:m,availability:w})}if(e.type==="array")return X5p({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,item:e.items,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,example:f9p({schema:e,logger:r.logger,fallback:s}),source:a,namespace:u});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&Nxo(e))return K5p({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,additionalProperties:e.additionalProperties,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,encoding:n,example:e.example,source:a,namespace:u});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?NWs({nameOverride:o,generatedName:g,title:O,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,discriminator:e.discriminator,encoding:n,source:a,namespace:u}):BWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:b,encoding:n,source:a,namespace:u});if(e.oneOf!=null&&e.oneOf.length>0){let C=yf(e,fd.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||C?NWs({nameOverride:o,generatedName:g,title:O,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,discriminator:e.discriminator,encoding:n,source:a,namespace:u}):BWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:b,encoding:n,source:a,namespace:u});if(e.oneOf.length===1&&e.oneOf[0]!=null){let R=qb(e.oneOf[0],t,r,i,a,u,d);return qSn(R,m,b)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let U=e.oneOf[0],H=e.oneOf[1];if(!Zd(U)&&U.type==="null")return qb(H,!0,r,i,a,u);if(!Zd(H)&&H.type==="null")return qb(U,!0,r,i,a,u)}let R=b8D({schemas:e.oneOf});if(R!=null)return bXt({nameOverride:o,generatedName:g,title:O,fernEnum:void 0,enumVarNames:void 0,enumValues:R,_default:e.default,description:m,availability:w,wrapAsNullable:t,groupName:b,context:r,source:a,inline:void 0});let $=p9p({schemas:e.oneOf,context:r});if($!=null&&!r.options.discriminatedUnionV2&&!C)return xWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},required:e.required,description:m,availability:w,wrapAsNullable:t,discriminant:$.discriminant,variants:$.schemas,context:r,groupName:b,encoding:n,source:a,namespace:u});let I=e.oneOf.filter(U=>!Zd(U)&&U.type==="null").length>0;return MSn({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,wrapAsNullable:t||I,context:r,subtypes:e.oneOf.filter(U=>Zd(U)||U.type!=="null"),encoding:n,groupName:b,source:a,namespace:u})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let $=qb(e.anyOf[0],t,r,i,a,u,d);return qSn($,m,b)}if(e.anyOf.length===2){let[$,I]=e.anyOf;if($!=null&&I!=null){if(!Zd($)&&$.type==="null"){let U=qb(I,!0,r,i,a,u);return qSn(U,m,b)}else if(!Zd(I)&&I.type==="null"){let U=qb($,!0,r,i,a,u);return qSn(U,m,b)}}}let C=p9p({schemas:e.anyOf,context:r});if(C!=null&&!r.options.discriminatedUnionV2)return xWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},required:e.required,description:m,availability:w,wrapAsNullable:t,discriminant:C.discriminant,variants:C.schemas,context:r,groupName:b,encoding:n,source:a,namespace:u});let R=e.anyOf.filter($=>!Zd($)&&$.type==="null").length>0;return MSn({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,wrapAsNullable:t||R,context:r,subtypes:e.anyOf.filter($=>Zd($)||$.type!=="null"),encoding:n,groupName:b,source:a,namespace:u})}if(e.allOf!=null||e.properties!=null){let C=[];for(let $ of e.allOf??[])(Zd($)||Object.keys($).length>0)&&C.push($);if((e.properties==null||Nxo(e))&&C.length===1&&C[0]!=null){let $=qb(C[0],t,r,i,a,u,d);return qSn($,m,b)}let R=C.filter($=>{let I=Fxo($);return I||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify($)}`),I});if((e.properties==null||Nxo(e))&&R.length===1&&R[0]!=null){let $=qb(R[0],t,r,i,a,u,d);return qSn($,m,b)}return n9p({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},description:m,required:e.required,wrapAsNullable:t,allOf:R,context:r,propertiesToExclude:l,groupName:b,fullExamples:E,additionalProperties:e.additionalProperties,availability:w,encoding:n,source:a,namespace:u})}if(e.type==="object"&&y8D(e)&&v8D(e)&&Nxo(e))return xxo({nameOverride:o,generatedName:g,title:O,description:m,availability:w,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${g}Key`,title:void 0,description:void 0,availability:void 0,schema:Xd.string({default:ASn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:_Kr({schema:e,logger:r.logger,fallback:s})}),groupName:b},valueSchema:El.unknown({nameOverride:void 0,generatedName:`${g}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:b}),groupName:b,encoding:n,example:e.example});if(e.type==null){let C=e.example??e.default;return El.unknown({nameOverride:o,generatedName:g,title:O,description:m,availability:w,groupName:b,example:C})}throw new Error(`Failed to convert schema breadcrumbs=${JSON.stringify(i)} value=${JSON.stringify(e)}`)}function h8D(e){if(e!=null){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase();if(t==="true")return!0;if(t==="false")return!1}}}function Wdi(e){if(e.$ref.startsWith(KRi))return e.$ref.replace(KRi,"")}function RWs(e,t,r,i){let n=yf(e,fd.TYPE_NAME),a=D2(t,i),u=e.description,l=Bie(e),d=Wdi(e);if(d==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return gy.reference({generatedName:a,nameOverride:n,title:void 0,schema:d,description:u??void 0,availability:l,groupName:void 0,source:r})}function y8D(e){return e.oneOf==null||e.oneOf.length===0}function v8D(e){return e.allOf==null||e.allOf.length===0}function Nxo(e){return e.properties==null||nY(e.properties)===0}function Lxo(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function qSn(e,t,r){return e.type==="reference"?El.reference({...e,description:t,availability:e.availability,groupName:r}):e.type==="optional"?El.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r,inline:void 0}):e.type==="nullable"?El.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r,inline:void 0}):e}function Fxo(e){return Zd(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>Fxo(t)):e.oneOf!=null?e.oneOf.every(t=>Fxo(t)):e.anyOf!=null?e.anyOf.every(t=>Fxo(t)):!1}function d9p({literal:e,wrapAsNullable:t,groupName:r,description:i,availability:n,nameOverride:a,generatedName:u,title:l}){return t?El.nullable({nameOverride:a,generatedName:u,title:l,value:El.literal({nameOverride:a,generatedName:u,title:l,value:e,description:i,availability:n,groupName:r}),groupName:r,description:i,availability:n,inline:void 0}):El.literal({nameOverride:a,generatedName:u,title:l,value:e,groupName:r,description:i,availability:n})}function w5({primitive:e,wrapAsNullable:t,groupName:r,description:i,availability:n,generatedName:a,nameOverride:u,title:l}){return r=typeof r=="string"?[r]:r,t?El.nullable({nameOverride:u,generatedName:a,title:l,value:El.primitive({nameOverride:u,generatedName:a,title:l,schema:e,description:i,availability:n,groupName:r}),groupName:r,description:i,availability:n,inline:void 0}):El.primitive({nameOverride:u,generatedName:a,title:l,schema:e,description:i,availability:n,groupName:r})}function b8D({schemas:e}){let t=new Set;for(let r of e){if(Zd(r))return;if(r.enum!=null&&Lxo(r.enum))r.enum.forEach(i=>t.add(i));else return}return Array.from(t)}function p9p({schemas:e,context:t}){let r={};for(let i of e){let n=_9p({schema:i,context:t});for(let[a,u]of Object.entries(n)){let l=r[a];l!=null?l[u]=i:r[a]={[u]:i}}}for(let[i,n]of Object.entries(r))if(Object.keys(n).length===e.length)return{discriminant:i,schemas:n}}function _9p({schema:e,context:t}){let r=Zd(e)?t.resolveSchemaReference(e):e;return g8D({schema:r,context:t})}function g8D({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let i of e.anyOf){let n=_9p({schema:i,context:t});for(let[a,u]of Object.entries(n??{}))r[a]=u}return r}for(let[i,n]of Object.entries(e.properties??{})){let a=Zd(n)?t.resolveSchemaReference(n):n;a.type==="string"&&a.enum!=null&&Lxo(a.enum)&&O8D(a.enum).length===1&&a.enum[0]!=null&&(r[i]=a.enum[0]);let u=h9p(a,"const");a.type==="string"&&u!=null&&(r[i]=u),i==="type"&&a.example!=null&&(r[i]=a.example)}return r}function O8D(e){if(!e)return[];let t=new Set;return e.forEach(r=>{typeof r=="string"?t.add(r.toLowerCase()):t.add(r)}),Array.from(t)}function h9p(e,t){let r=e[t];if(r!=null)return r}function m8D({schema:e,logger:t}){let r=$5p({schema:e,logger:t});if(r!=null)return k5p(r)}var TSn=class{document;taskContext;logger;DUMMY;options;namespace;static MESSAGE_REFERENCE_PREFIX="#/components/messages/";constructor({document:t,taskContext:r,options:i,namespace:n}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=i,this.namespace=n}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveTags(t,r){if(this.namespace==null&&t==null&&r!=null)return[r];let i=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};i.push(n)}return i.concat(t??[])}resolveSchemaReference(t){if(!t.$ref.startsWith(KRi))throw new Error(`Failed to resolve schema reference: ${t.$ref}`);let i=t.$ref.substring(KRi.length).split("/"),n=this.document.components;if(n==null||n.schemas==null)throw new Error("Document does not have components.schemas.");let[a,u,l]=i;if(a==null||a==="")throw new Error(`${t.$ref} cannot be resolved. No schema key provided.`);let d=n.schemas[a];if(d==null)throw new Error(`Schema "${a}" is undefined in document.components.schemas.`);if(Zd(d)&&(d=this.resolveSchemaReference(d)),u==="properties"&&l!=null){let s=d.properties?.[l];if(s==null)throw new Error(`Property "${l}" not found on "${a}". Full ref: ${t.$ref}`);Zd(s)?d=this.resolveSchemaReference(s):d=s}return d}referenceExists(t){let r=t.substring(2).split("/").map(n=>n.replace(/~1/g,"/")),i=this.document;for(let n of r){if(typeof i!="object"||i==null)return!1;i=i[n]}return!0}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,i){}markSchemaWithDiscriminantValue(t,r,i){}};var Uxo=class extends TSn{getExampleMessageReference(t){return`#/components/messages/${t.messageId}`}resolveMessageReference(t){let r="#/components/messages/",i=this.document.components;if(i==null||i.messages==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve message reference: ${t.$ref} in v2 components`);let n=t.$ref.substring(r.length),a=i.messages[n];if(a==null)throw new Error(`${t.$ref} is undefined`);return a}};function CSn(e,t){let r={},i={};return e==null?r=t:i={[e]:t},{rootSchemas:r,namespacedSchemas:i}}function Hdi(e){if(typeof e=="string")return rg.primitive(u_.string(e));if(typeof e=="number")return Number.isInteger(e)?rg.primitive(u_.int(e)):rg.primitive(u_.double(e));if(typeof e=="boolean")return rg.primitive(u_.boolean(e));if(Array.isArray(e)){let t=e.map(r=>Hdi(r));return t.length===0?void 0:rg.array(t.filter(r=>r!=null))}else if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string")){let t=[];for(let[r,i]of Object.entries(e)){let n=Hdi(i);n!=null&&t.push({key:u_.string(r),value:n})}return rg.map(t)}}function uha(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function y9p(e){if(e!=null&&Array.isArray(e))return e}var $di=class{schemas;nonRequestReferencedSchemas;context;constructor(t,r,i){this.schemas=t,this.nonRequestReferencedSchemas=r,this.context=i}buildExample({schema:t,exampleId:r,example:i,options:n,skipReadonly:a}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:i,options:{...n,maxCheckerDepth:n.maxCheckerDepth??5},depth:0,skipReadonly:a??!1})}buildExampleHelper({exampleId:t,example:r,schema:i,depth:n,visitedSchemaIds:a,options:u,skipReadonly:l}){switch(i.type){case"enum":return typeof r=="string"&&v9p({schema:i,value:r})?rg.enum(r):i.values[0]!=null?rg.enum(i.values[0]?.value):void 0;case"literal":return rg.literal(i.value);case"nullable":{if(r==null&&!this.hasExample(i.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(n,u)))return;let d=this.buildExampleHelper({schema:i.value,visitedSchemaIds:a,exampleId:t,example:r,depth:n,options:u,skipReadonly:l});return d!=null&&d.type==="array"&&d.value.length===0||d!=null&&d.type==="map"&&d.value.length===0||d!=null&&d.type==="object"&&Object.keys(d.properties).length===0?void 0:d}case"optional":{if(r==null&&!this.hasExample(i.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(n,u))||Object.is(r,null))return;let d=this.buildExampleHelper({schema:i.value,visitedSchemaIds:a,exampleId:t,example:r,depth:n,options:u,skipReadonly:l});return d!=null&&d.type==="array"&&d.value.length===0||d!=null&&d.type==="map"&&d.value.length===0||d!=null&&d.type==="object"&&Object.keys(d.properties).length===0?void 0:d}case"primitive":{let d=this.buildExampleFromPrimitive({schema:i.schema,example:r,options:u});return rg.primitive(d)}case"reference":{let d=this.schemas[i.schema];if(d!=null&&!a.has(i.schema)){a.add(i.schema);let s=d?.type==="object"&&!this.nonRequestReferencedSchemas.has(i.schema),o=this.buildExampleHelper({example:r,schema:d,exampleId:t,visitedSchemaIds:a,depth:n,options:u,skipReadonly:s||this.context.options.respectReadonlySchemas?l:!1});return a.delete(i.schema),o}return}case"oneOf":switch(i.value.type){case"discriminated":{let d={},s={},o={},c=uha(r),b=c?.[i.value.discriminantProperty],g=i.value.schemas[b],O=[],m=this.getDiscriminatedUnionVariantSchema(i.value,c);m!=null&&O.push(m),O.push(...Object.entries(i.value.schemas));for(let w of O)if(b!=null&&g!=null&&g.type==="object"){s=this.getAllProperties(g),o=this.getAllRequiredProperties(g),d[i.value.discriminantProperty]=rg.primitive(u_.string(b));break}else{let E=this.buildExampleHelper({exampleId:t,schema:w[1],example:void 0,visitedSchemaIds:a,depth:n,options:u,skipReadonly:l});if(E!=null){this.mergeExampleWith(E,d),d[i.value.discriminantProperty]=rg.primitive(u_.string(w[0]));break}}for(let w of i.value.commonProperties){s[w.key]={schema:w.schema,readonly:!1};let E=this.getResolvedSchema(w.schema);E.type!=="optional"&&E.type!=="nullable"&&(o[w.key]=w.schema)}for(let[w,E]of Object.entries(s)){let A=w in o;if(A&&c?.[w]!=null){let q=this.buildExampleHelper({schema:E.schema,exampleId:t,example:c[w],visitedSchemaIds:a,depth:n+1,options:u,skipReadonly:l});if(q!=null)d[w]=q;else return}else{let q=this.buildExampleHelper({exampleId:t,schema:E.schema,example:c?.[w],visitedSchemaIds:a,depth:n+1,options:u,skipReadonly:l});if(q!=null)d[w]=q;else if(A)return}}return rg.oneOf(odi.discriminated(d))}case"undiscriminated":{let d=this.getUnDiscriminatedUnionVariantSchema(i.value,r);if(d!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:d,visitedSchemaIds:a,depth:n,options:u,skipReadonly:l});break}}return;case"unknown":if(r!=null){let d=Hdi(r);if(d!=null)return rg.unknown(d)}return u.ignoreOptionals||this.exceedsMaxDepth(n,u)?void 0:u.isParameter?rg.primitive(u_.string(u.name??"string")):rg.map([{key:u_.string("key"),value:rg.primitive(u_.string("value"))}]);case"array":{let d=y9p(r),s=[];if(d!=null&&d.length>0)for(let o of d){let c=this.buildExampleHelper({exampleId:t,example:o,schema:i.value,depth:n+1,visitedSchemaIds:a,options:u,skipReadonly:l});c!=null&&s.push(c)}else if(i.example!=null&&i.example.length>0)for(let o of i.example){let c=this.buildExampleHelper({exampleId:t,example:o,schema:i.value,depth:n+1,visitedSchemaIds:a,options:u,skipReadonly:l});c!=null&&s.push(c)}else{let o=this.buildExampleHelper({exampleId:t,example:void 0,schema:i.value,depth:n+1,visitedSchemaIds:a,options:u,skipReadonly:l});o!=null&&s.push(o)}return rg.array(s)}case"map":{let d=uha(r??i.example);if(d!=null&&Object.entries(d).length>0){let c=[];for(let[b,g]of Object.entries(d)){let O=this.buildExampleFromPrimitive({schema:i.key.schema,example:b,options:u}),m=this.buildExampleHelper({exampleId:t,example:g,schema:i.value,visitedSchemaIds:a,depth:n+1,options:u,skipReadonly:l});m!=null&&c.push({key:O,value:m})}return rg.map(c)}if(i.key.schema.type==="string"&&i.value.type==="unknown")return rg.map([{key:u_.string("key"),value:rg.unknown(rg.primitive(u_.string("value")))}]);let s=this.buildExampleFromPrimitive({schema:i.key.schema,example:void 0,options:{...u,name:"key"}}),o=this.buildExampleHelper({exampleId:t,example:void 0,schema:i.value,visitedSchemaIds:a,depth:n+1,options:{...u,name:"value"},skipReadonly:l});return o!=null?rg.map([{key:s,value:o}]):rg.map([])}case"object":{let d={},s=i.fullExamples?.find(g=>g.name===t)??i.fullExamples?.find(g=>g.name==null)??i.fullExamples?.[0],o=uha(r)??(s!=null?uha(s.value):{})??{},c=this.getAllProperties(i),b=this.getAllRequiredProperties(i);for(let[g,O]of Object.entries(c)){if(l&&O.readonly)continue;let m=g in b,w=Object.keys(o).includes(g),E=this.buildExampleHelper({schema:O.schema,exampleId:t,example:o[g],visitedSchemaIds:a,depth:n+1,options:{...u,name:g},skipReadonly:l});if(m&&E!=null)d[g]=E;else{if(m)return;(w&&E!=null||!u.ignoreOptionals&&E!=null)&&(d[g]=E)}}if(i.additionalProperties){for(let[g,O]of Object.entries(o))if(!(g in d)){let m=this.buildExampleHelper({schema:El.unknown({example:O,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,groupName:void 0}),exampleId:t,example:O,visitedSchemaIds:a,depth:n+1,options:{...u,name:g},skipReadonly:l});m!=null&&(d[g]=m)}}return rg.object({properties:d})}default:Fo(i)}}mergeExampleWith(t,r){t._visit({array:Jo,enum:Jo,literal:Jo,map:i=>{for(let n of i){let a=n.key;a.type==="string"&&(r[a.value]=n.value)}},object:i=>{for(let[n,a]of Object.entries(i.properties))r[n]=a},oneOf:i=>{if(i.type==="discriminated")for(let[n,a]of Object.entries(i.value))r[n]=a;else this.mergeExampleWith(i.value,r)},primitive:Jo,unknown:Jo,_other:Jo})}getObjectSchema(t){if(t.type==="object")return t;if(t.type==="reference"){let r=this.schemas[t.schema];if(r!=null)return this.getObjectSchema(r)}}getDiscriminatedUnionVariantSchema(t,r){let i=r?.[t.discriminantProperty];if(i==null||typeof i!="string")return Object.entries(t.schemas)[0];let n=t.schemas[i];return n==null?Object.entries(t.schemas)[0]:[i,n]}getUnDiscriminatedUnionVariantSchema(t,r){return r==null?t.schemas[0]:t.schemas.map(a=>({schema:a,heuristic:this.calcExampleHeuristic(a,r)})).sort((a,u)=>u.heuristic-a.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return v9p({schema:t,value:r})?5:0;case"object":{if(!kj(r))return 0;let i=this.getAllProperties(t),n=0;for(let[a,u]of Object.entries(i))r[a]!=null?(n++,n+=this.calcExampleHeuristic(u.schema,r[a])):n--;return n}case"array":{if(!Array.isArray(r))return 0;let i=0;for(let n of r)i+=this.calcExampleHeuristic(t.value,n);return i}case"map":{if(!kj(r))return 0;let i=0;for(let[,n]of Object.entries(r))i+=this.calcExampleHeuristic(t.value,n);return i}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let i=this.getResolvedSchema(t);return i==null?0:this.calcExampleHeuristic(i,r)}case"oneOf":return Object.values(t.value.schemas).map(n=>this.calcExampleHeuristic(n,r)).sort((n,a)=>a-n)[0]??0;case"primitive":return r==null?0:t.schema._visit({int:()=>typeof r=="number",int64:()=>typeof r=="number",uint:()=>typeof r=="number",uint64:()=>typeof r=="number",float:()=>typeof r=="number",double:()=>typeof r=="number",string:()=>typeof r=="string",datetime:()=>typeof r=="string",date:()=>typeof r=="string",base64:()=>typeof r=="string",boolean:()=>typeof r=="boolean",_other:()=>!0})?1:-1;default:return 0}}hasExample(t,r,i=new Set,n){if(this.exceedsMaxCheckerDepth(r,n))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,i,n);case"enum":return t.example!=null;case"literal":return!1;case"map":return t.example!=null||t.key.schema.example!=null&&this.hasExample(t.value,r+1,i,n);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let u of t.properties)if(this.hasExample(u.schema,r+1,i,n))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let a=this.schemas[t.schema];if(a!=null&&!i.has(t.schema)){i.add(t.schema);let u=this.hasExample(a,r,i,n);return i.delete(t.schema),u}return!1}case"unknown":return t.example!=null;case"oneOf":return Object.values(t.value.schemas).some(a=>this.hasExample(a,r,i,n));default:return!1}}exceedsMaxCheckerDepth(t,r){return t>(r.maxCheckerDepth??0)}exceedsMaxDepth(t,r){return t>(r.maxDepth??0)}getAllProperties(t){let r={};for(let i of t.properties)r[i.key]={schema:i.schema,readonly:i.readonly??!1};for(let i of t.allOf){let n=this.schemas[i.schema];if(n==null)continue;let a=this.getResolvedSchema(n);a.type==="object"&&(r={...this.getAllProperties(a),...r})}return r}getAllRequiredProperties(t){let r={};for(let i of t.properties){let n=this.getResolvedSchema(i.schema);n.type!=="optional"&&n.type!=="nullable"&&(r[i.key]=i.schema)}for(let i of t.allOf){let n=this.schemas[i.schema];if(n==null)continue;let a=this.getResolvedSchema(n);a.type==="object"&&(r={...this.getAllRequiredProperties(a),...r})}return r}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}buildExampleFromPrimitive({example:t,schema:r,options:i}){switch(r.type){case"string":return t!=null&&typeof t=="string"?u_.string(t):r.example!=null?u_.string(r.example):u_.string(i.name??Sg.STRING);case"base64":return t!=null&&typeof t=="string"?u_.base64(t):r.example!=null?u_.base64(r.example):u_.base64(Sg.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?u_.boolean(t):r.example!=null?u_.boolean(r.example):u_.boolean(Sg.BOOLEAN);case"date":return t!=null&&typeof t=="string"?u_.date(t):r.example!=null?u_.date(r.example):u_.date(Sg.DATE);case"datetime":return t!=null&&typeof t=="string"?u_.datetime(t):r.example!=null?u_.datetime(r.example):u_.datetime(Sg.DATE_TIME);case"double":return t!=null&&typeof t=="number"?u_.double(t):r.example!=null?u_.double(r.example):u_.double(Sg.DOUBLE);case"float":return t!=null&&typeof t=="number"?u_.float(t):r.example!=null?u_.float(r.example):u_.float(Sg.FLOAT);case"int":return t!=null&&typeof t=="number"?u_.int(t):r.example!=null?u_.int(r.example):u_.int(Sg.INT);case"int64":return t!=null&&typeof t=="number"?u_.int64(t):r.example!=null?u_.int64(r.example):u_.int64(Sg.INT64);case"uint":return t!=null&&typeof t=="number"?u_.uint(t):r.example!=null?u_.uint(r.example):u_.uint(Sg.UINT);case"uint64":return t!=null&&typeof t=="number"?u_.uint64(t):r.example!=null?u_.uint64(r.example):u_.uint64(Sg.UINT64);default:Fo(r)}}};function v9p({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function gXt(e){switch(e.type){case"object":return El.object({allOf:e.allOf,properties:e.properties.map(t=>j8D(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,fullExamples:void 0,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:void 0});case"array":return El.array({description:e.description,availability:e.availability,value:gXt(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,example:void 0,inline:void 0});case"enum":return El.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,values:e.values,default:e.default,groupName:e.groupName,example:void 0,source:e.source,inline:void 0});case"literal":return El.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName});case"nullable":return El.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gXt(e.value),groupName:e.groupName,inline:void 0});case"optional":return El.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gXt(e.value),groupName:e.groupName,inline:void 0});case"primitive":return El.primitive({description:e.description,availability:e.availability,schema:b9p(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return El.map({description:e.description,availability:e.availability,key:El.primitive({description:e.key.description,availability:e.key.availability,schema:b9p(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,groupName:e.groupName}),value:gXt(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,encoding:e.encoding,example:void 0,inline:void 0});case"reference":return El.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return El.oneOf(P8D(e.value));case"unknown":return El.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:void 0,example:void 0,groupName:void 0,description:void 0,availability:void 0});default:Fo(e)}}function P8D(e){switch(e.type){case"discriminated":return QY.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:gXt(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,gXt(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return QY.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>gXt(t)),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:Fo(e)}}function b9p(e){switch(e.type){case"string":return Xd.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return Xd.base64({example:void 0});case"boolean":return Xd.boolean({default:e.default,example:void 0});case"date":return Xd.date({example:void 0});case"datetime":return Xd.datetime({example:void 0});case"double":return Xd.double({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"float":return Xd.float({example:void 0});case"int":return Xd.int({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"int64":return Xd.int64({default:e.default,example:void 0});case"uint":return Xd.uint({default:void 0,example:void 0});case"uint64":return Xd.uint64({default:void 0,example:void 0});default:Fo(e)}}function j8D(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:gXt(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function Vxo(e){return e.type!=="optional"&&e.type!=="nullable"}function FWs(e){return e==="POST"||e==="PUT"||e==="PATCH"}function sha(e){if(e.type==="full")return e.request==null&&e.response==null&&e.queryParameters==null&&e.pathParameters==null&&e.headers==null;{let t=e.value;return t.request==null&&t.response==null&&t["query-parameters"]==null&&t["path-parameters"]==null&&t.headers==null}}var Wxo=class{schemas;context;exampleTypeFactory;logger;constructor(t,r){this.schemas=t,this.context=r,this.schemas=t,this.exampleTypeFactory=new $di(t,r.nonRequestReferencedSchemas,r),this.logger=r.logger}buildEndpointExample(t){this.logger.debug(`Building endpoint example for ${t.method.toUpperCase()} ${t.path}`);let r=S8D(t.request),i=D8D(t.response);if(r?.type==="unsupported"||i?.type==="unsupported")return[];let n=[];if(r!=null&&r.type==="present"){let c=this.isSchemaRequired(r.schema);if(r.examples.length===0){let b=this.exampleTypeFactory.buildExample({skipReadonly:FWs(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});b!=null&&n.push([void 0,b])}else for(let{name:b,value:g}of r.examples){let O=this.exampleTypeFactory.buildExample({skipReadonly:FWs(t.method),schema:r.schema,exampleId:b,example:g,options:{isParameter:!1,ignoreOptionals:!0}});O!=null&&n.push([b,O])}if(c&&n.length===0)return this.logger.trace(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let a=[];if(i!=null&&i.type==="present"){let c=this.isSchemaRequired(i.schema);if(t.response?.type==="json"&&t.response.statusCode===204)a.push([void 0,yze.withoutStreaming(rg.object({properties:{}}))]);else if(i.examples.length===0){let b=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:i.schema,exampleId:void 0,example:void 0,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});b!=null&&(t.response?.type==="json"?a.push([void 0,yze.withoutStreaming(b)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,yze.withStreaming({sse:t.response?.type==="streamingSse",events:[b]})]))}else for(let{name:b,value:g}of i.examples){let O=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:i.schema,exampleId:b,example:g,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});O!=null&&(t.response?.type==="json"?a.push([b,yze.withoutStreaming(O)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,yze.withStreaming({sse:t.response?.type==="streamingSse",events:[O]})]))}if(c&&a.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let u=[];for(let c of t.pathParameters){let b=this.isSchemaRequired(c.schema),g=this.exampleTypeFactory.buildExample({schema:c.schema,exampleId:void 0,example:void 0,options:{name:c.name,isParameter:!0,ignoreOptionals:!0}});if(g!=null&&!OXt(g)&&(this.logger.warn(`Expected a primitive example but got ${g.type} for path parameter ${c.name} for ${t.method.toUpperCase()} ${t.path}`),g=void 0),b&&g==null)return[];g!=null&&u.push({name:c.name,parameterNameOverride:c.parameterNameOverride,value:g})}let l=[];for(let c of t.queryParameters){let b=this.isSchemaRequired(c.schema),g=this.exampleTypeFactory.buildExample({schema:c.schema,exampleId:void 0,example:void 0,options:{name:c.name,isParameter:!0,ignoreOptionals:!0}});if(g!=null&&!OXt(g)&&(this.logger.warn(`Expected a primitive example but got ${g.type} for query parameter ${c.name} for ${t.method.toUpperCase()} ${t.path}`),g=void 0),b&&g==null)return[];g!=null&&l.push({name:c.name,value:g})}let d=[];for(let c of t.headers){let b=this.isSchemaRequired(c.schema),g=this.exampleTypeFactory.buildExample({schema:c.schema,exampleId:void 0,example:void 0,options:{name:c.name,isParameter:!0,ignoreOptionals:!0}});if(g!=null&&!OXt(g)&&(this.logger.warn(`Expected a primitive example but got ${g.type} for header ${c.name} for ${t.method.toUpperCase()} ${t.path}`),g=void 0),b&&g==null)return[];g!=null&&d.push({name:c.name,value:g})}let s=[];t.request!=null&&t.response!=null?s=w8D(n,a):t.request!=null?s=n.map(([c,b])=>({id:c,request:b,response:void 0})):t.response!=null&&(s=a.map(([c,b])=>({id:c,request:void 0,response:b})));let o=t.examples.filter(c=>sha(c)).flatMap(c=>{if(c.type==="unknown"){if(c.value!=null){let b=c.value["code-samples"];if(b!=null)return this.convertCodeSamples(b)}return}else return c.codeSamples}).filter(c=>Qb(c));return s.length===0?[E5t.full({name:void 0,description:void 0,pathParameters:u,queryParameters:l,headers:d,request:void 0,response:void 0,codeSamples:o})]:s.map(({id:c,request:b,response:g})=>E5t.full({name:c,description:void 0,pathParameters:u,queryParameters:l,headers:d,request:b,response:g,codeSamples:o}))}convertCodeSamples(t){return t.map(r=>"language"in r?kJr.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):kJr.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?_V.Csharp:r.sdk,code:r.code})).filter(Qb)}isSchemaRequired(t){return Vxo(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function w8D(e,t){let r=[];if(e.length<=1){let[n,a]=e[0]??[];if(t.length===0)return r.push({id:n,request:a,response:void 0}),r;for(let[u,l]of t)r.push({id:u??n,request:a,response:l});return r}if(t.length<=1){let[n,a]=t[0]??[];if(t.length===0)return r.push({id:n,request:void 0,response:a}),r;for(let[u,l]of e)r.push({id:u??n,request:l,response:a});return r}let i=new Set;for(let[n,a]of e){let u=t.find(([d])=>d==null)?.[1]??t[0]?.[1];if(n==null){if(u==null)continue;r.push({id:void 0,request:a,response:u});continue}let l=!1;for(let d=0;d<t.length;d++){let[s,o]=t[d];s==null||i.has(d)||n===s&&(r.push({id:n,request:a,response:o}),s!=null&&i.add(d),l=!0)}!l&&u!=null&&r.push({id:n,request:a,response:u})}for(let n=0;n<t.length;n++){if(i.has(n))continue;let[a,u]=t[n],l=e.find(([d])=>d==null)?.[1]??e[0]?.[1];l!=null&&r.push({id:a,request:l,response:u})}return r}function S8D(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:E8D(e),examples:[]}:e.type==="json"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function D8D(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 OXt(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return OXt(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undiscriminated":return OXt(e.value.value);default:return!1}default:Fo(e)}}function E8D(e){return El.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:gXt(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0,readonly:void 0,writeonly:void 0,inline:void 0}).filter(Qb),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,source:e.source,inline:void 0})}var BSn=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new $di(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,publish:i,subscribe:n,handshake:a,source:u,namespace:l}){let d=[];for(let s of r){let o=[];for(let g of a.queryParameters){let O=this.isSchemaRequired(g.schema),m=this.exampleTypeFactory.buildExample({schema:g.schema,exampleId:void 0,example:s.queryParameters?.[g.name],options:{name:g.name,isParameter:!0,ignoreOptionals:!0}});m!=null&&!OXt(m)&&(m=void 0),!(O&&m==null)&&m!=null&&o.push({name:g.name,value:m})}let c=[];for(let g of a.headers){let O=this.isSchemaRequired(g.schema),m=this.exampleTypeFactory.buildExample({schema:g.schema,exampleId:void 0,example:s.headers?.[g.name],options:{name:g.name,isParameter:!0,ignoreOptionals:!0}});m!=null&&!OXt(m)&&(m=void 0),!(O&&m==null)&&m!=null&&c.push({name:g.name,value:m})}let b=[];for(let g of s.messages){let O=t.getExampleMessageReference(g),m=t.resolveMessageReference({$ref:O}),w=Zd(m.payload)?t.resolveSchemaReference(m.payload):m.payload,E=this.exampleTypeFactory.buildExample({schema:qb(w,!1,t,[g.messageId],u,l),exampleId:void 0,example:g.value,options:{isParameter:!1,ignoreOptionals:!0}});E!=null&&b.push({messageType:g.type,payload:E,description:void 0})}d.push({name:s.summary,queryParameters:o,headers:c,description:s.description,messages:b})}return d}buildWebsocketSessionExample({publish:t,subscribe:r,handshake:i}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},a=[];for(let l of i.queryParameters){let d=this.isSchemaRequired(l.schema),s=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(s!=null&&!OXt(s)&&(s=void 0),d&&s==null)return;s!=null&&a.push({name:l.name,value:s})}let u=[];for(let l of i.headers){let d=this.isSchemaRequired(l.schema),s=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(s!=null&&!OXt(s)&&(s=void 0),d&&s==null)return;s!=null&&u.push({name:l.name,value:s})}if(t!=null){let l=this.exampleTypeFactory.buildExample({schema:t,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});l!=null&&n.messages.push({messageType:"publish",payload:l,description:void 0})}if(r!=null){let l=this.exampleTypeFactory.buildExample({schema:r,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});l!=null&&n.messages.push({messageType:"subscribe",payload:l,description:void 0})}return n}isSchemaRequired(t){return Vxo(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 mG={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_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path",FERN_ENUM:"x-fern-enum",IGNORE:"x-fern-ignore"};function Hxo(e){return yf(e,mG.FERN_EXAMPLES)??[]}function $xo(e,t){return t.includes("://")?t:`${e}://${t}`}function Gxo(e){return e.startsWith("/")?e:"/"+e}function m9p({context:e,breadcrumbs:t,source:r,asyncApiOptions:i,document:n}){let a={},u={};for(let[s,o]of Object.entries(n.components?.schemas??{})){let c=qb(o,!1,e,[s],r,e.namespace);a[s]=c}let l=new BSn(a,e),d={};for(let[s,o]of Object.entries(n.servers??{}))d[s]={name:s,url:$xo(o.protocol,o.url)};for(let[s,o]of Object.entries(n.channels??{})){let c=yf(o,mG.IGNORE);if(c!=null&&c){e.logger.debug(`Channel ${s} is marked with x-fern-ignore. Skipping.`);continue}let b=[];if(o.parameters!=null)for(let[E,A]of Object.entries(o.parameters??{}))b.push({name:E,description:A.description,parameterNameOverride:void 0,schema:A.schema!=null?qb(A.schema,!1,e,t,r,e.namespace):El.primitive({schema:Xd.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,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:Bie(A),source:r});let g=[],O=[];if(o.bindings?.ws!=null){if(o.bindings.ws.headers!=null){let E=o.bindings.ws.headers.required??[];for(let[A,q]of Object.entries(o.bindings.ws.headers.properties??{})){let D=Zd(q)?e.resolveSchemaReference(q):q;g.push({name:A,schema:qb(D,!E.includes(A),e,[...t,A],r,e.namespace),description:D.description,parameterNameOverride:void 0,env:void 0,availability:Bie(D),source:r})}}if(o.bindings.ws.query!=null){let E=o.bindings.ws.query.required??[];for(let[A,q]of Object.entries(o.bindings.ws.query.properties??{})){let D=Zd(q)?e.resolveSchemaReference(q):q;O.push({name:A,schema:qb(D,!E.includes(A),e,[...t,A],r,e.namespace),description:D.description,parameterNameOverride:void 0,availability:Bie(D),source:r})}}}let m;o.publish!=null&&("oneOf"in o.publish.message?m=g9p({generatedName:o.publish.operationId??"PublishEvent",event:o.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:i}):m=O9p({action:"Publish",channelPath:s,message:o.publish.message,context:e,source:r}));let w;if(o.subscribe!=null&&("oneOf"in o.subscribe.message?w=g9p({generatedName:o.subscribe.operationId??"SubscribeEvent",event:o.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:i}):w=O9p({action:"Subscribe",channelPath:s,message:o.subscribe.message,context:e,source:r})),g.length>0||O.length>0||m!=null||w!=null){let E=Hxo(o),A=[];if(E.length>0)A=l.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:E,handshake:{headers:g,queryParameters:O},publish:m,subscribe:w,source:r,namespace:e.namespace});else{let C=l.buildWebsocketSessionExample({handshake:{headers:g,queryParameters:O},publish:m,subscribe:w});C!=null&&A.push(C)}let q=yf(o,mG.FERN_CHANNEL_ADDRESS),D=q??Gxo(s);u[s]={audiences:yf(o,fd.AUDIENCES)??[],handshake:{headers:g.map(C=>({...C,schema:cE(C.schema),env:C.env})),queryParameters:O.map(C=>({...C,schema:cE(C.schema)})),pathParameters:b.map(C=>({...C,parameterNameOverride:void 0,schema:cE(C.schema)}))},groupName:[yf(o,mG.FERN_SDK_GROUP_NAME)??s],publish:m!=null?cE(m):m,subscribe:w!=null?cE(w):w,servers:(o.servers?.map(C=>d[C])??Object.values(d)).filter(C=>C!=null),summary:yf(o,mG.FERN_DISPLAY_NAME),path:D,description:o.description,examples:A,source:r}}}return{groupedSchemas:CSn(e.namespace,a),channels:u??void 0,servers:Object.values(d),basePath:yf(n,mG.BASE_PATH)}}function g9p({generatedName:e,event:t,context:r,breadcrumbs:i,source:n,options:a,asyncApiOptions:u}){if("oneOf"in t.message&&t.message.oneOf!=null){let l=[],d=[];for(let s of t.message.oneOf){let o,c={type:"notFound"};if(Zd(s)){let b=r.resolveMessageReference(s);!Zd(b.payload)&&u.naming==="v2"?(c=b.name?{type:"name",name:b.name}:c,o={...b.payload,title:b.name??b.payload.title,description:b.name??b.payload.description}):o=b.payload}else o=s;d.push(c),l.push(o)}return MSn({description:t.description??t.message.description,availability:Bie(t.message),subtypes:l,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsNullable:!1,breadcrumbs:i,context:r,encoding:void 0,source:n,namespace:r.namespace,subtypePrefixOverrides:u.naming==="v2"?d:[]})}}function O9p({action:e,channelPath:t,message:r,context:i,source:n}){if(r.payload!=null){let a=r.payload;return Zd(r.payload)&&(a=i.resolveSchemaReference(r.payload)),Zd(a)?qb(a,!1,i,[t,e],n,i.namespace):qb(a,!1,i,[t,e],n,i.namespace)}}var Qxo=class extends TSn{getExampleMessageReference(t){return`#/channels/${t.channelId}/messages/${t.messageId}`}resolveMessageReference(t){let r="#/channels/",i="#/components/messages/";if(t.$ref.startsWith(r)){let l=t.$ref.split("/"),d=l[2],s=l[4];if(d==null||s==null||!this.document.channels?.[d])throw new Error(`Failed to resolve message reference ${t.$ref} in channel ${d}`);let c=this.document.channels[d].messages?.[s];if(c==null)throw new Error(`${t.$ref} is undefined`);return{name:s,...c}}let n=this.document.components;if(!t.$ref.startsWith(i)||!n?.messages)throw new Error(`Failed to resolve message reference: ${t.$ref} in v3 components`);let a=t.$ref.substring(i.length),u=n.messages[a];if(u==null)throw new Error(`${t.$ref} is undefined`);return{name:a,...u}}};var P9p="#/channels/",j9p="#/servers/",LWs="$message.";function S9p({context:e,breadcrumbs:t,source:r,asyncApiOptions:i,document:n}){let a={},u={},l={},d=[],s={};for(let[m,w]of Object.entries(n.components?.schemas??{}))a[m]=qb(w,!1,e,[m],r,e.namespace);for(let[m,w]of Object.entries(n.channels??{}))if(u[m]||(u[m]={}),w.messages)for(let[E,A]of Object.entries(w.messages))A&&A.payload!=null&&(l[E]||(l[E]=[]),l[E].push({channelId:m,payload:A.payload}));for(let[m,w]of Object.entries(l))if(w.length===1){let E=w[0],A=E.channelId;u[A]=u[A]||{},u[A][m]=qb(E.payload,!1,e,[m],r,e.namespace)}else{d.push(m);for(let{channelId:E,payload:A}of w){let q=`${E}_${m}`;u[E]||(u[E]={}),u[E][q]=qb(A,!1,e,[q],r,e.namespace)}}let o=Object.values(u).reduce((m,w)=>({...m,...w}),{}),c=new BSn(o,e),b={};for(let[m,w]of Object.entries(n.servers??{}))b[m]={name:m,url:$xo(w.protocol,w.host)};let g={};for(let[m,w]of Object.entries(n.operations??{})){if(yf(w,mG.IGNORE))continue;let E=M8D(w);if(g[E]||(g[E]={subscribe:[],publish:[]}),w.action==="receive")g[E].subscribe.push(...w.messages);else if(w.action==="send")g[E].publish.push(...w.messages);else throw new Error(`Operation ${m} has an invalid action: ${w.action}`)}let O={};for(let[m,w]of Object.entries(g)){O[m]={subscribe:void 0,publish:void 0};let E=m.split("/").pop()??m,A=E.charAt(0).toUpperCase()+E.slice(1);w.subscribe.length>0&&u[m]!=null&&(O[m].subscribe=w9p({generatedName:A+"SubscribeEvent",channelPath:m,messages:w.subscribe,breadcrumbs:t,context:e,source:r,messageSchemas:u[m],duplicatedMessageIds:d})),w.publish.length>0&&u[m]!=null&&(O[m].publish=w9p({generatedName:A+"PublishEvent",channelPath:m,messages:w.publish,breadcrumbs:t,context:e,source:r,messageSchemas:u[m],duplicatedMessageIds:d}))}for(let[m,w]of Object.entries(n.channels??{})){if(yf(w,mG.IGNORE))continue;let E=[],A=[],q=[];if(w.parameters!=null)for(let[D,C]of Object.entries(w.parameters)){let{type:R,parameterKey:$}=A8D(C.location),I=yf(C,mG.FERN_PARAMETER_OPTIONAL),U=G3(Dg(m))+G3(Dg(D)),H=yf(C,mG.FERN_ENUM),k=C.enum!=null&&Array.isArray(C.enum)?T8D({parameterName:U,fernEnum:H,parameterDescription:C.description,enumValues:C.enum,defaultValue:C.default,context:e,source:r}):El.primitive({schema:Xd.string({default:C.default,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:C.examples?.[0]}),description:void 0,availability:void 0,generatedName:"",title:U,groupName:void 0,nameOverride:void 0});I&&(k=El.optional({value:k,description:void 0,availability:void 0,generatedName:"",title:U,groupName:void 0,nameOverride:void 0,inline:void 0}));let K={name:$,description:C.description,parameterNameOverride:void 0,schema:k,variableReference:void 0,availability:Bie(C),source:r};R==="header"?E.push({...K,env:void 0}):R==="path"?A.push(K):R==="payload"&&q.push(K)}if(E.length>0||q.length>0||O[m]!=null&&(O[m].publish!=null||O[m].subscribe!=null)){let D=Hxo(w),C=[];if(D.length>0)C=c.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:D,handshake:{headers:E,queryParameters:q},publish:O[m]?.publish,subscribe:O[m]?.subscribe,source:r,namespace:e.namespace});else{let R=c.buildWebsocketSessionExample({handshake:{headers:E,queryParameters:q},publish:O[m]?.publish,subscribe:O[m]?.subscribe});R!=null&&C.push(R)}s[m]={audiences:yf(w,fd.AUDIENCES)??[],handshake:{headers:E.map(R=>({...R,schema:cE(R.schema),env:R.env})),queryParameters:q.map(R=>({...R,schema:cE(R.schema)})),pathParameters:A.map(R=>({...R,parameterNameOverride:void 0,schema:cE(R.schema)}))},groupName:[yf(w,mG.FERN_SDK_GROUP_NAME)??m],publish:O[m]?.publish!=null?cE(O[m].publish):void 0,subscribe:O[m]?.subscribe!=null?cE(O[m].subscribe):void 0,summary:yf(w,mG.FERN_DISPLAY_NAME),servers:w.servers?.map(R=>q8D(b,R))??Object.values(b),path:w.address??Gxo(m),description:w.description,examples:C,source:r}}}return{groupedSchemas:CSn(e.namespace,a),channels:s,servers:Object.values(b),basePath:yf(n,mG.BASE_PATH)}}function M8D(e){if(!e.channel.$ref.startsWith(P9p))throw new Error(`Failed to resolve channel path from operation ${e.channel.$ref}`);return e.channel.$ref.substring(P9p.length)}function A8D(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(LWs))throw new Error(`Invalid location format: ${e}; expected ${LWs} prefix`);let i=t.substring(LWs.length);if(i!=="header"&&i!=="path"&&i!=="payload")throw new Error(`Invalid message type: ${i}. Must be one of: header, path, payload`);return{type:i,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 q8D(e,t){if(!t.$ref.startsWith(j9p))throw new Error(`Failed to resolve server name from server ref ${t.$ref}`);let r=t.$ref.substring(j9p.length),i=e[r];if(i==null)throw new Error(`Failed to find server with name ${r}`);return i}function T8D({parameterName:e,fernEnum:t,parameterDescription:r,enumValues:i,defaultValue:n,context:a,source:u}){return bXt({nameOverride:void 0,generatedName:e,title:void 0,wrapAsNullable:!1,description:r??void 0,availability:void 0,fernEnum:t??{},enumVarNames:void 0,enumValues:i,_default:n,groupName:void 0,context:a,source:u,inline:void 0})}function w9p({generatedName:e,channelPath:t,messages:r,context:i,breadcrumbs:n,source:a,messageSchemas:u,duplicatedMessageIds:l}){if(r.length>0){let d=[];for(let s of r){let o=i.resolveMessageReference(s),c;l.some(g=>g===o.name)?c=`${t}_${o.name}`:c=o.name;let b=u[c];b!=null&&d.push(b)}return o9p({description:void 0,availability:void 0,subtypes:d,nameOverride:void 0,generatedName:e,title:void 0,groupName:void 0,wrapAsNullable:!1,breadcrumbs:n,context:i,encoding:void 0,source:a,namespace:i.namespace,subtypePrefixOverrides:[]})}}function D9p({document:e,taskContext:t,options:r,source:i,asyncApiOptions:n,namespace:a}){let u=[];if(a!=null&&u.push(a),parseFloat(e.asyncapi)<3){let l=e;l.tags?.[0]!=null?u.push(l.tags[0].name):n.naming!=="v2"&&u.push("websocket");let d=new Uxo({document:l,taskContext:t,options:r,namespace:a});return m9p({context:d,breadcrumbs:u,source:i,asyncApiOptions:n,document:l})}else{let l=e,d=new Qxo({document:l,taskContext:t,options:r,namespace:a});return S9p({context:d,breadcrumbs:u,source:i,asyncApiOptions:n,document:l})}}function E9p(e){let t=C8D(e),r={};return UWs({obj:t,occurrences:r,breadcrumbs:[]}),r}function UWs({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let i of e)UWs({obj:i,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let i=e.$ref;t[i]==null?t[i]=1:t[i]+=1;return}for(let i in e)UWs({obj:e[i],occurrences:t,breadcrumbs:[...r,i]})}}}function C8D(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?cha(r.get):void 0,put:r?.put!=null?cha(r.put):void 0,post:r?.post!=null?cha(r.post):void 0,patch:r?.patch!=null?cha(r.patch):void 0,delete:r?.delete!=null?cha(r.delete):void 0}]))}}function cha(e){return{...e,requestBody:e.requestBody!=null?Zd(e.requestBody)?e.requestBody:B8D(e.requestBody):void 0}}function B8D(e){let t,r;for(let i in e.content){let n=JB.parse(i);n!=null&&(n.isJSON()?t=e.content[i]:n.isMultipart()&&(r=e.content[i]))}return r!=null&&t!=null?{...e,content:{[JB.MULTIPART_FORM_DATA]:r}}:e}var Jxo=class{endpoints;parser=new MBi;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 i=[];for(let n of r){let a=this.parser.tryParse(n);if(a==null){t.logger.debug(`Ignoring configured filter endpoint "${n}"; expected format "POST /users/get"`);continue}i.push(`${a.method} ${a.path}`)}return i}};var M9p="#/components/parameters/",A9p="#/components/responses/",q9p="#/components/examples/",T9p="#/components/requestBodies/",xSn=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;constructor({document:t,taskContext:r,authHeaders:i,options:n,source:a,namespace:u}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=i,this.refOccurrences=E9p(t),this.options=n,this.source=a,this.filter=new Jxo({context:r,options:n}),this.DUMMY=this.getDummy(),this.namespace=u}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 i={type:"namespace",name:this.namespace};r.push(i)}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(n=>n.replace(/~1/g,"/")),i=this.document;for(let n of r){if(typeof i!="object"||i==null)return{"x-fern-type":"unknown"};i=i[n]}return i==null?(this.logger.warn(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(Zd(i)&&(i=this.resolveSchemaReference(i)),i)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(M9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(M9p.length),i=this.document.components.parameters[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveParameterReference(i):i}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(T9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(T9p.length),i=this.document.components.requestBodies[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveRequestBodyReference(i):i}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(A9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(A9p.length),i=this.document.components.responses[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveResponseReference(i):i}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(q9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(q9p.length),i=this.document.components.examples[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveExampleReference(i):i}referenceExists(t){let r=t.substring(2).split("/").map(n=>n.replace(/~1/g,"/")),i=this.document;for(let n of r){if(typeof i!="object"||i==null)return!1;i=i[n]}return!0}};var ISn=class extends xSn{constructor({document:t,taskContext:r,options:i,source:n,namespace:a}){super({document:t,taskContext:r,authHeaders:new Set,options:i,source:n,namespace:a})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,i){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,i){}getDiscriminatedUnionMetadata(t){}};var Kxo=class extends xSn{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discriminatedUnionReferences={};discriminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:i,options:n,source:a,namespace:u}){super({document:t,taskContext:r,authHeaders:i,options:n,source:a,namespace:u})}getDummy(){return new ISn({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,i){let n=this.discriminatedUnionReferences[t.$ref];n!=null?(n.discriminants.add(r),n.numReferences+=i):this.discriminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:i}}getReferencesFromDiscriminatedUnion(t){return this.discriminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,i){let n=this.discriminatedUnionMetadata[t.$ref];n!=null?n.discriminants.set(r,i):this.discriminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,i]])}}getDiscriminatedUnionMetadata(t){return this.discriminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}};function C9p(e){return yf(e,fd.ASYNC_CONFIG)}var B9p="$request.";function x9p(e){let t=yf(e,fd.STREAMING);if(t!=null)return typeof t=="boolean"?t?{type:"stream",format:"json"}:void 0:t["stream-condition"]==null&&t.format!=null?{type:"stream",format:t.format}:{type:"streamCondition",format:t.format??"json",streamDescription:t["stream-description"],streamConditionProperty:x8D(t["stream-condition"]),responseStream:t["response-stream"],response:t.response}}function x8D(e){return e.startsWith(B9p)?e.slice(B9p.length):e}function I9p(e){let t=e;if(t.cursor!=null)return hze.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});if("offset"in e){let r=e;return hze.offset({offset:r.offset,results:r.results,step:r.step,hasNextPage:r["has-next-page"]})}if("type"in e&&e.type==="custom"){let r=e;return hze.custom({results:r.results})}throw new Error("Invalid pagination extension")}function z9p(e,t){let r=yf(t,fd.PAGINATION);if(r!=null){if(typeof r=="boolean"){let i=yf(e,fd.PAGINATION);if(typeof i=="boolean")throw new Error("Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.");return i==null?void 0:I9p(i)}return I9p(r)}}var I8D=Yu.object({lang:Yu.string(),label:Yu.optional(Yu.string()),source:Yu.string()}),VWs=Yu.array(I8D);var R9p={README_EXT:"x-readme"};function z8D(e){if(!Array.isArray(e))return!1;for(let t of e)if(!kj(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function N9p(e){let t=yf(e,R9p.README_EXT);if(!kj(t))return[];let r=t["code-samples"];if(!z8D(r))return[];let i=[];for(let n of r)i.push({name:n.name,language:n.language,code:n.code,install:n.install,docs:void 0});return i}function F9p(e,t,r){let n=(yf(t,fd.EXAMPLES)??[]).filter(s=>{let o=l2.serialization.ExampleEndpointCallSchema.parse(s);return o.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),o.ok}),a=aha(t,mV.REDOCLY_CODE_SAMPLES_KEBAB,VWs,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],l=[...aha(t,mV.REDOCLY_CODE_SAMPLES_CAMEL,VWs,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...a];l.length>0&&n.push({"code-samples":l.map(s=>({name:s.label??s.lang,language:s.lang,code:s.source,install:void 0,docs:void 0}))});let d=N9p(t);return d.length>0&&n.push({"code-samples":d}),n.map(E5t.unknown)}function L9p(e){let t=yf(e,fd.AVAILABILITY);if(t==="ga"||t==="generally-available")return pV.GenerallyAvailable;if(t==="beta"||t==="pre-release")return pV.Beta;if(t==="deprecated")return pV.Deprecated;if(e.deprecated)return pV.Deprecated}function Yxo(e){return{url:R8D({url:e.url,variables:e.variables??{}}),description:e.description,name:N8D(e),audiences:yf(e,fd.AUDIENCES)}}function R8D({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([i,n])=>[i,n.default]));for(let[i,n]of Object.entries(r))e=e.replace(`{${i}}`,n);return e}function N8D(e){let t=yf(e,[fd.SERVER_NAME_V1,fd.SERVER_NAME_V2]);if(t!=null)return t;if(e.description?.toLowerCase()==="production")return"Production";if(e.description?.toLowerCase()==="sandbox")return"Sandbox"}function U9p(e){return yf(e,fd.PARAMETER_NAME)}function V9p(e){return yf(e,fd.SDK_VARIABLE)}function Xxo({path:e,httpMethod:t,parameters:r,context:i,requestBreadcrumbs:n,source:a}){let u={pathParameters:[],queryParameters:[],headers:[]};for(let l of r){let d=yf(l,fd.IGNORE);if(d!=null&&d){i.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let s=Zd(l)?i.resolveParameterReference(l):l,o=s.required??!1,c=Bie(s),b=[...n,s.name],g=D2(b,i.options.preserveSchemaIds),O=s.schema!=null?qb(s.schema,!o,i,b,a,i.namespace,!1,new Set,_Kr({schema:s,logger:i.logger})):o?El.primitive({nameOverride:void 0,generatedName:g,title:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:_Kr({schema:s,logger:i.logger})}),description:void 0,availability:c,groupName:void 0}):El.optional({nameOverride:void 0,generatedName:g,title:void 0,value:El.primitive({nameOverride:void 0,generatedName:g,title:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:_Kr({schema:s,logger:i.logger})}),description:void 0,availability:void 0,groupName:void 0}),description:void 0,availability:c,groupName:void 0,inline:void 0});if(s.in==="header"&&s.schema!=null&&!Zd(s.schema)&&s.schema.default!=null){let w=s.schema.default;typeof w=="string"&&w.length>0&&(O=El.literal({nameOverride:void 0,generatedName:g,title:void 0,value:cx.string(w),description:void 0,availability:c,groupName:void 0}))}let m={name:s.name,schema:O,description:s.description,parameterNameOverride:U9p(s),availability:c,source:a};s.in==="query"?u.queryParameters.push(m):s.in==="path"?u.pathParameters.push({...m,variableReference:V9p(s)}):s.in==="header"?!F8D.has(s.name.toLowerCase())&&!i.authHeaders.has(s.name)?u.headers.push({...m,env:void 0}):i.logger.debug(`Ignoring ${s.name} header, in ${t.toUpperCase()} ${e}`):i.logger.warn(`Skipping ${s.in} parameter, ${s.name}, in ${t.toUpperCase()} ${e}`)}return u}var F8D=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]);function W9p(e,t){for(let r of Object.keys(e))if(r.includes("text/event-stream")){let i=e[r];if(i==null)continue;let n=i.schema;return{contentType:r,schema:n??{},examples:lha(i,t)}}}function zSn(e,t){for(let r of Object.keys(e))if(r.includes("json")||r==="*/*"){let i=e[r];if(i==null)continue;let n=i.schema;return{contentType:r.includes("*")?void 0:r,schema:n??{},examples:lha(i,t)}}}function H9p(e,t){for(let r of Object.keys(e)){let i=e[r];if(i==null)continue;return{schema:i.schema??{},examples:lha(i,t)}}}function lha(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let i=yf(e,mV.EXAMPLES);return i!=null&&Object.keys(i).length>0&&r.push(...Object.entries(i).map(([n,a])=>({name:a.summary??n,value:a.value,description:a.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([n,a])=>{let u=Zd(a)?t.resolveExampleReference(a):a;return{name:u.summary??n,value:u.value,description:u.description}})),r}function L8D(e,t){for(let[r,i]of Object.entries(e.content))if(JB.parse(r)?.isURLEncoded())return{schema:i.schema,contentType:r,examples:lha(i,t)}}function U8D(e){for(let[t,r]of Object.entries(e.content))if(JB.parse(t)?.isMultipart())return{schema:r.schema,encoding:r.encoding}}function V8D(e){for(let t in e.content)if(JB.parse(t)?.isOctetStream())return!0;return!1}function W8D(e,t){let r=Zd(e)?WWs(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([i,n])=>!Zd(n)&&n.type==="string"&&n.format==="binary")!=null}function RSn({requestBody:e,document:t,context:r,requestBreadcrumbs:i,source:n,namespace:a}){let u=Zd(e)?r.resolveRequestBodyReference(e):e,l=U8D(u),d=l?.schema,s=l?.encoding,o=L8D(u,r),c=zSn(u.content,r);if(V8D(u))return VSe.octetStream({description:u.description,source:n});if(d!=null&&c==null||d!=null&&W8D(d,t)){let b=Zd(d)?WWs(d,t):{id:void 0,schema:d},g=qb(b.schema,!1,r,i,n,a),O=[];if(g.type==="object")for(let m of g.properties){if(m.schema.type==="primitive"&&m.schema.schema.type==="string"&&m.schema.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!1,isArray:!1,description:void 0}),description:m.schema.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}if(m.schema.type==="optional"&&m.schema.value.type==="primitive"&&m.schema.value.schema.type==="string"&&m.schema.value.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!0,isArray:!1,description:m.schema.value.description}),description:m.schema.value.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}if(m.schema.type==="array"&&m.schema.value.type==="primitive"&&m.schema.value.schema.type==="string"&&m.schema.value.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!1,isArray:!0,description:m.schema.value.description}),description:m.schema.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}if(m.schema.type==="optional"&&m.schema.value.type==="array"&&m.schema.value.value.type==="primitive"&&m.schema.value.value.schema.type==="string"&&m.schema.value.value.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!0,isArray:!0,description:m.schema.value.value.description}),description:m.schema.value.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}let w=s?.[m.key]?.contentType;O.push({key:m.key,schema:vze.json(m.schema),description:void 0,contentType:s?.[m.key]?.contentType,exploded:s?.[m.key]?.explode,encoding:w==null?r.options.defaultFormParameterEncoding:void 0})}return VSe.multipart({name:Zd(d)&&r.getNumberOfOccurrencesForRef(d)===1?b.id:void 0,description:b.schema.description,properties:O,source:n})}if(c!=null){let b=qb(c.schema,!1,r,i,n,a,!0);return VSe.json({description:void 0,schema:b,contentType:c.contentType,fullExamples:c.examples,additionalProperties:!Zd(c.schema)&&SSn(c.schema.additionalProperties),source:n})}if(o!=null&&o.schema!=null){let b=qb(o.schema,!1,r,i,n,a);return VSe.json({schema:b,description:u.description,contentType:o.contentType,source:n,fullExamples:o.examples,additionalProperties:!1})}}function WWs(e,t){if(!e.$ref.startsWith(KRi))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=Wdi(e);if(r==null)throw new Error(`Failed to resolve schema reference because missing schema id: ${e.$ref}`);let i=t.components?.schemas?.[r];if(i==null)throw new Error(`Failed to resolve schema reference because missing: ${e.$ref}`);return Zd(i)?WWs(i,t):{id:r,schema:i}}var HWs={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"},$9p=new Set(Object.values(HWs));var H8D=["200","201","202","204"];function Q9p({operationContext:e,responses:t,context:r,responseBreadcrumbs:i,responseStatusCode:n,streamFormat:a,source:u}){if(t==null)return{value:void 0,errors:{}};let l=$8D({responses:t,context:r,source:u,namespace:r.namespace}),d=!1,s;for(let o of n!=null?[n]:H8D){let c=t[o];c!=null&&(d=!0,s==null&&(s=G9p({operationContext:e,response:c,context:r,responseBreadcrumbs:i,streamFormat:a,source:u,namespace:r.namespace,statusCode:typeof o=="string"?parseInt(o):o})))}if(s==null&&!d&&t.default!=null&&(s=G9p({operationContext:e,response:t.default,context:r,responseBreadcrumbs:i,streamFormat:a,source:u,namespace:r.namespace})),s!=null)switch(s.type){case"json":return{value:s,errors:l};case"streamingJson":case"streamingSse":return{value:s,errors:l};case"file":case"text":case"streamingText":return{value:s,errors:l};default:Fo(s)}return{value:void 0,errors:l}}function G9p({operationContext:e,streamFormat:t,response:r,context:i,responseBreadcrumbs:n,source:a,namespace:u,statusCode:l}){let d=Zd(r)?i.resolveResponseReference(r):r;if(d.content!=null&&Object.entries(d.content).find(([b,g])=>{if(g.schema==null)return!1;let O=Zd(g.schema)?i.resolveSchemaReference(g.schema):g.schema;return O.type==="string"&&O.format==="binary"}))return lx.file({description:d.description,source:a,statusCode:l});let s=W9p(d.content??{},i);if(s!=null&&t!=null)switch(t){case"json":return lx.streamingJson({statusCode:l,description:d.description,responseProperty:yf(e.operation,fd.RESPONSE_PROPERTY),fullExamples:s.examples,schema:qb(s.schema,!1,i,n,a,u),source:a});case"sse":return lx.streamingSse({description:d.description,responseProperty:void 0,fullExamples:s.examples,schema:qb(s.schema,!1,i,n,a,u),source:a,statusCode:l})}let o=zSn(d.content??{},i);if(o!=null){if(t!=null)switch(t){case"json":return lx.streamingJson({description:d.description,responseProperty:void 0,fullExamples:o.examples,schema:qb(o.schema,!1,i,n,a,u),source:a,statusCode:l});case"sse":return lx.streamingSse({description:d.description,responseProperty:void 0,fullExamples:o.examples,schema:qb(o.schema,!1,i,n,a,u),source:a,statusCode:l})}return lx.json({description:d.description,schema:qb(o.schema,!1,i,n,a,u),responseProperty:yf(e.operation,fd.RESPONSE_PROPERTY),fullExamples:o.examples,source:a,statusCode:l})}for(let[c,b]of Object.entries(d.content??{})){let g=JB.parse(c);if(g!=null){if(g.isOctetStream()||g.isPDF()||g.isAudio()||g.isImage()||g.isVideo())return lx.file({description:d.description,source:a,statusCode:l});if(g.isPlainText()){let O=b.schema;if(O==null)return lx.text({description:d.description,source:a,statusCode:l});let m=Zd(O)?i.resolveSchemaReference(O):O;return m.type==="string"&&m.format==="byte"?lx.file({description:d.description,source:a,statusCode:l}):lx.text({description:d.description,source:a,statusCode:l})}}}}function $8D({responses:e,context:t,source:r,namespace:i}){let n={};for(let[a,u]of Object.entries(e)){if(a==="default")continue;let l=parseInt(a);if(l<400||l>600)continue;let d=Zd(u)?t.resolveResponseReference(u):u,s=H9p(d.content??{},t),o=HWs[l];if(o==null){t.logger.warn(`No error name found for status code ${a}`);continue}n[l]={statusCode:l,nameOverride:void 0,generatedName:o,description:d.description,schema:qb(s?.schema??{},!1,t,[o,"Body"],r,i),fullExamples:s?.examples,source:r}}return n}function hKr({operationContext:e,context:t,responseStatusCode:r,suffix:i,streamFormat:n,source:a}){let{document:u,operation:l,path:d,method:s,baseBreadcrumbs:o,sdkMethodName:c}=e,b=yf(l,fd.IDEMPOTENT),g=yf(l,[fd.REQUEST_NAME_V1,fd.REQUEST_NAME_V2]),O=[...o,"Request"],m=Xxo({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:O,path:d,httpMethod:s,source:a}),w=/{([^}]+)}/g,A=[...d.matchAll(w)].map(U=>U[1]).filter(U=>!m.pathParameters.some(H=>H.name===U));if(A.length>0)for(let U of A)m.pathParameters.push({name:U??"",variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:El.primitive({schema:Xd.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,groupName:void 0,availability:void 0,title:void 0}),description:void 0});let q=l.requestBody!=null?RSn({requestBody:l.requestBody,document:u,context:new ISn({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:O,source:a,namespace:t.namespace}):void 0;Q8D({context:t,convertedParameters:m})&&q!=null&&q.type==="json"&&q.schema.type!=="object"&&l.requestBody!=null?q=RSn({requestBody:l.requestBody,document:u,context:t,requestBreadcrumbs:[...O,"Body"],source:a,namespace:t.namespace}):l.requestBody!=null&&(q=RSn({requestBody:l.requestBody,document:u,context:t,requestBreadcrumbs:[...O],source:a,namespace:t.namespace}));let D=[...o,"Response"],C=Q9p({operationContext:e,streamFormat:n,responses:l.responses,context:t,responseBreadcrumbs:D,responseStatusCode:r,source:a});e.method==="GET"&&(q=void 0);let R=L9p(l),$=F9p(e,l,t),I=yf(l,fd.SERVER_NAME_V2);return{summary:l.summary,internal:yf(l,mV.INTERNAL),idempotent:b,audiences:yf(l,fd.AUDIENCES)??[],operationId:l.operationId!=null&&i!=null?l.operationId+"_"+i:l.operationId,tags:t.resolveTagsToTagIds(l.tags),namespace:t.namespace,sdkName:c,pathParameters:m.pathParameters,queryParameters:m.queryParameters,headers:m.headers,requestNameOverride:g??void 0,generatedRequestName:D2(O,t.options.preserveSchemaIds),request:q,response:C.value,errors:C.errors,servers:I!=null?[{name:I,url:void 0,audiences:void 0}]:(l.servers??[]).map(U=>Yxo(U)),description:l.description,authed:G8D(l,u),availability:R,method:s,path:d,examples:$,pagination:e.pagination,source:a}}function G8D(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function Q8D({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function K9p({operationContext:e,context:t,asyncExtension:r,source:i}){let{operation:n,pathItemParameters:a,operationParameters:u}=e,l=r.discriminant.name,d=r.discriminant.value,s=r["response-status-code"],o=J9p({context:t,headerToIgnore:l,parameters:a}),c=J9p({context:t,headerToIgnore:l,parameters:u}),b=hKr({operationContext:{...e,pathItemParameters:o,operationParameters:c,operation:{...n,responses:Object.fromEntries(Object.entries(n.responses).filter(([O])=>parseInt(O)!==s))}},context:t,streamFormat:void 0,source:i}),g=hKr({operationContext:{...e,pathItemParameters:o,operationParameters:c,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:s,streamFormat:void 0,source:i});return g.headers.push({name:l,schema:El.literal({nameOverride:void 0,generatedName:D2([l],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:cx.string(d),groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:i}),{sync:b,async:g}}function J9p({context:e,headerToIgnore:t,parameters:r}){return r.filter(i=>{let n=Zd(i)?e.resolveParameterReference(i):i;return!(n.in==="header"&&n.name===t)})}var $Ws="stream";function k9p({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:hKr({operationContext:e,context:t,streamFormat:r.format,source:t.source}),nonStreaming:void 0};case"streamCondition":{let i=Y9p({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0});if(i?.schemaReference!=null){let s=Wdi(i.schemaReference);s!=null&&t.excludeSchema(s)}let n=X9p({operation:e.operation,response:r.responseStream}),a=hKr({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+$Ws}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:i?.requestBody,responses:n},baseBreadcrumbs:[...e.baseBreadcrumbs,$Ws]},context:t,streamFormat:r.format,suffix:$Ws,source:t.source});a.examples=a.examples.filter(s=>Z9p(s,t)!==!1);let u=Y9p({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),l=X9p({operation:e.operation,response:r.response}),d=hKr({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:u?.requestBody,responses:l}},context:t,source:t.source});return d.examples=d.examples.filter(s=>Z9p(s,t)!==!0),{streaming:a,nonStreaming:d}}default:Fo(r)}}function Y9p({context:e,operation:t,streamingExtension:r,isStreaming:i}){if(t.requestBody==null)return;let n=Zd(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,a=zSn(n.content,e);if(a==null)return;let u=Zd(a.schema)?e.resolveSchemaReference(a.schema):a.schema;if(u.allOf==null&&u.properties==null)return;let l=u.properties?.[r.streamConditionProperty];l!=null&&Zd(l)&&(l=void 0);let d={...u,properties:{...u.properties,[r.streamConditionProperty]:{type:"boolean","x-fern-boolean-literal":i,...l??{}}},title:void 0,required:[...u.required??[],r.streamConditionProperty]};return{requestBody:{content:{[JB.APPLICATION_JSON]:{schema:d}}},schemaReference:Zd(a.schema)?a.schema:void 0}}function X9p({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[JB.APPLICATION_JSON]:{schema:t}}}}}function Z9p(e,t){return e._visit({unknown:r=>{let i=l2.serialization.ExampleEndpointCallSchema.parse(r);if(i.ok&&i.value.response!=null)return i.value.response.stream!=null},full:()=>{},_other:()=>{}})}function eLp({context:e,operationContext:t,source:r}){let{document:i,operation:n,path:a,method:u,baseBreadcrumbs:l,sdkMethodName:d}=t,s=[...l,"Payload"],o=Xxo({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:s,path:a,httpMethod:u,source:r});if(n.requestBody==null){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Missing a request body`);return}if(u!=="POST"&&u!=="GET"){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Not POST or GET`);return}let c=RSn({requestBody:n.requestBody,document:i,context:e,requestBreadcrumbs:[...l,"Payload"],source:r,namespace:e.namespace});if(c==null||c.type!=="json"){e.logger.error(`Skipping webhook ${a} because non-json request body`);return}if(n.operationId==null){e.logger.error(`Skipping webhook ${a} because no operation id present`);return}return{summary:n.summary,sdkName:d,namespace:e.namespace,method:u,operationId:n.operationId,tags:e.resolveTagsToTagIds(n.tags),headers:o.headers,generatedPayloadName:D2(s,e.options.preserveSchemaIds),payload:c.schema,description:n.description,examples:J8D(c.fullExamples),source:r}}function J8D(e){if(e==null)return[];let t=[];for(let r of e){let i=Hdi(r.value);i!=null&&t.push({description:r.description,name:r.name,payload:i})}return t}function GWs({context:e,pathItemContext:t,operation:r,convertToWebhook:i}){let n=yf(r,fd.IGNORE);if(n!=null&&n){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let a=K8D(r,e),u=z9p(e.document,r),l={...t,sdkMethodName:a,baseBreadcrumbs:Y8D({operation:r,sdkMethodName:a,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:u};if(i){let c=eLp({context:e,operationContext:l,source:e.source});return c!=null?{type:"webhook",value:c}:void 0}let d=x9p(r);if(d!=null){let c=k9p({context:e,operationContext:l,streamingExtension:d});return c!=null?{type:"streaming",streaming:c.streaming,nonStreaming:c.nonStreaming}:void 0}let s=C9p(r);if(s!=null){let c=K9p({context:e,operationContext:l,asyncExtension:s,source:e.source});return{type:"async",async:c.async,sync:c.sync}}return{type:"http",value:hKr({context:e,operationContext:l,streamFormat:void 0,source:e.source})}}function K8D(e,t){let r=yf(e,fd.SDK_METHOD_NAME),i=yf(e,fd.SDK_GROUP_NAME)??[];if(r!=null){let n=typeof i=="string"?[i]:i;return n=t.resolveGroupName(n),{groupName:n,methodName:r}}}function Y8D({sdkMethodName:e,operation:t,httpMethod:r,path:i,shouldUseIdiomaticRequestNames:n}){let a=[];if(e!=null){if(n&&a.push(e.methodName),e.groupName.length>0){let u=e.groupName[e.groupName.length-1];u!=null&&a.push(typeof u=="string"?u:u.name)}n||a.push(e.methodName)}else t.operationId!=null?a.push(t.operationId):a.push(Dg(`${r}_${i.split("/").join("_")}`));return a}function tLp(e,t,r,i){let n=[],a=iLp(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let l of a){if(i.filter.skipEndpoint({method:l.method,path:e})){i.logger.debug(`Skipping endpoint "${l.method} ${e}"`);continue}let d=X8D({operation:l.operation}),s=GWs({context:i,pathItemContext:{...u,method:l.method},operation:l.operation,convertToWebhook:d});s!=null&&n.push(s)}return n}function rLp(e,t,r,i){let n=[],a=iLp(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let l of a){if(i.filter.skipEndpoint({method:l.method,path:e})){i.logger.debug(`Skipping endpoint "${l.method} ${e}"`);continue}let d=GWs({context:i,pathItemContext:{...u,method:l.method},operation:l.operation,convertToWebhook:!0});d!=null&&n.push(d)}return n}function iLp(e){let t=[];return e.get!=null&&t.push({method:pG.Get,operation:e.get}),e.post!=null&&t.push({method:pG.Post,operation:e.post}),e.put!=null&&t.push({method:pG.Put,operation:e.put}),e.delete!=null&&t.push({method:pG.Delete,operation:e.delete}),e.patch!=null&&t.push({method:pG.Patch,operation:e.patch}),t}function X8D({operation:e}){return yf(e,[fd.WEBHOOK])??!1}function nLp(e){let t=yf(e,fd.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=yf(e,fd.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function aLp(e){return yf(e,fd.FERN_BASIC_AUTH)}function QWs(e,t){if(Zd(e))throw new Error(`Converting referenced security schemes is unsupported: ${JSON.stringify(e)}`);return Z8D(e,t)}function Z8D(e,t){if(e.type==="apiKey"&&e.in==="header"){let r=yf(e,mV.BEARER_FORMAT),i=yf(e,fd.FERN_HEADER_AUTH);return g5.header({headerName:e.name,prefix:r!=null?"Bearer":i?.prefix,headerVariableName:i?.name??yf(e,fd.HEADER_VARIABLE_NAME),headerEnvVar:i?.env})}else if(e.type==="http"&&e.scheme==="bearer"){let r=yf(e,fd.FERN_BEARER_TOKEN);return g5.bearer({tokenVariableName:r?.name??yf(e,fd.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:r?.env})}else if(e.type==="http"&&e.scheme==="basic"){let r=aLp(e),i=nLp(e);return g5.basic({usernameVariableName:r?.username?.name??i.usernameVariable,usernameEnvVar:r?.username?.env,passwordVariableName:r?.password?.name??i.passwordVariable,passwordEnvVar:r?.password?.env})}else{if(e.type==="openIdConnect")return g5.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return g5.oauth({scopesEnum:k8D(e,t)})}}function k8D(e,t){let r=e.flows.authorizationCode?.scopes??e.flows.clientCredentials?.scopes??e.flows.implicit?.scopes??e.flows.password?.scopes;if(r!=null){let i=bXt({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([a,u])=>[a,{description:u}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsNullable:!1,groupName:void 0,context:void 0,source:t,inline:void 0}),n=cE(i);if(n.type==="enum")return n}}function oLp(e){return yf(e,fd.BASE_PATH)}var e5D=Yu.record(Yu.string(),Yu.object({summary:Yu.string().optional(),description:Yu.string().optional()}));function uLp({document:e,context:t}){return aha(e,fd.GROUPS,e5D,t.logger)}function sLp({context:e,document:t}){return yf(t,fd.FERN_VERSION)??void 0}function cLp(e){let t=yf(e,fd.FERN_GLOBAL_HEADERS),r=[];for(let i of t??[])r.push({...i,schema:i.type!=null?oha({fernType:i.type,description:void 0,availability:void 0,generatedName:i.name??i.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function lLp(e){let t=yf(e,fd.FERN_IDEMPOTENCY_HEADERS),r=[];for(let i of t??[])r.push({...i,schema:i.type!=null?oha({fernType:i.type,description:void 0,availability:void 0,generatedName:i.name??i.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function fLp(e,t){let r=yf(e,fd.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([i,n])=>{if(n.type==="string")return[i,{nameOverride:void 0,generatedName:D2([i],t),title:n.title,schema:vj.string({default:ASn(n),pattern:n.pattern,format:n.format,minLength:n.minLength,maxLength:n.maxLength}),description:n.description,availability:void 0,groupName:void 0}];throw new Error(`Variable ${i} has unsupported schema ${JSON.stringify(n)}`)}))}var t5D="webhooks";function dLp(e){return yf(e,t5D)??{}}function pLp(e){return yf(e,fd.RESOLUTIONS)}function _Lp({openapi:e}){let t=pLp(e);if(t==null)return e;let r={};for(let i of t){let n=`#/components/schemas/${i.name}`;for(let a of i.resolutions)e=r5D({openapi:e,schemaReference:a,schemaName:i.name}),e=hLp({openapi:e,replaceReference:a,schemaReference:n,replacedReferences:r}),r={...r,...Object.fromEntries(i.resolutions.map(u=>[n,u]))}}return e}function r5D({openapi:e,schemaReference:t,schemaName:r}){let i=t.replace("#/","").split("/").map(a=>a.replaceAll("~1","/")),n=e;for(let a of i){let u=n[a];if(u==null)return e;n=u}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=n,e}function hLp({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:i}){let n=Object.keys(i).filter(d=>t.startsWith(d)).sort((d,s)=>s.length-d.length)[0];if(n!=null){let d=i[n];if(d!=null){let s=r.replace(n,d);return hLp({openapi:e,replaceReference:t,schemaReference:s,replacedReferences:{}})}}let a=t.replace("#/","").split("/").map(d=>d.replaceAll("~1","/")),u=e;for(let d of a.slice(0,-1)){let s=u[d];if(s==null)return e;u=s}let l=a[a.length-1];return l==null||(u[l]={$ref:r}),e}function vLp({openApi:e,taskContext:t,options:r,source:i,namespace:n}){e=_Lp({openapi:e});let a=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([I,U])=>QWs(U,i)==null?[]:[I,QWs(U,i)])),u=new Set(...Object.entries(a).map(([I,U])=>U.type==="basic"||U.type==="bearer"?"Authorization":U.type==="header"?U.headerName:null)),l=fLp(e,r.preserveSchemaIds),d=cLp(e),s=lLp(e),o=r.audiences??[],c=[],b=[],g=new Kxo({document:e,taskContext:t,authHeaders:u,options:r,source:i,namespace:n});g.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied..."),Object.entries(e.paths??{}).forEach(([I,U])=>{if(U==null)return;t.logger.debug(`Converting path ${I}`);let H=tLp(I,U,e,g);for(let k of H){let K=yLp({operation:k});if(!(o.length>0&&!o.some(ee=>K.includes(ee))))switch(k.type){case"async":c.push(k.sync),c.push(k.async);break;case"http":c.push(k.value);break;case"streaming":c.push(k.streaming),k.nonStreaming&&c.push(k.nonStreaming);break;case"webhook":b.push(k.value);break;default:Fo(k)}}}),Object.entries(dLp(e)).forEach(([I,U])=>{if(U==null)return;t.logger.debug(`Converting path ${I}`);let H=rLp(I,U,e,g);for(let k of H){let K=yLp({operation:k});o.length>0&&!o.some(ee=>K.includes(ee))||b.push(k.value)}});let O=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([I,U])=>{if(!Zd(U)){let H=yf(U,fd.IGNORE);if(H!=null&&H)return[];if($9p.has(I))return[I,qb({...U,"x-fern-type-name":`${I}Body`},!1,g,[I],i,n)]}return[I,qb(U,!1,g,[I],i,n)]}).filter(I=>I.length>0)),m=i5D(O,g,i),w=n5D(m,g),E={};for(let[I,U]of Object.entries(w)){let H=cE(U);g.isSchemaExcluded(I)||(E[I]=H,t.logger.debug(`Converted schema ${I}`))}let A=new $di(w,g.nonRequestReferencedSchemas,g),q=b.map(I=>{let H=I.examples;if(!r.disableExamples&&H.length===0){let k=A.buildExample({schema:I.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});k!=null&&(H=[{name:void 0,description:void 0,payload:k}])}return{...I,payload:cE(I.payload),examples:H}}),D=new Wxo(w,g),C=c.map(I=>{let U=I.examples,H=U;if(!r.disableExamples&&(U.length===0||U.every(sha))){let ee=D.buildEndpointExample(I);ee.length>0&&(H=[...ee,...U.filter(fe=>!sha(fe))])}let k=I.request,K=I.response;return{...I,request:k?.type==="json"?{...k,schema:cE(k.schema)}:k,response:K?.type==="json"?{...K,schema:cE(K.schema)}:K,queryParameters:I.queryParameters.map(ee=>({description:ee.description,name:ee.name,schema:cE(ee.schema),parameterNameOverride:ee.parameterNameOverride,availability:ee.availability,source:ee.source})),pathParameters:I.pathParameters.map(ee=>({description:ee.description,name:ee.name,schema:cE(ee.schema),parameterNameOverride:ee.parameterNameOverride,variableReference:ee.variableReference,availability:ee.availability,source:ee.source})),headers:I.headers.map(ee=>({description:ee.description,name:ee.name,schema:cE(ee.schema),parameterNameOverride:ee.parameterNameOverride,env:ee.env,availability:ee.availability,source:ee.source})),examples:H,errors:rd(I.errors,ee=>{let fe=ee.fullExamples?.map(me=>{let ge=Hdi(me.value);if(ge!=null)return{name:me.name,description:me.description,example:ge}}).filter(Qb);if(fe?.length===0){let me=A.buildExample({schema:ee.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});me!=null&&fe.push({name:void 0,description:void 0,example:me})}return{generatedName:ee.generatedName,nameOverride:ee.nameOverride,schema:cE(ee.schema),description:ee.description,source:ee.source,examples:fe}})}}),R=uLp({document:e,context:g});return{apiVersion:sLp({context:g,document:e}),basePath:oLp(e),title:e.info.title,description:e.info.description,groups:Object.fromEntries(Object.entries(R??{}).map(([I,U])=>[I,{summary:U.summary??void 0,description:U.description??void 0}])),servers:(e.servers??[]).map(I=>Yxo(I)),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(I=>[I.name,{id:I.name,description:I.description}])),orderedTagIds:e.tags?.map(I=>I.name)},endpoints:C,webhooks:q,channels:{},groupedSchemas:CSn(n,E),securitySchemes:a,hasEndpointsMarkedInternal:C.some(I=>I.internal),nonRequestReferencedSchemas:g.getReferencedSchemas(),variables:l,globalHeaders:d,idempotencyHeaders:s}}function i5D(e,t,r){let i={};for(let[n,a]of Object.entries(e)){if(a.type!=="object"){i[n]=a;continue}let u={$ref:`#/components/schemas/${n}`},l=t.getReferencesFromDiscriminatedUnion(u);if(l==null){i[n]=a;continue}let d={...a,type:"object",properties:a.properties.filter(o=>!l.discriminants.has(o.key)),allOfPropertyConflicts:a.allOfPropertyConflicts.filter(o=>!l.discriminants.has(o.propertyKey)),source:r};i[n]=d;let s=bLp({schema:a,schemas:e});for(let o of[...new Set(s)]){let c=i[o]??e[o];c==null||c.type!=="object"||(i[o]={...c,type:"object",properties:c.properties.filter(b=>!l.discriminants.has(b.key)),allOfPropertyConflicts:c.allOfPropertyConflicts.filter(b=>!l.discriminants.has(b.propertyKey))})}}return i}function n5D(e,t){let r={};for(let[i,n]of Object.entries(e)){if(n.type!=="object"){r[i]=n;continue}let a={$ref:`#/components/schemas/${i}`},u=t.getDiscriminatedUnionMetadata(a);if(u==null){r[i]=n;continue}let l=[];for(let s of n.properties)if(u.discriminants.has(s.key)){let o=u.discriminants.get(s.key);o!=null&&l.push({...s,schema:El.literal({nameOverride:void 0,generatedName:D2([n.generatedName,o],t.options.preserveSchemaIds),title:void 0,value:cx.string(o),groupName:void 0,description:void 0,availability:n.availability})})}else l.push(s);let d={...n,type:"object",properties:l};r[i]=d}return r}function bLp({schema:e,schemas:t}){let r=[];for(let i of e.allOf){r.push(i.schema);let n=t[i.schema];n!=null&&n.type==="object"&&r.push(...bLp({schema:n,schemas:t}))}return r}function yLp({operation:e}){let t=[];switch(e.type){case"async":t=e.async.audiences;break;case"http":t=e.value.audiences;break;case"streaming":t=e.streaming.audiences;break;case"webhook":break;default:Fo(e)}return t}function YRi({context:e,documents:t,options:r}){let i={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:{},globalHeaders:[],idempotencyHeaders:[],groups:{}};for(let n of t){let a=n.source!=null?n.source:wie.openapi({file:"<memory>"});switch(n.type){case"openapi":{let u=vLp({taskContext:e,openApi:n.value,options:CWs({options:n.settings,overrides:r}),source:a,namespace:n.namespace});i=o5D(i,u);break}case"asyncapi":{let u=D9p({document:n.value,taskContext:e,options:CWs({options:n.settings,overrides:r}),source:a,asyncApiOptions:a5D({options:n.settings}),namespace:n.namespace});u.servers!=null&&(i.websocketServers=[...i.websocketServers,...u.servers.map(l=>({...l,audiences:void 0,description:void 0}))]),u.channels!=null&&(i.channels={...i.channels,...u.channels}),u.groupedSchemas!=null&&(i.groupedSchemas=gLp(i.groupedSchemas,u.groupedSchemas)),u.basePath!=null&&(i.basePath=u.basePath);break}default:Fo(n)}}return i}function a5D({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??H5p.naming}}function o5D(e,t){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:gLp(e.groupedSchemas,t.groupedSchemas),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},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 gLp(e,t){e.rootSchemas={...e.rootSchemas,...t.rootSchemas};for(let[r,i]of Object.entries(t.namespacedSchemas))e.namespacedSchemas[r]!=null?e.namespacedSchemas[r]={...e.namespacedSchemas[r],...i}:e.namespacedSchemas[r]=i;return e}var Zxo={config:new OLp.Config({apis:{},styleguide:{plugins:[TWs],rules:{spec:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!0};function fha(e){return e.swagger!=null}function JWs(e){return e.openapi!=null}function Gdi(e,t={}){return{...Object.fromEntries(CN(e.namedDefinitionFiles).map(([r,i])=>[r,{...i,defaultUrl:t.defaultURL}])),...CN(e.importedDefinitions).reduce((r,[i,n])=>({...r,...$ra(Gdi(n.definition,{defaultURL:n.url}),(a,u)=>PR(i,sy.of(u)))}),{})}}function dha(e,t={}){return{...Object.fromEntries(CN(e.packageMarkers).map(([r,i])=>[r,{...i,defaultUrl:t.defaultURL}])),...CN(e.importedDefinitions).reduce((r,[i,n])=>({...r,...$ra(dha(n.definition,{defaultURL:n.url}),(a,u)=>PR(i,sy.of(u)))}),{})}}function yKr(e){return{...dha(e),...Gdi(e)}}function xie(e,t){return yKr(e.definition)[t]?.contents}function dF(e,t){for(let[r,i]of CN(yKr(e.definition)))t(r,i.contents,{isPackageMarker:_Ci(r)===X1,defaultUrl:i.defaultUrl})}function XRi(e,t){for(let[r,i]of CN(dha(e.definition)))t(r,i.contents)}var AHp=yi(MHp(),1);async function nya(e){return(await(0,AHp.convertObj)(e,{})).openapi}var THp=require("fs/promises");var qHp=require("fs/promises");async function ozo({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:i}){let n=null;try{let a=(await(0,qHp.readFile)(e,"utf8")).toString();try{n=JSON.parse(a)}catch{n=Kd.load(a,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}return yds({data:t,overrides:n,allowNullKeys:i})}async function CHp({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,THp.readFile)(t)).toString(),n=await Kd.load(i);return r!=null?await ozo({absoluteFilePathToOverrides:r,context:e,data:n}):n}var oya=yi(Bxo(),1);var BHp=yi(Bxo(),1),X$s=yi(require("path"),1);var aya=class extends BHp.BaseResolver{absolutePathToOpenAPIOverrides;constructor(t){super(),this.absolutePathToOpenAPIOverrides=t}resolveExternalRef(t,r){let i=super.resolveExternalRef(t,r);return TGr(Wl.of(i))?i:this.absolutePathToOpenAPIOverrides!=null?X$s.default.resolve(X$s.default.dirname(this.absolutePathToOpenAPIOverrides),r):i}};async function Z$s({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,parsed:r}){return(r!=null?await(0,oya.bundle)({...Zxo,doc:{source:new oya.Source(e,"<openapi>"),parsed:r},externalRefResolver:new aya(t)}):await(0,oya.bundle)({...Zxo,ref:e,externalRefResolver:new aya(t)})).bundle.parsed}var bHD=["examples","example",fd.EXAMPLES,mV.REDOCLY_CODE_SAMPLES_CAMEL,mV.REDOCLY_CODE_SAMPLES_KEBAB];async function uya({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r}){let i=await Z$s({absolutePathToOpenAPI:t}),n;if(r!=null?n=r:typeof i=="object"&&i[fd.OPENAPI_OVERIDES_FILEPATH]!=null&&(n=Xu(_p(t),Xa.of(i[fd.OPENAPI_OVERIDES_FILEPATH]))),n!=null){let a=await ozo({absoluteFilePathToOverrides:n,context:e,data:i,allowNullKeys:bHD});return await Z$s({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,parsed:a})}return i}var U5t=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r}){let i=[];for(let n of r){let a=(await(0,xHp.readFile)(n.absoluteFilepath)).toString(),u=aT(this.absoluteFilePath,n.source.file);n.source.relativePathToDependency!=null&&(u=Xu(n.source.relativePathToDependency,u));let l=n.source.type==="protobuf"?wie.protobuf({file:u}):wie.openapi({file:u});if(a.includes("openapi")||a.includes("swagger")){let d=await uya({absolutePathToOpenAPI:n.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:n.absoluteFilepathToOverrides});if(JWs(d))i.push({type:"openapi",value:d,source:l,namespace:n.namespace,settings:n.settings});else if(fha(d)){let s=await nya(d);i.push({type:"openapi",value:s,source:l,namespace:n.namespace,settings:n.settings})}}else if(a.includes("asyncapi")){let d=await CHp({context:t,absoluteFilePath:n.absoluteFilepath,absoluteFilePathToOverrides:n.absoluteFilepathToOverrides});i.push({type:"asyncapi",value:d,source:l,namespace:n.namespace,settings:n.settings})}else t.failAndThrow(`${n.absoluteFilepath} is not a valid OpenAPI or AsyncAPI file`)}return i}};var yzo=require("fs/promises"),cGp=yi(Lte(),1);var sGp=yi(uGp(),1);async function SG(e,t,r=[],{doNotPipeOutput:i=!1,secrets:n=[],substitutions:a={},...u}={}){let l=n.reduce((o,c)=>({...o,[c]:"<redacted>"}),a),d=[t,...r].join(" ");for(let[o,c]of Object.entries(l))d=d.replaceAll(o,c);e?.debug(`+ ${d}`);let s=(0,sGp.default)(t,r,u);return i||(s.stdout?.pipe(process.stdout),s.stderr?.pipe(process.stderr)),s.then(o=>(o.stdout==null&&(o.stdout=""),o.stderr==null&&(o.stderr=""),o))}function _zo(e,{logger:t,...r}={}){return(i,n)=>SG(t,e,i,{...r,...n})}var fGD="buf.gen.yaml",lGp="output",dGD=`${lGp}/openapi.yaml`,hzo=class{context;constructor({context:t}){this.context=t}async generate({absoluteFilepathToProtobufRoot:t,absoluteFilepathToProtobufTarget:r,relativeFilepathToProtobufRoot:i,local:n}){return n?this.generateLocal({absoluteFilepathToProtobufRoot:t,absoluteFilepathToProtobufTarget:r,relativeFilepathToProtobufRoot:i}):this.generateRemote()}async generateLocal({absoluteFilepathToProtobufRoot:t,absoluteFilepathToProtobufTarget:r,relativeFilepathToProtobufRoot:i}){let n=await this.setupProtobufGeneratorConfig({absoluteFilepathToProtobufRoot:t,relativeFilepathToProtobufRoot:i}),a=aT(t,r);return this.doGenerateLocal({cwd:n,target:a})}async setupProtobufGeneratorConfig({absoluteFilepathToProtobufRoot:t,relativeFilepathToProtobufRoot:r}){let i=Wl.of((await cGp.default.dir()).path);return await(0,yzo.cp)(t,i,{recursive:!0}),await(0,yzo.writeFile)(Xu(i,Xa.of(fGD)),pGD({relativeFilepathToProtobufRoot:r})),i}async doGenerateLocal({cwd:t,target:r}){let i=_zo("which",{cwd:t,logger:this.context.logger});try{await i(["buf"])}catch{this.context.failAndThrow("Missing required dependency; please install 'buf' to continue (e.g. 'brew install buf').")}try{await i(["protoc-gen-openapi"])}catch{this.context.failAndThrow("Missing required dependency; please install 'protoc-gen-openapi' to continue (e.g. 'brew install go && go install github.com/fern-api/protoc-gen-openapi/cmd/protoc-gen-openapi@latest').")}let n=_zo("buf",{cwd:t,logger:this.context.logger});return await n(["config","init"]),await n(["generate",r]),Xu(t,Xa.of(dGD))}async generateRemote(){this.context.failAndThrow("Remote Protobuf generation is unimplemented.")}};function pGD({relativeFilepathToProtobufRoot:e}){return`
1937
+ `)),{ok:!0,value:t}):i}}function wAo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var i1n=class e extends Error{errors;constructor(t){super(t.map(wAo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var n1n=class e extends Error{errors;constructor(t){super(t.map(wAo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function VA(e){return{optional:()=>h5s(e),transform:t=>y5s(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new n1n(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new i1n(i.errors)}}}function h5s(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>JP.OPTIONAL};return{...t,...VA(t)}}function y5s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...VA(r)}}function aRp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:DM(t,"string")}]}:{ok:!0,value:BigInt(t)},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t.toString()}:{ok:!1,errors:[{path:r,message:DM(t,"bigint")}]},getType:()=>JP.BIGINT};return{...O5(e),...VA(e)}}var GPD=/^([+-]?\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 oRp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:DM(t,"string")}]}:GPD.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:DM(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:DM(t,"Date object")}]},getType:()=>JP.DATE};return{...O5(e),...VA(e)}}function _G(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...O5(r),...VA(r)}}}function SAo(e){let t=new Set(e);return _G(JP.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:DM(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:DM(i,"enum")}]}:{ok:!0,value:i})()}function uRp(e){let t=v5s(e);return{...t,...VA(t)}}function v5s(e){return{parse:(t,r)=>a1n(e).parse(t,r),json:(t,r)=>a1n(e).json(t,r),getType:()=>a1n(e).getType()}}function a1n(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function Kpa(e){return Object.entries(e)}function Ypa(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function sdi(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 Xpa(e){return Object.keys(e)}function sRp(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function M5t(e){return{withParsedProperties:t=>b5s(e,t)}}function b5s(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let u=Object.entries(t).reduce((l,[d,s])=>({...l,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(i,n)=>{if(!sdi(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:DM(i,"object")}]};let a=new Set(Object.keys(t)),u=Ypa(i,Object.keys(i).filter(l=>!a.has(l)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...VA(r),...M5t(r)}}function cRp(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function cdi(e){return e.isProperty}function DAo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>cdi(i)?i.rawKey:r),_getParsedProperties:()=>Xpa(e),parse:(r,i)=>{let n={},a=[];for(let[u,l]of Kpa(e)){let d=cdi(l)?l.rawKey:u,s=cdi(l)?l.valueSchema:l,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,dRp(s)&&a.push(d)}return lRp({value:r,requiredKeys:a,getProperty:u=>{let l=n[u];if(l!=null)return{transformedKey:l.parsedKey,transform:d=>l.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,u]of Kpa(e)){let l=cdi(u)?u.valueSchema:u;dRp(l)&&n.push(a)}return lRp({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return cdi(u)?{transformedKey:u.rawKey,transform:l=>u.valueSchema.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:l=>u.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>JP.OBJECT};return{...O5(t),...VA(t),...M5t(t),...yRi(t)}}function lRp({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!sdi(e))return{ok:!1,errors:[{path:a,message:DM(e,"object")}]};let u=new Set(t),l=[],d={};for(let[s,o]of Object.entries(e)){let c=r(s);if(c!=null){u.delete(s);let b=c.transform(o);b.ok?d[c.transformedKey]=b.value:(d[s]=o,l.push(...b.errors))}else switch(i){case"fail":l.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=o;break}}return l.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),l.length===0||n?{ok:!0,value:d}:{ok:!1,errors:l}}function yRi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>fRp({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>fRp({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>JP.OBJECT};return{...r,...VA(r),...M5t(r),...yRi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>JP.OBJECT};return{...t,...VA(t),...M5t(t),...yRi(t)}}}}function fRp({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=sRp(Xpa(t),s=>n.has(s)),l=r(Ypa(t,u)),d=i(Ypa(t,a));return l.ok&&d.ok?{ok:!0,value:{...l.value,...d.value}}:{ok:!1,errors:[...l.ok?[]:l.errors,...d.ok?[]:d.errors]}}function dRp(e){return!QPD(e)}function QPD(e){switch(e.getType()){case JP.ANY:case JP.UNKNOWN:case JP.OPTIONAL:return!0;default:return!1}}function pRp(e){return DAo(e)}function _Rp(e){let t={...v5s(e),_getRawProperties:()=>a1n(e)._getRawProperties(),_getParsedProperties:()=>a1n(e)._getParsedProperties()};return{...t,...VA(t),...M5t(t),...yRi(t)}}function EAo(e){let t={parse:(r,i)=>hRp(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>hRp(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>JP.LIST};return{...O5(t),...VA(t)}}function hRp(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:DM(e,"list"),path:[]}]}}function yRp(e){return _G(JP.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:DM(r,`"${e}"`)}]})()}function vRp(e){return _G(JP.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:DM(r,`${e.toString()}`)}]})()}var bRp=_G(JP.ANY,e=>({ok:!0,value:e}));var gRp=_G(JP.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DM(e,"boolean")}]});var ORp=_G(JP.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DM(e,"number")}]});var mRp=_G(JP.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:DM(e,"string")}]});var PRp=_G(JP.UNKNOWN,e=>({ok:!0,value:e}));function wRp(e,t){let r={parse:(i,n)=>jRp({value:i,isKeyNumeric:e.getType()===JP.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>jRp({value:i,isKeyNumeric:e.getType()===JP.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>JP.RECORD};return{...O5(r),...VA(r)}}function jRp({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return sdi(e)?Kpa(e).reduce((a,[u,l])=>{if(l==null)return a;let d=a,s=u;if(t){let g=u.length>0?Number(u):NaN;isNaN(g)||(s=g)}let o=r(s),c=i(l,s);if(d.ok&&o.ok&&c.ok)return{ok:!0,value:{...d.value,[o.value]:c.value}};let b=[];return d.ok||b.push(...d.errors),o.ok||b.push(...o.errors),c.ok||b.push(...c.errors),{ok:!1,errors:b}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:DM(e,"object")}]}}function SRp(e){let t=EAo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:DM(i,"Set")}]},getType:()=>JP.SET};return{...O5(r),...VA(r)}}function ERp(e){let t={parse:(r,i)=>DRp((n,a)=>n.parse(r,a),e,i),json:(r,i)=>DRp((n,a)=>n.json(r,a),e,i),getType:()=>JP.UNDISCRIMINATED_UNION};return{...O5(t),...VA(t)}}function DRp(e,t,r){let i=[];for(let[n,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let l of u.errors)i.push({path:l.path,message:`[Variant ${n}] ${l.message}`})}return{ok:!1,errors:i}}function MRp(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function qRp(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=SAo(Xpa(t)),a={parse:(u,l)=>ARp({value:u,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.parse(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),json:(u,l)=>ARp({value:u,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),getType:()=>JP.UNION};return{...O5(a),...VA(a),...M5t(a)}}function ARp({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:l=[]}){if(!sdi(e))return{ok:!1,errors:[{path:l,message:DM(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:l,message:`Missing discriminant ("${t}")`}]};let o=i(d);if(!o.ok)return{ok:!1,errors:o.errors};let c=n(o.value);if(c==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...l,t],message:"Unexpected discriminant value"}]};let b=u(s,c);return b.ok?{ok:!0,value:{[r]:d,...b.value}}:b}var BO=At.objectWithoutOptionalProperties({title:At.string().optional()});var MAo=At.objectWithoutOptionalProperties({file:At.string()});var AAo=At.objectWithoutOptionalProperties({file:At.string()});var qAo=At.union("type",{openapi:MAo,protobuf:AAo}).transform({transform:e=>{switch(e.type){case"openapi":return wie.openapi(e);case"protobuf":return wie.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var ly=At.objectWithoutOptionalProperties({source:qAo.optional()});var TAo=At.objectWithoutOptionalProperties({typeName:At.string()});var CAo=At.union("type",{protobuf:TAo}).transform({transform:e=>{switch(e.type){case"protobuf":return t1n.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Die=At.objectWithoutOptionalProperties({encoding:CAo.optional()});var _f=At.objectWithoutOptionalProperties({description:At.string().optional()});var BAo=At.enum_(["GenerallyAvailable","Beta","Deprecated"]);var dh=At.objectWithoutOptionalProperties({availability:BAo.optional()});var tXt=At.number();var rXt=At.objectWithoutOptionalProperties({statusCode:tXt.optional()});var s0=At.objectWithoutOptionalProperties({nameOverride:At.string().optional(),generatedName:At.string()});var uE=At.objectWithoutOptionalProperties({inline:At.boolean().optional()});var JY=At.string();var KY=At.string();var xAo=At.objectWithoutOptionalProperties({id:KY}).extend(_f);var IAo=At.string();var zAo=At.objectWithoutOptionalProperties({usernameVariableName:At.string().optional(),usernameEnvVar:At.string().optional(),passwordVariableName:At.string().optional(),passwordEnvVar:At.string().optional()});var RAo=At.objectWithoutOptionalProperties({tokenVariableName:At.string().optional(),tokenEnvVar:At.string().optional()});var NAo=At.objectWithoutOptionalProperties({headerName:At.string(),prefix:At.string().optional(),headerVariableName:At.string().optional(),headerEnvVar:At.string().optional()});var FAo=At.objectWithoutOptionalProperties({queryParameterName:At.string()});var LAo=At.objectWithoutOptionalProperties({snake:At.string().optional(),camel:At.string().optional(),screamingSnake:At.string().optional(),pascal:At.string().optional()});var ldi=At.objectWithoutOptionalProperties({nameOverride:At.string().optional(),generatedName:At.string(),value:At.string(),casing:LAo.optional()}).extend(_f).extend(dh);var UAo=At.objectWithoutOptionalProperties({type:At.stringLiteral("namespace"),name:At.string()});var VAo=At.undiscriminatedUnion([At.string(),UAo]);var fdi=At.list(VAo);var xO=At.objectWithoutOptionalProperties({groupName:fdi.optional()});var o1n=At.objectWithoutOptionalProperties({default:ldi.optional(),values:At.list(ldi)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var WAo=At.objectWithoutOptionalProperties({scopesEnum:o1n.optional()});var HAo=At.union("type",{basic:zAo,bearer:RAo,header:NAo,query:FAo,oauth:WAo}).transform({transform:e=>{switch(e.type){case"basic":return g5.basic(e);case"bearer":return g5.bearer(e);case"header":return g5.header(e);case"query":return g5.query(e);case"oauth":return g5.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var Zpa=At.objectWithoutOptionalProperties({name:At.string().optional(),url:At.string(),audiences:At.list(At.string()).optional()}).extend(_f);var $Ao=At.string();var iXt=At.objectWithoutOptionalProperties({namespace:At.string().optional()});var O5s={};Co(O5s,{FullExample:()=>WA,FullObjectExample:()=>QAo,FullOneOfExample:()=>KAo,KeyValuePair:()=>JAo,LiteralExample:()=>GAo,PrimitiveExample:()=>s1n,PropertyKey:()=>u1n});var u1n=At.string();var s1n=At.union("type",{int:At.object({value:At.number()}),int64:At.object({value:At.number()}),uint:At.object({value:At.number()}),uint64:At.object({value:At.number()}),float:At.object({value:At.number()}),double:At.object({value:At.number()}),string:At.object({value:At.string()}),datetime:At.object({value:At.string()}),date:At.object({value:At.string()}),base64:At.object({value:At.string()}),boolean:At.object({value:At.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return u_.int(e.value);case"int64":return u_.int64(e.value);case"uint":return u_.uint(e.value);case"uint64":return u_.uint64(e.value);case"float":return u_.float(e.value);case"double":return u_.double(e.value);case"string":return u_.string(e.value);case"datetime":return u_.datetime(e.value);case"date":return u_.date(e.value);case"base64":return u_.base64(e.value);case"boolean":return u_.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var GAo=At.union("type",{boolean:At.object({value:At.boolean()}),string:At.object({value:At.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return r1n.boolean(e.value);case"string":return r1n.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var WA=At.union("type",{primitive:At.object({value:s1n}),object:At.lazyObject(()=>QAo),array:At.object({value:At.list(At.lazy(()=>WA))}),map:At.object({value:At.list(At.lazyObject(()=>JAo))}),enum:At.object({value:At.string()}),literal:At.object({value:GAo}),oneOf:At.object({value:At.lazy(()=>KAo)}),unknown:At.object({value:At.lazy(()=>WA)})}).transform({transform:e=>{switch(e.type){case"primitive":return rg.primitive(e.value);case"object":return rg.object(e);case"array":return rg.array(e.value);case"map":return rg.map(e.value);case"enum":return rg.enum(e.value);case"literal":return rg.literal(e.value);case"oneOf":return rg.oneOf(e.value);case"unknown":return rg.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var QAo=At.objectWithoutOptionalProperties({properties:At.record(u1n,At.lazy(()=>WA))});var JAo=At.objectWithoutOptionalProperties({key:s1n,value:At.lazy(()=>WA)});var KAo=At.union("type",{discriminated:At.object({value:At.record(u1n,At.lazy(()=>WA))}),undiscriminated:At.object({value:At.lazy(()=>WA)})}).transform({transform:e=>{switch(e.type){case"discriminated":return odi.discriminated(e.value);case"undiscriminated":return odi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var m5s={};Co(m5s,{AllOfPropertyConflict:()=>w1n,ArraySchema:()=>Rqo,Availability:()=>BAo,BooleanSchema:()=>Tqo,CasingOverrides:()=>LAo,CommonProperty:()=>$qo,CursorPagination:()=>yqo,CustomCodeSample:()=>_qo,CustomCodeSampleLanguage:()=>fqo,CustomCodeSampleSdk:()=>pqo,CustomPagination:()=>bqo,DiscriminatedOneOfSchema:()=>Wqo,DoubleSchema:()=>Aqo,Endpoint:()=>gqo,EndpointExample:()=>g1n,EndpointResponseExample:()=>lqo,EndpointSdkName:()=>nXt,EnumSchema:()=>o1n,EnumValue:()=>ldi,ErrorExample:()=>aqo,FernExample:()=>uqo,FileResponse:()=>_1n,FileSchema:()=>ZAo,FullEndpointExample:()=>hqo,GlobalHeader:()=>Bqo,Header:()=>ddi,HeaderExample:()=>b1n,HttpEndpointServer:()=>y1n,HttpError:()=>oqo,HttpMethod:()=>c1n,IdempotencyHeader:()=>xqo,IntSchema:()=>Eqo,JsonRequest:()=>rqo,JsonResponse:()=>h1n,LiteralSchema:()=>j1n,LiteralSchemaValue:()=>Iqo,LongSchema:()=>Mqo,MapSchema:()=>Nqo,MultipartRequest:()=>p1n,MultipartRequestProperty:()=>tqo,MultipartRequestPropertyEncoding:()=>eqo,MultipartSchema:()=>kAo,NullableSchema:()=>Lqo,ObjectProperty:()=>Vqo,ObjectPropertyConflictInfo:()=>S1n,ObjectSchema:()=>zqo,OctetStreamRequest:()=>d1n,OffsetPagination:()=>vqo,OneOfSchema:()=>Uqo,OpenApiIntermediateRepresentation:()=>TRp,OptionalSchema:()=>Fqo,Pagination:()=>O1n,PathParameter:()=>l1n,PathParameterExample:()=>sqo,PrimitiveSchema:()=>_di,PrimitiveSchemaValue:()=>Cqo,QueryParameter:()=>f1n,QueryParameterExample:()=>v1n,ReferencedSchema:()=>aXt,Request:()=>iqo,Response:()=>nqo,Schema:()=>IO,Schemas:()=>Dqo,SdkGroupInfo:()=>YAo,StreamingResponseExample:()=>cqo,StringSchema:()=>qqo,SupportedSdkLanguage:()=>dqo,Tags:()=>XAo,TextResponse:()=>pdi,UnDiscriminatedOneOfSchema:()=>Hqo,Webhook:()=>Oqo,WebhookExampleCall:()=>P1n,WebhookHttpMethod:()=>m1n,WebsocketChannel:()=>Sqo,WebsocketHandshake:()=>mqo,WebsocketMessageExample:()=>jqo,WebsocketServer:()=>Pqo,WebsocketSessionExample:()=>wqo});var YAo=At.objectWithoutOptionalProperties({summary:At.string().optional(),description:At.string().optional()});var XAo=At.objectWithoutOptionalProperties({tagsById:At.record(KY,xAo),orderedTagIds:At.list(KY).optional()});var c1n=At.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var l1n=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>IO),variableReference:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var f1n=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>IO),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var ddi=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>IO),env:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var nXt=At.objectWithoutOptionalProperties({groupName:fdi,methodName:At.string()});var d1n=At.objectWithoutOptionalProperties({}).extend(_f).extend(ly);var ZAo=At.objectWithoutOptionalProperties({isOptional:At.boolean(),isArray:At.boolean()}).extend(_f);var kAo=At.union("type",{file:ZAo,json:At.object({value:At.lazy(()=>IO)})}).transform({transform:e=>{switch(e.type){case"file":return vze.file(e);case"json":return vze.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var eqo=At.enum_(["json","form"]);var tqo=At.objectWithoutOptionalProperties({key:At.string(),schema:kAo,contentType:At.string().optional(),exploded:At.boolean().optional(),encoding:eqo.optional()}).extend(_f);var p1n=At.objectWithoutOptionalProperties({name:At.string().optional(),properties:At.list(tqo)}).extend(_f).extend(ly);var rqo=At.objectWithoutOptionalProperties({schema:At.lazy(()=>IO),contentType:At.string().optional(),additionalProperties:At.boolean()}).extend(_f).extend(ly);var iqo=At.union("type",{octetStream:d1n,multipart:p1n,json:rqo}).transform({transform:e=>{switch(e.type){case"octetStream":return udi.octetStream(e);case"multipart":return udi.multipart(e);case"json":return udi.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var _1n=At.objectWithoutOptionalProperties({}).extend(_f).extend(ly).extend(rXt);var h1n=At.objectWithoutOptionalProperties({schema:At.lazy(()=>IO),responseProperty:At.string().optional()}).extend(_f).extend(ly).extend(rXt);var pdi=At.objectWithoutOptionalProperties({}).extend(_f).extend(ly).extend(rXt);var nqo=At.union("type",{file:_1n,json:h1n,text:pdi,streamingSse:h1n,streamingText:pdi,streamingJson:h1n}).transform({transform:e=>{switch(e.type){case"file":return Sie.file(e);case"json":return Sie.json(e);case"text":return Sie.text(e);case"streamingSse":return Sie.streamingSse(e);case"streamingText":return Sie.streamingText(e);case"streamingJson":return Sie.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var aqo=At.objectWithoutOptionalProperties({name:At.string().optional(),description:At.string().optional(),example:At.lazy(()=>WA)});var oqo=At.objectWithoutOptionalProperties({schema:At.lazy(()=>IO).optional(),examples:At.list(aqo).optional()}).extend(_f).extend(s0).extend(ly);var y1n=At.objectWithoutOptionalProperties({name:At.string().optional(),url:At.string().optional(),audiences:At.list(At.string()).optional()});var uqo=At.unknown();var sqo=At.objectWithoutOptionalProperties({name:At.string(),parameterNameOverride:At.string().optional(),value:At.lazy(()=>WA)});var v1n=At.objectWithoutOptionalProperties({name:At.string(),value:At.lazy(()=>WA)});var b1n=At.objectWithoutOptionalProperties({name:At.string(),value:At.lazy(()=>WA)});var cqo=At.objectWithoutOptionalProperties({sse:At.boolean(),events:At.list(At.lazy(()=>WA))});var lqo=At.union("type",{withStreaming:cqo,withoutStreaming:At.object({value:At.lazy(()=>WA)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return yze.withStreaming(e);case"withoutStreaming":return yze.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var fqo=At.objectWithoutOptionalProperties({name:At.string().optional(),language:At.string(),code:At.string(),install:At.string().optional()}).extend(_f);var dqo=At.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var pqo=At.objectWithoutOptionalProperties({name:At.string().optional(),sdk:dqo,code:At.string()}).extend(_f);var _qo=At.union("type",{language:fqo,sdk:pqo}).transform({transform:e=>{switch(e.type){case"language":return kJr.language(e);case"sdk":return kJr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var hqo=At.objectWithoutOptionalProperties({name:At.string().optional(),pathParameters:At.list(sqo).optional(),queryParameters:At.list(v1n).optional(),headers:At.list(b1n).optional(),request:At.lazy(()=>WA).optional(),response:lqo.optional(),codeSamples:At.list(_qo)}).extend(_f);var g1n=At.union("type",{unknown:At.object({value:uqo}),full:hqo}).transform({transform:e=>{switch(e.type){case"unknown":return E5t.unknown(e.value);case"full":return E5t.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var yqo=At.objectWithoutOptionalProperties({cursor:At.string(),nextCursor:At.property("next_cursor",At.string()),results:At.string()});var vqo=At.objectWithoutOptionalProperties({offset:At.string(),results:At.string(),step:At.string().optional(),hasNextPage:At.string().optional()});var bqo=At.objectWithoutOptionalProperties({results:At.string()});var O1n=At.union("type",{cursor:yqo,offset:vqo,custom:bqo}).transform({transform:e=>{switch(e.type){case"cursor":return hze.cursor(e);case"offset":return hze.offset(e);case"custom":return hze.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var gqo=At.objectWithoutOptionalProperties({authed:At.boolean(),internal:At.boolean().optional(),idempotent:At.boolean().optional(),method:c1n,audiences:At.list(At.string()),path:At.string(),summary:At.string().optional(),operationId:At.string().optional(),tags:At.list(KY),pathParameters:At.list(l1n),queryParameters:At.list(f1n),headers:At.list(ddi),sdkName:nXt.optional(),generatedRequestName:At.string(),requestNameOverride:At.string().optional(),request:iqo.optional(),response:nqo.optional(),errors:At.record(tXt,oqo),servers:At.list(y1n),examples:At.list(g1n),pagination:O1n.optional()}).extend(_f).extend(dh).extend(ly).extend(iXt);var m1n=At.enum_(["GET","POST"]);var P1n=At.objectWithoutOptionalProperties({name:At.string().optional(),payload:At.lazy(()=>WA)}).extend(_f);var Oqo=At.objectWithoutOptionalProperties({sdkName:nXt.optional(),method:m1n,summary:At.string().optional(),operationId:At.string(),tags:At.list(KY),headers:At.list(ddi),generatedPayloadName:At.string(),payload:At.lazy(()=>IO),examples:At.list(P1n)}).extend(_f).extend(ly).extend(iXt);var mqo=At.objectWithoutOptionalProperties({queryParameters:At.list(f1n),headers:At.list(ddi),pathParameters:At.list(l1n)});var Pqo=At.objectWithoutOptionalProperties({name:At.string(),url:At.string()});var jqo=At.objectWithoutOptionalProperties({messageType:At.string(),payload:At.lazy(()=>WA)}).extend(_f);var wqo=At.objectWithoutOptionalProperties({name:At.string().optional(),queryParameters:At.list(v1n).optional(),headers:At.list(b1n).optional(),messages:At.list(jqo)}).extend(_f);var Sqo=At.objectWithoutOptionalProperties({audiences:At.list(At.string()),path:At.string(),groupName:fdi,summary:At.string().optional(),handshake:mqo,publish:At.lazy(()=>IO).optional(),subscribe:At.lazy(()=>IO).optional(),servers:At.list(Pqo),examples:At.list(wqo)}).extend(_f).extend(ly);var Dqo=At.objectWithoutOptionalProperties({rootSchemas:At.record(JY,At.lazy(()=>IO)),namespacedSchemas:At.record($Ao,At.record(JY,At.lazy(()=>IO)))});var Eqo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional()});var Mqo=At.objectWithoutOptionalProperties({default:At.number().optional()});var Aqo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional()});var qqo=At.objectWithoutOptionalProperties({default:At.string().optional(),pattern:At.string().optional(),format:At.string().optional(),minLength:At.number().optional(),maxLength:At.number().optional()});var Tqo=At.objectWithoutOptionalProperties({default:At.boolean().optional()});var Cqo=At.union("type",{int:Eqo,int64:Mqo,uint:At.object({}),uint64:At.object({}),float:At.object({}),double:Aqo,string:qqo,datetime:At.object({}),date:At.object({}),base64:At.object({}),boolean:Tqo}).transform({transform:e=>{switch(e.type){case"int":return vj.int(e);case"int64":return vj.int64(e);case"uint":return vj.uint();case"uint64":return vj.uint64();case"float":return vj.float();case"double":return vj.double(e);case"string":return vj.string(e);case"datetime":return vj.datetime();case"date":return vj.date();case"base64":return vj.base64();case"boolean":return vj.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var _di=At.objectWithoutOptionalProperties({schema:Cqo}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO);var Bqo=At.objectWithoutOptionalProperties({header:At.string(),name:At.string().optional(),optional:At.boolean().optional(),env:At.string().optional(),schema:At.lazy(()=>IO).optional()});var xqo=At.objectWithoutOptionalProperties({header:At.string(),name:At.string().optional(),env:At.string().optional(),schema:At.lazy(()=>IO).optional()});var TRp=At.objectWithoutOptionalProperties({apiVersion:At.unknown().optional(),title:At.string().optional(),description:At.string().optional(),basePath:At.string().optional(),servers:At.list(Zpa),websocketServers:At.list(Zpa),groups:At.record(At.string(),YAo),tags:XAo,hasEndpointsMarkedInternal:At.boolean(),endpoints:At.list(gqo),webhooks:At.list(Oqo),channels:At.record(At.string(),Sqo),groupedSchemas:Dqo,variables:At.record(At.string(),_di),nonRequestReferencedSchemas:At.set(JY),securitySchemes:At.record(IAo,HAo),globalHeaders:At.list(Bqo).optional(),idempotencyHeaders:At.list(xqo).optional()});var aXt=At.objectWithoutOptionalProperties({schema:JY}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO);var Iqo=At.union("type",{boolean:At.object({value:At.boolean()}),string:At.object({value:At.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return cx.boolean(e.value);case"string":return cx.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var j1n=At.objectWithoutOptionalProperties({value:Iqo}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO);var IO=At.union("type",{primitive:_di,object:At.lazyObject(()=>zqo),array:At.lazyObject(()=>Rqo),map:At.lazyObject(()=>Nqo),optional:At.lazyObject(()=>Fqo),enum:o1n,reference:aXt,literal:j1n,oneOf:At.object({value:At.lazy(()=>Uqo)}),nullable:At.lazyObject(()=>Lqo),unknown:s0}).transform({transform:e=>{switch(e.type){case"primitive":return gy.primitive(e);case"object":return gy.object(e);case"array":return gy.array(e);case"map":return gy.map(e);case"optional":return gy.optional(e);case"enum":return gy.enum(e);case"reference":return gy.reference(e);case"literal":return gy.literal(e);case"oneOf":return gy.oneOf(e.value);case"nullable":return gy.nullable(e);case"unknown":return gy.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var w1n=At.objectWithoutOptionalProperties({propertyKey:At.string(),allOfSchemaIds:At.list(JY),conflictingTypeSignatures:At.boolean()});var zqo=At.objectWithoutOptionalProperties({allOf:At.list(aXt),properties:At.list(At.lazyObject(()=>Vqo)),allOfPropertyConflicts:At.list(w1n),additionalProperties:At.boolean()}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var S1n=At.objectWithoutOptionalProperties({differentSchema:At.boolean()});var Vqo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>IO),readonly:At.boolean().optional(),writeonly:At.boolean().optional(),conflict:At.record(JY,S1n),generatedName:At.string(),nameOverride:At.string().optional(),audiences:At.list(At.string())}).extend(dh);var Rqo=At.objectWithoutOptionalProperties({value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO).extend(uE);var Nqo=At.objectWithoutOptionalProperties({key:_di,value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(BO).extend(uE);var Fqo=At.objectWithoutOptionalProperties({value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO).extend(uE);var Lqo=At.objectWithoutOptionalProperties({value:At.lazy(()=>IO)}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO).extend(uE);var Uqo=At.union("type",{discriminated:At.lazyObject(()=>Wqo),undiscriminated:At.lazyObject(()=>Hqo)}).transform({transform:e=>{switch(e.type){case"discriminated":return eKr.discriminated(e);case"undiscriminated":return eKr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Wqo=At.objectWithoutOptionalProperties({discriminantProperty:At.string(),commonProperties:At.list(At.lazyObject(()=>$qo)),schemas:At.record(At.string(),At.lazy(()=>IO))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var $qo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>IO)});var Hqo=At.objectWithoutOptionalProperties({schemas:At.list(At.lazy(()=>IO))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var P5s={};Co(P5s,{ArraySchemaWithExample:()=>fTo,Base64WithExample:()=>oTo,BooleanWithExample:()=>uTo,CommonPropertyWithExample:()=>OTo,DateWithExample:()=>aTo,DatetimeWithExample:()=>nTo,DiscriminatedOneOfSchemaWithExample:()=>bTo,DoubleWithExample:()=>rTo,EndpointWithExample:()=>BRp,EnumSchemaWithExample:()=>cTo,FloatWithExample:()=>tTo,HeaderWithExample:()=>hdi,HttpErrorWithExample:()=>Yqo,Int64WithExample:()=>Zqo,IntWithExample:()=>Xqo,JsonRequestWithExample:()=>Qqo,JsonResponseWithExample:()=>E1n,MapSchemaWithExample:()=>dTo,NamedFullExample:()=>oXt,NullableSchemaWithExample:()=>_To,ObjectPropertyWithExample:()=>vTo,ObjectSchemaWithExample:()=>hTo,OneOfSchemaWithExample:()=>yTo,OptionalSchemaWithExample:()=>pTo,PathParameterWithExample:()=>Gqo,PrimitiveSchemaValueWithExample:()=>sTo,PrimitiveSchemaWithExample:()=>M1n,QueryParameterWithExample:()=>D1n,RequestWithExample:()=>Jqo,ResponseWithExample:()=>Kqo,SchemaWithExample:()=>EM,StringSchemaWithExample:()=>iTo,Uint64WithExample:()=>eTo,UintWithExample:()=>kqo,UnDiscriminatedOneOfSchemaWithExample:()=>gTo,UnknownSchemaWithExample:()=>lTo,WebhookWithExample:()=>xRp,WebsocketHandshakeWithExample:()=>CRp});var oXt=At.objectWithoutOptionalProperties({name:At.string().optional(),value:At.unknown()}).extend(_f);var D1n=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>EM),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var hdi=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>EM),env:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var CRp=At.objectWithoutOptionalProperties({queryParameters:At.list(D1n),headers:At.list(hdi)});var Gqo=At.objectWithoutOptionalProperties({name:At.string(),schema:At.lazy(()=>EM),variableReference:At.string().optional(),parameterNameOverride:At.string().optional()}).extend(_f).extend(dh).extend(ly);var Qqo=At.objectWithoutOptionalProperties({schema:At.lazy(()=>EM),contentType:At.string().optional(),fullExamples:At.list(oXt).optional(),additionalProperties:At.boolean()}).extend(_f).extend(ly);var Jqo=At.union("type",{octetStream:d1n,multipart:p1n,json:Qqo}).transform({transform:e=>{switch(e.type){case"octetStream":return VSe.octetStream(e);case"multipart":return VSe.multipart(e);case"json":return VSe.json(e);default:return e}},untransform:({_visit:e,...t})=>t});var E1n=At.objectWithoutOptionalProperties({schema:At.lazy(()=>EM),responseProperty:At.string().optional(),fullExamples:At.list(oXt).optional()}).extend(_f).extend(ly).extend(rXt);var Kqo=At.union("type",{file:_1n,json:E1n,text:pdi,streamingSse:E1n,streamingText:pdi,streamingJson:E1n}).transform({transform:e=>{switch(e.type){case"file":return lx.file(e);case"json":return lx.json(e);case"text":return lx.text(e);case"streamingSse":return lx.streamingSse(e);case"streamingText":return lx.streamingText(e);case"streamingJson":return lx.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Yqo=At.objectWithoutOptionalProperties({statusCode:tXt,schema:At.lazy(()=>EM),fullExamples:At.list(oXt).optional()}).extend(_f).extend(s0).extend(ly);var BRp=At.objectWithoutOptionalProperties({authed:At.boolean(),internal:At.boolean().optional(),idempotent:At.boolean().optional(),method:c1n,audiences:At.list(At.string()),path:At.string(),summary:At.string().optional(),operationId:At.string().optional(),tags:At.list(KY),pathParameters:At.list(Gqo),queryParameters:At.list(D1n),headers:At.list(hdi),sdkName:nXt.optional(),generatedRequestName:At.string(),requestNameOverride:At.string().optional(),request:Jqo.optional(),response:Kqo.optional(),errors:At.record(tXt,Yqo),servers:At.list(y1n),examples:At.list(g1n),pagination:O1n.optional()}).extend(_f).extend(dh).extend(ly).extend(iXt);var xRp=At.objectWithoutOptionalProperties({sdkName:nXt.optional(),method:m1n,summary:At.string().optional(),operationId:At.string(),tags:At.list(KY),headers:At.list(hdi),generatedPayloadName:At.string(),payload:At.lazy(()=>EM),examples:At.list(P1n)}).extend(_f).extend(ly).extend(iXt);var Xqo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional(),example:At.number().optional()});var Zqo=At.objectWithoutOptionalProperties({default:At.number().optional(),example:At.number().optional()});var kqo=At.objectWithoutOptionalProperties({default:At.number().optional(),example:At.number().optional()});var eTo=At.objectWithoutOptionalProperties({default:At.number().optional(),example:At.number().optional()});var tTo=At.objectWithoutOptionalProperties({example:At.number().optional()});var rTo=At.objectWithoutOptionalProperties({default:At.number().optional(),minimum:At.number().optional(),maximum:At.number().optional(),exclusiveMinimum:At.boolean().optional(),exclusiveMaximum:At.boolean().optional(),multipleOf:At.number().optional(),example:At.number().optional()});var iTo=At.objectWithoutOptionalProperties({default:At.string().optional(),pattern:At.string().optional(),format:At.string().optional(),minLength:At.number().optional(),maxLength:At.number().optional(),example:At.string().optional()});var nTo=At.objectWithoutOptionalProperties({example:At.string().optional()});var aTo=At.objectWithoutOptionalProperties({example:At.string().optional()});var oTo=At.objectWithoutOptionalProperties({example:At.string().optional()});var uTo=At.objectWithoutOptionalProperties({default:At.boolean().optional(),example:At.boolean().optional()});var sTo=At.union("type",{int:Xqo,int64:Zqo,uint:kqo,uint64:eTo,float:tTo,double:rTo,string:iTo,datetime:nTo,date:aTo,base64:oTo,boolean:uTo}).transform({transform:e=>{switch(e.type){case"int":return Xd.int(e);case"int64":return Xd.int64(e);case"uint":return Xd.uint(e);case"uint64":return Xd.uint64(e);case"float":return Xd.float(e);case"double":return Xd.double(e);case"string":return Xd.string(e);case"datetime":return Xd.datetime(e);case"date":return Xd.date(e);case"base64":return Xd.base64(e);case"boolean":return Xd.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var M1n=At.objectWithoutOptionalProperties({schema:sTo}).extend(_f).extend(s0).extend(xO).extend(dh).extend(BO);var cTo=At.objectWithoutOptionalProperties({default:ldi.optional(),values:At.list(ldi),example:At.string().optional()}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var lTo=At.objectWithoutOptionalProperties({example:At.unknown()}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO);var EM=At.union("type",{primitive:M1n,object:At.lazyObject(()=>hTo),array:At.lazyObject(()=>fTo),map:At.lazyObject(()=>dTo),optional:At.lazyObject(()=>pTo),enum:cTo,reference:aXt,literal:j1n,oneOf:At.object({value:At.lazy(()=>yTo)}),nullable:At.lazyObject(()=>_To),unknown:lTo}).transform({transform:e=>{switch(e.type){case"primitive":return El.primitive(e);case"object":return El.object(e);case"array":return El.array(e);case"map":return El.map(e);case"optional":return El.optional(e);case"enum":return El.enum(e);case"reference":return El.reference(e);case"literal":return El.literal(e);case"oneOf":return El.oneOf(e.value);case"nullable":return El.nullable(e);case"unknown":return El.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var fTo=At.objectWithoutOptionalProperties({value:At.lazy(()=>EM),example:At.list(At.unknown()).optional()}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO).extend(uE);var dTo=At.objectWithoutOptionalProperties({key:M1n,value:At.lazy(()=>EM),example:At.unknown().optional()}).extend(xO).extend(s0).extend(_f).extend(dh).extend(Die).extend(BO).extend(uE);var pTo=At.objectWithoutOptionalProperties({value:At.lazy(()=>EM)}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO).extend(uE);var _To=At.objectWithoutOptionalProperties({value:At.lazy(()=>EM)}).extend(xO).extend(s0).extend(_f).extend(dh).extend(BO).extend(uE);var hTo=At.objectWithoutOptionalProperties({allOf:At.list(aXt),properties:At.list(At.lazyObject(()=>vTo)),allOfPropertyConflicts:At.list(w1n),fullExamples:At.list(oXt).optional(),additionalProperties:At.boolean()}).extend(_f).extend(s0).extend(xO).extend(dh).extend(ly).extend(BO).extend(uE);var vTo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>EM),readonly:At.boolean().optional(),writeonly:At.boolean().optional(),audiences:At.list(At.string()),conflict:At.record(JY,S1n),nameOverride:At.string().optional(),generatedName:At.string()}).extend(dh);var yTo=At.union("type",{discriminated:At.lazyObject(()=>bTo),undiscriminated:At.lazyObject(()=>gTo)}).transform({transform:e=>{switch(e.type){case"discriminated":return QY.discriminated(e);case"undiscriminated":return QY.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var bTo=At.objectWithoutOptionalProperties({discriminantProperty:At.string(),commonProperties:At.list(At.lazyObject(()=>OTo)),schemas:At.record(At.string(),At.lazy(()=>EM))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var OTo=At.objectWithoutOptionalProperties({key:At.string(),schema:At.lazy(()=>EM)});var gTo=At.objectWithoutOptionalProperties({schemas:At.list(At.lazy(()=>EM))}).extend(_f).extend(s0).extend(xO).extend(dh).extend(Die).extend(ly).extend(BO).extend(uE);var IRp=/^(\d+)/,A1n=/^[a-zA-Z][a-zA-Z0-9_]*$/,zRp={"<":"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 ydi(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","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 u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${ydi(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${ydi(a)}`}function kpa(e){let t=e.match(IRp);if(t&&t[0]!=null){let r=t[0],i=e.substring(r.length),n=parseFloat(r);if(!isNaN(n)&&isFinite(n)){let a=ydi(n);return i.length>0?`${a}_${i}`:a}}}function q1n(e){let t=kpa(e),r=zRp[e];return t!=null?G3(Dg(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":G3(Dg(e)))}function Eie(e,t){return e.type==="primitive"&&t.type==="primitive"?RRp(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?JPD(e.values,t.values):e.type==="array"&&t.type==="array"?Eie(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"?Eie(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?KPD(e.value,t.value):e.type==="object"&&t.type==="object"?YPD(e,t):e.type==="map"&&t.type==="map"?RRp(e.key.schema,t.key.schema)&&Eie(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function RRp(e,t){return e.type===t.type}function JPD(e,t){let r=new Set(...e.map(n=>n.value)),i=new Set(...t.map(n=>n.value));return F1e(r,i)}function KPD(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,i])=>{let n=t.schemas[r];return n==null?!1:Eie(i,n)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,i)=>{let n=t.schemas[i];return n==null?!1:Eie(r,n)}):!1}function YPD(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(i=>[i.key,i.schema]));return Object.entries(t.properties).every(([i,n])=>{let a=r[i];return a==null?!1:Eie(a,n.schema)})}var j2;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(j2||(j2={}));var mTo=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:i,environmentOverrides:n,globalHeaderOverrides:a,authOverrides:u}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=n,this.authOverrides=u,this.globalHeaderOverrides=a,this.detectGlobalHeaders=i?.detectGlobalHeaders??!0,this.objectQueryParameters=i?.objectQueryParameters??!1,this.respectReadonlySchemas=i?.respectReadonlySchemas??!1,this.respectNullableSchemas=i?.respectNullableSchemas??!1,this.onlyIncludeReferencedSchemas=i?.onlyIncludeReferencedSchemas??!1,this.inlinePathParameters=i?.inlinePathParameters??!1,this.referencedSchemaIds=i?.onlyIncludeReferencedSchemas?new Set:void 0,this.enableUniqueErrorsPerEndpoint=i?.enableUniqueErrorsPerEndpoint??!1,this.builder=new hRi(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let l={};if(!this.enableUniqueErrorsPerEndpoint)for(let d of r.endpoints)for(let[s,o]of Object.entries(d.errors)){let c=parseInt(s),b=l[c];b==null&&o.schema!=null?l[c]=o.schema:b!=null&&o.schema!=null&&Eie(b,o.schema)||this.unknownSchema.add(c)}}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}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.onlyIncludeReferencedSchemas&&this.isInAnyState(j2.Channel,j2.Endpoint,j2.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:Fo(t)}}markObjectSchemaAsReferenced(t,r){for(let i of t.allOf)this.markSchemaIdAsReferenced(i.schema,r);for(let i of t.properties)this.markSchemaAsReferenced(i.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let i of Object.values(t.schemas))this.markSchemaAsReferenced(i,r);return;case"undiscriminated":for(let i of t.schemas)this.markSchemaAsReferenced(i,r);return;default:Fo(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let i=this.getSchema(t,r);i!=null&&this.markSchemaAsReferenced(i,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function fI(e){switch(e){case pV.Deprecated:return"deprecated";case pV.Beta:return"pre-release";case pV.GenerallyAvailable:return"generally-available";default:return}}function XPD(e){let t=e.find(i=>typeof i=="object"&&i.type==="namespace"),r=e.filter(i=>typeof i=="string"||i.type!=="namespace");return t?[t,...r]:r}function NRp(e){let t=e?XPD(e):void 0;if(t==null||t.length===0)return JTi;let r=[];for(let[i,n]of t.entries())if(typeof n=="string")r.push(Dg(n));else if(typeof n=="object")switch(n.type){case"namespace":{i<t.length-1?r.push(Dg(n.name)):r.push(n.name,JTi);break}default:Fo(n.type)}else Fo(n);return r.join("/")}function T1n(e){return sy.of(`${NRp(e)}.yml`)}function j5s({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?JTi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(i=>typeof i=="string"||i.type!=="namespace")]:r=e.groupName,NRp(r))}function FRp({sdkName:e,namespaceOverride:t}){return sy.of(`${j5s({sdkName:e,namespaceOverride:t})}.yml`)}function LRp({location:e,namespaceOverride:t}){return t!=null?PR(sy.of(t),e):e}function PTo(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Fo(e.type)}}function C1n(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;case"unknown":return;default:Fo(e)}}function MM(e){return typeof e=="string"?e:e.type}function B1n(e){if(typeof e!="string")return e.docs}function e_a(e){if(typeof e!="string")return e.default}function w5s(e){if(typeof e!="string")return e.validation}var ZPD=-2147483648,kPD=2147483647,ejD=-17976931348623157e292,tjD=17976931348623157e292;function H0({schema:e,fileContainingReference:t,declarationFile:r=t,context:i,namespace:n,declarationDepth:a}){switch(i.shouldMarkSchemaAsReferenced()&&i.markSchemaAsReferenced(e,n),e.type){case"primitive":return jTo(e);case"array":return E5s({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"map":return M5s({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"reference":return D5s({schema:e,fileContainingReference:t,context:i,namespace:n});case"unknown":return q5s();case"optional":return wTo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"nullable":return A5s({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"enum":return ljD({schema:e,fileContainingReference:t,context:i,declarationFile:r,declarationDepth:a});case"literal":return e.value,T5s(e);case"object":return fjD({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"oneOf":return djD({schema:e.value,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});default:Fo(e)}}function jTo(e){switch(e.schema.type){case"string":return njD({description:e.description,schema:e.schema});case"int":return ajD({description:e.description,schema:e.schema});case"float":return ojD({description:e.description,schema:e.schema});case"double":return ujD({description:e.description,schema:e.schema});case"boolean":return rjD({description:e.description,schema:e.schema});case"int64":return ijD({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",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:fI(e.availability)}:{}}}function rjD({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function ijD({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function njD({description:e,schema:t}){let r="string",i=sjD(t);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function ajD({description:e,schema:t}){let r="integer",i=VRp(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function ojD({description:e,schema:t}){let r="float";if(e==null)return r;let i={type:r};return e!=null&&(i.docs=e),i}function ujD({description:e,schema:t}){let r="double",i=VRp(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function sjD(e){if(e==null)return;let{format:t,pattern:r,minLength:i,maxLength:n}=e,a=cjD(t);if(!(a==null&&r==null&&i==null&&n==null))return{format:a,pattern:r,minLength:i,maxLength:n}}function cjD(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 VRp(e,t){if(e==null)return;let{minimum:r,maximum:i,multipleOf:n}=e,{exclusiveMinimum:a,exclusiveMaximum:u}=e;if(r=S5s(r,t),i=S5s(i,t),n=S5s(n,t),!(r==null&&i==null&&a==null&&u==null&&n==null))return{min:r,max:i,exclusiveMin:a,exclusiveMax:u,multipleOf:n}}function S5s(e,t){if(e===void 0)return;let[r,i]=t==="integer"?[ZPD,kPD]:[ejD,tjD];return e<r||e>i?void 0:e}function D5s({schema:e,fileContainingReference:t,context:r,namespace:i}){let n=r.getSchema(e.schema,i);if(n==null)return"unknown";let a=pjD(n)??e.schema,u=C1n(n),l=_jD(n),d=STo({context:r,fileContainingReference:t,declarationFile:T1n(u),type:a}),s=n.type==="nullable"?`optional<${d}>`:d;return e.description==null&&l==null?s:{type:n.type==="nullable"?`optional<${d}>`:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function E5s({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=`list<${MM(u)}>`;return e.description==null&&e.title==null?l:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{},type:l}}function M5s({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=jTo(e.key),l=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),d=e.encoding!=null?PTo(e.encoding):void 0,s=`map<${MM(u)}, ${MM(l)}>`;if(e.description==null&&d==null&&e.title==null)return s;let o={type:s};return e.description!=null&&(o.docs=e.description),e.encoding!=null&&(o.encoding=d),e.availability!=null&&(o.availability=fI(e.availability)),o}function A5s({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){if(!i.respectNullableSchemas)return wTo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});let u=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=MM(u),d=B1n(u),s=e_a(u),o=w5s(u),c=l.startsWith("nullable<")?l:`nullable<${l}>`;if(e.availability==null&&e.description==null&&d==null&&s==null&&o==null&&e.title==null)return URp({typeReference:c,itemType:l});let b={type:c};return(e.description!=null||d!=null)&&(b.docs=e.description??d),s!=null&&(b.default=s),o!=null&&(b.validation=o),e.availability!=null&&(b.availability=fI(e.availability)),URp({typeReference:b,itemType:l})}function wTo({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=H0({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=MM(u),d=B1n(u),s=e_a(u),o=w5s(u),c=l.startsWith("optional<")?l:`optional<${l}>`;if(e.availability==null&&e.description==null&&d==null&&s==null&&o==null&&e.title==null)return c;let b={type:c};return(e.description!=null||d!=null)&&(b.docs=e.description??d),s!=null&&(b.default=s),o!=null&&(b.validation=o),e.availability!=null&&(b.availability=fI(e.availability)),b}function q5s(){return"unknown"}function T5s(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Fo(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function ljD({schema:e,fileContainingReference:t,declarationFile:r,context:i,declarationDepth:n}){let a=t_a(e,n),u=e.nameOverride??e.generatedName;i.builder.addType(r,{name:u,schema:a.schema});let l=STo({type:u,fileContainingReference:t,declarationFile:r,context:i});if(e.description==null&&e.default==null&&e.title==null)return l;let d={type:l};return e.description!=null&&(d.docs=e.description),e.default!=null&&(d.default=e.default.value),e.availability!=null&&(d.availability=fI(e.availability)),d}function fjD({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=C5s({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=e.nameOverride??e.generatedName;i.builder.addType(r,{name:l,schema:u.schema});let d=STo({type:l,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?d:{type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function djD({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=B5s({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),l=e.nameOverride??e.generatedName;i.builder.addType(r,{name:l,schema:u.schema});let d=STo({type:l,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?d:{...e.title!=null?{"display-name":e.title}:{},type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:fI(e.availability)}:{}}}function STo({type:e,fileContainingReference:t,declarationFile:r,context:i}){if(r===t)return e;let n=i.builder.addImport({file:t,fileToImport:r});return n!=null?`${n}.${e}`:e}function pjD(e){return gy._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 _jD(e){return gy._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:()=>{}})}function URp({typeReference:e,itemType:t}){return t.startsWith("optional<")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}function tKr(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Fo(e)}}function HRp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a;switch(e.type){case"primitive":a=vjD(e);break;case"array":a=hjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"map":a=yjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"reference":a=bjD({schema:e,context:t,declarationFile:r,namespace:i});break;case"unknown":a=OjD(e.nameOverride,e.generatedName);break;case"optional":a=$Rp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"nullable":a=gjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"enum":a=t_a(e,n);break;case"literal":a=mjD(e,e.nameOverride,e.generatedName);break;case"object":a=C5s({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"oneOf":a=B5s({schema:e.value,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;default:Fo(e)}return a}function C5s({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=t.isInState(j2.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),u=!1,l={},d=new Set;for(let g of e.properties){if(g.readonly&&(u=!0),a&&g.readonly)continue;if(Object.keys(g.conflict).length>0){if(Object.entries(g.conflict).every(([D,C])=>!C.differentSchema))continue;Object.entries(g.conflict).forEach(([D])=>{x5s({property:g.key,schemaId:D,context:t,namespace:i}).forEach(R=>{d.add(R)})})}let O=H0({schema:g.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}),m=g.audiences,w=g.nameOverride,E=fI(g.availability),A=SjD(g);l[g.key]=wjD({typeReference:O,audiences:m,name:w,availability:E,propertyAccess:A})}let s=new Set;for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(O=>d.add(O)),g.conflictingTypeSignatures&&s.add(g.propertyKey);let o=[];for(let g of e.allOf){let O=GRp({schema:g.schema,context:t,namespace:i});if(O==null||d.has(g.schema)||d.has(O))continue;let m=H0({schema:gy.reference(g),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});o.push(MM(m))}for(let g of d){let O=I5s(t,g,i);for(let m of O.properties)l[m.key]==null&&(s.has(m.key)&&(l[m.key]="unknown"),l[m.key]=H0({schema:m.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}));for(let m of O.allOf){if(d.has(m.schema))continue;let w=H0({schema:gy.reference(m),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});o.push(MM(w))}}let c={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(l).map(([g,O])=>jjD(g)?[g,typeof O=="string"?{type:O,name:`_${g}`}:{...O,name:`_${g}`}]:[g,O]))};o.length>0&&(c.extends=o),e.additionalProperties&&(c["extra-properties"]=!0),e.availability!=null&&(c.availability=fI(e.availability)),e.source!=null&&(c.source=tKr(e.source)),c.inline=z5s(e,n);let b=e.nameOverride??e.generatedName;return{name:u&&t.respectReadonlySchemas&&!a?`${b}Read`:b,schema:c}}function x5s({property:e,schemaId:t,context:r,namespace:i}){let n=r.getSchema(t,i);if(n==null)return[];if(n.type==="reference")return x5s({property:e,schemaId:n.schema,context:r,namespace:i});if(n.type==="object"){let{properties:a,allOf:u}=I5s(r,t,i),l=a.some(s=>s.key===e),d=[...u.flatMap(s=>x5s({property:e,context:r,schemaId:s.schema,namespace:i}))];if(l||d.length>0)return[t,...d]}return[]}function I5s(e,t,r){let i=e.getSchema(t,r);if(i==null)return{properties:[],allOf:[]};if(i.type==="object")return{properties:i.properties,allOf:i.allOf};if(i.type==="reference")return I5s(e,i.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${i.type}`)}function hjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:E5s({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function yjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:M5s({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function vjD(e){let t=jTo(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...i}=t;return{name:e.nameOverride??e.generatedName,schema:{...i}}}function WRp(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function t_a(e,t){let r={enum:e.values.map(a=>{let u=a.nameOverride??a.generatedName,l=a.value;if(u===l&&a.description==null&&(a.casing==null||WRp(a.casing)))return u;let d={value:a.value};if(u!==l&&(d.name=u),a.description!=null&&(d.docs=a.description),a.casing!=null&&!WRp(a.casing)){let s={},o=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,o=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,o=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,o=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,o=!0),o&&(d.casing=s)}return d})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=z5s(e,t);let i=new Set,n={...r,enum:[],source:e.source!=null?tKr(e.source):void 0};for(let a of r.enum){let u=typeof a=="string"?a:a.name??a.value;i.has(u.toLowerCase())||(n.enum.push(a),i.add(u.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:n}}function bjD({schema:e,context:t,declarationFile:r,namespace:i}){return{name:e.nameOverride??e.generatedName,schema:D5s({schema:e,context:t,fileContainingReference:r,namespace:i})}}function gjD({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:A5s({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}:$Rp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n})}function $Rp({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:wTo({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}}function OjD(e,t){return{name:e??t,schema:q5s()}}function mjD(e,t,r){return{name:t??r,schema:T5s(e)}}function B5s({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=e.encoding!=null?PTo(e.encoding):void 0;if(e.type==="discriminated"){let l={};for(let s of e.commonProperties)l[s.key]=H0({schema:s.schema,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1});let d={};for(let[s,o]of Object.entries(e.schemas))d[s]=H0({schema:o,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":l,docs:e.description??void 0,availability:e.availability!=null?fI(e.availability):void 0,union:d,encoding:a,source:e.source!=null?tKr(e.source):void 0}}}let u=[];for(let l of e.schemas)u.push(H0({schema:l,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:u,encoding:a,source:e.source!=null?tKr(e.source):void 0,inline:z5s(e,n)}}}var PjD=/^[0-9]/;function jjD(e){return PjD.test(e)}function GRp({schema:e,context:t,namespace:r}){let i=t.getSchema(e,r);if(i!=null)return i.type==="reference"?GRp({context:t,schema:i.schema,namespace:r}):e}function wjD({typeReference:e,audiences:t,name:r,availability:i,propertyAccess:n}){return t.length===0&&r==null&&i==null&&n==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...i!=null?{availability:i}:{},...n!=null?{access:n}:{}}}function z5s(e,t){return e.inline===!0||t>0?!0:void 0}function SjD(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return l2.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return l2.ObjectPropertyAccess.WriteOnly}}function QRp(e){let t=e.replace(/^x-|^X-/,"");return Dg(t)}var JRp="BasicAuthScheme",DTo="BearerAuthScheme";function KRp(e){if(e.authOverrides!=null){for(let[r,i]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:i});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,i]of Object.entries(e.ir.securitySchemes))if(i.type==="basic"){let n={scheme:"basic"};i.usernameVariableName!=null&&(n.username===void 0?n.username={name:i.usernameVariableName}:n.username.name=i.usernameVariableName),i.usernameEnvVar!=null&&(n.username===void 0?n.username={env:i.usernameEnvVar}:n.username.env=i.usernameEnvVar),i.passwordVariableName!=null&&(n.password===void 0?n.password={name:i.passwordVariableName}:n.password.name=i.passwordVariableName),i.passwordEnvVar!=null&&(n.password===void 0?n.password={env:i.passwordEnvVar}:n.password.env=i.passwordEnvVar),e.builder.addAuthScheme({name:JRp,schema:n}),t||(e.builder.setAuth(JRp),t=!0)}else if(i.type==="bearer"){let n={scheme:"bearer"};i.tokenVariableName!=null&&(n.token===void 0?n.token={name:i.tokenVariableName}:n.token.name=i.tokenVariableName),i.tokenEnvVar!=null&&(n.token===void 0?n.token={env:i.tokenEnvVar}:n.token.env=i.tokenEnvVar),e.builder.addAuthScheme({name:DTo,schema:n}),t||(e.builder.setAuth(DTo),t=!0)}else if(i.type==="header")if(t)e.builder.addGlobalHeader({name:i.headerName,schema:{type:"string",name:i.headerVariableName??QRp(i.headerName),env:i.headerEnvVar}});else{let n={header:i.headerName,name:i.headerVariableName??"apiKey",type:"string"};i.headerEnvVar!=null&&(n.env=i.headerEnvVar),i.prefix!=null&&(n.prefix=i.prefix),e.builder.addAuthScheme({name:r,schema:n}),e.builder.setAuth(r),t=!0}else if(i.type==="oauth"){let n={scheme:"bearer"};e.builder.addAuthScheme({name:DTo,schema:n}),t||(e.builder.setAuth(DTo),t=!0),i.scopesEnum!=null&&i.scopesEnum.values.length>0&&e.builder.addType(sy.of("__package__.yml"),{name:"OauthScope",schema:t_a(i.scopesEnum,0).schema})}}function uXt({header:e,context:t,fileContainingReference:r,namespace:i}){let n=H0({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),a=MM(n),u=e.name.replace(/^x-|^X-/,""),l=e.parameterNameOverride!=null?e.parameterNameOverride:Dg(u);if(e.description==null&&e.name===l&&e.env==null&&e.availability==null)return a;let d={type:a};return l!==e.name&&(d.name=l),e.description!=null&&(d.docs=e.description),e.env!=null&&(d.env=e.env),e.availability!=null&&(d.availability=fI(e.availability)),d}function ETo({pathParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=H0({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return MM(n);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:MM(n)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=fI(e.availability)),a}function ATo({queryParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=R5s({schema:e.schema,context:t,fileContainingReference:r,namespace:i});if(n==null)return;let a=MM(n.value),u=e_a(n.value);if(a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>"),e.description==null&&!n.allowMultiple&&u==null&&e.parameterNameOverride==null&&e.availability==null)return a;let l={type:a};return u!=null&&(l.default=u),n.allowMultiple&&(l["allow-multiple"]=!0),e.description!=null&&(l.docs=e.description),e.parameterNameOverride!=null&&(l.name=e.parameterNameOverride),e.availability!=null&&(l.availability=fI(e.availability)),DjD(n.value)&&n.value.validation!==void 0&&(l.validation=n.value.validation),l}function R5s({schema:e,context:t,fileContainingReference:r,namespace:i}){if(e.type==="reference"){let n=t.getSchema(e.schema,i);if(n==null)return;if(n.type==="array")return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,groupName:void 0,inline:void 0}),context:t,declarationFile:sy.of(X1),fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(n.type==="oneOf"&&n.value.type==="undiscriminated"){let a=[];for(let[u,l]of Object.entries(n.value.schemas))l.type==="literal"&&l.value.type==="string"&&(A1n.test(l.value.value)?a.push(l.value.value):a.push({value:l.value.value,name:q1n(l.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),{value:e.generatedName,allowMultiple:!1};if(n.value.schemas.length===2){let[u,l]=n.value.schemas;if(u!=null&&l!=null&&MTo({array:u,primitive:l}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:l,description:e.description,availability:e.availability,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(u!=null&&l!=null&&MTo({array:u,primitive:l}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0}}for(let[u,l]of Object.entries(n.value.schemas))return R5s({schema:l,context:t,fileContainingReference:r,namespace:i})}else if(t.objectQueryParameters)return{value:H0({schema:e,context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let n=t.getSchema(e.value.schema,i);if(n==null)return;if(n.type==="array")return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:H0({schema:e,context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let n=[];for(let[a,u]of Object.entries(e.value.value.schemas))u.type==="literal"&&u.value.type==="string"&&(A1n.test(u.value.value)?n.push(u.value.value):n.push({value:u.value.value,name:q1n(u.value.value)}));if(n.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:n}}),{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,u]=e.value.value.schemas;if(a!=null&&u!=null&&MTo({array:a,primitive:u}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(a!=null&&u!=null&&MTo({array:u,primitive:a}))return{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0}}for(let[a,u]of Object.entries(e.value.value.schemas))return R5s({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:void 0,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i})}else if(e.value.type==="object")return t.objectQueryParameters?{value:H0({schema:e,context:t,fileContainingReference:r,declarationFile:sy.of(X1),namespace:i,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:H0({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:H0({schema:gy.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0}:{value:H0({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}function MTo({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function DjD(e){return e.type!=null}function YRp({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"]=EjD(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=MjD({context:t,namedFullExamples:e.headers}));for(let i of e.messages){let n=vdi(i.payload);n!=null&&r.messages.push({type:i.messageType,body:n})}return r}function EjD(e){let t={};return e.forEach(r=>{let i=vdi(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function MjD({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),i={};return t.forEach(n=>{let a=vdi(n.value);r.has(n.name)||a!=null&&(i[n.name]=a)}),i}function vdi(e){switch(e.type){case"primitive":return XRp(e.value);case"object":return ZRp(e.properties);case"array":return AjD(e.value);case"map":return qjD(e.value);case"oneOf":return TjD(e.value);case"enum":return e.value;case"literal":return CjD(e.value);case"unknown":return vdi(e.value);default:Fo(e)}}function XRp(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"date":return e.value;case"base64":case"boolean":return e.value;default:Fo(e)}}function ZRp(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,vdi(r)]))}function AjD(e){return e.map(t=>vdi(t))}function qjD(e){return Object.fromEntries(e.map(t=>[XRp(t.key),vdi(t.value)]))}function TjD(e){return e.type==="discriminated"?ZRp(e.value):vdi(e.value)}function CjD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Fo(e)}}function rKr(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function qTo(e,t){return t??(e?.groupName!=null?rKr(e.groupName):void 0)}function kRp({channel:e,context:t,declarationFile:r}){let i={path:e.path,url:e.servers[0]?.name,auth:!1};e.audiences!=null&&e.audiences.length>0&&(i.audiences=e.audiences),e.summary!=null&&(i["display-name"]=e.summary),e.description!=null&&(i.docs=e.description);let n=rKr(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let d of e.handshake.pathParameters)a[d.name]=ETo({pathParameter:d,context:t,fileContainingReference:r,namespace:n});Object.keys(a).length>0&&(i["path-parameters"]=a);let u={};if(e.handshake.queryParameters.length>0)for(let d of e.handshake.queryParameters){let s=ATo({queryParameter:d,context:t,fileContainingReference:r,namespace:n});s!=null&&(u[d.name]=s)}Object.keys(u).length>0&&(i["query-parameters"]=u);let l={};if(e.handshake.headers.length>0)for(let d of e.handshake.headers){let s=uXt({header:d,context:t,fileContainingReference:r,namespace:n});l[d.name]=s}Object.keys(l).length>0&&(i.headers=l),t.builder.addChannel(r,{channel:i}),e.subscribe!=null&&t.builder.addChannelMessage(r,{messageId:"subscribe",message:{origin:"server",body:H0({schema:e.subscribe,context:t,fileContainingReference:r,namespace:n,declarationDepth:0})}}),e.publish!=null&&t.builder.addChannelMessage(r,{messageId:"publish",message:{origin:"client",body:H0({schema:e.publish,context:t,fileContainingReference:r,namespace:n,declarationDepth:0})}});for(let d of e.examples){let s=YRp({context:t,websocketExample:d});t.builder.addChannelExample(r,{example:s})}}var iKr="Base",BjD="Default";function bdi(e){return Object.entries(e).reduce((t,[r,i])=>(Dbn(i)?Object.entries(i.urls).forEach(([n,a])=>{t[n]=a}):t[r]=typeof i=="string"?i:i.url,t),{})}function eNp(e){if(e.environmentOverrides!=null){for(let[g,O]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:g,schema:O});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=[];for(let g of e.ir.servers){let O=g.audiences?{url:g.url,audiences:g.audiences}:g.url;if(g.name==null){r.push(O);continue}t[g.name]=O}let i={},n=[];for(let g of e.ir.endpoints)for(let O of g.servers){if(O.url==null)continue;let m=O.audiences?{url:O.url,audiences:O.audiences}:O.url;if(O.name==null){n.push(m);continue}i[O.name]=m}let a={},u=[];for(let g of e.ir.websocketServers){let O=g.audiences?{url:g.url,audiences:g.audiences}:g.url;if(g.name==null){u.push(O);continue}a[g.name]=O}let l=Object.keys(t).length,d=l>0,s=Object.keys(i).length>0,o=Object.keys(a).length>0;if(!d&&!s&&o&&e.ir.servers.length===0){for(let[g,O]of Object.entries(a))e.builder.addEnvironment({name:g,schema:O});e.builder.setDefaultEnvironment(Object.keys(a)[0]),e.builder.setDefaultUrl(iKr);return}if(n.length>0&&e.logger.error(`Skipping endpoint level servers ${n.map(g=>typeof g=="string"?g:g.url).join(", ")} because x-fern-server-name was not provided.`),!d){let g=e.ir.servers[0]?.url,O=e.ir.servers[0]?.audiences;if(g!=null){let m=O?{url:g,audiences:O}:g;t[BjD]=m}}let c=Object.values(t).map(g=>typeof g=="string"?g:g.url),b=r.filter(g=>{let O=typeof g=="string"?g:g.url;return!c.includes(O)});if(b.length>0&&e.logger.error(`Skipping top level servers ${b.map(g=>typeof g=="string"?g:g.url).join(", ")} because x-fern-server-name was not provided.`),s)if(l===1){let g=Object.keys(t)[0],O=Object.values(t)[0],m=typeof O=="string"?O:O.url;e.builder.addEnvironment({name:g,schema:{urls:{[iKr]:m,...bdi(i),...bdi(a)}}}),e.builder.setDefaultEnvironment(g),e.builder.setDefaultUrl(iKr)}else{let g=!0;for(let[O,m]of Object.entries(t))g?(e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(i),...bdi(a)}}}),e.builder.setDefaultEnvironment(O),g=!1):e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(i),...bdi(a)}}});e.builder.setDefaultUrl(iKr)}else{let g=!0;for(let[O,m]of Object.entries(t))g?(o?e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(a)}}}):e.builder.addEnvironment({name:O,schema:m}),e.builder.setDefaultEnvironment(O),g=!1):o?e.builder.addEnvironment({name:O,schema:{urls:{[iKr]:typeof m=="string"?m:m.url,...bdi(a)}}}):e.builder.addEnvironment({name:O,schema:m});o&&e.builder.setDefaultUrl(iKr)}}function TTo(e){return MM(e).startsWith("optional")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}var N5s=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},xjD=.75,IjD=new Set("authorization");function tNp(e){if(e.globalHeaderOverrides!=null){for(let[r,i]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:i});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,i]of Object.entries(t)){let n="optional<string>";if(i.name==null&&i.env==null&&typeof i.schema=="string")n=i.schema;else if(i!=null){let a=i.schema?C1n(i.schema):void 0,u=a!=null?rKr(a):void 0,l=sy.of("api.yml");n={name:i.name,env:i.env,type:i.schema!=null?MM(H0({schema:i.schema,context:e,fileContainingReference:u?PR(sy.of(Dg(u)),l):l,namespace:u,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:n})}if(e.detectGlobalHeaders){let r={};for(let n of e.ir.endpoints)for(let a of n.headers){if(IjD.has(a.name.toLowerCase()))continue;let u=r[a.name];if(u==null){let l=t[a.name],d=uXt({header:{...a,schema:l?.schema??a.schema,name:l?.name??a.name},fileContainingReference:sy.of(Q3),context:e,namespace:void 0});u=new N5s(d),r[a.name]=u}u.increment()}let i=e.ir.endpoints.length*xjD;for(let[n,a]of Object.entries(r)){let u=t[n],l=a.count===e.ir.endpoints.length,d=a.count>=i;u==null&&(l?e.builder.addGlobalHeader({name:n,schema:a.schema}):d&&e.builder.addGlobalHeader({name:n,schema:TTo(a.schema)}))}}}function rNp(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?C1n(t.schema):void 0,i=r!=null?rKr(r):void 0,n=uXt({header:{...t,schema:t.schema??gy.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,groupName:void 0,nameOverride:void 0,schema:vj.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},fileContainingReference:sy.of(Q3),context:e,namespace:i});e.builder.addIdempotencyHeader({name:t.header,schema:TTo(n)})}}function hG(e){switch(e.type){case"primitive":return nNp(e.value);case"object":return aNp(e.properties);case"array":return oNp(e.value);case"map":return RjD(e.value);case"oneOf":return NjD(e.value);case"enum":return e.value;case"literal":return FjD(e.value);case"unknown":return hG(e.value);default:Fo(e)}}function iNp(e){switch(e.type){case"withStreaming":return e.sse?{stream:zjD(e.events)}:{stream:oNp(e.events)};case"withoutStreaming":return{body:hG(e.value)};default:Fo(e)}}function nNp(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!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"date":return e.value;case"base64":case"boolean":return e.value;default:Fo(e)}}function aNp(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,hG(r)]))}function zjD(e){return e.map(t=>({event:"",data:hG(t)}))}function oNp(e){return e.map(t=>hG(t))}function RjD(e){return Object.fromEntries(e.map(t=>[nNp(t.key),hG(t.value)]))}function NjD(e){return e.type==="discriminated"?aNp(e.value):hG(e.value)}function FjD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Fo(e)}}function uNp({endpointExample:e,context:t}){let r={};return e.type!=="full"?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"]=LjD(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=UjD(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=VjD({context:t,namedFullExamples:e.headers})),e.request!=null&&(r.request=hG(e.request)),e.response!=null&&(r.response=iNp(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(i=>i.type==="language"?{name:i.name??void 0,docs:i.description??void 0,language:i.language,code:i.code,install:i.install??void 0}:{name:i.name??void 0,docs:i.description??void 0,sdk:i.sdk,code:i.code}).filter(Qb)),r)}function LjD(e){let t={};return e.forEach(r=>{let i=hG(r.value);i!=null&&(t[r.parameterNameOverride??r.name]=i)}),t}function UjD(e){let t={};return e.forEach(r=>{let i=hG(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function VjD({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),i={};return t.forEach(n=>{let a=hG(n.value);r.has(n.name)||a!=null&&(i[n.name]=a)}),i}function sNp(e){return pG._visit(e,{get:()=>l2.HttpMethodSchema.Get,post:()=>l2.HttpMethodSchema.Post,put:()=>l2.HttpMethodSchema.Put,patch:()=>l2.HttpMethodSchema.Patch,delete:()=>l2.HttpMethodSchema.Delete,head:()=>{throw new Error("HEAD is unsupported")},options:()=>{throw new Error("HEAD is unsupported")},trace:()=>{throw new Error("HEAD is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function cNp(e){return e==="POST"||e==="PUT"||e==="PATCH"}function lNp({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:i}=r.ir,n=[],a=new Set,u=e.path,l=qTo(e.sdkName,e.namespace),d={};for(let m of e.pathParameters)m.parameterNameOverride&&(u=u.replace(m.name,m.parameterNameOverride)),d[m.parameterNameOverride??m.name]=ETo({pathParameter:m,context:r,fileContainingReference:t,namespace:l}),a.add(m.name);let s={};for(let m of e.queryParameters){let w=ATo({queryParameter:m,context:r,fileContainingReference:t,namespace:l});w!=null&&(s[m.name]=w,a.add(m.name))}let o;if(e.pagination!=null)switch(e.pagination.type){case"cursor":o={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":o={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":o={type:"custom",results:e.pagination.results};break;default:Fo(e.pagination)}let c={path:u,method:sNp(e.method),auth:e.authed,docs:e.description??void 0,pagination:o,source:e.source!=null?tKr(e.source):void 0};!$jD({context:r,request:e.request})&&Object.keys(d).length>0&&(c["path-parameters"]=d),e.summary!=null&&(c["display-name"]=e.summary);let b={},g=r.builder.getGlobalHeaderNames(),O=e.headers.filter(m=>!g.has(m.name));for(let m of O){let w=uXt({header:m,context:r,fileContainingReference:t,namespace:l});b[m.name]=w,a.add(typeof w=="string"?m.name:w.name??m.name)}if(e.request!=null){r.setInState(j2.Request);let m=HjD({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s:void 0,nonRequestReferencedSchemas:Array.from(i),headers:Object.keys(b).length>0?b:void 0,usedNames:a,namespace:l});c.request=m.value,n=[...n,...m.schemaIdsToExclude??[]],r.unsetInState(j2.Request)}else{let m=r.inlinePathParameters&&Object.keys(d).length>0,w=Object.keys(s).length>0,E=Object.keys(b).length>0,A={};(m||w||E)&&(A.name=e.requestNameOverride??e.generatedRequestName),m&&(A["path-parameters"]=d),w&&(A["query-parameters"]=s),E&&(A.headers=b),Object.keys(A).length>0&&(c.request=A)}if(e.response!=null&&e.response._visit({json:m=>{let w=H0({schema:m.schema,context:r,fileContainingReference:t,namespace:l,declarationDepth:0});c.response={docs:m.description??void 0,type:MM(w)},m.statusCode!=null&&(c.response["status-code"]=m.statusCode),m.responseProperty!=null&&(c.response.property=m.responseProperty)},streamingJson:m=>{let w=H0({schema:m.schema,context:r,fileContainingReference:t,namespace:l,declarationDepth:0});c["response-stream"]={docs:m.description??void 0,type:MM(w),format:"json"}},streamingSse:m=>{let w=H0({schema:m.schema,context:r,fileContainingReference:t,namespace:l,declarationDepth:0});c["response-stream"]={docs:m.description??void 0,type:MM(w),format:"sse"}},file:m=>{c.response={docs:m.description??void 0,type:"file","status-code":m.statusCode}},streamingText:m=>{c["response-stream"]={docs:m.description??void 0,type:"text"}},text:m=>{c.response={docs:m.description??void 0,type:"text","status-code":m.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let m=r.getDefaultServerName(),w=e.servers[0];w==null?m!=null&&(c.url=m):c.url=w.name??void 0}return e.idempotent&&(c.idempotent=!0),e.availability!=null&&(c.availability=fI(e.availability)),Object.entries(e.errors).forEach(([m,w])=>{let E=w.generatedName,A=sy.of(X1);r.builder.enableUniqueErrorsPerEndpoint&&(E=`${e.generatedRequestName}${w.generatedName}`,w.schema!=null&&(w.schema.type!=="reference"&&w.schema.type!=="oneOf"?w.schema.generatedName=`${e.generatedRequestName}${w.schema.generatedName}`:w.schema.type==="oneOf"&&(w.schema.value.generatedName=`${e.generatedRequestName}${w.schema.value.generatedName}`)));let q={"status-code":parseInt(m)},D=LRp({location:fNp,namespaceOverride:l});if(w.schema!=null){let $=H0({schema:w.schema,context:r,fileContainingReference:D,declarationFile:D,namespace:l,declarationDepth:0});q.type=MM($),q.docs=w.description}r.builder.addError(D,{name:E,schema:r.isErrorUnknownSchema(parseInt(m))?{...q,type:"unknown"}:q}),c.errors==null&&(c.errors=[]);let C=r.builder.addImport({file:t,fileToImport:D});c.errors.push(C!=null?`${C}.${E}`:E),q.type!=null&&w.examples?.forEach($=>{let I={value:hG($.example),name:$.name,docs:$.description};r.builder.addErrorExample(D,{name:E,example:I})})}),e.examples.length>0&&(c.examples=WjD({endpointExamples:e.examples,context:r})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?c.audiences=[F5s,...e.audiences]:e.audiences.length>0&&(c.audiences=e.audiences),{value:c,schemaIdsToExclude:n}}function WjD({endpointExamples:e,context:t}){return e.map(r=>{try{return uNp({endpointExample:r,context:t})}catch(i){throw console.error(`Error building endpoint example: ${i}`),i}})}function HjD({endpoint:e,declarationFile:t,context:r,request:i,requestNameOverride:n,generatedRequestName:a,pathParameters:u,queryParameters:l,nonRequestReferencedSchemas:d,headers:s,usedNames:o,namespace:c}){if(i.type==="json"){let b=i.schema.type==="reference"?i.schema.schema:void 0,g=i.schema.type==="reference"?r.getSchema(i.schema.schema,c):i.schema;if(g?.type!=="object"||b!=null&&d.includes(b)){let A=H0({schema:i.schema,fileContainingReference:t,context:r,namespace:c,declarationDepth:0}),q={schemaIdsToExclude:[],value:{body:A}},D=Object.keys(u??{}).length>0,C=Object.keys(l??{}).length>0,R=Object.keys(s??{}).length>0;return D&&(q.value["path-parameters"]=u),C&&(q.value["query-parameters"]=l),R&&(q.value.headers=s),(D||C||R)&&(q.value.name=n??a),i.contentType!=null&&(q.value["content-type"]=i.contentType),i.description!=null&&(q.value.docs=i.description),q}let O=Object.fromEntries(g.properties.filter(A=>A.readonly==null?!0:!(cNp(e.method)&&A.readonly)).map(A=>{let q=H0({schema:A.schema,fileContainingReference:t,context:r,namespace:c,declarationDepth:1}),D=A.nameOverride??A.key,C=fI(A.availability);if(!o.has(D)&&A.audiences.length<=0)return o.add(D),A.nameOverride!=null?[A.key,{type:MM(q),docs:B1n(q),name:A.nameOverride,availability:C}]:[A.key,C?{...typeof q=="string"?{type:q}:q,availability:C}:q];let R={type:MM(q),docs:B1n(q)};return o.has(D)&&(R.name=A.generatedName),A.audiences.length>0&&(R.audiences=A.audiences),C!=null&&(R.availability=C),o.add(D),[A.key,R]})),m=g.allOf.map(A=>{let q=H0({schema:gy.reference(A),fileContainingReference:t,context:r,namespace:c,declarationDepth:0});return MM(q)}),w={properties:O};m.length>0&&(w.extends=m),i.additionalProperties&&(w["extra-properties"]=!0);let E={name:n??g.nameOverride??g.generatedName,"path-parameters":u,"query-parameters":l,headers:s,body:w};return i.contentType!=null&&(E["content-type"]=i.contentType),i.description!=null&&(E.docs=i.description),{schemaIdsToExclude:b!=null?[b]:[],value:E}}else{if(i.type==="octetStream")return{schemaIdsToExclude:[],value:{body:"bytes","content-type":JB.APPLICATION_OCTET_STREAM,...i.description?{docs:i.description}:{}}};if(i.type==="multipart"){let b=Object.fromEntries(i.properties.map(g=>{if(g.schema.type==="file"){let O=g.schema.isArray?"list<file>":"file";if(O=g.schema.isOptional?`optional<${O}>`:O,g.description!=null||g.contentType!=null){let m={type:O};if(g.description!=null&&(m.docs=g.description),g.contentType!=null){let w=g.contentType.split(",")[0];m["content-type"]=w}return[g.key,m]}return[g.key,O]}else{let O=H0({schema:g.schema.value,fileContainingReference:t,context:r,namespace:c,declarationDepth:1});if(g.contentType!=null||g.exploded||g.encoding==="form"){let m=typeof O=="string"?{type:O}:O;g.contentType!=null&&(m["content-type"]=g.contentType),g.encoding==="form"?m.style="form":g.exploded&&(m.style="exploded"),O=m}return[g.key,O]}}));return{schemaIdsToExclude:i.name==null?[]:[i.name],value:{name:n??i.name??a,"path-parameters":u,"query-parameters":l,headers:s,body:{properties:b},"content-type":JB.MULTIPART_FORM_DATA,...i.description?{docs:i.description}:{}}}}else Fo(i)}}function $jD({context:e,request:t}){if(!e.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;default:Fo(t)}}function GjD({location:e,namespaceOverride:t}){return t!=null?{...e,file:PR(sy.of(t),e.file)}:e}function QjD(e){let t=e.namespace,r=e.tags.filter(d=>d!==t)[0],i=e.operationId;if(i==null)return r!=null?{file:sy.of(`${Dg(r)}.yml`),endpointId:e.summary!=null?Dg(e.summary):Dg(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:sy.of(X1),endpointId:Dg(e.summary)}:{file:sy.of(X1),endpointId:Dg(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:sy.of(X1),endpointId:i};let n=r_a(r),a=r_a(i);if(F1e(n,a))return{file:sy.of("__package__.yml"),endpointId:r};let u=YjD({operationId:i,tag:r,path:e.path,method:e.method});if(u!=null)return u;let l=[];for(let d=0;d<n.length;++d){let s=n[d];if(s!=null&&s===a[d])l.push(s);else{let o=Dg(r);return{file:sy.of(`${o}.yml`),endpointId:i,tag:r}}}if(l.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:sy.of(Dg(l.join("_"))+".yml"),endpointId:Dg(a.slice(l.length).join("_")),tag:r}}function i_a(e){let t=e.tags[0];if(e.sdkName!=null){let r=j5s({sdkName:e.sdkName,namespaceOverride:e.namespace}),i=`${r}.yml`,n=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:sy.of(i),endpointId:e.sdkName.methodName,tag:n?t:void 0}}return GjD({namespaceOverride:e.namespace,location:QjD(e)})}function r_a(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=vBe(t),t}var JjD=new RegExp("[^a-zA-Z0-9{}]+"),KjD=new RegExp("[{}]","g");function YjD({operationId:e,tag:t,path:r,method:i}){let a=`${r.split(JjD).join("_").replaceAll(KjD,"_")}_${i.toLowerCase()}`;if(e.endsWith(a))return{file:sy.of(Dg(t)+".yml"),endpointId:Dg(e.slice(0,-1*a.length)),tag:t}}function dNp(e){let t=new Set,{endpoints:r,tags:i}=e.ir,n=[];for(let a of r){let{endpointId:u,file:l,tag:d}=i_a(a),s=l.split(".")[0];s!=null&&t.add(s);let o;if(a.sdkName!=null){let g=e.ir.groups;for(let O of a.sdkName.groupName){let m=typeof O=="string"?O:O.name,w=g[m];if(w==null)break;if(w.summary!=null||w.description!=null){o=g[m];break}}}let c=d==null?void 0:i.tagsById[d];e.setInState(j2.Endpoint),e.setEndpointMethod(a.method);let b=lNp({context:e,endpoint:a,declarationFile:l});e.unsetEndpointMethod(),e.unsetInState(j2.Endpoint),n=[...n,...b.schemaIdsToExclude],e.builder.addEndpoint(l,{name:u,schema:b.value,source:a.source!=null?tKr(a.source):void 0}),(c?.id!=null||c?.description!=null)&&e.builder.setServiceInfo(l,{"display-name":o?.summary??c?.id,docs:o?.description??c?.description??void 0})}return{schemaIdsToExclude:n,sdkGroups:t}}function pNp(e){for(let[t,r]of Object.entries(e.ir.variables)){let i=r.groupName!=null?rKr(r.groupName):void 0,n=H0({schema:gy.primitive(r),context:e,fileContainingReference:sy.of(X1),namespace:i,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:MM(n),docs:r.description??void 0}})}}function _Np(e){for(let t of e.ir.webhooks){let r=kjD({webhook:t,context:e});if(r==null)continue;let i=qTo(t.sdkName,t.namespace),n={};for(let u of t.headers)n[u.name]=uXt({header:u,context:e,fileContainingReference:r.file,namespace:i});let a={method:t.method,"display-name":t.summary??void 0,headers:n,payload:H0({schema:t.payload,context:e,fileContainingReference:r.file,namespace:i,declarationDepth:0}),examples:t.examples!=null?t.examples.map(u=>({docs:u.description,name:u.name,payload:hG(u.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function XjD({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:PR(sy.of(t),e.file)}:e}function ZjD({webhook:e,context:t}){let r=e.tags[0],i=e.operationId;if(r==null)return{file:sy.of(X1),endpointId:i};let n=r_a(r),a=r_a(i);if(F1e(n,a))return{file:sy.of("__package__.yml"),endpointId:r};let u=[];for(let l=0;l<n.length;++l){let d=n[l];if(d!=null&&d===a[l])u.push(d);else{let s=Dg(r);return{file:sy.of(`${s}.yml`),endpointId:i,tag:r}}}if(u.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:sy.of(Dg(u.join("_"))+".yml"),endpointId:Dg(a.slice(u.length).join("_")),tag:r}}function kjD({webhook:e,context:t}){return e.sdkName!=null?{file:FRp({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:XjD({namespaceOverride:e.namespace,location:ZjD({webhook:e,context:t})})}var ewD=sy.of(X1);function hNp(e){switch(e.type){case"object":return sXt(e.groupName);case"enum":return sXt(e.groupName);case"oneOf":return sXt(e.value.groupName);case"array":return sXt(e.groupName);case"map":return sXt(e.groupName);case"reference":return sXt(e.groupName);case"literal":return sXt(e.groupName);case"optional":return sXt(e.groupName);case"nullable":return sXt(e.groupName);case"primitive":return sXt(e.groupName);case"unknown":return ewD;default:Fo(e)}}function sXt(e){return T1n(e)}var F5s="external",fNp=sy.of(X1);function yNp({schemas:e,schemaIdsToExclude:t,namespace:r,context:i}){for(let[n,a]of Object.entries(e)){if(t.includes(n))continue;let u=hNp(a),l=HRp({schema:a,context:i,declarationFile:u,namespace:r,declarationDepth:0});if(Jsi(l.schema)){let d=MM(l.schema);if(d===(l.name??n)||d===`optional<${l.name??n}>`)continue}i.builder.addType(u,{name:l.name??n,schema:l.schema})}}function vNp(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),eNp(e),tNp(e),rNp(e),KRp(e),pNp(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(F5s);let t=dNp(e),r=t.sdkGroups;e.setInState(j2.Webhook),_Np(e),e.unsetInState(j2.Webhook),e.setInState(j2.Channel);for(let n of Object.values(e.ir.channels)){let a=T1n(n.groupName);kRp({channel:n,context:e,declarationFile:a})}e.unsetInState(j2.Channel);let i=twD({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});yNp({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:i,namespace:void 0,context:e});for(let[n,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))yNp({schemas:a,schemaIdsToExclude:i,namespace:n,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(a=>r.has(a))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.build()}function twD({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let i=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),n=new Set(t);for(let a of i)r.includes(a)||n.add(a);return Array.from(n)}function L5s(e){let t=new mTo(e);return vNp(t)}var vRi={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1};function U5s({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??vRi.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??vRi.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??vRi.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??vRi.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??vRi.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??vRi.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??vRi.inlinePathParameters}}var CTo=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:i,absoluteFilePath:n}){let a=L5s({taskContext:t,ir:r,options:U5s({overrides:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.args.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.args.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.args.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.args.objectQueryParameters}}),authOverrides:this.args.generatorsConfiguration?.api?.auth!=null?{...this.args.generatorsConfiguration?.api}:void 0,environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.args.generatorsConfiguration?.api?.headers!=null?{...this.args.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:n??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Kd.dump(a.rootApiFile)},namedDefinitionFiles:{...rd(a.definitionFiles,u=>({absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Kd.dump(u),contents:u})),[sy.of(X1)]:{absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Kd.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var n_a=class extends D5t{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;exampleGeneration;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.exampleGeneration=t.exampleGeneration,this.converter=new CTo(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:i},n){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:i},n);return this.converter.convert({context:t,ir:a,settings:n,absoluteFilePath:r})}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new USe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion})}};function x1n(e){if(e.settings==null)return;let t={detectGlobalHeaders:!0};return e.settings.unions==="v1"&&(t.discriminatedUnionV2=!0),t}var OLp=yi(Bxo(),1);var mV={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};var nha={of(e){return e}};var W5p={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},TWs={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:W5p,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},fd={SOURCE:nha.of("source"),SDK_METHOD_NAME:nha.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:nha.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:nha.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport"};var OG={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!0,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,preserveSchemaIds:!1,objectQueryParameters:!1,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!1,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json"};function CWs({options:e,overrides:t}){return{disableExamples:t?.disableExamples??OG.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??OG.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??OG.useTitlesAsName,audiences:t?.audiences??e?.audiences??OG.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??OG.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??OG.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??OG.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??OG.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??OG.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??OG.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??OG.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??OG.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??OG.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??OG.objectQueryParameters,filter:t?.filter??e?.filter??OG.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??OG.asyncApiNaming,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0}}var H5p={naming:"v1"};function yf(e,t){let r=Array.isArray(t)?t:[t];for(let i of r){let n=e[i];if(n!=null)return n}}function aha(e,t,r,i,n=[]){try{let a=yf(e,t);if(a!=null)return r.parse(a)}catch{let u=vBe(n).join(" -> ");i.error(`${u.length>0?`${u}: `:""}Failed to parse ${t}`)}}function QRi(e){let t=yf(e,"examples");return t!=null&&Array.isArray(t)?t:[]}function $5p({schema:e,logger:t}){return yf(e,fd.ENCODING)??void 0}function G5p(e){return yf(e,fd.FERN_ENUM)}function Q5p({nameOverride:e,generatedName:t,title:r,schema:i,description:n,availability:a}){let u=yf(i,fd.SDK_GROUP_NAME),l=yf(i,fd.TYPE_DEFINITION);if(l!=null)return oha({fernType:l,nameOverride:e,generatedName:t,title:r,description:n,availability:a,groupName:typeof u=="string"?[u]:u})}function oha({fernType:e,nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u}){return NU({type:e,_default:void 0,validation:void 0,visitor:{primitive:l=>{switch(l.v1){case"BASE_64":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.base64({example:void 0})});case"BOOLEAN":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.boolean({default:void 0,example:void 0})});case"DATE":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.date({example:void 0})});case"DATE_TIME":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.datetime({example:void 0})});case"FLOAT":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.float({example:void 0})});case"DOUBLE":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.uint({default:void 0,example:void 0})});case"INTEGER":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.uint64({default:void 0,example:void 0})});case"LONG":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return El.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,groupName:u,schema:Xd.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Fo(l.v1)}},unknown:()=>El.unknown({nameOverride:t,generatedName:r,title:i,example:void 0,description:n,availability:a,groupName:u}),map:({keyType:l,valueType:d})=>l?.type==="primitive"&&d!=null?El.map({nameOverride:t,generatedName:r,title:i,key:l,value:d,description:n,availability:a,groupName:u,encoding:void 0,example:void 0,inline:void 0}):void 0,list:l=>l!=null?El.array({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,example:void 0,inline:void 0}):void 0,optional:l=>l!=null?El.optional({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,inline:void 0}):void 0,nullable:l=>l!=null?El.nullable({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,inline:void 0}):void 0,set:l=>l!=null?El.array({nameOverride:t,generatedName:r,title:i,value:l,description:n,availability:a,groupName:u,example:void 0,inline:void 0}):void 0,literal:l=>El.literal({nameOverride:t,generatedName:r,title:i,value:l._visit({string:d=>cx.string(d),boolean:d=>cx.boolean(d),_other:()=>{throw new Error("Unexpected literal type")}}),description:n,availability:a,groupName:u}),named:()=>{}}})}function J5p(e){let t=yf(e,fd.SOURCE);if(t!=null)return t.endsWith(".proto")?wie.protobuf({file:t}):wie.openapi({file:t})}function JRi(e){if(e!=null&&typeof e=="boolean")return e}function Zd(e){return e.$ref!=null}function K5p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,additionalProperties:n,description:a,availability:u,wrapAsNullable:l,context:d,groupName:s,example:o,encoding:c,source:b,namespace:g}){return typeof n=="boolean"||SSn(n)?xxo({nameOverride:e,generatedName:t,title:r,wrapAsNullable:l,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:El.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:void 0}),groupName:s,example:o,encoding:c}):xxo({nameOverride:e,generatedName:t,title:r,wrapAsNullable:l,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),groupName:void 0},valueSchema:Y5p(qb(n,d.options.optionalAdditionalProperties?l:!1,d,[...i,"Value"],b,g,void 0,void 0,void 0)),groupName:s,example:o,encoding:c})}function Y5p(e){switch(e.type){case"array":case"enum":case"map":case"object":e.inline=!0;break;case"literal":case"primitive":case"reference":case"unknown":break;case"nullable":case"optional":e.inline=!0,e.value=Y5p(e.value);break;case"oneOf":e.value.inline=!0;break;default:Fo(e)}return e}function xxo({nameOverride:e,generatedName:t,title:r,keySchema:i,valueSchema:n,wrapAsNullable:a,description:u,availability:l,groupName:d,example:s,encoding:o}){return a?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.map({nameOverride:e,generatedName:t,title:r,description:u,availability:i.availability,key:i,value:n,groupName:d,encoding:o,example:s,inline:void 0}),description:u,availability:l,groupName:d,inline:void 0}):El.map({nameOverride:e,generatedName:t,title:r,description:u,availability:l,key:i,value:n,groupName:d,encoding:o,example:s,inline:void 0})}function SSn(e){return e==null?!1:typeof e=="boolean"?e:!Zd(e)&&Object.keys(e).length===0}function X5p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,item:n,description:a,availability:u,wrapAsNullable:l,context:d,groupName:s,example:o,source:c,namespace:b}){let g=n==null?El.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,groupName:s}):qb(n,!1,d,[...i,"Item"],c,b);return k4D({nameOverride:e,generatedName:t,title:r,groupName:s,itemSchema:g,wrapAsNullable:l,description:a,availability:u,example:o})}function k4D({nameOverride:e,generatedName:t,title:r,itemSchema:i,wrapAsNullable:n,description:a,availability:u,groupName:l,example:d}){return n?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.array({nameOverride:e,generatedName:t,title:r,value:i,description:a,availability:u,groupName:l,example:d,inline:void 0}),description:a,availability:u,groupName:l,inline:void 0}):El.array({nameOverride:e,generatedName:t,title:r,value:i,description:a,availability:u,groupName:l,example:d,inline:void 0})}function Bie(e){switch(yf(e,fd.AVAILABILITY)){case"deprecated":return pV.Deprecated;case"beta":return pV.Beta;case"generally-available":return pV.GenerallyAvailable;default:break}if(!Zd(e)&&e.deprecated)return pV.Deprecated}function BWs({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:u,required:l,wrapAsNullable:d,discriminator:s,context:o,groupName:c,encoding:b,source:g,namespace:O}){let m=s.propertyName,w=Object.fromEntries(Object.entries(s.mapping??{}).map(([A,q])=>{let D=DSn({$ref:q},!1,o,[q],b,g,O);return o.markReferencedByDiscriminatedUnion({$ref:q},m,1),[A,D]})),E=Object.entries(n).filter(([A])=>A!==m).map(([A,q])=>{let D=l!=null&&l.includes(A),C=qb(q,!D,o,[...i,A],g,O);return{key:A,schema:C}});return Z5p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:E,description:a,availability:u,discriminant:m,subtypes:w,groupName:c,source:g})}function xWs({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:u,required:l,wrapAsNullable:d,discriminant:s,variants:o,context:c,groupName:b,encoding:g,source:O,namespace:m}){let w=Object.fromEntries(Object.entries(o).map(([A,q])=>{if(Zd(q)){let D=DSn(q,!1,c,[q.$ref],g,O,m);return c.markReferencedByDiscriminatedUnion(q,s,1),[A,D]}else{let D=ESn(q,!1,c,[...i,A],g,O,m,new Set([s]));return[A,D]}})),E=Object.entries(n).filter(([A])=>A!==s).map(([A,q])=>{let D=l!=null&&l.includes(A),C=qb(q,!D,c,[...i,A],O,m);return{key:A,schema:C}});return Z5p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:E,description:a,availability:u,discriminant:s,subtypes:w,groupName:b,source:O})}function Z5p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,properties:n,description:a,availability:u,discriminant:l,subtypes:d,groupName:s,source:o}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.oneOf(QY.discriminated({description:a,availability:u,discriminantProperty:l,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:n,groupName:s,encoding:void 0,source:o,inline:void 0})),groupName:s,description:a,availability:u,inline:void 0}):El.oneOf(QY.discriminated({description:a,availability:u,discriminantProperty:l,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:n,groupName:s,encoding:void 0,source:o,inline:void 0}))}function k5p(e){if(e.proto!=null)return t1n.protobuf({typeName:e.proto.type})}function bXt({nameOverride:e,generatedName:t,title:r,fernEnum:i,enumVarNames:n,enumValues:a,_default:u,description:l,availability:d,wrapAsNullable:s,groupName:o,context:c,source:b,inline:g}){let O=t8D(n??[]),m=new Set(a),w=Array.from(m).map((A,q)=>{let D=i?.[A],C=O[q],R=A1n.test(A),$=D?.name??C,I=R?A:q1n(A);return $!=null&&!A1n.test($)&&(c?.logger.warn(`Enum name override ${$} is not a valid name. Falling back on ${I}.`),$=void 0),{nameOverride:$,generatedName:I,value:A,description:D?.description,availability:d,casing:{snake:D?.casing?.snake??void 0,pascal:D?.casing?.pascal??void 0,screamingSnake:D?.casing?.screamingSnake??void 0,camel:D?.casing?.camel??void 0}}}),E=u!=null?w.find(A=>A.value===u):void 0;return e8D({wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:w,_default:E,description:l,availability:d,groupName:o,source:b,inline:g})}function e8D({wrapAsNullable:e,nameOverride:t,generatedName:r,title:i,values:n,_default:a,description:u,availability:l,groupName:d,source:s,inline:o}){return e?El.nullable({nameOverride:t,generatedName:r,title:i,value:El.enum({nameOverride:t,generatedName:r,title:i,values:n,description:u,default:a,availability:l,example:void 0,groupName:d,source:s,inline:o}),description:u,availability:l,groupName:d,inline:o}):El.enum({nameOverride:t,generatedName:r,title:i,values:n,description:u,availability:l,default:a,example:void 0,groupName:d,source:s,inline:o})}function t8D(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(i=>i[r]===t[r]);)r++;return e.map(i=>i.substring(r))}function e9p({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,description:o,availability:c,wrapAsNullable:b,example:g,groupName:O}){return i==="int64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint32"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int({default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O})}function t9p(e){return typeof e=="string"?cx.string(e):typeof e=="boolean"?cx.boolean(e):cx.string(`${e}`)}function r9p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,value:n,description:a,availability:u,groupName:l}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.literal({nameOverride:e,generatedName:t,title:r,value:t9p(n),description:a,availability:u,groupName:l}),description:a,availability:u,groupName:l,inline:void 0}):El.literal({nameOverride:e,generatedName:t,title:r,value:t9p(n),description:a,availability:u,groupName:l})}function IWs({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,description:o,availability:c,wrapAsNullable:b,example:g,groupName:O}){return i==null||i==="double"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.double({default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="float"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.float({example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="int32"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int({default:n,minimum:a,maximum:u,exclusiveMinimum:l,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="int64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.int64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint32"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="uint64"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.uint64({default:n,example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):i==="time-delta"?w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.float({example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O}):w5({nameOverride:e,generatedName:t,title:r,primitive:Xd.float({example:g}),wrapAsNullable:b,description:o,availability:c,groupName:O})}var r8D={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},i8D={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},n8D={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},a8D={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},o8D={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},u8D={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},s8D={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},c8D={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function Ixo(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],i=[r8D,i8D,n8D,a8D,o8D,u8D,s8D,c8D],n;do{n=t;for(let a of i)if(a.isApplicable(t)){let{refUnderProcessing:u,newBreadcrumbs:l}=a.applyStrategy(t);t=u,r=[...r,...l]}}while(t.join("")!==n.join(""));return r}function D2(e,t){let i=e.map(n=>/^[^a-zA-Z0-9]+$/.test(n)?n:G3(Dg(n))).join("");return/^\d/.test(i)?kpa(i)??i:i}function zWs(e){let t=e.join("_");return Dg(t)}function cE(e){switch(e.type){case"object":return gy.object({allOf:e.allOf,properties:e.properties.map(t=>f8D(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:e.inline});case"array":return gy.array({description:e.description,availability:e.availability,value:cE(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,inline:e.inline});case"enum":return gy.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return gy.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"nullable":return gy.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:cE(e.value),groupName:e.groupName,inline:e.inline});case"optional":return gy.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:cE(e.value),groupName:e.groupName,inline:e.inline});case"primitive":return gy.primitive({description:e.description,availability:e.availability,schema:i9p(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return gy.map({description:e.description,availability:e.availability,key:gy.primitive({description:e.key.description,availability:e.key.availability,schema:i9p(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,groupName:e.groupName}),value:cE(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,encoding:e.encoding,inline:e.inline});case"reference":return gy.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return gy.oneOf(l8D(e.value));case"unknown":return gy.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Fo(e)}}function l8D(e){switch(e.type){case"discriminated":return eKr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:cE(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,cE(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return eKr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>cE(t)),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:Fo(e)}}function i9p(e){switch(e.type){case"string":return vj.string(e);case"base64":return vj.base64();case"boolean":return vj.boolean(e);case"date":return vj.date();case"datetime":return vj.datetime();case"double":return vj.double(e);case"float":return vj.float();case"int":return vj.int(e);case"int64":return vj.int64(e);case"uint":return vj.uint();case"uint64":return vj.uint64();default:Fo(e)}}function f8D(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:cE(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function zxo(e,t){return Eie(cE(e),cE(t))}function n9p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,required:u,wrapAsNullable:l,allOf:d,context:s,propertiesToExclude:o,groupName:c,fullExamples:b,additionalProperties:g,availability:O,encoding:m,source:w,namespace:E}){let A=[...u??[]],q={...n},D=[],C=[];for(let U of d)if(Zd(U)){let H=s.resolveSchemaReference(U);if(H.discriminator!=null&&H.discriminator.mapping!=null)continue;if(H.oneOf!=null){for(let K of H.oneOf){let ee=Zd(K)?s.resolveSchemaReference(K):K,fe=qb(ee,!1,s.DUMMY,i,w,E);fe.type==="object"&&D.push(...fe.properties.map(me=>me.schema.type!=="optional"&&me.schema.type!=="nullable"?{...me,schema:El.optional({nameOverride:void 0,generatedName:"",title:void 0,value:me.schema,description:void 0,availability:me.availability,groupName:void 0,inline:void 0})}:me))}continue}let k=Wdi(U);if(k==null)continue;C.push({schemaId:k,convertedSchema:RWs(U,[k],w,s.options.preserveSchemaIds),properties:a9p({schema:U,context:s,breadcrumbs:i,source:w,namespace:E})}),s.markSchemaAsReferencedByNonRequest(k)}else{let H=qb(U,!1,s,i,w,E);H.type==="object"&&D.push(...H.properties)}let R={};for(let U of C)for(let[H,k]of Object.entries(U.properties)){let K=R[H];K!=null?(K.schemaIds.push(U.schemaId),K.schemas.some(fe=>zxo(fe,k))||K.schemas.push(k)):R[H]={schemaIds:[U.schemaId],schemas:[k]}}let $=[];for(let[U,H]of Object.entries(R))H.schemaIds.length>1&&$.push({propertyKey:U,allOfSchemaIds:H.schemaIds,conflictingTypeSignatures:H.schemas.length>1});let I=Object.entries(q).map(([U,H])=>{let k=A.includes(U),K=yf(H,fd.AUDIENCES)??[],ee=Bie(H),fe=Zd(H)?!1:H.readOnly,me=Zd(H)?!1:H.writeOnly,ge=yf(H,fd.FERN_PROPERTY_NAME),we=[...i,U],Ze=zWs(we),Mt=k?qb(H,!1,s,we,w,E):El.optional({nameOverride:e,generatedName:Ze,title:r,description:void 0,availability:ee,value:qb(H,!1,s,we,w,E),groupName:c,inline:void 0}),De={};for(let Te of C){let xt=Te.properties[U];xt!=null&&!zxo(Mt,xt)?De[Te.schemaId]={differentSchema:!0}:xt!=null&&(De[Te.schemaId]={differentSchema:!1})}return{key:U,schema:Mt,nameOverride:ge,audiences:K,conflict:De,generatedName:zWs([...i,U]),availability:ee,readonly:fe,writeonly:me}});return I.push(...D.map(U=>{let H=U.conflict;for(let k of C){let K=k.properties[U.key];K!=null&&!zxo(U.schema,K)?H[k.schemaId]={differentSchema:!0}:K!=null&&(H[k.schemaId]={differentSchema:!1})}return{...U,conflict:H}})),d8D({nameOverride:e,generatedName:t,title:r,wrapAsNullable:l,properties:I.filter(U=>!o.has(U.key)),description:a,allOf:C.map(U=>U.convertedSchema),allOfPropertyConflicts:$,groupName:c,fullExamples:b,additionalProperties:g,availability:O,source:w})}function d8D({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,properties:n,description:a,allOf:u,allOfPropertyConflicts:l,groupName:d,fullExamples:s,additionalProperties:o,availability:c,source:b}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.object({description:a,properties:n,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:l,groupName:d,fullExamples:s,additionalProperties:SSn(o),availability:void 0,source:b,inline:void 0}),description:a,availability:c,groupName:d,inline:void 0}):El.object({description:a,properties:n,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:l,groupName:d,fullExamples:s,additionalProperties:SSn(o),availability:c,source:b,inline:void 0})}function a9p({schema:e,context:t,breadcrumbs:r,source:i,namespace:n}){let a={},[u,l]=Zd(e)?[t.resolveSchemaReference(e),Ixo(e.$ref)]:[e,r];for(let d of u.allOf??[])a={...a,...a9p({schema:d,context:t,breadcrumbs:l,source:i,namespace:n})};for(let[d,s]of Object.entries(u.properties??{})){let o=qb(s,!1,t,[...l,d],i,n);a[d]=o}return a}function o9p({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,description:n,availability:a,wrapAsNullable:u,context:l,subtypes:d,groupName:s,encoding:o,source:c,subtypePrefixOverrides:b,namespace:g}){let O=u9p(d);return s9p({uniqueSubtypes:O,nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:n,availability:a,groupName:s,context:l,encoding:o,source:c})}function MSn({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,description:n,availability:a,wrapAsNullable:u,context:l,subtypes:d,groupName:s,encoding:o,source:c,subtypePrefixOverrides:b,namespace:g}){let O=p8D({schemas:d}),m=d.flatMap((E,A)=>{if(!Zd(E)&&E.enum!=null&&l.options.coerceEnumsToLiterals&&E.type==="string")return E.enum.map(D=>El.literal({nameOverride:void 0,generatedName:D2([t,D],l.options.preserveSchemaIds),title:void 0,value:cx.string(String(D)),groupName:void 0,description:void 0,availability:D.availability}));let q=O[A];if(b!=null){let D=b[A];D!=null&&"name"in D&&(q=D.name)}return[qb(E,!1,l,[...i,q??`${A}`],c,g)]}),w=u9p(m);return s9p({uniqueSubtypes:w,nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:n,availability:a,groupName:s,context:l,encoding:o,source:c})}function u9p(e){let t=[];for(let r=0;r<e.length;++r){let i=e[r],n=!1;for(let a=r+1;a<e.length;++a){let u=e[a];if(i!=null&&u!=null&&Eie(i,u)){n=!0;break}}i!=null&&!n&&t.push(i)}return t}function s9p({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,groupName:l,context:d,encoding:s,source:o}){if(Object.entries(e).every(([b,g])=>g.type==="literal")){let b={},g=[];return Object.entries(e).forEach(([O,m])=>{m.type==="literal"&&m.value.type==="string"&&(g.push(m.value.value),m.description!=null&&(b[m.value.value]={description:m.description}))}),bXt({nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,fernEnum:b,enumVarNames:void 0,enumValues:g,_default:void 0,groupName:l,context:d,source:o,inline:void 0})}return e.length===1&&e[0]!=null?e[0]:c9p({nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,subtypes:e,groupName:l,encoding:s,source:o})}function NWs({nameOverride:e,generatedName:t,title:r,description:i,availability:n,wrapAsNullable:a,context:u,groupName:l,discriminator:d,encoding:s,source:o,namespace:c}){let b=Object.entries(d.mapping??{}).map(([m,w],E)=>{let A={$ref:w},q=DSn(A,!1,u,[w],s,o,c);return u.markSchemaWithDiscriminantValue(A,d.propertyName,m),q.type==="object"&&(q.properties={[d.propertyName]:El.literal({nameOverride:void 0,generatedName:D2([t,m],u.options.preserveSchemaIds),title:void 0,value:cx.string(m),groupName:void 0,description:void 0,availability:void 0}),...q.properties.filter(D=>D.key!==d.propertyName)}),q}),g=[];for(let m=0;m<b.length;++m){let w=b[m],E=!1;for(let A=m+1;A<b.length;++A){let q=b[A];if(w!=null&&q!=null&&Eie(w,q)){E=!0;break}}w!=null&&!E&&g.push(w)}if(Object.entries(g).every(([m,w])=>w.type==="literal")){let m={},w=[];return Object.entries(g).forEach(([E,A])=>{A.type==="literal"&&A.value.type==="string"&&(w.push(A.value.value),A.description!=null&&(m[A.value.value]={description:A.description}))}),bXt({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:i,availability:n,fernEnum:m,enumVarNames:void 0,enumValues:w,_default:void 0,groupName:l,context:u,source:o,inline:void 0})}return g.length===1&&g[0]!=null?g[0]:c9p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:i,availability:n,subtypes:g,groupName:l,encoding:s,source:o})}function p8D({schemas:e}){let t={},r=0;for(let a of e){if(!Zd(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let u=Object.keys(a.properties),l={},d=u;for(let[s,o]of Object.entries(t)){let c=nYa(o,u);d=nYa(d,o),l[s]=c}l[r]=d,t=l}}r++}let i=[],n=0;for(let a of e){let u=t[n];if(u!=null&&u.length>0){let l=u.sort();if(l[0]!=null){i.push(l[0]),++n;continue}}Zd(a)?i.push(ydi(n)??`${n}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?i.push(""):i.push(ydi(n)??`${n}`),++n}return i}function c9p({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,description:n,availability:a,subtypes:u,groupName:l,encoding:d,source:s}){return i?El.nullable({nameOverride:e,generatedName:t,title:r,value:El.oneOf(QY.undiscriminated({description:n,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:l,encoding:d,source:s,inline:void 0})),description:n,availability:a,groupName:l,inline:void 0}):El.oneOf(QY.undiscriminated({description:n,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,groupName:l,encoding:d,source:s,inline:void 0}))}function ASn(e){if(e.default!=null&&typeof e.default=="string")return e.default}function Rxo({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let i=QRi(e);for(let n of i??[])if(typeof n=="number")return n;if(r&&typeof r=="number")return r}function l9p({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let i=QRi(e);for(let n of i??[])if(typeof n=="boolean")return n;if(r&&typeof r=="boolean")return r}function _Kr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let i=QRi(e);for(let n of i??[])if(typeof n=="string")return n;if(r&&typeof r=="string")return r}function f9p({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let i=QRi(e);for(let n of i??[])if(Array.isArray(n))return n;if(r&&Array.isArray(r))return r}var KRi="#/components/schemas/";function qb(e,t,r,i,n,a,u=!1,l=new Set,d){let s=J5p(e)??n,o=m8D({schema:e,logger:r.logger});if(Zd(e)){let c=Wdi(e);return c!=null?(u?r.markSchemaAsReferencedByRequest(c):r.markSchemaAsReferencedByNonRequest(c),DSn(e,t,r,i,o,s,a)):ESn(r.resolveSchemaReference(e),t,r,Ixo(e.$ref),o,s,a,l,u,d)}return ESn(e,t,r,i,o,s,a,l,u,d)}function DSn(e,t,r,i,n,a,u){let l=e.$ref.includes("properties")?ESn(r.resolveSchemaReference(e),t,r,i,n,a,u,new Set):El.reference(RWs(e,i,a,r.options.preserveSchemaIds));return t?El.nullable({title:void 0,nameOverride:void 0,generatedName:D2(i,r.options.preserveSchemaIds),value:l,description:void 0,availability:void 0,groupName:void 0,inline:void 0}):l}function _8D(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function ESn(e,t,r,i,n,a,u,l=new Set,d=!1,s){typeof e=="string"&&(e={type:e});let o=yf(e,fd.TYPE_NAME)??(r.options.useTitlesAsName?_8D(e.title):void 0),c=yf(e,fd.SDK_GROUP_NAME)??yf(e,mV.TAGS)?.[0],b=(typeof c=="string"?[c]:c)??[];b=r.resolveGroupName(b);let g=D2(i,r.options.preserveSchemaIds),O=e.title,m=e.description,w=Bie(e),E=[];e.example!=null&&E.push({name:void 0,value:e.example,description:void 0});let A=yf(e,mV.EXAMPLES);A!=null&&Object.keys(A).length>0&&E.push(...Object.entries(A).map(([C,R])=>({name:R?.summary??C,value:R.value,description:R.description})));let q=QRi(e);q!=null&&Object.keys(q).length>0&&E.push(...q.map(C=>({name:void 0,value:C,description:void 0})));let D=Q5p({schema:e,description:m,title:O,nameOverride:o,generatedName:g,availability:w});if(D!=null)return D;if(Array.isArray(e.type)){let C=e.type.indexOf("null"),R=C!==-1;e.type.length===1?e.type=e.type[0]:e.type.length===2&&R?(e.type.splice(C,1),e.type=e.type[0],e.nullable=!0):(R&&(e.type.splice(C,1),e.nullable=!0),e.oneOf==null?e.oneOf=e.type:e.oneOf.push(...e.type))}if(!t&&e.nullable===!0)return ESn(e,!0,r,i,n,a,u,l,d,s);if(e.enum!=null&&(e.type==="string"||e.type==null)){if(!Lxo(e.enum))return w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.string({default:ASn(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:_Kr({schema:e,logger:r.logger,fallback:s})}),groupName:b,wrapAsNullable:t,description:m,availability:w});let C=G5p(e);return e.enum.length===1&&e.enum[0]!=null&&C==null?r9p({nameOverride:o,generatedName:g,title:O,wrapAsNullable:t,value:e.enum[0],description:m,availability:w,groupName:b}):bXt({nameOverride:o,generatedName:g,title:O,fernEnum:C,enumVarNames:yf(e,[mV.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:m,availability:w,wrapAsNullable:t,groupName:b,context:r,source:a,inline:void 0})}if(Lxo(e.type)&&e.type.length>1){let C=e.type.includes("null"),R=e.type.filter($=>$!=="null").map($=>({type:$,nullable:C}));return MSn({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,wrapAsNullable:t,context:r,subtypes:R,groupName:b,encoding:n,source:a,namespace:u})}if(e.type==="boolean"){let C=yf(e,fd.BOOLEAN_LITERAL);return C!=null?d9p({nameOverride:o,generatedName:g,title:O,literal:cx.boolean(C),wrapAsNullable:t,description:m,availability:w,groupName:b}):w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.boolean({default:h8D(e.default),example:l9p({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:m,availability:w,groupName:b})}if(e.type==="number")return IWs({nameOverride:o,generatedName:g,title:O,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:JRi(e.exclusiveMinimum),exclusiveMaximum:JRi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:w,wrapAsNullable:t,example:Rxo({schema:e,logger:r.logger,fallback:s}),groupName:b});if(e.type==="integer")return e9p({nameOverride:o,generatedName:g,title:O,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:JRi(e.exclusiveMinimum),exclusiveMaximum:JRi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:w,wrapAsNullable:t,example:Rxo({schema:e,logger:r.logger,fallback:s}),groupName:b});if(e.type==="float")return IWs({nameOverride:o,generatedName:g,title:O,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:JRi(e.exclusiveMinimum),exclusiveMaximum:JRi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:w,wrapAsNullable:t,example:Rxo({schema:e,logger:r.logger,fallback:s}),groupName:b});if(e.type==="string"){if(e.format==="date-time")return w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.datetime({example:_Kr({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:m,availability:w,groupName:b});if(e.format==="json-string")return El.unknown({nameOverride:o,generatedName:g,title:O,description:m,availability:w,groupName:b,example:void 0});let C=h9p(e,"const");return C!=null?d9p({nameOverride:o,generatedName:g,title:O,literal:cx.string(C),wrapAsNullable:t,description:m,availability:w,groupName:b}):w5({nameOverride:o,generatedName:g,title:O,primitive:Xd.string({default:ASn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:_Kr({schema:e,logger:r.logger,fallback:s})}),groupName:b,wrapAsNullable:t,description:m,availability:w})}if(e.type==="array")return X5p({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,item:e.items,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,example:f9p({schema:e,logger:r.logger,fallback:s}),source:a,namespace:u});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&Nxo(e))return K5p({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,additionalProperties:e.additionalProperties,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,encoding:n,example:e.example,source:a,namespace:u});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?NWs({nameOverride:o,generatedName:g,title:O,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,discriminator:e.discriminator,encoding:n,source:a,namespace:u}):BWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:b,encoding:n,source:a,namespace:u});if(e.oneOf!=null&&e.oneOf.length>0){let C=yf(e,fd.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||C?NWs({nameOverride:o,generatedName:g,title:O,description:m,availability:w,wrapAsNullable:t,context:r,groupName:b,discriminator:e.discriminator,encoding:n,source:a,namespace:u}):BWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,groupName:b,encoding:n,source:a,namespace:u});if(e.oneOf.length===1&&e.oneOf[0]!=null){let R=qb(e.oneOf[0],t,r,i,a,u,d);return qSn(R,m,b)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let U=e.oneOf[0],H=e.oneOf[1];if(!Zd(U)&&U.type==="null")return qb(H,!0,r,i,a,u);if(!Zd(H)&&H.type==="null")return qb(U,!0,r,i,a,u)}let R=b8D({schemas:e.oneOf});if(R!=null)return bXt({nameOverride:o,generatedName:g,title:O,fernEnum:void 0,enumVarNames:void 0,enumValues:R,_default:e.default,description:m,availability:w,wrapAsNullable:t,groupName:b,context:r,source:a,inline:void 0});let $=p9p({schemas:e.oneOf,context:r});if($!=null&&!r.options.discriminatedUnionV2&&!C)return xWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},required:e.required,description:m,availability:w,wrapAsNullable:t,discriminant:$.discriminant,variants:$.schemas,context:r,groupName:b,encoding:n,source:a,namespace:u});let I=e.oneOf.filter(U=>!Zd(U)&&U.type==="null").length>0;return MSn({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,wrapAsNullable:t||I,context:r,subtypes:e.oneOf.filter(U=>Zd(U)||U.type!=="null"),encoding:n,groupName:b,source:a,namespace:u})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let $=qb(e.anyOf[0],t,r,i,a,u,d);return qSn($,m,b)}if(e.anyOf.length===2){let[$,I]=e.anyOf;if($!=null&&I!=null){if(!Zd($)&&$.type==="null"){let U=qb(I,!0,r,i,a,u);return qSn(U,m,b)}else if(!Zd(I)&&I.type==="null"){let U=qb($,!0,r,i,a,u);return qSn(U,m,b)}}}let C=p9p({schemas:e.anyOf,context:r});if(C!=null&&!r.options.discriminatedUnionV2)return xWs({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},required:e.required,description:m,availability:w,wrapAsNullable:t,discriminant:C.discriminant,variants:C.schemas,context:r,groupName:b,encoding:n,source:a,namespace:u});let R=e.anyOf.filter($=>!Zd($)&&$.type==="null").length>0;return MSn({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:w,wrapAsNullable:t||R,context:r,subtypes:e.anyOf.filter($=>Zd($)||$.type!=="null"),encoding:n,groupName:b,source:a,namespace:u})}if(e.allOf!=null||e.properties!=null){let C=[];for(let $ of e.allOf??[])(Zd($)||Object.keys($).length>0)&&C.push($);if((e.properties==null||Nxo(e))&&C.length===1&&C[0]!=null){let $=qb(C[0],t,r,i,a,u,d);return qSn($,m,b)}let R=C.filter($=>{let I=Fxo($);return I||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify($)}`),I});if((e.properties==null||Nxo(e))&&R.length===1&&R[0]!=null){let $=qb(R[0],t,r,i,a,u,d);return qSn($,m,b)}return n9p({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},description:m,required:e.required,wrapAsNullable:t,allOf:R,context:r,propertiesToExclude:l,groupName:b,fullExamples:E,additionalProperties:e.additionalProperties,availability:w,encoding:n,source:a,namespace:u})}if(e.type==="object"&&y8D(e)&&v8D(e)&&Nxo(e))return xxo({nameOverride:o,generatedName:g,title:O,description:m,availability:w,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${g}Key`,title:void 0,description:void 0,availability:void 0,schema:Xd.string({default:ASn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:_Kr({schema:e,logger:r.logger,fallback:s})}),groupName:b},valueSchema:El.unknown({nameOverride:void 0,generatedName:`${g}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,groupName:b}),groupName:b,encoding:n,example:e.example});if(e.type==null){let C=e.example??e.default;return El.unknown({nameOverride:o,generatedName:g,title:O,description:m,availability:w,groupName:b,example:C})}throw new Error(`Failed to convert schema breadcrumbs=${JSON.stringify(i)} value=${JSON.stringify(e)}`)}function h8D(e){if(e!=null){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase();if(t==="true")return!0;if(t==="false")return!1}}}function Wdi(e){if(e.$ref.startsWith(KRi))return e.$ref.replace(KRi,"")}function RWs(e,t,r,i){let n=yf(e,fd.TYPE_NAME),a=D2(t,i),u=e.description,l=Bie(e),d=Wdi(e);if(d==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return gy.reference({generatedName:a,nameOverride:n,title:void 0,schema:d,description:u??void 0,availability:l,groupName:void 0,source:r})}function y8D(e){return e.oneOf==null||e.oneOf.length===0}function v8D(e){return e.allOf==null||e.allOf.length===0}function Nxo(e){return e.properties==null||nY(e.properties)===0}function Lxo(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function qSn(e,t,r){return e.type==="reference"?El.reference({...e,description:t,availability:e.availability,groupName:r}):e.type==="optional"?El.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r,inline:void 0}):e.type==="nullable"?El.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,groupName:r,inline:void 0}):e}function Fxo(e){return Zd(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>Fxo(t)):e.oneOf!=null?e.oneOf.every(t=>Fxo(t)):e.anyOf!=null?e.anyOf.every(t=>Fxo(t)):!1}function d9p({literal:e,wrapAsNullable:t,groupName:r,description:i,availability:n,nameOverride:a,generatedName:u,title:l}){return t?El.nullable({nameOverride:a,generatedName:u,title:l,value:El.literal({nameOverride:a,generatedName:u,title:l,value:e,description:i,availability:n,groupName:r}),groupName:r,description:i,availability:n,inline:void 0}):El.literal({nameOverride:a,generatedName:u,title:l,value:e,groupName:r,description:i,availability:n})}function w5({primitive:e,wrapAsNullable:t,groupName:r,description:i,availability:n,generatedName:a,nameOverride:u,title:l}){return r=typeof r=="string"?[r]:r,t?El.nullable({nameOverride:u,generatedName:a,title:l,value:El.primitive({nameOverride:u,generatedName:a,title:l,schema:e,description:i,availability:n,groupName:r}),groupName:r,description:i,availability:n,inline:void 0}):El.primitive({nameOverride:u,generatedName:a,title:l,schema:e,description:i,availability:n,groupName:r})}function b8D({schemas:e}){let t=new Set;for(let r of e){if(Zd(r))return;if(r.enum!=null&&Lxo(r.enum))r.enum.forEach(i=>t.add(i));else return}return Array.from(t)}function p9p({schemas:e,context:t}){let r={};for(let i of e){let n=_9p({schema:i,context:t});for(let[a,u]of Object.entries(n)){let l=r[a];l!=null?l[u]=i:r[a]={[u]:i}}}for(let[i,n]of Object.entries(r))if(Object.keys(n).length===e.length)return{discriminant:i,schemas:n}}function _9p({schema:e,context:t}){let r=Zd(e)?t.resolveSchemaReference(e):e;return g8D({schema:r,context:t})}function g8D({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let i of e.anyOf){let n=_9p({schema:i,context:t});for(let[a,u]of Object.entries(n??{}))r[a]=u}return r}for(let[i,n]of Object.entries(e.properties??{})){let a=Zd(n)?t.resolveSchemaReference(n):n;a.type==="string"&&a.enum!=null&&Lxo(a.enum)&&O8D(a.enum).length===1&&a.enum[0]!=null&&(r[i]=a.enum[0]);let u=h9p(a,"const");a.type==="string"&&u!=null&&(r[i]=u),i==="type"&&a.example!=null&&(r[i]=a.example)}return r}function O8D(e){if(!e)return[];let t=new Set;return e.forEach(r=>{typeof r=="string"?t.add(r.toLowerCase()):t.add(r)}),Array.from(t)}function h9p(e,t){let r=e[t];if(r!=null)return r}function m8D({schema:e,logger:t}){let r=$5p({schema:e,logger:t});if(r!=null)return k5p(r)}var TSn=class{document;taskContext;logger;DUMMY;options;namespace;static MESSAGE_REFERENCE_PREFIX="#/components/messages/";constructor({document:t,taskContext:r,options:i,namespace:n}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=i,this.namespace=n}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveTags(t,r){if(this.namespace==null&&t==null&&r!=null)return[r];let i=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};i.push(n)}return i.concat(t??[])}resolveSchemaReference(t){if(!t.$ref.startsWith(KRi))throw new Error(`Failed to resolve schema reference: ${t.$ref}`);let i=t.$ref.substring(KRi.length).split("/"),n=this.document.components;if(n==null||n.schemas==null)throw new Error("Document does not have components.schemas.");let[a,u,l]=i;if(a==null||a==="")throw new Error(`${t.$ref} cannot be resolved. No schema key provided.`);let d=n.schemas[a];if(d==null)throw new Error(`Schema "${a}" is undefined in document.components.schemas.`);if(Zd(d)&&(d=this.resolveSchemaReference(d)),u==="properties"&&l!=null){let s=d.properties?.[l];if(s==null)throw new Error(`Property "${l}" not found on "${a}". Full ref: ${t.$ref}`);Zd(s)?d=this.resolveSchemaReference(s):d=s}return d}referenceExists(t){let r=t.substring(2).split("/").map(n=>n.replace(/~1/g,"/")),i=this.document;for(let n of r){if(typeof i!="object"||i==null)return!1;i=i[n]}return!0}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,i){}markSchemaWithDiscriminantValue(t,r,i){}};var Uxo=class extends TSn{getExampleMessageReference(t){return`#/components/messages/${t.messageId}`}resolveMessageReference(t){let r="#/components/messages/",i=this.document.components;if(i==null||i.messages==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve message reference: ${t.$ref} in v2 components`);let n=t.$ref.substring(r.length),a=i.messages[n];if(a==null)throw new Error(`${t.$ref} is undefined`);return a}};function CSn(e,t){let r={},i={};return e==null?r=t:i={[e]:t},{rootSchemas:r,namespacedSchemas:i}}function Hdi(e){if(typeof e=="string")return rg.primitive(u_.string(e));if(typeof e=="number")return Number.isInteger(e)?rg.primitive(u_.int(e)):rg.primitive(u_.double(e));if(typeof e=="boolean")return rg.primitive(u_.boolean(e));if(Array.isArray(e)){let t=e.map(r=>Hdi(r));return t.length===0?void 0:rg.array(t.filter(r=>r!=null))}else if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string")){let t=[];for(let[r,i]of Object.entries(e)){let n=Hdi(i);n!=null&&t.push({key:u_.string(r),value:n})}return rg.map(t)}}function uha(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function y9p(e){if(e!=null&&Array.isArray(e))return e}var $di=class{schemas;nonRequestReferencedSchemas;context;constructor(t,r,i){this.schemas=t,this.nonRequestReferencedSchemas=r,this.context=i}buildExample({schema:t,exampleId:r,example:i,options:n,skipReadonly:a}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:i,options:{...n,maxCheckerDepth:n.maxCheckerDepth??5},depth:0,skipReadonly:a??!1})}buildExampleHelper({exampleId:t,example:r,schema:i,depth:n,visitedSchemaIds:a,options:u,skipReadonly:l}){switch(i.type){case"enum":return typeof r=="string"&&v9p({schema:i,value:r})?rg.enum(r):i.values[0]!=null?rg.enum(i.values[0]?.value):void 0;case"literal":return rg.literal(i.value);case"nullable":{if(r==null&&!this.hasExample(i.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(n,u)))return;let d=this.buildExampleHelper({schema:i.value,visitedSchemaIds:a,exampleId:t,example:r,depth:n,options:u,skipReadonly:l});return d!=null&&d.type==="array"&&d.value.length===0||d!=null&&d.type==="map"&&d.value.length===0||d!=null&&d.type==="object"&&Object.keys(d.properties).length===0?void 0:d}case"optional":{if(r==null&&!this.hasExample(i.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(n,u))||Object.is(r,null))return;let d=this.buildExampleHelper({schema:i.value,visitedSchemaIds:a,exampleId:t,example:r,depth:n,options:u,skipReadonly:l});return d!=null&&d.type==="array"&&d.value.length===0||d!=null&&d.type==="map"&&d.value.length===0||d!=null&&d.type==="object"&&Object.keys(d.properties).length===0?void 0:d}case"primitive":{let d=this.buildExampleFromPrimitive({schema:i.schema,example:r,options:u});return rg.primitive(d)}case"reference":{let d=this.schemas[i.schema];if(d!=null&&!a.has(i.schema)){a.add(i.schema);let s=d?.type==="object"&&!this.nonRequestReferencedSchemas.has(i.schema),o=this.buildExampleHelper({example:r,schema:d,exampleId:t,visitedSchemaIds:a,depth:n,options:u,skipReadonly:s||this.context.options.respectReadonlySchemas?l:!1});return a.delete(i.schema),o}return}case"oneOf":switch(i.value.type){case"discriminated":{let d={},s={},o={},c=uha(r),b=c?.[i.value.discriminantProperty],g=i.value.schemas[b],O=[],m=this.getDiscriminatedUnionVariantSchema(i.value,c);m!=null&&O.push(m),O.push(...Object.entries(i.value.schemas));for(let w of O)if(b!=null&&g!=null&&g.type==="object"){s=this.getAllProperties(g),o=this.getAllRequiredProperties(g),d[i.value.discriminantProperty]=rg.primitive(u_.string(b));break}else{let E=this.buildExampleHelper({exampleId:t,schema:w[1],example:void 0,visitedSchemaIds:a,depth:n,options:u,skipReadonly:l});if(E!=null){this.mergeExampleWith(E,d),d[i.value.discriminantProperty]=rg.primitive(u_.string(w[0]));break}}for(let w of i.value.commonProperties){s[w.key]={schema:w.schema,readonly:!1};let E=this.getResolvedSchema(w.schema);E.type!=="optional"&&E.type!=="nullable"&&(o[w.key]=w.schema)}for(let[w,E]of Object.entries(s)){let A=w in o;if(A&&c?.[w]!=null){let q=this.buildExampleHelper({schema:E.schema,exampleId:t,example:c[w],visitedSchemaIds:a,depth:n+1,options:u,skipReadonly:l});if(q!=null)d[w]=q;else return}else{let q=this.buildExampleHelper({exampleId:t,schema:E.schema,example:c?.[w],visitedSchemaIds:a,depth:n+1,options:u,skipReadonly:l});if(q!=null)d[w]=q;else if(A)return}}return rg.oneOf(odi.discriminated(d))}case"undiscriminated":{let d=this.getUnDiscriminatedUnionVariantSchema(i.value,r);if(d!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:d,visitedSchemaIds:a,depth:n,options:u,skipReadonly:l});break}}return;case"unknown":if(r!=null){let d=Hdi(r);if(d!=null)return rg.unknown(d)}return u.ignoreOptionals||this.exceedsMaxDepth(n,u)?void 0:u.isParameter?rg.primitive(u_.string(u.name??"string")):rg.map([{key:u_.string("key"),value:rg.primitive(u_.string("value"))}]);case"array":{let d=y9p(r),s=[];if(d!=null&&d.length>0)for(let o of d){let c=this.buildExampleHelper({exampleId:t,example:o,schema:i.value,depth:n+1,visitedSchemaIds:a,options:u,skipReadonly:l});c!=null&&s.push(c)}else if(i.example!=null&&i.example.length>0)for(let o of i.example){let c=this.buildExampleHelper({exampleId:t,example:o,schema:i.value,depth:n+1,visitedSchemaIds:a,options:u,skipReadonly:l});c!=null&&s.push(c)}else{let o=this.buildExampleHelper({exampleId:t,example:void 0,schema:i.value,depth:n+1,visitedSchemaIds:a,options:u,skipReadonly:l});o!=null&&s.push(o)}return rg.array(s)}case"map":{let d=uha(r??i.example);if(d!=null&&Object.entries(d).length>0){let c=[];for(let[b,g]of Object.entries(d)){let O=this.buildExampleFromPrimitive({schema:i.key.schema,example:b,options:u}),m=this.buildExampleHelper({exampleId:t,example:g,schema:i.value,visitedSchemaIds:a,depth:n+1,options:u,skipReadonly:l});m!=null&&c.push({key:O,value:m})}return rg.map(c)}if(i.key.schema.type==="string"&&i.value.type==="unknown")return rg.map([{key:u_.string("key"),value:rg.unknown(rg.primitive(u_.string("value")))}]);let s=this.buildExampleFromPrimitive({schema:i.key.schema,example:void 0,options:{...u,name:"key"}}),o=this.buildExampleHelper({exampleId:t,example:void 0,schema:i.value,visitedSchemaIds:a,depth:n+1,options:{...u,name:"value"},skipReadonly:l});return o!=null?rg.map([{key:s,value:o}]):rg.map([])}case"object":{let d={},s=i.fullExamples?.find(g=>g.name===t)??i.fullExamples?.find(g=>g.name==null)??i.fullExamples?.[0],o=uha(r)??(s!=null?uha(s.value):{})??{},c=this.getAllProperties(i),b=this.getAllRequiredProperties(i);for(let[g,O]of Object.entries(c)){if(l&&O.readonly)continue;let m=g in b,w=Object.keys(o).includes(g),E=this.buildExampleHelper({schema:O.schema,exampleId:t,example:o[g],visitedSchemaIds:a,depth:n+1,options:{...u,name:g},skipReadonly:l});if(m&&E!=null)d[g]=E;else{if(m)return;(w&&E!=null||!u.ignoreOptionals&&E!=null)&&(d[g]=E)}}if(i.additionalProperties){for(let[g,O]of Object.entries(o))if(!(g in d)){let m=this.buildExampleHelper({schema:El.unknown({example:O,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,groupName:void 0}),exampleId:t,example:O,visitedSchemaIds:a,depth:n+1,options:{...u,name:g},skipReadonly:l});m!=null&&(d[g]=m)}}return rg.object({properties:d})}default:Fo(i)}}mergeExampleWith(t,r){t._visit({array:Jo,enum:Jo,literal:Jo,map:i=>{for(let n of i){let a=n.key;a.type==="string"&&(r[a.value]=n.value)}},object:i=>{for(let[n,a]of Object.entries(i.properties))r[n]=a},oneOf:i=>{if(i.type==="discriminated")for(let[n,a]of Object.entries(i.value))r[n]=a;else this.mergeExampleWith(i.value,r)},primitive:Jo,unknown:Jo,_other:Jo})}getObjectSchema(t){if(t.type==="object")return t;if(t.type==="reference"){let r=this.schemas[t.schema];if(r!=null)return this.getObjectSchema(r)}}getDiscriminatedUnionVariantSchema(t,r){let i=r?.[t.discriminantProperty];if(i==null||typeof i!="string")return Object.entries(t.schemas)[0];let n=t.schemas[i];return n==null?Object.entries(t.schemas)[0]:[i,n]}getUnDiscriminatedUnionVariantSchema(t,r){return r==null?t.schemas[0]:t.schemas.map(a=>({schema:a,heuristic:this.calcExampleHeuristic(a,r)})).sort((a,u)=>u.heuristic-a.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return v9p({schema:t,value:r})?5:0;case"object":{if(!kj(r))return 0;let i=this.getAllProperties(t),n=0;for(let[a,u]of Object.entries(i))r[a]!=null?(n++,n+=this.calcExampleHeuristic(u.schema,r[a])):n--;return n}case"array":{if(!Array.isArray(r))return 0;let i=0;for(let n of r)i+=this.calcExampleHeuristic(t.value,n);return i}case"map":{if(!kj(r))return 0;let i=0;for(let[,n]of Object.entries(r))i+=this.calcExampleHeuristic(t.value,n);return i}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let i=this.getResolvedSchema(t);return i==null?0:this.calcExampleHeuristic(i,r)}case"oneOf":return Object.values(t.value.schemas).map(n=>this.calcExampleHeuristic(n,r)).sort((n,a)=>a-n)[0]??0;case"primitive":return r==null?0:t.schema._visit({int:()=>typeof r=="number",int64:()=>typeof r=="number",uint:()=>typeof r=="number",uint64:()=>typeof r=="number",float:()=>typeof r=="number",double:()=>typeof r=="number",string:()=>typeof r=="string",datetime:()=>typeof r=="string",date:()=>typeof r=="string",base64:()=>typeof r=="string",boolean:()=>typeof r=="boolean",_other:()=>!0})?1:-1;default:return 0}}hasExample(t,r,i=new Set,n){if(this.exceedsMaxCheckerDepth(r,n))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,i,n);case"enum":return t.example!=null;case"literal":return!1;case"map":return t.example!=null||t.key.schema.example!=null&&this.hasExample(t.value,r+1,i,n);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let u of t.properties)if(this.hasExample(u.schema,r+1,i,n))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let a=this.schemas[t.schema];if(a!=null&&!i.has(t.schema)){i.add(t.schema);let u=this.hasExample(a,r,i,n);return i.delete(t.schema),u}return!1}case"unknown":return t.example!=null;case"oneOf":return Object.values(t.value.schemas).some(a=>this.hasExample(a,r,i,n));default:return!1}}exceedsMaxCheckerDepth(t,r){return t>(r.maxCheckerDepth??0)}exceedsMaxDepth(t,r){return t>(r.maxDepth??0)}getAllProperties(t){let r={};for(let i of t.properties)r[i.key]={schema:i.schema,readonly:i.readonly??!1};for(let i of t.allOf){let n=this.schemas[i.schema];if(n==null)continue;let a=this.getResolvedSchema(n);a.type==="object"&&(r={...this.getAllProperties(a),...r})}return r}getAllRequiredProperties(t){let r={};for(let i of t.properties){let n=this.getResolvedSchema(i.schema);n.type!=="optional"&&n.type!=="nullable"&&(r[i.key]=i.schema)}for(let i of t.allOf){let n=this.schemas[i.schema];if(n==null)continue;let a=this.getResolvedSchema(n);a.type==="object"&&(r={...this.getAllRequiredProperties(a),...r})}return r}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}buildExampleFromPrimitive({example:t,schema:r,options:i}){switch(r.type){case"string":return t!=null&&typeof t=="string"?u_.string(t):r.example!=null?u_.string(r.example):u_.string(i.name??Sg.STRING);case"base64":return t!=null&&typeof t=="string"?u_.base64(t):r.example!=null?u_.base64(r.example):u_.base64(Sg.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?u_.boolean(t):r.example!=null?u_.boolean(r.example):u_.boolean(Sg.BOOLEAN);case"date":return t!=null&&typeof t=="string"?u_.date(t):r.example!=null?u_.date(r.example):u_.date(Sg.DATE);case"datetime":return t!=null&&typeof t=="string"?u_.datetime(t):r.example!=null?u_.datetime(r.example):u_.datetime(Sg.DATE_TIME);case"double":return t!=null&&typeof t=="number"?u_.double(t):r.example!=null?u_.double(r.example):u_.double(Sg.DOUBLE);case"float":return t!=null&&typeof t=="number"?u_.float(t):r.example!=null?u_.float(r.example):u_.float(Sg.FLOAT);case"int":return t!=null&&typeof t=="number"?u_.int(t):r.example!=null?u_.int(r.example):u_.int(Sg.INT);case"int64":return t!=null&&typeof t=="number"?u_.int64(t):r.example!=null?u_.int64(r.example):u_.int64(Sg.INT64);case"uint":return t!=null&&typeof t=="number"?u_.uint(t):r.example!=null?u_.uint(r.example):u_.uint(Sg.UINT);case"uint64":return t!=null&&typeof t=="number"?u_.uint64(t):r.example!=null?u_.uint64(r.example):u_.uint64(Sg.UINT64);default:Fo(r)}}};function v9p({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function gXt(e){switch(e.type){case"object":return El.object({allOf:e.allOf,properties:e.properties.map(t=>j8D(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,fullExamples:void 0,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:void 0});case"array":return El.array({description:e.description,availability:e.availability,value:gXt(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName,example:void 0,inline:void 0});case"enum":return El.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,values:e.values,default:e.default,groupName:e.groupName,example:void 0,source:e.source,inline:void 0});case"literal":return El.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,groupName:e.groupName});case"nullable":return El.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gXt(e.value),groupName:e.groupName,inline:void 0});case"optional":return El.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gXt(e.value),groupName:e.groupName,inline:void 0});case"primitive":return El.primitive({description:e.description,availability:e.availability,schema:b9p(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName});case"map":return El.map({description:e.description,availability:e.availability,key:El.primitive({description:e.key.description,availability:e.key.availability,schema:b9p(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,groupName:e.groupName}),value:gXt(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,groupName:e.groupName,encoding:e.encoding,example:void 0,inline:void 0});case"reference":return El.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schema:e.schema,groupName:e.groupName,source:e.source});case"oneOf":return El.oneOf(P8D(e.value));case"unknown":return El.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:void 0,example:void 0,groupName:void 0,description:void 0,availability:void 0});default:Fo(e)}}function P8D(e){switch(e.type){case"discriminated":return QY.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:gXt(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,gXt(r)])),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return QY.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>gXt(t)),groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:Fo(e)}}function b9p(e){switch(e.type){case"string":return Xd.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return Xd.base64({example:void 0});case"boolean":return Xd.boolean({default:e.default,example:void 0});case"date":return Xd.date({example:void 0});case"datetime":return Xd.datetime({example:void 0});case"double":return Xd.double({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"float":return Xd.float({example:void 0});case"int":return Xd.int({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"int64":return Xd.int64({default:e.default,example:void 0});case"uint":return Xd.uint({default:void 0,example:void 0});case"uint64":return Xd.uint64({default:void 0,example:void 0});default:Fo(e)}}function j8D(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:gXt(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function Vxo(e){return e.type!=="optional"&&e.type!=="nullable"}function FWs(e){return e==="POST"||e==="PUT"||e==="PATCH"}function sha(e){if(e.type==="full")return e.request==null&&e.response==null&&e.queryParameters==null&&e.pathParameters==null&&e.headers==null;{let t=e.value;return t.request==null&&t.response==null&&t["query-parameters"]==null&&t["path-parameters"]==null&&t.headers==null}}var Wxo=class{schemas;context;exampleTypeFactory;logger;constructor(t,r){this.schemas=t,this.context=r,this.schemas=t,this.exampleTypeFactory=new $di(t,r.nonRequestReferencedSchemas,r),this.logger=r.logger}buildEndpointExample(t){this.logger.debug(`Building endpoint example for ${t.method.toUpperCase()} ${t.path}`);let r=S8D(t.request),i=D8D(t.response);if(r?.type==="unsupported"||i?.type==="unsupported")return[];let n=[];if(r!=null&&r.type==="present"){let c=this.isSchemaRequired(r.schema);if(r.examples.length===0){let b=this.exampleTypeFactory.buildExample({skipReadonly:FWs(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});b!=null&&n.push([void 0,b])}else for(let{name:b,value:g}of r.examples){let O=this.exampleTypeFactory.buildExample({skipReadonly:FWs(t.method),schema:r.schema,exampleId:b,example:g,options:{isParameter:!1,ignoreOptionals:!0}});O!=null&&n.push([b,O])}if(c&&n.length===0)return this.logger.trace(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let a=[];if(i!=null&&i.type==="present"){let c=this.isSchemaRequired(i.schema);if(t.response?.type==="json"&&t.response.statusCode===204)a.push([void 0,yze.withoutStreaming(rg.object({properties:{}}))]);else if(i.examples.length===0){let b=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:i.schema,exampleId:void 0,example:void 0,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});b!=null&&(t.response?.type==="json"?a.push([void 0,yze.withoutStreaming(b)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,yze.withStreaming({sse:t.response?.type==="streamingSse",events:[b]})]))}else for(let{name:b,value:g}of i.examples){let O=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:i.schema,exampleId:b,example:g,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});O!=null&&(t.response?.type==="json"?a.push([b,yze.withoutStreaming(O)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,yze.withStreaming({sse:t.response?.type==="streamingSse",events:[O]})]))}if(c&&a.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let u=[];for(let c of t.pathParameters){let b=this.isSchemaRequired(c.schema),g=this.exampleTypeFactory.buildExample({schema:c.schema,exampleId:void 0,example:void 0,options:{name:c.name,isParameter:!0,ignoreOptionals:!0}});if(g!=null&&!OXt(g)&&(this.logger.warn(`Expected a primitive example but got ${g.type} for path parameter ${c.name} for ${t.method.toUpperCase()} ${t.path}`),g=void 0),b&&g==null)return[];g!=null&&u.push({name:c.name,parameterNameOverride:c.parameterNameOverride,value:g})}let l=[];for(let c of t.queryParameters){let b=this.isSchemaRequired(c.schema),g=this.exampleTypeFactory.buildExample({schema:c.schema,exampleId:void 0,example:void 0,options:{name:c.name,isParameter:!0,ignoreOptionals:!0}});if(g!=null&&!OXt(g)&&(this.logger.warn(`Expected a primitive example but got ${g.type} for query parameter ${c.name} for ${t.method.toUpperCase()} ${t.path}`),g=void 0),b&&g==null)return[];g!=null&&l.push({name:c.name,value:g})}let d=[];for(let c of t.headers){let b=this.isSchemaRequired(c.schema),g=this.exampleTypeFactory.buildExample({schema:c.schema,exampleId:void 0,example:void 0,options:{name:c.name,isParameter:!0,ignoreOptionals:!0}});if(g!=null&&!OXt(g)&&(this.logger.warn(`Expected a primitive example but got ${g.type} for header ${c.name} for ${t.method.toUpperCase()} ${t.path}`),g=void 0),b&&g==null)return[];g!=null&&d.push({name:c.name,value:g})}let s=[];t.request!=null&&t.response!=null?s=w8D(n,a):t.request!=null?s=n.map(([c,b])=>({id:c,request:b,response:void 0})):t.response!=null&&(s=a.map(([c,b])=>({id:c,request:void 0,response:b})));let o=t.examples.filter(c=>sha(c)).flatMap(c=>{if(c.type==="unknown"){if(c.value!=null){let b=c.value["code-samples"];if(b!=null)return this.convertCodeSamples(b)}return}else return c.codeSamples}).filter(c=>Qb(c));return s.length===0?[E5t.full({name:void 0,description:void 0,pathParameters:u,queryParameters:l,headers:d,request:void 0,response:void 0,codeSamples:o})]:s.map(({id:c,request:b,response:g})=>E5t.full({name:c,description:void 0,pathParameters:u,queryParameters:l,headers:d,request:b,response:g,codeSamples:o}))}convertCodeSamples(t){return t.map(r=>"language"in r?kJr.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):kJr.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?_V.Csharp:r.sdk,code:r.code})).filter(Qb)}isSchemaRequired(t){return Vxo(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function w8D(e,t){let r=[];if(e.length<=1){let[n,a]=e[0]??[];if(t.length===0)return r.push({id:n,request:a,response:void 0}),r;for(let[u,l]of t)r.push({id:u??n,request:a,response:l});return r}if(t.length<=1){let[n,a]=t[0]??[];if(t.length===0)return r.push({id:n,request:void 0,response:a}),r;for(let[u,l]of e)r.push({id:u??n,request:l,response:a});return r}let i=new Set;for(let[n,a]of e){let u=t.find(([d])=>d==null)?.[1]??t[0]?.[1];if(n==null){if(u==null)continue;r.push({id:void 0,request:a,response:u});continue}let l=!1;for(let d=0;d<t.length;d++){let[s,o]=t[d];s==null||i.has(d)||n===s&&(r.push({id:n,request:a,response:o}),s!=null&&i.add(d),l=!0)}!l&&u!=null&&r.push({id:n,request:a,response:u})}for(let n=0;n<t.length;n++){if(i.has(n))continue;let[a,u]=t[n],l=e.find(([d])=>d==null)?.[1]??e[0]?.[1];l!=null&&r.push({id:a,request:l,response:u})}return r}function S8D(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:E8D(e),examples:[]}:e.type==="json"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function D8D(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 OXt(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return OXt(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undiscriminated":return OXt(e.value.value);default:return!1}default:Fo(e)}}function E8D(e){return El.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:gXt(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0,readonly:void 0,writeonly:void 0,inline:void 0}).filter(Qb),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,source:e.source,inline:void 0})}var BSn=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new $di(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,publish:i,subscribe:n,handshake:a,source:u,namespace:l}){let d=[];for(let s of r){let o=[];for(let g of a.queryParameters){let O=this.isSchemaRequired(g.schema),m=this.exampleTypeFactory.buildExample({schema:g.schema,exampleId:void 0,example:s.queryParameters?.[g.name],options:{name:g.name,isParameter:!0,ignoreOptionals:!0}});m!=null&&!OXt(m)&&(m=void 0),!(O&&m==null)&&m!=null&&o.push({name:g.name,value:m})}let c=[];for(let g of a.headers){let O=this.isSchemaRequired(g.schema),m=this.exampleTypeFactory.buildExample({schema:g.schema,exampleId:void 0,example:s.headers?.[g.name],options:{name:g.name,isParameter:!0,ignoreOptionals:!0}});m!=null&&!OXt(m)&&(m=void 0),!(O&&m==null)&&m!=null&&c.push({name:g.name,value:m})}let b=[];for(let g of s.messages){let O=t.getExampleMessageReference(g),m=t.resolveMessageReference({$ref:O}),w=Zd(m.payload)?t.resolveSchemaReference(m.payload):m.payload,E=this.exampleTypeFactory.buildExample({schema:qb(w,!1,t,[g.messageId],u,l),exampleId:void 0,example:g.value,options:{isParameter:!1,ignoreOptionals:!0}});E!=null&&b.push({messageType:g.type,payload:E,description:void 0})}d.push({name:s.summary,queryParameters:o,headers:c,description:s.description,messages:b})}return d}buildWebsocketSessionExample({publish:t,subscribe:r,handshake:i}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},a=[];for(let l of i.queryParameters){let d=this.isSchemaRequired(l.schema),s=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(s!=null&&!OXt(s)&&(s=void 0),d&&s==null)return;s!=null&&a.push({name:l.name,value:s})}let u=[];for(let l of i.headers){let d=this.isSchemaRequired(l.schema),s=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(s!=null&&!OXt(s)&&(s=void 0),d&&s==null)return;s!=null&&u.push({name:l.name,value:s})}if(t!=null){let l=this.exampleTypeFactory.buildExample({schema:t,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});l!=null&&n.messages.push({messageType:"publish",payload:l,description:void 0})}if(r!=null){let l=this.exampleTypeFactory.buildExample({schema:r,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});l!=null&&n.messages.push({messageType:"subscribe",payload:l,description:void 0})}return n}isSchemaRequired(t){return Vxo(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 mG={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_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path",FERN_ENUM:"x-fern-enum",IGNORE:"x-fern-ignore"};function Hxo(e){return yf(e,mG.FERN_EXAMPLES)??[]}function $xo(e,t){return t.includes("://")?t:`${e}://${t}`}function Gxo(e){return e.startsWith("/")?e:"/"+e}function m9p({context:e,breadcrumbs:t,source:r,asyncApiOptions:i,document:n}){let a={},u={};for(let[s,o]of Object.entries(n.components?.schemas??{})){let c=qb(o,!1,e,[s],r,e.namespace);a[s]=c}let l=new BSn(a,e),d={};for(let[s,o]of Object.entries(n.servers??{}))d[s]={name:s,url:$xo(o.protocol,o.url)};for(let[s,o]of Object.entries(n.channels??{})){let c=yf(o,mG.IGNORE);if(c!=null&&c){e.logger.debug(`Channel ${s} is marked with x-fern-ignore. Skipping.`);continue}let b=[];if(o.parameters!=null)for(let[E,A]of Object.entries(o.parameters??{}))b.push({name:E,description:A.description,parameterNameOverride:void 0,schema:A.schema!=null?qb(A.schema,!1,e,t,r,e.namespace):El.primitive({schema:Xd.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,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:Bie(A),source:r});let g=[],O=[];if(o.bindings?.ws!=null){if(o.bindings.ws.headers!=null){let E=o.bindings.ws.headers.required??[];for(let[A,q]of Object.entries(o.bindings.ws.headers.properties??{})){let D=Zd(q)?e.resolveSchemaReference(q):q;g.push({name:A,schema:qb(D,!E.includes(A),e,[...t,A],r,e.namespace),description:D.description,parameterNameOverride:void 0,env:void 0,availability:Bie(D),source:r})}}if(o.bindings.ws.query!=null){let E=o.bindings.ws.query.required??[];for(let[A,q]of Object.entries(o.bindings.ws.query.properties??{})){let D=Zd(q)?e.resolveSchemaReference(q):q;O.push({name:A,schema:qb(D,!E.includes(A),e,[...t,A],r,e.namespace),description:D.description,parameterNameOverride:void 0,availability:Bie(D),source:r})}}}let m;o.publish!=null&&("oneOf"in o.publish.message?m=g9p({generatedName:o.publish.operationId??"PublishEvent",event:o.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:i}):m=O9p({action:"Publish",channelPath:s,message:o.publish.message,context:e,source:r}));let w;if(o.subscribe!=null&&("oneOf"in o.subscribe.message?w=g9p({generatedName:o.subscribe.operationId??"SubscribeEvent",event:o.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:i}):w=O9p({action:"Subscribe",channelPath:s,message:o.subscribe.message,context:e,source:r})),g.length>0||O.length>0||m!=null||w!=null){let E=Hxo(o),A=[];if(E.length>0)A=l.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:E,handshake:{headers:g,queryParameters:O},publish:m,subscribe:w,source:r,namespace:e.namespace});else{let C=l.buildWebsocketSessionExample({handshake:{headers:g,queryParameters:O},publish:m,subscribe:w});C!=null&&A.push(C)}let q=yf(o,mG.FERN_CHANNEL_ADDRESS),D=q??Gxo(s);u[s]={audiences:yf(o,fd.AUDIENCES)??[],handshake:{headers:g.map(C=>({...C,schema:cE(C.schema),env:C.env})),queryParameters:O.map(C=>({...C,schema:cE(C.schema)})),pathParameters:b.map(C=>({...C,parameterNameOverride:void 0,schema:cE(C.schema)}))},groupName:[yf(o,mG.FERN_SDK_GROUP_NAME)??s],publish:m!=null?cE(m):m,subscribe:w!=null?cE(w):w,servers:(o.servers?.map(C=>d[C])??Object.values(d)).filter(C=>C!=null),summary:yf(o,mG.FERN_DISPLAY_NAME),path:D,description:o.description,examples:A,source:r}}}return{groupedSchemas:CSn(e.namespace,a),channels:u??void 0,servers:Object.values(d),basePath:yf(n,mG.BASE_PATH)}}function g9p({generatedName:e,event:t,context:r,breadcrumbs:i,source:n,options:a,asyncApiOptions:u}){if("oneOf"in t.message&&t.message.oneOf!=null){let l=[],d=[];for(let s of t.message.oneOf){let o,c={type:"notFound"};if(Zd(s)){let b=r.resolveMessageReference(s);!Zd(b.payload)&&u.naming==="v2"?(c=b.name?{type:"name",name:b.name}:c,o={...b.payload,title:b.name??b.payload.title,description:b.name??b.payload.description}):o=b.payload}else o=s;d.push(c),l.push(o)}return MSn({description:t.description??t.message.description,availability:Bie(t.message),subtypes:l,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsNullable:!1,breadcrumbs:i,context:r,encoding:void 0,source:n,namespace:r.namespace,subtypePrefixOverrides:u.naming==="v2"?d:[]})}}function O9p({action:e,channelPath:t,message:r,context:i,source:n}){if(r.payload!=null){let a=r.payload;return Zd(r.payload)&&(a=i.resolveSchemaReference(r.payload)),Zd(a)?qb(a,!1,i,[t,e],n,i.namespace):qb(a,!1,i,[t,e],n,i.namespace)}}var Qxo=class extends TSn{getExampleMessageReference(t){return`#/channels/${t.channelId}/messages/${t.messageId}`}resolveMessageReference(t){let r="#/channels/",i="#/components/messages/";if(t.$ref.startsWith(r)){let l=t.$ref.split("/"),d=l[2],s=l[4];if(d==null||s==null||!this.document.channels?.[d])throw new Error(`Failed to resolve message reference ${t.$ref} in channel ${d}`);let c=this.document.channels[d].messages?.[s];if(c==null)throw new Error(`${t.$ref} is undefined`);return{name:s,...c}}let n=this.document.components;if(!t.$ref.startsWith(i)||!n?.messages)throw new Error(`Failed to resolve message reference: ${t.$ref} in v3 components`);let a=t.$ref.substring(i.length),u=n.messages[a];if(u==null)throw new Error(`${t.$ref} is undefined`);return{name:a,...u}}};var P9p="#/channels/",j9p="#/servers/",LWs="$message.";function S9p({context:e,breadcrumbs:t,source:r,asyncApiOptions:i,document:n}){let a={},u={},l={},d=[],s={};for(let[m,w]of Object.entries(n.components?.schemas??{}))a[m]=qb(w,!1,e,[m],r,e.namespace);for(let[m,w]of Object.entries(n.channels??{}))if(u[m]||(u[m]={}),w.messages)for(let[E,A]of Object.entries(w.messages))A&&A.payload!=null&&(l[E]||(l[E]=[]),l[E].push({channelId:m,payload:A.payload}));for(let[m,w]of Object.entries(l))if(w.length===1){let E=w[0],A=E.channelId;u[A]=u[A]||{},u[A][m]=qb(E.payload,!1,e,[m],r,e.namespace)}else{d.push(m);for(let{channelId:E,payload:A}of w){let q=`${E}_${m}`;u[E]||(u[E]={}),u[E][q]=qb(A,!1,e,[q],r,e.namespace)}}let o=Object.values(u).reduce((m,w)=>({...m,...w}),{}),c=new BSn(o,e),b={};for(let[m,w]of Object.entries(n.servers??{}))b[m]={name:m,url:$xo(w.protocol,w.host)};let g={};for(let[m,w]of Object.entries(n.operations??{})){if(yf(w,mG.IGNORE))continue;let E=M8D(w);if(g[E]||(g[E]={subscribe:[],publish:[]}),w.action==="receive")g[E].subscribe.push(...w.messages);else if(w.action==="send")g[E].publish.push(...w.messages);else throw new Error(`Operation ${m} has an invalid action: ${w.action}`)}let O={};for(let[m,w]of Object.entries(g)){O[m]={subscribe:void 0,publish:void 0};let E=m.split("/").pop()??m,A=E.charAt(0).toUpperCase()+E.slice(1);w.subscribe.length>0&&u[m]!=null&&(O[m].subscribe=w9p({generatedName:A+"SubscribeEvent",channelPath:m,messages:w.subscribe,breadcrumbs:t,context:e,source:r,messageSchemas:u[m],duplicatedMessageIds:d})),w.publish.length>0&&u[m]!=null&&(O[m].publish=w9p({generatedName:A+"PublishEvent",channelPath:m,messages:w.publish,breadcrumbs:t,context:e,source:r,messageSchemas:u[m],duplicatedMessageIds:d}))}for(let[m,w]of Object.entries(n.channels??{})){if(yf(w,mG.IGNORE))continue;let E=[],A=[],q=[];if(w.parameters!=null)for(let[D,C]of Object.entries(w.parameters)){let{type:R,parameterKey:$}=A8D(C.location),I=yf(C,mG.FERN_PARAMETER_OPTIONAL),U=G3(Dg(m))+G3(Dg(D)),H=yf(C,mG.FERN_ENUM),k=C.enum!=null&&Array.isArray(C.enum)?T8D({parameterName:U,fernEnum:H,parameterDescription:C.description,enumValues:C.enum,defaultValue:C.default,context:e,source:r}):El.primitive({schema:Xd.string({default:C.default,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:C.examples?.[0]}),description:void 0,availability:void 0,generatedName:"",title:U,groupName:void 0,nameOverride:void 0});I&&(k=El.optional({value:k,description:void 0,availability:void 0,generatedName:"",title:U,groupName:void 0,nameOverride:void 0,inline:void 0}));let K={name:$,description:C.description,parameterNameOverride:void 0,schema:k,variableReference:void 0,availability:Bie(C),source:r};R==="header"?E.push({...K,env:void 0}):R==="path"?A.push(K):R==="payload"&&q.push(K)}if(E.length>0||q.length>0||O[m]!=null&&(O[m].publish!=null||O[m].subscribe!=null)){let D=Hxo(w),C=[];if(D.length>0)C=c.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:D,handshake:{headers:E,queryParameters:q},publish:O[m]?.publish,subscribe:O[m]?.subscribe,source:r,namespace:e.namespace});else{let R=c.buildWebsocketSessionExample({handshake:{headers:E,queryParameters:q},publish:O[m]?.publish,subscribe:O[m]?.subscribe});R!=null&&C.push(R)}s[m]={audiences:yf(w,fd.AUDIENCES)??[],handshake:{headers:E.map(R=>({...R,schema:cE(R.schema),env:R.env})),queryParameters:q.map(R=>({...R,schema:cE(R.schema)})),pathParameters:A.map(R=>({...R,parameterNameOverride:void 0,schema:cE(R.schema)}))},groupName:[yf(w,mG.FERN_SDK_GROUP_NAME)??m],publish:O[m]?.publish!=null?cE(O[m].publish):void 0,subscribe:O[m]?.subscribe!=null?cE(O[m].subscribe):void 0,summary:yf(w,mG.FERN_DISPLAY_NAME),servers:w.servers?.map(R=>q8D(b,R))??Object.values(b),path:w.address??Gxo(m),description:w.description,examples:C,source:r}}}return{groupedSchemas:CSn(e.namespace,a),channels:s,servers:Object.values(b),basePath:yf(n,mG.BASE_PATH)}}function M8D(e){if(!e.channel.$ref.startsWith(P9p))throw new Error(`Failed to resolve channel path from operation ${e.channel.$ref}`);return e.channel.$ref.substring(P9p.length)}function A8D(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(LWs))throw new Error(`Invalid location format: ${e}; expected ${LWs} prefix`);let i=t.substring(LWs.length);if(i!=="header"&&i!=="path"&&i!=="payload")throw new Error(`Invalid message type: ${i}. Must be one of: header, path, payload`);return{type:i,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 q8D(e,t){if(!t.$ref.startsWith(j9p))throw new Error(`Failed to resolve server name from server ref ${t.$ref}`);let r=t.$ref.substring(j9p.length),i=e[r];if(i==null)throw new Error(`Failed to find server with name ${r}`);return i}function T8D({parameterName:e,fernEnum:t,parameterDescription:r,enumValues:i,defaultValue:n,context:a,source:u}){return bXt({nameOverride:void 0,generatedName:e,title:void 0,wrapAsNullable:!1,description:r??void 0,availability:void 0,fernEnum:t??{},enumVarNames:void 0,enumValues:i,_default:n,groupName:void 0,context:a,source:u,inline:void 0})}function w9p({generatedName:e,channelPath:t,messages:r,context:i,breadcrumbs:n,source:a,messageSchemas:u,duplicatedMessageIds:l}){if(r.length>0){let d=[];for(let s of r){let o=i.resolveMessageReference(s),c;l.some(g=>g===o.name)?c=`${t}_${o.name}`:c=o.name;let b=u[c];b!=null&&d.push(b)}return o9p({description:void 0,availability:void 0,subtypes:d,nameOverride:void 0,generatedName:e,title:void 0,groupName:void 0,wrapAsNullable:!1,breadcrumbs:n,context:i,encoding:void 0,source:a,namespace:i.namespace,subtypePrefixOverrides:[]})}}function D9p({document:e,taskContext:t,options:r,source:i,asyncApiOptions:n,namespace:a}){let u=[];if(a!=null&&u.push(a),parseFloat(e.asyncapi)<3){let l=e;l.tags?.[0]!=null?u.push(l.tags[0].name):n.naming!=="v2"&&u.push("websocket");let d=new Uxo({document:l,taskContext:t,options:r,namespace:a});return m9p({context:d,breadcrumbs:u,source:i,asyncApiOptions:n,document:l})}else{let l=e,d=new Qxo({document:l,taskContext:t,options:r,namespace:a});return S9p({context:d,breadcrumbs:u,source:i,asyncApiOptions:n,document:l})}}function E9p(e){let t=C8D(e),r={};return UWs({obj:t,occurrences:r,breadcrumbs:[]}),r}function UWs({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let i of e)UWs({obj:i,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let i=e.$ref;t[i]==null?t[i]=1:t[i]+=1;return}for(let i in e)UWs({obj:e[i],occurrences:t,breadcrumbs:[...r,i]})}}}function C8D(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?cha(r.get):void 0,put:r?.put!=null?cha(r.put):void 0,post:r?.post!=null?cha(r.post):void 0,patch:r?.patch!=null?cha(r.patch):void 0,delete:r?.delete!=null?cha(r.delete):void 0}]))}}function cha(e){return{...e,requestBody:e.requestBody!=null?Zd(e.requestBody)?e.requestBody:B8D(e.requestBody):void 0}}function B8D(e){let t,r;for(let i in e.content){let n=JB.parse(i);n!=null&&(n.isJSON()?t=e.content[i]:n.isMultipart()&&(r=e.content[i]))}return r!=null&&t!=null?{...e,content:{[JB.MULTIPART_FORM_DATA]:r}}:e}var Jxo=class{endpoints;parser=new MBi;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 i=[];for(let n of r){let a=this.parser.tryParse(n);if(a==null){t.logger.debug(`Ignoring configured filter endpoint "${n}"; expected format "POST /users/get"`);continue}i.push(`${a.method} ${a.path}`)}return i}};var M9p="#/components/parameters/",A9p="#/components/responses/",q9p="#/components/examples/",T9p="#/components/requestBodies/",xSn=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;constructor({document:t,taskContext:r,authHeaders:i,options:n,source:a,namespace:u}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=i,this.refOccurrences=E9p(t),this.options=n,this.source=a,this.filter=new Jxo({context:r,options:n}),this.DUMMY=this.getDummy(),this.namespace=u}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 i={type:"namespace",name:this.namespace};r.push(i)}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(n=>n.replace(/~1/g,"/")),i=this.document;for(let n of r){if(typeof i!="object"||i==null)return{"x-fern-type":"unknown"};i=i[n]}return i==null?(this.logger.warn(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(Zd(i)&&(i=this.resolveSchemaReference(i)),i)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(M9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(M9p.length),i=this.document.components.parameters[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveParameterReference(i):i}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(T9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(T9p.length),i=this.document.components.requestBodies[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveRequestBodyReference(i):i}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(A9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(A9p.length),i=this.document.components.responses[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveResponseReference(i):i}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(q9p))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(q9p.length),i=this.document.components.examples[r];if(i==null)throw new Error(`${t.$ref} is undefined`);return Zd(i)?this.resolveExampleReference(i):i}referenceExists(t){let r=t.substring(2).split("/").map(n=>n.replace(/~1/g,"/")),i=this.document;for(let n of r){if(typeof i!="object"||i==null)return!1;i=i[n]}return!0}};var ISn=class extends xSn{constructor({document:t,taskContext:r,options:i,source:n,namespace:a}){super({document:t,taskContext:r,authHeaders:new Set,options:i,source:n,namespace:a})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,i){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,i){}getDiscriminatedUnionMetadata(t){}};var Kxo=class extends xSn{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discriminatedUnionReferences={};discriminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:i,options:n,source:a,namespace:u}){super({document:t,taskContext:r,authHeaders:i,options:n,source:a,namespace:u})}getDummy(){return new ISn({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,i){let n=this.discriminatedUnionReferences[t.$ref];n!=null?(n.discriminants.add(r),n.numReferences+=i):this.discriminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:i}}getReferencesFromDiscriminatedUnion(t){return this.discriminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,i){let n=this.discriminatedUnionMetadata[t.$ref];n!=null?n.discriminants.set(r,i):this.discriminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,i]])}}getDiscriminatedUnionMetadata(t){return this.discriminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}};function C9p(e){return yf(e,fd.ASYNC_CONFIG)}var B9p="$request.";function x9p(e){let t=yf(e,fd.STREAMING);if(t!=null)return typeof t=="boolean"?t?{type:"stream",format:"json"}:void 0:t["stream-condition"]==null&&t.format!=null?{type:"stream",format:t.format}:{type:"streamCondition",format:t.format??"json",streamDescription:t["stream-description"],streamConditionProperty:x8D(t["stream-condition"]),responseStream:t["response-stream"],response:t.response}}function x8D(e){return e.startsWith(B9p)?e.slice(B9p.length):e}function I9p(e){let t=e;if(t.cursor!=null)return hze.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});if("offset"in e){let r=e;return hze.offset({offset:r.offset,results:r.results,step:r.step,hasNextPage:r["has-next-page"]})}if("type"in e&&e.type==="custom"){let r=e;return hze.custom({results:r.results})}throw new Error("Invalid pagination extension")}function z9p(e,t){let r=yf(t,fd.PAGINATION);if(r!=null){if(typeof r=="boolean"){let i=yf(e,fd.PAGINATION);if(typeof i=="boolean")throw new Error("Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.");return i==null?void 0:I9p(i)}return I9p(r)}}var I8D=Yu.object({lang:Yu.string(),label:Yu.optional(Yu.string()),source:Yu.string()}),VWs=Yu.array(I8D);var R9p={README_EXT:"x-readme"};function z8D(e){if(!Array.isArray(e))return!1;for(let t of e)if(!kj(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function N9p(e){let t=yf(e,R9p.README_EXT);if(!kj(t))return[];let r=t["code-samples"];if(!z8D(r))return[];let i=[];for(let n of r)i.push({name:n.name,language:n.language,code:n.code,install:n.install,docs:void 0});return i}function F9p(e,t,r){let n=(yf(t,fd.EXAMPLES)??[]).filter(s=>{let o=l2.serialization.ExampleEndpointCallSchema.parse(s);return o.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),o.ok}),a=aha(t,mV.REDOCLY_CODE_SAMPLES_KEBAB,VWs,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],l=[...aha(t,mV.REDOCLY_CODE_SAMPLES_CAMEL,VWs,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...a];l.length>0&&n.push({"code-samples":l.map(s=>({name:s.label??s.lang,language:s.lang,code:s.source,install:void 0,docs:void 0}))});let d=N9p(t);return d.length>0&&n.push({"code-samples":d}),n.map(E5t.unknown)}function L9p(e){let t=yf(e,fd.AVAILABILITY);if(t==="ga"||t==="generally-available")return pV.GenerallyAvailable;if(t==="beta"||t==="pre-release")return pV.Beta;if(t==="deprecated")return pV.Deprecated;if(e.deprecated)return pV.Deprecated}function Yxo(e){return{url:R8D({url:e.url,variables:e.variables??{}}),description:e.description,name:N8D(e),audiences:yf(e,fd.AUDIENCES)}}function R8D({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([i,n])=>[i,n.default]));for(let[i,n]of Object.entries(r))e=e.replace(`{${i}}`,n);return e}function N8D(e){let t=yf(e,[fd.SERVER_NAME_V1,fd.SERVER_NAME_V2]);if(t!=null)return t;if(e.description?.toLowerCase()==="production")return"Production";if(e.description?.toLowerCase()==="sandbox")return"Sandbox"}function U9p(e){return yf(e,fd.PARAMETER_NAME)}function V9p(e){return yf(e,fd.SDK_VARIABLE)}function Xxo({path:e,httpMethod:t,parameters:r,context:i,requestBreadcrumbs:n,source:a}){let u={pathParameters:[],queryParameters:[],headers:[]};for(let l of r){let d=yf(l,fd.IGNORE);if(d!=null&&d){i.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let s=Zd(l)?i.resolveParameterReference(l):l,o=s.required??!1,c=Bie(s),b=[...n,s.name],g=D2(b,i.options.preserveSchemaIds),O=s.schema!=null?qb(s.schema,!o,i,b,a,i.namespace,!1,new Set,_Kr({schema:s,logger:i.logger})):o?El.primitive({nameOverride:void 0,generatedName:g,title:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:_Kr({schema:s,logger:i.logger})}),description:void 0,availability:c,groupName:void 0}):El.optional({nameOverride:void 0,generatedName:g,title:void 0,value:El.primitive({nameOverride:void 0,generatedName:g,title:void 0,schema:Xd.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:_Kr({schema:s,logger:i.logger})}),description:void 0,availability:void 0,groupName:void 0}),description:void 0,availability:c,groupName:void 0,inline:void 0});if(s.in==="header"&&s.schema!=null&&!Zd(s.schema)&&s.schema.default!=null){let w=s.schema.default;typeof w=="string"&&w.length>0&&(O=El.literal({nameOverride:void 0,generatedName:g,title:void 0,value:cx.string(w),description:void 0,availability:c,groupName:void 0}))}let m={name:s.name,schema:O,description:s.description,parameterNameOverride:U9p(s),availability:c,source:a};s.in==="query"?u.queryParameters.push(m):s.in==="path"?u.pathParameters.push({...m,variableReference:V9p(s)}):s.in==="header"?!F8D.has(s.name.toLowerCase())&&!i.authHeaders.has(s.name)?u.headers.push({...m,env:void 0}):i.logger.debug(`Ignoring ${s.name} header, in ${t.toUpperCase()} ${e}`):i.logger.warn(`Skipping ${s.in} parameter, ${s.name}, in ${t.toUpperCase()} ${e}`)}return u}var F8D=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]);function W9p(e,t){for(let r of Object.keys(e))if(r.includes("text/event-stream")){let i=e[r];if(i==null)continue;let n=i.schema;return{contentType:r,schema:n??{},examples:lha(i,t)}}}function zSn(e,t){for(let r of Object.keys(e))if(r.includes("json")||r==="*/*"){let i=e[r];if(i==null)continue;let n=i.schema;return{contentType:r.includes("*")?void 0:r,schema:n??{},examples:lha(i,t)}}}function H9p(e,t){for(let r of Object.keys(e)){let i=e[r];if(i==null)continue;return{schema:i.schema??{},examples:lha(i,t)}}}function lha(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let i=yf(e,mV.EXAMPLES);return i!=null&&Object.keys(i).length>0&&r.push(...Object.entries(i).map(([n,a])=>({name:a.summary??n,value:a.value,description:a.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([n,a])=>{let u=Zd(a)?t.resolveExampleReference(a):a;return{name:u.summary??n,value:u.value,description:u.description}})),r}function L8D(e,t){for(let[r,i]of Object.entries(e.content))if(JB.parse(r)?.isURLEncoded())return{schema:i.schema,contentType:r,examples:lha(i,t)}}function U8D(e){for(let[t,r]of Object.entries(e.content))if(JB.parse(t)?.isMultipart())return{schema:r.schema,encoding:r.encoding}}function V8D(e){for(let t in e.content)if(JB.parse(t)?.isOctetStream())return!0;return!1}function W8D(e,t){let r=Zd(e)?WWs(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([i,n])=>!Zd(n)&&n.type==="string"&&n.format==="binary")!=null}function RSn({requestBody:e,document:t,context:r,requestBreadcrumbs:i,source:n,namespace:a}){let u=Zd(e)?r.resolveRequestBodyReference(e):e,l=U8D(u),d=l?.schema,s=l?.encoding,o=L8D(u,r),c=zSn(u.content,r);if(V8D(u))return VSe.octetStream({description:u.description,source:n});if(d!=null&&c==null||d!=null&&W8D(d,t)){let b=Zd(d)?WWs(d,t):{id:void 0,schema:d},g=qb(b.schema,!1,r,i,n,a),O=[];if(g.type==="object")for(let m of g.properties){if(m.schema.type==="primitive"&&m.schema.schema.type==="string"&&m.schema.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!1,isArray:!1,description:void 0}),description:m.schema.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}if(m.schema.type==="optional"&&m.schema.value.type==="primitive"&&m.schema.value.schema.type==="string"&&m.schema.value.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!0,isArray:!1,description:m.schema.value.description}),description:m.schema.value.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}if(m.schema.type==="array"&&m.schema.value.type==="primitive"&&m.schema.value.schema.type==="string"&&m.schema.value.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!1,isArray:!0,description:m.schema.value.description}),description:m.schema.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}if(m.schema.type==="optional"&&m.schema.value.type==="array"&&m.schema.value.value.type==="primitive"&&m.schema.value.value.schema.type==="string"&&m.schema.value.value.schema.format==="binary"){O.push({key:m.key,schema:vze.file({isOptional:!0,isArray:!0,description:m.schema.value.value.description}),description:m.schema.value.description,contentType:s?.[m.key]?.contentType,exploded:!1,encoding:void 0});continue}let w=s?.[m.key]?.contentType;O.push({key:m.key,schema:vze.json(m.schema),description:void 0,contentType:s?.[m.key]?.contentType,exploded:s?.[m.key]?.explode,encoding:w==null?r.options.defaultFormParameterEncoding:void 0})}return VSe.multipart({name:Zd(d)&&r.getNumberOfOccurrencesForRef(d)===1?b.id:void 0,description:b.schema.description,properties:O,source:n})}if(c!=null){let b=qb(c.schema,!1,r,i,n,a,!0);return VSe.json({description:void 0,schema:b,contentType:c.contentType,fullExamples:c.examples,additionalProperties:!Zd(c.schema)&&SSn(c.schema.additionalProperties),source:n})}if(o!=null&&o.schema!=null){let b=qb(o.schema,!1,r,i,n,a);return VSe.json({schema:b,description:u.description,contentType:o.contentType,source:n,fullExamples:o.examples,additionalProperties:!1})}}function WWs(e,t){if(!e.$ref.startsWith(KRi))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=Wdi(e);if(r==null)throw new Error(`Failed to resolve schema reference because missing schema id: ${e.$ref}`);let i=t.components?.schemas?.[r];if(i==null)throw new Error(`Failed to resolve schema reference because missing: ${e.$ref}`);return Zd(i)?WWs(i,t):{id:r,schema:i}}var HWs={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"},$9p=new Set(Object.values(HWs));var H8D=["200","201","202","204"];function Q9p({operationContext:e,responses:t,context:r,responseBreadcrumbs:i,responseStatusCode:n,streamFormat:a,source:u}){if(t==null)return{value:void 0,errors:{}};let l=$8D({responses:t,context:r,source:u,namespace:r.namespace}),d=!1,s;for(let o of n!=null?[n]:H8D){let c=t[o];c!=null&&(d=!0,s==null&&(s=G9p({operationContext:e,response:c,context:r,responseBreadcrumbs:i,streamFormat:a,source:u,namespace:r.namespace,statusCode:typeof o=="string"?parseInt(o):o})))}if(s==null&&!d&&t.default!=null&&(s=G9p({operationContext:e,response:t.default,context:r,responseBreadcrumbs:i,streamFormat:a,source:u,namespace:r.namespace})),s!=null)switch(s.type){case"json":return{value:s,errors:l};case"streamingJson":case"streamingSse":return{value:s,errors:l};case"file":case"text":case"streamingText":return{value:s,errors:l};default:Fo(s)}return{value:void 0,errors:l}}function G9p({operationContext:e,streamFormat:t,response:r,context:i,responseBreadcrumbs:n,source:a,namespace:u,statusCode:l}){let d=Zd(r)?i.resolveResponseReference(r):r;if(d.content!=null&&Object.entries(d.content).find(([b,g])=>{if(g.schema==null)return!1;let O=Zd(g.schema)?i.resolveSchemaReference(g.schema):g.schema;return O.type==="string"&&O.format==="binary"}))return lx.file({description:d.description,source:a,statusCode:l});let s=W9p(d.content??{},i);if(s!=null&&t!=null)switch(t){case"json":return lx.streamingJson({statusCode:l,description:d.description,responseProperty:yf(e.operation,fd.RESPONSE_PROPERTY),fullExamples:s.examples,schema:qb(s.schema,!1,i,n,a,u),source:a});case"sse":return lx.streamingSse({description:d.description,responseProperty:void 0,fullExamples:s.examples,schema:qb(s.schema,!1,i,n,a,u),source:a,statusCode:l})}let o=zSn(d.content??{},i);if(o!=null){if(t!=null)switch(t){case"json":return lx.streamingJson({description:d.description,responseProperty:void 0,fullExamples:o.examples,schema:qb(o.schema,!1,i,n,a,u),source:a,statusCode:l});case"sse":return lx.streamingSse({description:d.description,responseProperty:void 0,fullExamples:o.examples,schema:qb(o.schema,!1,i,n,a,u),source:a,statusCode:l})}return lx.json({description:d.description,schema:qb(o.schema,!1,i,n,a,u),responseProperty:yf(e.operation,fd.RESPONSE_PROPERTY),fullExamples:o.examples,source:a,statusCode:l})}for(let[c,b]of Object.entries(d.content??{})){let g=JB.parse(c);if(g!=null){if(g.isOctetStream()||g.isPDF()||g.isAudio()||g.isImage()||g.isVideo())return lx.file({description:d.description,source:a,statusCode:l});if(g.isPlainText()){let O=b.schema;if(O==null)return lx.text({description:d.description,source:a,statusCode:l});let m=Zd(O)?i.resolveSchemaReference(O):O;return m.type==="string"&&m.format==="byte"?lx.file({description:d.description,source:a,statusCode:l}):lx.text({description:d.description,source:a,statusCode:l})}}}}function $8D({responses:e,context:t,source:r,namespace:i}){let n={};for(let[a,u]of Object.entries(e)){if(a==="default")continue;let l=parseInt(a);if(l<400||l>600)continue;let d=Zd(u)?t.resolveResponseReference(u):u,s=H9p(d.content??{},t),o=HWs[l];if(o==null){t.logger.warn(`No error name found for status code ${a}`);continue}n[l]={statusCode:l,nameOverride:void 0,generatedName:o,description:d.description,schema:qb(s?.schema??{},!1,t,[o,"Body"],r,i),fullExamples:s?.examples,source:r}}return n}function hKr({operationContext:e,context:t,responseStatusCode:r,suffix:i,streamFormat:n,source:a}){let{document:u,operation:l,path:d,method:s,baseBreadcrumbs:o,sdkMethodName:c}=e,b=yf(l,fd.IDEMPOTENT),g=yf(l,[fd.REQUEST_NAME_V1,fd.REQUEST_NAME_V2]),O=[...o,"Request"],m=Xxo({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:O,path:d,httpMethod:s,source:a}),w=/{([^}]+)}/g,A=[...d.matchAll(w)].map(U=>U[1]).filter(U=>!m.pathParameters.some(H=>H.name===U));if(A.length>0)for(let U of A)m.pathParameters.push({name:U??"",variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:El.primitive({schema:Xd.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,groupName:void 0,availability:void 0,title:void 0}),description:void 0});let q=l.requestBody!=null?RSn({requestBody:l.requestBody,document:u,context:new ISn({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:O,source:a,namespace:t.namespace}):void 0;Q8D({context:t,convertedParameters:m})&&q!=null&&q.type==="json"&&q.schema.type!=="object"&&l.requestBody!=null?q=RSn({requestBody:l.requestBody,document:u,context:t,requestBreadcrumbs:[...O,"Body"],source:a,namespace:t.namespace}):l.requestBody!=null&&(q=RSn({requestBody:l.requestBody,document:u,context:t,requestBreadcrumbs:[...O],source:a,namespace:t.namespace}));let D=[...o,"Response"],C=Q9p({operationContext:e,streamFormat:n,responses:l.responses,context:t,responseBreadcrumbs:D,responseStatusCode:r,source:a});e.method==="GET"&&(q=void 0);let R=L9p(l),$=F9p(e,l,t),I=yf(l,fd.SERVER_NAME_V2);return{summary:l.summary,internal:yf(l,mV.INTERNAL),idempotent:b,audiences:yf(l,fd.AUDIENCES)??[],operationId:l.operationId!=null&&i!=null?l.operationId+"_"+i:l.operationId,tags:t.resolveTagsToTagIds(l.tags),namespace:t.namespace,sdkName:c,pathParameters:m.pathParameters,queryParameters:m.queryParameters,headers:m.headers,requestNameOverride:g??void 0,generatedRequestName:D2(O,t.options.preserveSchemaIds),request:q,response:C.value,errors:C.errors,servers:I!=null?[{name:I,url:void 0,audiences:void 0}]:(l.servers??[]).map(U=>Yxo(U)),description:l.description,authed:G8D(l,u),availability:R,method:s,path:d,examples:$,pagination:e.pagination,source:a}}function G8D(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function Q8D({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function K9p({operationContext:e,context:t,asyncExtension:r,source:i}){let{operation:n,pathItemParameters:a,operationParameters:u}=e,l=r.discriminant.name,d=r.discriminant.value,s=r["response-status-code"],o=J9p({context:t,headerToIgnore:l,parameters:a}),c=J9p({context:t,headerToIgnore:l,parameters:u}),b=hKr({operationContext:{...e,pathItemParameters:o,operationParameters:c,operation:{...n,responses:Object.fromEntries(Object.entries(n.responses).filter(([O])=>parseInt(O)!==s))}},context:t,streamFormat:void 0,source:i}),g=hKr({operationContext:{...e,pathItemParameters:o,operationParameters:c,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:s,streamFormat:void 0,source:i});return g.headers.push({name:l,schema:El.literal({nameOverride:void 0,generatedName:D2([l],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:cx.string(d),groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:i}),{sync:b,async:g}}function J9p({context:e,headerToIgnore:t,parameters:r}){return r.filter(i=>{let n=Zd(i)?e.resolveParameterReference(i):i;return!(n.in==="header"&&n.name===t)})}var $Ws="stream";function k9p({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:hKr({operationContext:e,context:t,streamFormat:r.format,source:t.source}),nonStreaming:void 0};case"streamCondition":{let i=Y9p({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0});if(i?.schemaReference!=null){let s=Wdi(i.schemaReference);s!=null&&t.excludeSchema(s)}let n=X9p({operation:e.operation,response:r.responseStream}),a=hKr({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+$Ws}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:i?.requestBody,responses:n},baseBreadcrumbs:[...e.baseBreadcrumbs,$Ws]},context:t,streamFormat:r.format,suffix:$Ws,source:t.source});a.examples=a.examples.filter(s=>Z9p(s,t)!==!1);let u=Y9p({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),l=X9p({operation:e.operation,response:r.response}),d=hKr({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:u?.requestBody,responses:l}},context:t,source:t.source});return d.examples=d.examples.filter(s=>Z9p(s,t)!==!0),{streaming:a,nonStreaming:d}}default:Fo(r)}}function Y9p({context:e,operation:t,streamingExtension:r,isStreaming:i}){if(t.requestBody==null)return;let n=Zd(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,a=zSn(n.content,e);if(a==null)return;let u=Zd(a.schema)?e.resolveSchemaReference(a.schema):a.schema;if(u.allOf==null&&u.properties==null)return;let l=u.properties?.[r.streamConditionProperty];l!=null&&Zd(l)&&(l=void 0);let d={...u,properties:{...u.properties,[r.streamConditionProperty]:{type:"boolean","x-fern-boolean-literal":i,...l??{}}},title:void 0,required:[...u.required??[],r.streamConditionProperty]};return{requestBody:{content:{[JB.APPLICATION_JSON]:{schema:d}}},schemaReference:Zd(a.schema)?a.schema:void 0}}function X9p({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[JB.APPLICATION_JSON]:{schema:t}}}}}function Z9p(e,t){return e._visit({unknown:r=>{let i=l2.serialization.ExampleEndpointCallSchema.parse(r);if(i.ok&&i.value.response!=null)return i.value.response.stream!=null},full:()=>{},_other:()=>{}})}function eLp({context:e,operationContext:t,source:r}){let{document:i,operation:n,path:a,method:u,baseBreadcrumbs:l,sdkMethodName:d}=t,s=[...l,"Payload"],o=Xxo({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:s,path:a,httpMethod:u,source:r});if(n.requestBody==null){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Missing a request body`);return}if(u!=="POST"&&u!=="GET"){e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Not POST or GET`);return}let c=RSn({requestBody:n.requestBody,document:i,context:e,requestBreadcrumbs:[...l,"Payload"],source:r,namespace:e.namespace});if(c==null||c.type!=="json"){e.logger.error(`Skipping webhook ${a} because non-json request body`);return}if(n.operationId==null){e.logger.error(`Skipping webhook ${a} because no operation id present`);return}return{summary:n.summary,sdkName:d,namespace:e.namespace,method:u,operationId:n.operationId,tags:e.resolveTagsToTagIds(n.tags),headers:o.headers,generatedPayloadName:D2(s,e.options.preserveSchemaIds),payload:c.schema,description:n.description,examples:J8D(c.fullExamples),source:r}}function J8D(e){if(e==null)return[];let t=[];for(let r of e){let i=Hdi(r.value);i!=null&&t.push({description:r.description,name:r.name,payload:i})}return t}function GWs({context:e,pathItemContext:t,operation:r,convertToWebhook:i}){let n=yf(r,fd.IGNORE);if(n!=null&&n){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let a=K8D(r,e),u=z9p(e.document,r),l={...t,sdkMethodName:a,baseBreadcrumbs:Y8D({operation:r,sdkMethodName:a,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:u};if(i){let c=eLp({context:e,operationContext:l,source:e.source});return c!=null?{type:"webhook",value:c}:void 0}let d=x9p(r);if(d!=null){let c=k9p({context:e,operationContext:l,streamingExtension:d});return c!=null?{type:"streaming",streaming:c.streaming,nonStreaming:c.nonStreaming}:void 0}let s=C9p(r);if(s!=null){let c=K9p({context:e,operationContext:l,asyncExtension:s,source:e.source});return{type:"async",async:c.async,sync:c.sync}}return{type:"http",value:hKr({context:e,operationContext:l,streamFormat:void 0,source:e.source})}}function K8D(e,t){let r=yf(e,fd.SDK_METHOD_NAME),i=yf(e,fd.SDK_GROUP_NAME)??[];if(r!=null){let n=typeof i=="string"?[i]:i;return n=t.resolveGroupName(n),{groupName:n,methodName:r}}}function Y8D({sdkMethodName:e,operation:t,httpMethod:r,path:i,shouldUseIdiomaticRequestNames:n}){let a=[];if(e!=null){if(n&&a.push(e.methodName),e.groupName.length>0){let u=e.groupName[e.groupName.length-1];u!=null&&a.push(typeof u=="string"?u:u.name)}n||a.push(e.methodName)}else t.operationId!=null?a.push(t.operationId):a.push(Dg(`${r}_${i.split("/").join("_")}`));return a}function tLp(e,t,r,i){let n=[],a=iLp(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let l of a){if(i.filter.skipEndpoint({method:l.method,path:e})){i.logger.debug(`Skipping endpoint "${l.method} ${e}"`);continue}let d=X8D({operation:l.operation}),s=GWs({context:i,pathItemContext:{...u,method:l.method},operation:l.operation,convertToWebhook:d});s!=null&&n.push(s)}return n}function rLp(e,t,r,i){let n=[],a=iLp(t),u={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let l of a){if(i.filter.skipEndpoint({method:l.method,path:e})){i.logger.debug(`Skipping endpoint "${l.method} ${e}"`);continue}let d=GWs({context:i,pathItemContext:{...u,method:l.method},operation:l.operation,convertToWebhook:!0});d!=null&&n.push(d)}return n}function iLp(e){let t=[];return e.get!=null&&t.push({method:pG.Get,operation:e.get}),e.post!=null&&t.push({method:pG.Post,operation:e.post}),e.put!=null&&t.push({method:pG.Put,operation:e.put}),e.delete!=null&&t.push({method:pG.Delete,operation:e.delete}),e.patch!=null&&t.push({method:pG.Patch,operation:e.patch}),t}function X8D({operation:e}){return yf(e,[fd.WEBHOOK])??!1}function nLp(e){let t=yf(e,fd.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=yf(e,fd.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function aLp(e){return yf(e,fd.FERN_BASIC_AUTH)}function QWs(e,t){if(Zd(e))throw new Error(`Converting referenced security schemes is unsupported: ${JSON.stringify(e)}`);return Z8D(e,t)}function Z8D(e,t){if(e.type==="apiKey"&&e.in==="header"){let r=yf(e,mV.BEARER_FORMAT),i=yf(e,fd.FERN_HEADER_AUTH);return g5.header({headerName:e.name,prefix:r!=null?"Bearer":i?.prefix,headerVariableName:i?.name??yf(e,fd.HEADER_VARIABLE_NAME),headerEnvVar:i?.env})}else if(e.type==="http"&&e.scheme==="bearer"){let r=yf(e,fd.FERN_BEARER_TOKEN);return g5.bearer({tokenVariableName:r?.name??yf(e,fd.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:r?.env})}else if(e.type==="http"&&e.scheme==="basic"){let r=aLp(e),i=nLp(e);return g5.basic({usernameVariableName:r?.username?.name??i.usernameVariable,usernameEnvVar:r?.username?.env,passwordVariableName:r?.password?.name??i.passwordVariable,passwordEnvVar:r?.password?.env})}else{if(e.type==="openIdConnect")return g5.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return g5.oauth({scopesEnum:k8D(e,t)})}}function k8D(e,t){let r=e.flows.authorizationCode?.scopes??e.flows.clientCredentials?.scopes??e.flows.implicit?.scopes??e.flows.password?.scopes;if(r!=null){let i=bXt({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([a,u])=>[a,{description:u}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsNullable:!1,groupName:void 0,context:void 0,source:t,inline:void 0}),n=cE(i);if(n.type==="enum")return n}}function oLp(e){return yf(e,fd.BASE_PATH)}var e5D=Yu.record(Yu.string(),Yu.object({summary:Yu.string().optional(),description:Yu.string().optional()}));function uLp({document:e,context:t}){return aha(e,fd.GROUPS,e5D,t.logger)}function sLp({context:e,document:t}){return yf(t,fd.FERN_VERSION)??void 0}function cLp(e){let t=yf(e,fd.FERN_GLOBAL_HEADERS),r=[];for(let i of t??[])r.push({...i,schema:i.type!=null?oha({fernType:i.type,description:void 0,availability:void 0,generatedName:i.name??i.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function lLp(e){let t=yf(e,fd.FERN_IDEMPOTENCY_HEADERS),r=[];for(let i of t??[])r.push({...i,schema:i.type!=null?oha({fernType:i.type,description:void 0,availability:void 0,generatedName:i.name??i.header,title:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function fLp(e,t){let r=yf(e,fd.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([i,n])=>{if(n.type==="string")return[i,{nameOverride:void 0,generatedName:D2([i],t),title:n.title,schema:vj.string({default:ASn(n),pattern:n.pattern,format:n.format,minLength:n.minLength,maxLength:n.maxLength}),description:n.description,availability:void 0,groupName:void 0}];throw new Error(`Variable ${i} has unsupported schema ${JSON.stringify(n)}`)}))}var t5D="webhooks";function dLp(e){return yf(e,t5D)??{}}function pLp(e){return yf(e,fd.RESOLUTIONS)}function _Lp({openapi:e}){let t=pLp(e);if(t==null)return e;let r={};for(let i of t){let n=`#/components/schemas/${i.name}`;for(let a of i.resolutions)e=r5D({openapi:e,schemaReference:a,schemaName:i.name}),e=hLp({openapi:e,replaceReference:a,schemaReference:n,replacedReferences:r}),r={...r,...Object.fromEntries(i.resolutions.map(u=>[n,u]))}}return e}function r5D({openapi:e,schemaReference:t,schemaName:r}){let i=t.replace("#/","").split("/").map(a=>a.replaceAll("~1","/")),n=e;for(let a of i){let u=n[a];if(u==null)return e;n=u}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=n,e}function hLp({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:i}){let n=Object.keys(i).filter(d=>t.startsWith(d)).sort((d,s)=>s.length-d.length)[0];if(n!=null){let d=i[n];if(d!=null){let s=r.replace(n,d);return hLp({openapi:e,replaceReference:t,schemaReference:s,replacedReferences:{}})}}let a=t.replace("#/","").split("/").map(d=>d.replaceAll("~1","/")),u=e;for(let d of a.slice(0,-1)){let s=u[d];if(s==null)return e;u=s}let l=a[a.length-1];return l==null||(u[l]={$ref:r}),e}function vLp({openApi:e,taskContext:t,options:r,source:i,namespace:n}){e=_Lp({openapi:e});let a=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([I,U])=>QWs(U,i)==null?[]:[I,QWs(U,i)])),u=new Set(...Object.entries(a).map(([I,U])=>U.type==="basic"||U.type==="bearer"?"Authorization":U.type==="header"?U.headerName:null)),l=fLp(e,r.preserveSchemaIds),d=cLp(e),s=lLp(e),o=r.audiences??[],c=[],b=[],g=new Kxo({document:e,taskContext:t,authHeaders:u,options:r,source:i,namespace:n});g.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied..."),Object.entries(e.paths??{}).forEach(([I,U])=>{if(U==null)return;t.logger.debug(`Converting path ${I}`);let H=tLp(I,U,e,g);for(let k of H){let K=yLp({operation:k});if(!(o.length>0&&!o.some(ee=>K.includes(ee))))switch(k.type){case"async":c.push(k.sync),c.push(k.async);break;case"http":c.push(k.value);break;case"streaming":c.push(k.streaming),k.nonStreaming&&c.push(k.nonStreaming);break;case"webhook":b.push(k.value);break;default:Fo(k)}}}),Object.entries(dLp(e)).forEach(([I,U])=>{if(U==null)return;t.logger.debug(`Converting path ${I}`);let H=rLp(I,U,e,g);for(let k of H){let K=yLp({operation:k});o.length>0&&!o.some(ee=>K.includes(ee))||b.push(k.value)}});let O=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([I,U])=>{if(!Zd(U)){let H=yf(U,fd.IGNORE);if(H!=null&&H)return[];if($9p.has(I))return[I,qb({...U,"x-fern-type-name":`${I}Body`},!1,g,[I],i,n)]}return[I,qb(U,!1,g,[I],i,n)]}).filter(I=>I.length>0)),m=i5D(O,g,i),w=n5D(m,g),E={};for(let[I,U]of Object.entries(w)){let H=cE(U);g.isSchemaExcluded(I)||(E[I]=H,t.logger.debug(`Converted schema ${I}`))}let A=new $di(w,g.nonRequestReferencedSchemas,g),q=b.map(I=>{let H=I.examples;if(!r.disableExamples&&H.length===0){let k=A.buildExample({schema:I.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});k!=null&&(H=[{name:void 0,description:void 0,payload:k}])}return{...I,payload:cE(I.payload),examples:H}}),D=new Wxo(w,g),C=c.map(I=>{let U=I.examples,H=U;if(!r.disableExamples&&(U.length===0||U.every(sha))){let ee=D.buildEndpointExample(I);ee.length>0&&(H=[...ee,...U.filter(fe=>!sha(fe))])}let k=I.request,K=I.response;return{...I,request:k?.type==="json"?{...k,schema:cE(k.schema)}:k,response:K?.type==="json"?{...K,schema:cE(K.schema)}:K,queryParameters:I.queryParameters.map(ee=>({description:ee.description,name:ee.name,schema:cE(ee.schema),parameterNameOverride:ee.parameterNameOverride,availability:ee.availability,source:ee.source})),pathParameters:I.pathParameters.map(ee=>({description:ee.description,name:ee.name,schema:cE(ee.schema),parameterNameOverride:ee.parameterNameOverride,variableReference:ee.variableReference,availability:ee.availability,source:ee.source})),headers:I.headers.map(ee=>({description:ee.description,name:ee.name,schema:cE(ee.schema),parameterNameOverride:ee.parameterNameOverride,env:ee.env,availability:ee.availability,source:ee.source})),examples:H,errors:rd(I.errors,ee=>{let fe=ee.fullExamples?.map(me=>{let ge=Hdi(me.value);if(ge!=null)return{name:me.name,description:me.description,example:ge}}).filter(Qb);if(fe?.length===0){let me=A.buildExample({schema:ee.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});me!=null&&fe.push({name:void 0,description:void 0,example:me})}return{generatedName:ee.generatedName,nameOverride:ee.nameOverride,schema:cE(ee.schema),description:ee.description,source:ee.source,examples:fe}})}}),R=uLp({document:e,context:g});return{apiVersion:sLp({context:g,document:e}),basePath:oLp(e),title:e.info.title,description:e.info.description,groups:Object.fromEntries(Object.entries(R??{}).map(([I,U])=>[I,{summary:U.summary??void 0,description:U.description??void 0}])),servers:(e.servers??[]).map(I=>Yxo(I)),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(I=>[I.name,{id:I.name,description:I.description}])),orderedTagIds:e.tags?.map(I=>I.name)},endpoints:C,webhooks:q,channels:{},groupedSchemas:CSn(n,E),securitySchemes:a,hasEndpointsMarkedInternal:C.some(I=>I.internal),nonRequestReferencedSchemas:g.getReferencedSchemas(),variables:l,globalHeaders:d,idempotencyHeaders:s}}function i5D(e,t,r){let i={};for(let[n,a]of Object.entries(e)){if(a.type!=="object"){i[n]=a;continue}let u={$ref:`#/components/schemas/${n}`},l=t.getReferencesFromDiscriminatedUnion(u);if(l==null){i[n]=a;continue}let d={...a,type:"object",properties:a.properties.filter(o=>!l.discriminants.has(o.key)),allOfPropertyConflicts:a.allOfPropertyConflicts.filter(o=>!l.discriminants.has(o.propertyKey)),source:r};i[n]=d;let s=bLp({schema:a,schemas:e});for(let o of[...new Set(s)]){let c=i[o]??e[o];c==null||c.type!=="object"||(i[o]={...c,type:"object",properties:c.properties.filter(b=>!l.discriminants.has(b.key)),allOfPropertyConflicts:c.allOfPropertyConflicts.filter(b=>!l.discriminants.has(b.propertyKey))})}}return i}function n5D(e,t){let r={};for(let[i,n]of Object.entries(e)){if(n.type!=="object"){r[i]=n;continue}let a={$ref:`#/components/schemas/${i}`},u=t.getDiscriminatedUnionMetadata(a);if(u==null){r[i]=n;continue}let l=[];for(let s of n.properties)if(u.discriminants.has(s.key)){let o=u.discriminants.get(s.key);o!=null&&l.push({...s,schema:El.literal({nameOverride:void 0,generatedName:D2([n.generatedName,o],t.options.preserveSchemaIds),title:void 0,value:cx.string(o),groupName:void 0,description:void 0,availability:n.availability})})}else l.push(s);let d={...n,type:"object",properties:l};r[i]=d}return r}function bLp({schema:e,schemas:t}){let r=[];for(let i of e.allOf){r.push(i.schema);let n=t[i.schema];n!=null&&n.type==="object"&&r.push(...bLp({schema:n,schemas:t}))}return r}function yLp({operation:e}){let t=[];switch(e.type){case"async":t=e.async.audiences;break;case"http":t=e.value.audiences;break;case"streaming":t=e.streaming.audiences;break;case"webhook":break;default:Fo(e)}return t}function YRi({context:e,documents:t,options:r}){let i={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:{},globalHeaders:[],idempotencyHeaders:[],groups:{}};for(let n of t){let a=n.source!=null?n.source:wie.openapi({file:"<memory>"});switch(n.type){case"openapi":{let u=vLp({taskContext:e,openApi:n.value,options:CWs({options:n.settings,overrides:r}),source:a,namespace:n.namespace});i=o5D(i,u);break}case"asyncapi":{let u=D9p({document:n.value,taskContext:e,options:CWs({options:n.settings,overrides:r}),source:a,asyncApiOptions:a5D({options:n.settings}),namespace:n.namespace});u.servers!=null&&(i.websocketServers=[...i.websocketServers,...u.servers.map(l=>({...l,audiences:void 0,description:void 0}))]),u.channels!=null&&(i.channels={...i.channels,...u.channels}),u.groupedSchemas!=null&&(i.groupedSchemas=gLp(i.groupedSchemas,u.groupedSchemas)),u.basePath!=null&&(i.basePath=u.basePath);break}default:Fo(n)}}return i}function a5D({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??H5p.naming}}function o5D(e,t){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:gLp(e.groupedSchemas,t.groupedSchemas),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},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 gLp(e,t){e.rootSchemas={...e.rootSchemas,...t.rootSchemas};for(let[r,i]of Object.entries(t.namespacedSchemas))e.namespacedSchemas[r]!=null?e.namespacedSchemas[r]={...e.namespacedSchemas[r],...i}:e.namespacedSchemas[r]=i;return e}var Zxo={config:new OLp.Config({apis:{},styleguide:{plugins:[TWs],rules:{spec:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!0};function fha(e){return e.swagger!=null}function JWs(e){return e.openapi!=null}function Gdi(e,t={}){return{...Object.fromEntries(CN(e.namedDefinitionFiles).map(([r,i])=>[r,{...i,defaultUrl:t.defaultURL}])),...CN(e.importedDefinitions).reduce((r,[i,n])=>({...r,...$ra(Gdi(n.definition,{defaultURL:n.url}),(a,u)=>PR(i,sy.of(u)))}),{})}}function dha(e,t={}){return{...Object.fromEntries(CN(e.packageMarkers).map(([r,i])=>[r,{...i,defaultUrl:t.defaultURL}])),...CN(e.importedDefinitions).reduce((r,[i,n])=>({...r,...$ra(dha(n.definition,{defaultURL:n.url}),(a,u)=>PR(i,sy.of(u)))}),{})}}function yKr(e){return{...dha(e),...Gdi(e)}}function xie(e,t){return yKr(e.definition)[t]?.contents}function dF(e,t){for(let[r,i]of CN(yKr(e.definition)))t(r,i.contents,{isPackageMarker:_Ci(r)===X1,defaultUrl:i.defaultUrl})}function XRi(e,t){for(let[r,i]of CN(dha(e.definition)))t(r,i.contents)}var AHp=yi(MHp(),1);async function nya(e){return(await(0,AHp.convertObj)(e,{})).openapi}var THp=require("fs/promises");var qHp=require("fs/promises");async function ozo({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:i}){let n=null;try{let a=(await(0,qHp.readFile)(e,"utf8")).toString();try{n=JSON.parse(a)}catch{n=Kd.load(a,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}return yds({data:t,overrides:n,allowNullKeys:i})}async function CHp({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let i=(await(0,THp.readFile)(t)).toString(),n=await Kd.load(i);return r!=null?await ozo({absoluteFilePathToOverrides:r,context:e,data:n}):n}var oya=yi(Bxo(),1);var BHp=yi(Bxo(),1),X$s=yi(require("path"),1);var aya=class extends BHp.BaseResolver{absolutePathToOpenAPIOverrides;constructor(t){super(),this.absolutePathToOpenAPIOverrides=t}resolveExternalRef(t,r){let i=super.resolveExternalRef(t,r);return TGr(Wl.of(i))?i:this.absolutePathToOpenAPIOverrides!=null?X$s.default.resolve(X$s.default.dirname(this.absolutePathToOpenAPIOverrides),r):i}};async function Z$s({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,parsed:r}){return(r!=null?await(0,oya.bundle)({...Zxo,doc:{source:new oya.Source(e,"<openapi>"),parsed:r},externalRefResolver:new aya(t)}):await(0,oya.bundle)({...Zxo,ref:e,externalRefResolver:new aya(t)})).bundle.parsed}var bHD=["examples","example",fd.EXAMPLES,mV.REDOCLY_CODE_SAMPLES_CAMEL,mV.REDOCLY_CODE_SAMPLES_KEBAB];async function uya({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r}){let i=await Z$s({absolutePathToOpenAPI:t}),n;if(r!=null?n=r:typeof i=="object"&&i[fd.OPENAPI_OVERIDES_FILEPATH]!=null&&(n=Xu(_p(t),Xa.of(i[fd.OPENAPI_OVERIDES_FILEPATH]))),n!=null){let a=await ozo({absoluteFilePathToOverrides:n,context:e,data:i,allowNullKeys:bHD});return await Z$s({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,parsed:a})}return i}var U5t=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r}){let i=[];for(let n of r){let a=(await(0,xHp.readFile)(n.absoluteFilepath)).toString(),u=aT(this.absoluteFilePath,n.source.file);n.source.relativePathToDependency!=null&&(u=Xu(n.source.relativePathToDependency,u));let l=n.source.type==="protobuf"?wie.protobuf({file:u}):wie.openapi({file:u});if(a.includes("openapi")||a.includes("swagger")){let d=await uya({absolutePathToOpenAPI:n.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:n.absoluteFilepathToOverrides});if(JWs(d)){i.push({type:"openapi",value:d,source:l,namespace:n.namespace,settings:n.settings});continue}else if(fha(d)){let s=await nya(d);i.push({type:"openapi",value:s,source:l,namespace:n.namespace,settings:n.settings});continue}}if(a.includes("asyncapi")){let d=await CHp({context:t,absoluteFilePath:n.absoluteFilepath,absoluteFilePathToOverrides:n.absoluteFilepathToOverrides});i.push({type:"asyncapi",value:d,source:l,namespace:n.namespace,settings:n.settings});continue}t.failAndThrow(`${n.absoluteFilepath} is not a valid OpenAPI or AsyncAPI file`)}return i}};var yzo=require("fs/promises"),cGp=yi(Lte(),1);var sGp=yi(uGp(),1);async function SG(e,t,r=[],{doNotPipeOutput:i=!1,secrets:n=[],substitutions:a={},...u}={}){let l=n.reduce((o,c)=>({...o,[c]:"<redacted>"}),a),d=[t,...r].join(" ");for(let[o,c]of Object.entries(l))d=d.replaceAll(o,c);e?.debug(`+ ${d}`);let s=(0,sGp.default)(t,r,u);return i||(s.stdout?.pipe(process.stdout),s.stderr?.pipe(process.stderr)),s.then(o=>(o.stdout==null&&(o.stdout=""),o.stderr==null&&(o.stderr=""),o))}function _zo(e,{logger:t,...r}={}){return(i,n)=>SG(t,e,i,{...r,...n})}var fGD="buf.gen.yaml",lGp="output",dGD=`${lGp}/openapi.yaml`,hzo=class{context;constructor({context:t}){this.context=t}async generate({absoluteFilepathToProtobufRoot:t,absoluteFilepathToProtobufTarget:r,relativeFilepathToProtobufRoot:i,local:n}){return n?this.generateLocal({absoluteFilepathToProtobufRoot:t,absoluteFilepathToProtobufTarget:r,relativeFilepathToProtobufRoot:i}):this.generateRemote()}async generateLocal({absoluteFilepathToProtobufRoot:t,absoluteFilepathToProtobufTarget:r,relativeFilepathToProtobufRoot:i}){let n=await this.setupProtobufGeneratorConfig({absoluteFilepathToProtobufRoot:t,relativeFilepathToProtobufRoot:i}),a=aT(t,r);return this.doGenerateLocal({cwd:n,target:a})}async setupProtobufGeneratorConfig({absoluteFilepathToProtobufRoot:t,relativeFilepathToProtobufRoot:r}){let i=Wl.of((await cGp.default.dir()).path);return await(0,yzo.cp)(t,i,{recursive:!0}),await(0,yzo.writeFile)(Xu(i,Xa.of(fGD)),pGD({relativeFilepathToProtobufRoot:r})),i}async doGenerateLocal({cwd:t,target:r}){let i=_zo("which",{cwd:t,logger:this.context.logger});try{await i(["buf"])}catch{this.context.failAndThrow("Missing required dependency; please install 'buf' to continue (e.g. 'brew install buf').")}try{await i(["protoc-gen-openapi"])}catch{this.context.failAndThrow("Missing required dependency; please install 'protoc-gen-openapi' to continue (e.g. 'brew install go && go install github.com/fern-api/protoc-gen-openapi/cmd/protoc-gen-openapi@latest').")}let n=_zo("buf",{cwd:t,logger:this.context.logger});return await n(["config","init"]),await n(["generate",r]),Xu(t,Xa.of(dGD))}async generateRemote(){this.context.failAndThrow("Remote Protobuf generation is unimplemented.")}};function pGD({relativeFilepathToProtobufRoot:e}){return`
1938
1938
  version: v1
1939
1939
  plugins:
1940
1940
  - plugin: openapi
@@ -1944,7 +1944,7 @@ plugins:
1944
1944
  - enum_type=string
1945
1945
  - default_response=false
1946
1946
  - source_root=${e}
1947
- `}async function qze({context:e,specs:t,relativePathToDependency:r}){let i=new hzo({context:e}),n=t.filter(l=>l.type==="openapi").map(l=>({...l,relativePathToDependency:r})),a=t.filter(l=>l.type==="protobuf"),u=await Promise.all(a.map(async l=>_GD({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u]}async function _GD({generator:e,protobufSpec:t,relativePathToDependency:r}){return{type:"openapi",absoluteFilepath:await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally}),absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}var sKp=require("fs"),qDn=require("fs/promises");var cKp=require("os"),lKp=yi(require("path"),1),fKp=require("stream/promises"),dKp=yi(jRo(),1),pKp=yi(Lte(),1);var rJs=yi(JBi(),1);var aP;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(aP||(aP={}));var HJD=BQr();async function _Kp({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:aP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:aP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${XJD(s)}`},async o=>{switch(s.type){case"version":l=await KJD({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await JJD({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:Fo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var hKp="dependencies";var $JD="metadata.json",GJD=".fern";function QJD(e){return Xu(Wl.of((0,cKp.homedir)()),Xa.of(GJD),Xa.of(hKp),Xa.of(e.organization),Xa.of(e.apiName),Xa.of(e.version))}async function JJD({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let u=await a.workspace.getDefinition({context:t,relativePathToDependency:Xa.of(e.path)},i);return t.logger.info("Loaded..."),u}async function KJD({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=QJD(e),u=Xu(a,Xa.of(hKp)),l=Xu(a,Xa.of($JD)),d;if(!await Cf(u)||!await Cf(l)){t.logger.info("Downloading manifest...");let c=await HJD.definitionRegistry.get(rJs.FernFiddle.OrganizationId(e.organization),rJs.FernFiddle.ApiId(e.apiName),e.version);if(!c.ok){c.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:m=>{t.failWithoutThrowing("Failed to download API manifest",m)}});return}let b=c.body.yamlSchemaVersion!=null?parseInt(c.body.yamlSchemaVersion):void 0,g=oRi(r),O=oRi(c.body.cliVersion);if(b!=null){if(b>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${c.body.cliVersion}`);return}else if(b<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(g.major!==O.major||g.minor!==O.minor){t.failWithoutThrowing(`CLI version is ${c.body.cliVersion}. Expected ${g.major}.${g.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+c.body.definitionS3DownloadUrl),await(0,qDn.mkdir)(u,{recursive:!0});try{await YJD({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,qDn.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,qDn.readFile)(l)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:u,context:t,cliVersion:d.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function YJD({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await xR.get(e,{responseType:"stream"}),i=await pKp.default.dir(),n=lKp.default.join(i.path,"api.tgz");await(0,fKp.pipeline)(r.data,(0,sKp.createWriteStream)(n)),await(0,dKp.extract)({file:n,cwd:t})}function XJD(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Fo(e)}}var MKp=yi(mKp(),1);function wRo(e,t){for(let[r,i]of CN(e))kJD({relativeFilepath:r,failure:i,logger:t})}function kJD({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case aP.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case aP.FILE_READ:r.error("Failed to open file: "+e);break;case aP.FILE_MISSING:r.error("Missing file: "+e);break;case aP.FILE_PARSE:t.error instanceof gna?r.error(jie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case aP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of eKD(i))r.error(jie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case aP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case aP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${GYa}: `+t.dependencyName);break;case aP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case aP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case aP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(jie({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));for(let i of t.error.allErrors)i!==t.error.error&&r.debug(jie({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:Fo(t)}}function eKD(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var PKp=require("fs/promises");async function jKp(e,t){let r=[];for(let i of await qBe(e,t))r.push(await tKD({relativeFilepath:aT(e,i),absoluteFilepath:i}));return r}async function tKD({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,PKp.readFile)(t)).toString()}}async function wKp(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Kd.load(n.fileContents,{schema:Kd.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:aP.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}async function SKp({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all(CN(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(nY(b)>0)d[s]={type:aP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=_p(s);if(D4t(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:aP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await _Kp({dependencyName:typeof o.contents.export=="string"?o.contents.export:o.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});m.didSucceed?l[_p(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),nY(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var DKp=yi(require("path"),1);var aJs={};Co(aJs,{additionalProperties:()=>aKD,default:()=>uKD,definitions:()=>oKD,properties:()=>iKD,required:()=>nKD,type:()=>rKD});var rKD="object",iKD={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},nKD=["name"],aKD=!1,oKD={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},uKD={type:rKD,properties:iKD,required:nKD,additionalProperties:aKD,definitions:oKD};var oJs={};Co(oJs,{additionalProperties:()=>lKD,default:()=>dKD,definitions:()=>fKD,properties:()=>cKD,type:()=>sKD});var sKD="object",cKD={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},lKD=!1,fKD={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},dKD={type:sKD,properties:cKD,additionalProperties:lKD,definitions:fKD};var uJs={};Co(uJs,{additionalProperties:()=>hKD,default:()=>vKD,definitions:()=>yKD,properties:()=>_KD,type:()=>pKD});var pKD="object",_KD={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},hKD=!1,yKD={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},vKD={type:pKD,properties:_KD,additionalProperties:hKD,definitions:yKD};function EKp({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of CN(e)){let d=l.contents,s=o=>{a[u]={type:aP.JSONSCHEMA_VALIDATION,error:o}};if(u===Q3){let o=DGr(d,aJs);if(o.success){let c=l2.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(DKp.default.basename(u)===X1){let o=DGr(d,uJs);if(o.success){let c=l2.serialization.PackageMarkerFileSchema.parseOrThrow(d);n[u]={defaultUrl:typeof c.export=="object"?c.export.url:void 0,contents:c,rawContents:l.rawContents}}else s(o)}else{let o=DGr(d,oJs);if(o.success){let c=l2.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:Xu(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[Xa.of(Q3)]:{type:aP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var wpi=class extends D5t{context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,MKp.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=Xu(this.absoluteFilePath,Xa.of(R8)),l=await Dys({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await jKp(u,"{yml,yaml}"),s=await wKp(d);if(!s.didSucceed)return wRo(s.failures,a.logger),a.failAndThrow();let o=EKp({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return wRo(o.failures,a.logger),a.failAndThrow();let c=await SKp({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return wRo(c.failures,a.logger),a.failAndThrow();n=new USe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:{absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions},cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};function SV(e){let t=gKD(e),{value:r,done:i}=sJs(t,"{");return i?{head:r,parts:[]}:{head:r,parts:[...bKD(t)]}}function*bKD(e){let t;do{let{value:r}=sJs(e,"}"),i=sJs(e,"{");t=i.done,yield{pathParameter:r,tail:i.value}}while(!t)}function*gKD(e){for(let t of e)yield t}function sJs(e,t){let r="",i=e.next();for(;i.done!==!0&&i.value!==t;)r+=i.value,i=e.next();return{value:r,done:i.done??!1}}function Iya(e){let t=2166136261;function r(n,a){if(typeof n=="object"&&n!=null){if(a>64){i("[MaxDepthExceeded]");return}if(Array.isArray(n)){i("[");for(let u=0;u<n.length;u++)u>0&&i(","),r(n[u],a+1);i("]")}else i("{"),Object.keys(n).sort().forEach((l,d)=>{d>0&&i(","),i(l),i(":"),r(n[l],a+1)}),i("}")}else i(String(n))}function i(n){for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);t^=u,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24),t>>>=0}}return r(e,0),t.toString(16)}function AKp({fieldName:e,containerType:t,maxDepth:r,currentDepth:i,typeDeclarations:n,skipOptionalProperties:a}){if(i>=r)return IXt({containerType:t});switch(t.type){case"list":{let u=ZT({fieldName:e,typeReference:t.list,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.list({list:[u.example,u.example],itemType:t.list}),jsonExample:[u.jsonExample,u.jsonExample]}}case"literal":return{type:"success",example:GO.literal({literal:t.literal._visit({boolean:u=>n_.boolean(u),string:u=>n_.string({original:u}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:t.literal._visit({boolean:u=>u,string:u=>u,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":{if(a)return IXt({containerType:t});let u=ZT({fieldName:e,typeReference:t.optional,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.optional({optional:u.example,valueType:t.optional}),jsonExample:u.jsonExample}}case"nullable":{if(a)return IXt({containerType:t});let u=ZT({fieldName:e,typeReference:t.nullable,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.nullable({nullable:u.example,valueType:t.nullable}),jsonExample:u.jsonExample}}case"set":{let u=ZT({fieldName:e,typeReference:t.set,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.set({set:[u.example],itemType:t.set}),jsonExample:[u.jsonExample]}}case"map":{let u=ZT({fieldName:e,typeReference:t.keyType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a}),l=ZT({fieldName:e,typeReference:t.valueType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"||l.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.map({map:[{key:u.example,value:l.example}],keyType:t.keyType,valueType:t.valueType}),jsonExample:{[u.jsonExample]:l.jsonExample}}}default:Fo(t)}}function IXt({containerType:e}){switch(e.type){case"list":return{type:"success",example:GO.list({list:[],itemType:e.list}),jsonExample:[]};case"literal":return{type:"success",example:GO.literal({literal:e.literal._visit({boolean:t=>n_.boolean(t),string:t=>n_.string({original:t}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:e.literal._visit({boolean:t=>t,string:t=>t,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":return{type:"success",example:GO.optional({optional:void 0,valueType:e.optional}),jsonExample:void 0};case"nullable":return{type:"success",example:GO.nullable({nullable:void 0,valueType:e.nullable}),jsonExample:void 0};case"set":return{type:"success",example:GO.set({set:[],itemType:e.set}),jsonExample:[]};case"map":return{type:"success",example:GO.map({map:[],keyType:e.keyType,valueType:e.valueType}),jsonExample:{}};default:Fo(e)}}function TKp({fieldName:e,primitiveType:t}){switch(t.v1){case"STRING":return jKD({fieldName:e,validation:OKD(t.v2)});case"BASE_64":return{type:"success",example:n_.base64(Sg.BASE64),jsonExample:Sg.BASE64};case"BOOLEAN":return{type:"success",example:n_.boolean(Sg.BOOLEAN),jsonExample:Sg.BOOLEAN};case"DATE":return{type:"success",example:n_.date(Sg.DATE),jsonExample:Sg.DATE};case"DATE_TIME":return{type:"success",example:n_.datetime({datetime:new Date(Sg.DATE_TIME),raw:Sg.DATE_TIME}),jsonExample:Sg.DATE_TIME};case"DOUBLE":return wKD({fieldName:e,validation:mKD(t.v2)});case"FLOAT":return{type:"success",example:n_.float(Sg.FLOAT),jsonExample:Sg.FLOAT};case"INTEGER":return SKD({fieldName:e,validation:PKD(t.v2)});case"UINT_64":return{type:"success",example:n_.uint64(Sg.INT64),jsonExample:Sg.INT64};case"UINT":return{type:"success",example:n_.uint(Sg.UINT),jsonExample:Sg.UINT};case"BIG_INTEGER":return{type:"success",example:n_.bigInteger(Sg.INT64.toString()),jsonExample:`${Sg.INT64}`};case"LONG":return{type:"success",example:n_.long(Sg.INT64),jsonExample:Sg.INT64};case"UUID":return{type:"success",example:n_.uuid(Sg.UUID),jsonExample:Sg.UUID};default:Fo(t.v1)}}function OKD(e){if(e?.type==="string")return e.validation}function mKD(e){if(e?.type==="double")return e.validation}function PKD(e){if(e?.type==="integer")return e.validation}function qKp(e){if(e<=Sg.SAMPLE_STRINGS.length){let t=Sg.SAMPLE_STRINGS[e-1];if(t)return t;throw new Error(`Unexpected undefined value in SAMPLE_STRINGS at index ${e-1}`)}return Sg.SAMPLE_STRINGS[Sg.SAMPLE_STRINGS.length-1]+".".repeat(e-Sg.SAMPLE_STRINGS.length)}function jKD({fieldName:e,validation:t}){if(t){let i=t.minLength,n=t.maxLength;if(i){let a=qKp(i);return{type:"success",example:n_.string({original:a}),jsonExample:a}}else if(n){let a=qKp(n);return{type:"success",example:n_.string({original:a}),jsonExample:a}}}let r=e??Sg.STRING;return{type:"success",example:n_.string({original:r}),jsonExample:r}}function wKD({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:n_.double(r),jsonExample:r};if(i)return{type:"success",example:n_.double(i),jsonExample:i}}return{type:"success",example:n_.double(Sg.DOUBLE),jsonExample:Sg.DOUBLE}}function SKD({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:n_.integer(r),jsonExample:r};if(i)return{type:"success",example:n_.integer(i),jsonExample:i}}return{type:"success",example:n_.integer(Sg.INT),jsonExample:Sg.INT}}function ZT({fieldName:e,typeReference:t,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){if(n>i)return{type:"failure",message:"Exceeded max depth"};switch(t.type){case"named":{let u=r[t.typeId];if(u==null)return{type:"failure",message:`Failed to find type declaration with id ${t.typeId}`};let l=BDn({fieldName:e,typeDeclaration:u,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(l==null)return{type:"failure",message:"Failed to generate example for type declaration"};if(l.type==="failure")return l;let{example:d,jsonExample:s}=l;return{type:"success",example:{jsonExample:s,shape:Ab.named({shape:d,typeName:u.name})},jsonExample:s}}case"container":{let u=AKp({fieldName:e,containerType:t.container,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure"){let{example:s,jsonExample:o}=IXt({containerType:t.container});return{type:"success",example:{jsonExample:o,shape:Ab.container(s)},jsonExample:o}}let{example:l,jsonExample:d}=u;return{type:"success",example:{jsonExample:d,shape:Ab.container(l)},jsonExample:d}}case"primitive":{let{jsonExample:u,example:l}=TKp({fieldName:e,primitiveType:t.primitive});return{type:"success",example:{jsonExample:u,shape:Ab.primitive(l)},jsonExample:u}}case"unknown":{let u={key:"value"};return{type:"success",example:{jsonExample:u,shape:Ab.unknown(u)},jsonExample:u}}}}function xDn({typeReference:e,typeDeclarations:t}){if(e.type==="container"&&e.container.type==="optional")return!0;if(e.type==="named"){let r=t[e.typeId];if(r?.shape.type==="alias"&&r?.shape.resolvedType.type==="container"&&r?.shape.resolvedType.container.type==="optional")return!0}return!1}function BDn({fieldName:e,typeDeclarations:t,typeDeclaration:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){switch(r.shape.type){case"alias":{let u=ZT({fieldName:e,typeDeclarations:t,typeReference:r.shape.aliasOf,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure")return u;let{example:l,jsonExample:d}=u;return{type:"success",example:tw.alias({value:l}),jsonExample:d}}case"enum":{let u=r.shape.values[0];return u==null?{type:"failure",message:"No enum values present"}:{type:"success",example:tw.enum({value:u.name}),jsonExample:u.name.wireValue}}case"object":{let u={},l=[];if(r.shape.extends!=null)for(let c of r.shape.extends){let b=t[c.typeId];if(b==null)continue;let g=BDn({fieldName:e,typeDeclaration:b,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});g!=null&&g.type==="success"&&g.example.type==="object"&&(Object.assign(u,g.jsonExample),l.push(...g.example.properties))}let d=DKD({fieldName:e,typeDeclaration:r,objectTypeDeclaration:r.shape,typeDeclarations:t,currentDepth:n,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure")return d;let{example:s,jsonExample:o}=d;return{type:"success",example:tw.object({...s,properties:[...l,...s.properties]}),jsonExample:Object.assign({},u,o)}}case"undiscriminatedUnion":{let u=0;for(let l of r.shape.members){let d=ZT({fieldName:e,typeReference:l.type,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure"){++u;continue}let{example:s,jsonExample:o}=d;return{type:"success",example:tw.undiscriminatedUnion({index:u,singleUnionType:s}),jsonExample:o}}break}case"union":{let u=r.shape.discriminant,l={};if(r.shape.baseProperties!=null)for(let d of r.shape.baseProperties){let s=ZT({fieldName:d.name.wireValue,typeReference:d.valueType,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});s.type==="success"&&(l[d.name.wireValue]=s.jsonExample)}for(let d of r.shape.types){let s=d.shape._visit({noProperties:()=>({type:"success",example:tw.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:QN.noProperties()}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...l}}),samePropertiesAsObject:o=>{let c=t[o.typeId];if(c==null)return{type:"failure",message:`Failed to find type declaration with id ${o.typeId}`};let b=BDn({currentDepth:n,maxDepth:i,fieldName:e,typeDeclaration:c,typeDeclarations:t,skipOptionalProperties:a});if(b==null)return{type:"failure",message:"Failed to generate example for type reference"};if(b.type==="failure")return b;let{example:g,jsonExample:O}=b;return{type:"success",example:tw.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:QN.samePropertiesAsObject({typeId:c.name.typeId,object:g.type==="object"?g:{properties:[]}})}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...typeof O=="object"?O:{},...l}}},singleProperty:o=>{let c=ZT({currentDepth:n+1,maxDepth:i,fieldName:e,typeReference:o.type,typeDeclarations:t,skipOptionalProperties:a});if(c.type==="failure")return c;let{example:b,jsonExample:g}=c;return{type:"success",example:tw.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:QN.singleProperty(b)}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,[o.name.wireValue]:g,...l}}},_other:()=>{throw new Error("Encountered unknown union type")}});if(s.type!=="failure")return s}}}return{type:"failure",message:"Failed to generate example for type reference"}}function DKD({fieldName:e,typeDeclaration:t,objectTypeDeclaration:r,typeDeclarations:i,maxDepth:n,currentDepth:a,skipOptionalProperties:u}){let l={},d=[];for(let s of[...r.properties??[],...r.extendedProperties??[]]){let o=ZT({fieldName:s.name.wireValue,typeReference:s.valueType,typeDeclarations:i,currentDepth:a+1,maxDepth:n,skipOptionalProperties:u});if(o.type==="failure"&&!xDn({typeDeclarations:i,typeReference:s.valueType}))return{type:"failure",message:`Failed to generate required property ${s.name.wireValue} b/c ${o.message}`};if(o.type==="failure")continue;let{example:c,jsonExample:b}=o;d.push({name:s.name,originalTypeDeclaration:t.name,value:c}),l[s.name.wireValue]=b}return{type:"success",example:tw.object({properties:d}),jsonExample:l}}var cJs=pd.primitive({v1:g0.String,v2:Z_.string({default:void 0,validation:void 0})});function zya({ir:e,endpoint:t,service:r,typeDeclarations:i,skipOptionalRequestProperties:n,generationResponse:a}){let u={name:void 0,endpointHeaders:[],endpointPathParameters:[],queryParameters:[],servicePathParameters:[],serviceHeaders:[],rootPathParameters:[],request:void 0,response:Cq.ok(KT.body(void 0)),docs:void 0},l=[{params:t.pathParameters,add:s=>u.endpointPathParameters.push(s)},{params:r.pathParameters,add:s=>u.servicePathParameters.push(s)},{params:e.pathParameters,add:s=>u.rootPathParameters.push(s)}];for(let s of l)for(let o of s.params){let c=ZT({fieldName:o.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}for(let s of t.queryParameters){if(n&&xDn({typeDeclarations:i,typeReference:s.valueType}))continue;let o=ZT({fieldName:s.name.name.originalName,currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:s.valueType,skipOptionalProperties:n});if(o.type==="failure")return o;let{example:c}=o;u.queryParameters.push({name:s.name,shape:s.allowMultiple?f2.exploded():f2.single(),value:c})}let d=[{params:t.headers,add:s=>u.endpointHeaders.push(s)},{params:r.headers,add:s=>u.serviceHeaders.push(s)}];for(let s of d)for(let o of s.params){if(n&&xDn({typeDeclarations:i,typeReference:o.valueType}))continue;let c=ZT({fieldName:o.name.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}if(t.requestBody!=null)switch(t.requestBody.type){case"bytes":return{type:"failure",message:"Bytes request unsupported"};case"fileUpload":return{type:"failure",message:"File upload unsupported"};case"inlinedRequestBody":{let s={},o=[];if(t.requestBody.extends!=null)for(let c of t.requestBody.extends){let b=i[c.typeId];if(b==null)throw new Error(`Failed to find extended type declaration with id ${c.typeId}`);let g=BDn({typeDeclaration:b,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});g!=null&&g.type==="success"&&Object.assign(s,g.jsonExample)}for(let c of[...t.requestBody.properties??[],...t.requestBody.extendedProperties??[]]){let b=ZT({fieldName:c.name.wireValue,typeReference:c.valueType,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});if(b.type==="failure"&&!xDn({typeDeclarations:i,typeReference:c.valueType}))return{type:"failure",message:`Failed to generate required property ${c.name.wireValue} b/c ${b.message}`};if(b.type==="failure")continue;let{example:g,jsonExample:O}=b;o.push({name:c.name,originalTypeDeclaration:void 0,value:g}),s[c.name.wireValue]=O}u.request=U$.inlinedRequestBody({jsonExample:s,properties:o});break}case"reference":{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.requestBody.requestBodyType,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.request=U$.reference(o);break}default:Fo(t.requestBody)}if(a.type==="success"&&t.response?.body!=null)switch(t.response.body.type){case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.responseBodyType,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.body({...o,jsonExample:c}));break}case"streamParameter":{let s;switch(t.response.body.nonStreamResponse.type){case"bytes":return{type:"failure",message:"Bytes unsupported"};case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.nonStreamResponse.value.responseBodyType,skipOptionalProperties:!1});break;case"text":s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:cJs,skipOptionalProperties:!1});break;default:Fo(t.response.body.nonStreamResponse)}if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.body({...o,jsonExample:c}));break}case"streaming":{let s;switch(t.response.body.value.type){case"sse":{if(s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.sse([{data:{...o,jsonExample:c},event:""}]));break}case"json":{if(s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.stream([{...o,jsonExample:c}]));break}case"text":{if(s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:cJs,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.stream([{...o,jsonExample:c}]));break}default:Fo(t.response.body.value)}break}case"text":{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:cJs,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.body({...o,jsonExample:c}));break}case"bytes":return{type:"failure",message:"Bytes unsupported"};default:Fo(t.response.body)}else if(a.type==="error")if(a.declaration.type==null)u.response=Cq.error({body:void 0,error:a.declaration.name});else{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:a.declaration.type,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.response=Cq.error({body:o,error:a.declaration.name})}try{return{type:"success",example:{id:Iya(u),url:EKD(t,u),...u},jsonExample:void 0}}catch(s){return{type:"failure",message:`Parse failure with exceptions ${s}`}}}function EKD(e,t){let r={};[...t.rootPathParameters,...t.servicePathParameters,...t.endpointPathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.fullPath.head+e.fullPath.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function mNi({ir:e,exampleGeneration:t}){for(let[r,i]of Object.entries(e.services))for(let n of i.endpoints){if(n.userSpecifiedExamples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let a=zya({ir:e,service:i,endpoint:n,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples,generationResponse:{type:"success"}});if(a.type==="failure")continue;let{example:u}=a;n.autogeneratedExamples=[{example:u}]}return e}function lJs(e,t){return{apiName:e.apiName,basePath:e.basePath,apiDisplayName:e.apiDisplayName??t.apiDisplayName,apiDocs:e.apiDocs??t.apiDocs,auth:e.auth??t.auth,headers:[...e.headers??[],...t.headers??[]],environments:e.environments??t.environments,types:{...e.types??{},...t.types??{}},constants:{...e.constants??{},...t.constants??{}},errors:{...e.errors??{},...t.errors??{}},services:{...e.services??{},...t.services??{}},webhookGroups:{...e.webhookGroups??{},...t.webhookGroups??{}},subpackages:{...e.subpackages??{},...t.subpackages??{}},websocketChannels:{...e.websocketChannels??{},...t.websocketChannels??{}},rootPackage:{service:e.rootPackage.service??t.rootPackage.service,types:[...e.rootPackage.types??[],...t.rootPackage.types??[]],errors:[...e.rootPackage.errors??[],...t.rootPackage.errors??[]],subpackages:[...e.rootPackage.subpackages??[],...t.rootPackage.subpackages??[]],fernFilepath:e.rootPackage.fernFilepath??t.rootPackage.fernFilepath,webhooks:e.rootPackage.webhooks??t.rootPackage.webhooks,websocket:e.rootPackage.websocket??t.rootPackage.websocket,hasEndpointsInTree:e.rootPackage.hasEndpointsInTree||t.rootPackage.hasEndpointsInTree,navigationConfig:e.rootPackage.navigationConfig??t.rootPackage.navigationConfig,docs:e.rootPackage.docs??t.rootPackage.docs},fdrApiDefinitionId:e.fdrApiDefinitionId??t.fdrApiDefinitionId,apiVersion:e.apiVersion??t.apiVersion,idempotencyHeaders:[...e.idempotencyHeaders??[],...t.idempotencyHeaders??[]],pathParameters:[...e.pathParameters??[],...t.pathParameters??[]],errorDiscriminationStrategy:e.errorDiscriminationStrategy??t.errorDiscriminationStrategy,variables:[...e.variables??[],...t.variables??[]],serviceTypeReferenceInfo:e.serviceTypeReferenceInfo??t.serviceTypeReferenceInfo,readmeConfig:e.readmeConfig??t.readmeConfig,sourceConfig:e.sourceConfig??t.sourceConfig,publishConfig:e.publishConfig??t.publishConfig,dynamic:e.dynamic??t.dynamic,sdkConfig:e.sdkConfig??t.sdkConfig}}var Oy=class{breadcrumbs=[];constructor({breadcrumbs:t=[]}={}){this.breadcrumbs=t}};var CKp={[Jb.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,G3(e)])),[Jb.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Jb.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Jb.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[Jb.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Jb.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[Jb.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Jb.GenerationLanguage.SWIFT]:new Set([])};var MKD=["go","ruby"];function ZSe({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:AKD({name:c,keywords:qKD({generationLanguage:e,keywords:t})})}),l=Dg(n),d=G3(l),s=aYa(n),o=Lra(l);return r&&(!BKD(o)&&(e==null||MKD.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=SRo(c);if(g!=null)return g;if(DRo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=SRo(c);return g??(DRo(c)?c.toUpperCase():b===0?G3(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(aYa).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function AKD({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":CKD(e)?"_"+e:e}function qKD({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return CKp[e]}var TKD=/^[0-9]/;function CKD(e){return TKD.test(e)}function BKD(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=SRo(i)!=null||DRo(i),a=SRo(t)!=null||DRo(t);return n&&a})}function SRo(e){return IKD.get(e.toUpperCase())}function DRo(e){return xKD.has(e.toUpperCase())}var xKD=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),IKD=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var PNi=class e{args;spec;settings;logger;generationLanguage;smartCasing;casingsGenerator;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.casingsGenerator=ZSe({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing})}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((n,a)=>!(/^\d+$/.test(n)||e.BREADCRUMBS_TO_IGNORE.includes(n)||a===0&&n==="components"||a===1&&n==="schemas"||t[0]==="paths"&&(a===0||a===1&&["get","post","put","delete","patch"].includes(n)||a===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&n==="parameters"))),i=Dg(r.join("_"));return i.charAt(0).toUpperCase()+i.slice(1)}createPackage(t={}){return{fernFilepath:{allParts:[],packagePath:[],file:t.name!=null?this.casingsGenerator.generateName(t.name):void 0},service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,navigationConfig:void 0}}async resolveReference(t){let r=this.spec,i;if(t.$ref.startsWith("http://")||t.$ref.startsWith("https://")){let a=t.$ref.split("#"),u=a[0];if(i=a[1],!u)return{resolved:!1};let l=await fetch(u);if(!l.ok)return{resolved:!1};try{let d=await l.text();try{r=JSON.parse(d)}catch{r=Kd.load(d)}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!i)return{resolved:!0,value:r}}let n=(i??t.$ref).replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(a=>a.replace(/~1/g,"/"));for(let a of n){if(typeof r!="object"||r==null)return{resolved:!1};r=r[a]}return r==null?{resolved:!1}:{resolved:!0,value:r}}createNamedTypeReference(t){return pd.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t??"defaultName"),typeId:t,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type!=="named")return;let r=t.typeId;return{typeId:r,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r)}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){return Object.fromEntries(Object.entries(r).filter(([i])=>i!==t))}maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}};var sz=class extends Oy{getExtensionValue(t){if(!(typeof t!="object"||t==null))return t[this.key]}};var Rya=class{errors=[];logger;constructor({logger:t}){this.logger=t}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}logErrors(){for(let t of this.errors)this.logger.log(V0.Info,jie({title:t.message,breadcrumbs:t.path,subtitle:t.path!=null?k_.dim(t.path.join(" -> ")):void 0}))}};var AG={};Co(AG,{FernAvailabilityExtension:()=>ERo,FernEnumExtension:()=>MRo,FernIgnoreExtension:()=>ARo});var ERo=class extends sz{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r}){super({breadcrumbs:t}),this.node=r}async convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.node);if(i==null||typeof i!="string")return;switch(i.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return a7.InDevelopment;case"PRE_RELEASE":return a7.PreRelease;case"GENERAL_AVAILABILITY":return a7.GeneralAvailability;case"DEPRECATED":return a7.Deprecated;default:return}}};var zKD=Yu.object({snake:Yu.string().optional(),camel:Yu.string().optional(),screamingSnake:Yu.string().optional(),pascal:Yu.string().optional()}),RKD=Yu.object({description:Yu.string().optional(),name:Yu.string().optional(),casing:zKD.optional()}),BKp=Yu.record(RKD);var MRo=class extends sz{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i==null)return;let n=BKp.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-enum extension: ${n.error.message}`,path:this.breadcrumbs});return}return n.data}};var ARo=class extends sz{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return i}}};function jNi(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","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 u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${jNi(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${jNi(a)}`}var pJs=yi(xKp(),1);var IKp=["get","post","put","delete","patch"];var qRo=class extends sz{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return i}}};var LKD=Yu.object({cursor:Yu.string(),next_cursor:Yu.string(),results:Yu.string()}),UKD=Yu.object({offset:Yu.string(),results:Yu.string(),step:Yu.string().optional(),"has-next-page":Yu.string().optional()}),fJs=Yu.union([Yu.boolean(),LKD,UKD]);var dJs="$request.",TRo="$response.",CRo=class extends sz{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i}){super({breadcrumbs:t}),this.operation=r,this.document=i}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=fJs.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){let a=this.getExtensionValue(this.document);if(a==null)return;if(typeof a=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let u=fJs.safeParse(a);if(!u.success){r.collect({message:`Invalid x-fern-pagination extension: ${u.error.message}`,path:this.breadcrumbs});return}if(typeof u.data=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig(u.data,t)}if(typeof n.data=="boolean"){r.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig(n.data,t)}convertPaginationConfig(t,r){let i=t;if("cursor"in i)return{type:"cursor",cursor:r.maybeTrimPrefix(i.cursor,dJs),nextCursor:r.maybeTrimPrefix(i.next_cursor,TRo),results:r.maybeTrimPrefix(i.results,TRo)};let n=t;return{type:"offset",offset:r.maybeTrimPrefix(n.offset,dJs),results:r.maybeTrimPrefix(n.results,TRo),step:n.step!=null?r.maybeTrimPrefix(n.step,dJs):void 0,hasNextPage:n["has-next-page"]!=null?r.maybeTrimPrefix(n["has-next-page"],TRo):void 0}}};var VKD="$request.",WKD=Yu.object({"stream-condition":Yu.string().optional(),format:Yu.enum(["sse","json"]).optional(),"stream-description":Yu.string().optional(),"response-stream":Yu.any(),response:Yu.any()}),HKD=Yu.union([Yu.boolean(),WKD]),BRo=class extends sz{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=HKD.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-streaming extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean")return n.data?{type:"stream",format:"json"}:void 0;if(n.data["stream-condition"]==null&&n.data.format!=null)return{type:"stream",format:n.data.format};if(n.data["stream-condition"]==null){r.collect({message:"Missing required stream-condition property",path:this.breadcrumbs});return}return{type:"streamCondition",format:n.data.format??"json",streamDescription:n.data["stream-description"],streamConditionProperty:t.maybeTrimPrefix(n.data["stream-condition"],VKD),responseStream:n.data["response-stream"],response:n.data.response}}};var xRo=class extends sz{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return i}}};var IRo=class extends sz{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=Array.isArray(i)?i.filter(a=>typeof a=="string"):typeof i=="string"?[i]:[];if(n.length!==0)return{groups:n}}};var zRo=class extends sz{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null&&typeof i=="string")return{methodName:i}}};var RRo=class e extends Oy{static LIST_UNKNOWN=pd.container(Ev.list(pd.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new cX({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:pd.container(Ev.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var NRo=class extends Oy{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:a0.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var FRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:a0.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new cX({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new cX({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:a0.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(Qb),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var LRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator!=null){for(let[a,u]of Object.entries(this.schema.discriminator.mapping??{})){let l=new cX({schemaOrReference:{$ref:u},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",a]}),d=t.getTypeIdFromSchemaReference({$ref:u}),s=await l.convert({context:t,errorCollector:r});if(s?.type!=null&&d!=null){let o=t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:a});i.push({docs:void 0,discriminantValue:o,availability:s.availability,displayName:void 0,shape:Z8.samePropertiesAsObject({typeId:d,name:t.casingsGenerator.generateName(d),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...s.inlinedTypes}}}return{union:a0.union({baseProperties:[],discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf||this.schema.oneOf.length===0)return;let i=[],n={};for(let[a,u]of this.schema.oneOf.entries()){let l=[...this.breadcrumbs,"oneOf",jNi(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new Dpi({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:a0.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var URo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?pd.container(Ev.literal(k8.string(i))):pd.primitive({v1:"STRING",v2:Z_.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":case void 0:return pd.primitive({v1:"DOUBLE",v2:Z_.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return pd.primitive({v1:"FLOAT",v2:Z_.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return pd.primitive({v1:"LONG",v2:Z_.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return pd.primitive({v1:"UINT",v2:Z_.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return pd.primitive({v1:"UINT_64",v2:Z_.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?pd.container(Ev.literal(k8.boolean(i))):pd.primitive({v1:"BOOLEAN",v2:Z_.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var Dpi=class extends Oy{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){if(this.schema.enum?.length){let u=new AG.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),d=new NRo({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:u}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let n=new URo({schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:n,resolvedType:n}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let u=await new RRo({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:u.typeReference,resolvedType:u.typeReference}),context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.oneOf!=null){let u=await new LRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.union,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let u=await new FRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.object,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:t.casingsGenerator.generateName(this.id)}}};var cX=class extends Oy{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:l.reference,inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new Dpi({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return pd.container(Ev.optional(t))}wrapInNullable(t){return pd.container(Ev.nullable(t))}};var Nya=class e extends Oy{static STRING=pd.primitive({v1:"STRING",v2:Z_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=pd.container(Ev.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new cX({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??e.STRING,location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:return}}};var VRo=class extends Oy{requestBody;group;method;constructor({breadcrumbs:t,requestBody:r,group:i,method:n}){super({breadcrumbs:t}),this.requestBody=r,this.group=i,this.method=n}async convert({context:t,errorCollector:r}){if(!this.requestBody.content)return;let i=Object.keys(this.requestBody.content).filter(u=>u.includes("json"));for(let u of i){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}let n=Object.keys(this.requestBody.content).filter(u=>u.includes("multipart"));for(let u of n){let l=[...this.group,this.method,"Request"].join("_"),d=await this.convertRequestSchemaForMediaType({schemaId:l,contentType:u,context:t,errorCollector:r});if(d!=null&&d.schema?.shape.type==="object")return{requestBody:eI.fileUpload({docs:this.requestBody.description,name:t.casingsGenerator.generateName(l),properties:d.schema?.shape.properties.map(o=>this.convertRequestBodyProperty({context:t,property:o,contentType:u}))}),inlinedTypes:t.removeSchemaFromInlinedTypes({id:l,inlinedTypes:d.inlinedTypes}),examples:d.examples}}let a=Object.keys(this.requestBody.content).filter(u=>u.includes("urlencoded"));for(let u of a){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}}async convertRequestSchemaForMediaType({schemaId:t,contentType:r,context:i,errorCollector:n}){let a=this.requestBody.content[r];if(a==null||a.schema==null)return;let l=await new cX({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:t}).convert({context:i,errorCollector:n});if(l==null)return;let d=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([s,o])=>[s,i.isReferenceObject(o)?await i.resolveReference(o):o]))):void 0;return{...l,examples:d}}async handleJsonOrFormContent({contentType:t,context:r,errorCollector:i}){let n=[...this.group,this.method,"Request"].join("_"),a=await this.convertRequestSchemaForMediaType({schemaId:n,contentType:t,context:r,errorCollector:i});if(a!=null)return a.schema?.shape.type==="object"?{requestBody:eI.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:r.casingsGenerator.generateName(n),extendedProperties:a.schema?.shape.extendedProperties,extends:a.schema?.shape.extends,properties:a.schema?.shape.properties,extraProperties:a.schema?.shape.extraProperties}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}:{requestBody:eI.reference({contentType:t,docs:this.requestBody.description,requestBodyType:a.type}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}}convertRequestBodyProperty({context:t,property:r,contentType:i}){return t.isFile(r.valueType)?GN.file(xU.file({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isFile(r.valueType.container.optional)?GN.file(xU.file({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isFile(r.valueType.container.list)?GN.file(xU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isOptional(r.valueType.container.list)&&t.isFile(r.valueType.container.list.container.optional)?GN.file(xU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isList(r.valueType.container.optional)&&t.isFile(r.valueType.container.optional.container.list)?GN.file(xU.fileArray({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):GN.bodyProperty({...r,contentType:i,style:void 0,name:r.name})}};var WRo=class extends Oy{responseBody;group;method;statusCode;constructor({breadcrumbs:t,responseBody:r,group:i,method:n,statusCode:a}){super({breadcrumbs:t}),this.responseBody=r,this.group=i,this.method=n,this.statusCode=a}async convert({context:t,errorCollector:r}){if(!this.responseBody.content)return;let i=Object.keys(this.responseBody.content).filter(n=>n.includes("json"));for(let n of[...i]){let a=this.responseBody.content[n];if(a==null||a.schema==null)continue;let u=[...this.group,this.method,"Response",this.statusCode].join("_"),d=await new cX({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:u}).convert({context:t,errorCollector:r});if(d==null)continue;let s=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([o,c])=>[o,t.isReferenceObject(c)?await t.resolveReference(c):c]))):void 0;if(n.includes("json"))return{responseBody:cT.json(sSe.response({responseBodyType:d.type,docs:this.responseBody.description})),inlinedTypes:d.inlinedTypes,examples:s}}}};var $KD=/{([^}]+)}/g,IDn=class extends Oy{operation;method;path;inlinedTypes={};constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t}),this.operation=r,this.method=i,this.path=n}convertHttpMethod(){switch(this.method){case"get":return o7.Get;case"post":return o7.Post;case"put":return o7.Put;case"delete":return o7.Delete;case"patch":return o7.Patch;default:return}}async convertParameters({context:t,errorCollector:r,breadcrumbs:i}){let n=[],a=[],u=[];if(!this.operation.parameters)return{pathParameters:n,queryParameters:a,headers:u};for(let s of this.operation.parameters){if(t.isReferenceObject(s)){let b=await t.resolveReference(s);if(b.resolved)s=b.value;else continue}let c=await new Nya({breadcrumbs:i,parameter:s}).convert({context:t,errorCollector:r});if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":n.push(c.parameter);break;case"query":a.push(c.parameter);break;case"header":u.push(c.parameter);break}}let d=[...this.path.matchAll($KD)].map(s=>s[1]).filter(s=>!n.some(o=>o.name.originalName===s));for(let s of d)s!=null&&n.push({name:t.casingsGenerator.generateName(s),valueType:Nya.STRING,docs:void 0,location:"ENDPOINT",variable:void 0});return{pathParameters:n,queryParameters:a,headers:u}}async convertRequestBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.requestBody==null)return;let u;if(t.isReferenceObject(this.operation.requestBody)){let s=await t.resolveReference(this.operation.requestBody);s.resolved&&(u=s.value)}else u=this.operation.requestBody;if(u==null)return null;let d=await new VRo({breadcrumbs:i,requestBody:u,group:n??[],method:a}).convert({context:t,errorCollector:r});if(d!=null)return this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},{value:d.requestBody,examples:d.examples}}async convertResponseBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.responses!=null)for(let[u,l]of Object.entries(this.operation.responses)){let d=parseInt(u);if(isNaN(d)||d<200||d>=300)continue;let s;if(t.isReferenceObject(l)){let b=await t.resolveReference(l);b.resolved&&(s=b.value)}else s=l;if(s==null)continue;let c=await new WRo({breadcrumbs:[...i,u],responseBody:s,group:n??[],method:a,statusCode:u}).convert({context:t,errorCollector:r});if(c!=null)return this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},{value:{statusCode:d,body:c.responseBody},examples:c.examples}}}computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r}){let n=new zRo({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.methodName,u=new IRo({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.groups??[];if(n!=null)return{group:u,method:n}}computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}){let i=this.operation.tags?.[0],n=this.operation.operationId;if(n==null){let l=this.operation.summary!=null?Dg(this.operation.summary):Dg(`${this.method}_${this.path.split("/").join("_")}`);return i!=null?{group:[i],method:l}:{method:l}}if(i==null)return{method:n};let a=zKp(i),u=zKp(n);return F1e(a,u)?{method:i}:this.computeGroupAndMethodFromTokens({tag:i,tagTokens:a,operationId:n,operationIdTokens:u})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,operationId:i,operationIdTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:Dg(u.join("_"))}}};function zKp(e){let t=GKD(e)?QKD(e):JKD(e);return t=t.map(r=>r.toLowerCase()),t=vBe(t),t}function GKD(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function QKD(e){return e.split(/(?=[A-Z])/)}function JKD(e){return e.split(/[^a-zA-Z0-9]+/)}var HRo=class extends IDn{idempotent;constructor({breadcrumbs:t,operation:r,method:i,path:n,idempotent:a}){super({breadcrumbs:t,operation:r,method:i,path:n}),this.idempotent=a}async convert({context:t,errorCollector:r}){let i=this.convertHttpMethod();if(i==null)return;let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),{headers:u,pathParameters:l,queryParameters:d}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"parameters"]}),s=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"requestBody"],group:n,method:a}),o=s?.value,c=await this.convertResponseBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"responses"],group:n,method:a});return{group:n,endpoint:{id:`${n?.join(".")??""}.${a}`,displayName:this.operation.summary,method:i,name:t.casingsGenerator.generateName(a),baseUrl:void 0,path:SV(this.path),pathParameters:l,queryParameters:d,headers:u,requestBody:o,sdkRequest:void 0,response:c?.value,errors:[],auth:this.operation.security!=null||t.spec.security!=null,availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description,userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:SV(this.path),allPathParameters:l,pagination:void 0,transport:void 0},inlinedTypes:this.inlinedTypes}}convertExamples({requestExamples:t,responseExamples:r,context:i}){return[]}};var $Ro=class extends IDn{constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t,operation:r,method:i,path:n})}async convert({context:t,errorCollector:r}){if(this.operation.operationId==null){r.collect({message:"Skipping webhook because no operation id present",path:this.breadcrumbs});return}if(this.operation.requestBody==null){r.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let i=this.convertHttpMethod();if(i==null)return;if(i!=="POST"&&i!=="GET"){r.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=[...this.breadcrumbs,"Payload"],{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:u}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:u,group:n,method:a}),c;if(o?.value.type==="inlinedRequestBody")c=RU.inlinedPayload({name:o.value.name,extends:o.value.extends,properties:o.value.properties});else if(o?.value.type==="reference")c=RU.reference({payloadType:o.value.requestBodyType,docs:o.value.docs});else return;return{group:n,webhook:{id:`${n?.join(".")??""}.${a}`,name:t.casingsGenerator.generateName(a),displayName:this.operation.summary,method:i,headers:l,payload:c,examples:[],availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description},inlinedTypes:this.inlinedTypes}}};var GRo=class extends Oy{pathItem;path;constructor({breadcrumbs:t,pathItem:r,path:i}){super({breadcrumbs:t}),this.pathItem=r,this.path=i}async convert({context:t,errorCollector:r}){let i=[],n=[],a={};for(let u of IKp){let l=this.pathItem[u];if(l==null)continue;let d=[...this.breadcrumbs,u],s=await this.tryParseAsWebhook({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});if(s!=null){n.push(s),Object.assign(a,s.inlinedTypes);continue}new BRo({breadcrumbs:d,operation:l}).convert({context:t,errorCollector:r})!=null;let b=await this.tryParseAsHttpEndpoint({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});b!=null&&(i.push(b),Object.assign(a,b.inlinedTypes))}return{endpoints:i,webhooks:n,inlinedTypes:a}}async tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){return new xRo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a})?await new $Ro({breadcrumbs:i,operation:t,method:pJs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert({context:n,errorCollector:a}):void 0}async tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){new CRo({breadcrumbs:i,operation:t,document:n.spec}).convert({context:n,errorCollector:a})!=null;let s=new qRo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a});return await new HRo({breadcrumbs:i,operation:t,method:pJs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:s}).convert({context:n,errorCollector:a})}};var QRo=class extends Oy{securityScheme;constructor({breadcrumbs:t,securityScheme:r}){super({breadcrumbs:t}),this.securityScheme=r}convert({context:t,errorCollector:r}){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return DR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return DR.basic({username:t.casingsGenerator.generateName("username"),password:t.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return DR.header({name:{name:t.casingsGenerator.generateName(this.securityScheme.name),wireValue:this.securityScheme.name},valueType:pd.container(Ev.optional(pd.primitive({v1:"STRING",v2:Z_.string({default:void 0,validation:void 0})}))),prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return DR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var Fya=class extends sz{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r}){super({breadcrumbs:t}),this.server=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.server);if(!(i==null||typeof i!="string"))return i}};var JRo=class extends Oy{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;let i;return this.servers.some(a=>new Fya({breadcrumbs:this.breadcrumbs,server:a}).convert({context:t,errorCollector:r})!=null)?i=this.servers.map(a=>{let l=new Fya({breadcrumbs:this.breadcrumbs,server:a}).convert({context:t,errorCollector:r});if(l!=null)return{id:l,name:t.casingsGenerator.generateName(l),url:this.getServerUrl(a),docs:a.description}}).filter(Qb):i=[{id:"default",name:t.casingsGenerator.generateName("Default"),url:this.getServerUrl(this.servers[0]),docs:this.servers[0].description}],{defaultEnvironment:i[0]?.id,environments:BU.singleBaseUrl({environments:i})}}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[i,n]of Object.entries(t.variables))n.default!=null&&(r=r.replace(`{${i}}`,n.default));return r}};var Lya=class extends Oy{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:uc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:uc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.convertServers({context:t,errorCollector:r}),await this.convertSecuritySchemes({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertPaths({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...mNi({ir:i,exampleGeneration:{disabled:!1}})},i}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertSecuritySchemes({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.components?.securitySchemes??{})){let u;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(!s.resolved)continue;u=s.value}else u=a;let d=new QRo({breadcrumbs:["components","securitySchemes",n],securityScheme:u}).convert({context:t,errorCollector:r});d!=null&&i.push(d)}i.length>0&&(this.ir.auth={requirement:"ANY",schemes:i,docs:void 0})}convertServers({context:t,errorCollector:r}){let n=new JRo({breadcrumbs:["servers"],servers:t.spec.servers}).convert({context:t,errorCollector:r});n!=null&&(this.ir.environments=n)}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new Dpi({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertPaths({context:t,errorCollector:r}){let i={};for(let[n,a]of Object.entries(t.spec.paths??{})){if(a==null)continue;let l=await new GRo({breadcrumbs:["paths",n],pathItem:a,path:n}).convert({context:t,errorCollector:r});if(l!=null){for(let d of l.endpoints){let s=d.group?.join(".")??"";i[s]==null&&(i[s]=[]),i[s].push(d.endpoint)}for(let d of l.webhooks){let s=d.group?.join(".")??"";this.ir.webhookGroups[s]==null&&(this.ir.webhookGroups[s]=[]),this.ir.webhookGroups[s].push(d.webhook)}this.ir.types={...this.ir.types,...l.inlinedTypes}}}this.addServicesToIr({groupToEndpoints:i,context:t}),this.addWebhookGroupsToIr({webhookGroups:this.ir.webhookGroups,context:t})}addServicesToIr({groupToEndpoints:t,context:r}){for(let[i,n]of Object.entries(t)){let a=i.split(".").map(l=>r.casingsGenerator.generateName(l)),u=a[a.length-1]??r.casingsGenerator.generateName("");this.ir.services[i]={name:{fernFilepath:{allParts:a,packagePath:a.slice(0,-1),file:u}},displayName:void 0,basePath:SV(""),headers:[],pathParameters:[],availability:void 0,endpoints:n,transport:void 0,encoding:void 0},i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].service=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.service=i}}addWebhookGroupsToIr({webhookGroups:t,context:r}){for(let[i,n]of Object.entries(t))this.ir.webhookGroups[i]=n,i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].webhooks=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.webhooks=i}};var Uya=class extends PNi{isReferenceObject(t){return t!=null&&"$ref"in t}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}async convertReferenceToTypeReference(t){let r=this.getTypeIdFromSchemaReference(t);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:pd.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return lSe.ReadOnly;if(r.writeOnly)return lSe.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new AG.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:a7.Deprecated,message:void 0}}};var KRo=class e extends Oy{static LIST_UNKNOWN=pd.container(Ev.list(pd.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new H5t({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:pd.container(Ev.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var YRo=class extends Oy{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:a0.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var XRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:a0.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new H5t({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new H5t({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:a0.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(Qb),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var ZRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator!=null){for(let[a,u]of Object.entries(this.schema.discriminator.mapping??{})){let l=new H5t({schemaOrReference:{$ref:u},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",a]}),d=t.getTypeIdFromSchemaReference({$ref:u}),s=await l.convert({context:t,errorCollector:r});if(s?.type!=null&&d!=null){let o=t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:a});i.push({docs:void 0,discriminantValue:o,availability:s.availability,displayName:void 0,shape:Z8.samePropertiesAsObject({typeId:d,name:t.casingsGenerator.generateName(d),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...s.inlinedTypes}}}return{union:a0.union({baseProperties:[],discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf||this.schema.oneOf.length===0)return;let i=[],n={};for(let[a,u]of this.schema.oneOf.entries()){let l=[...this.breadcrumbs,"oneOf",jNi(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new Rze({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:a0.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var kRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?pd.container(Ev.literal(k8.string(i))):pd.primitive({v1:"STRING",v2:Z_.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":case void 0:return pd.primitive({v1:"DOUBLE",v2:Z_.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return pd.primitive({v1:"FLOAT",v2:Z_.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return pd.primitive({v1:"LONG",v2:Z_.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return pd.primitive({v1:"UINT",v2:Z_.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return pd.primitive({v1:"UINT_64",v2:Z_.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?pd.container(Ev.literal(k8.boolean(i))):pd.primitive({v1:"BOOLEAN",v2:Z_.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var Rze=class extends Oy{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){if(this.schema.enum?.length){let u=new AG.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),d=new YRo({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:u}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let n=new kRo({schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:n,resolvedType:n}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let u=await new KRo({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:u.typeReference,resolvedType:u.typeReference}),context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.oneOf!=null){let u=await new ZRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.union,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let u=await new XRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.object,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:t.casingsGenerator.generateName(this.id)}}};var H5t=class extends Oy{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:l.reference,inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new Rze({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return pd.container(Ev.optional(t))}wrapInNullable(t){return pd.container(Ev.nullable(t))}};var Epi=class e extends Oy{static STRING=pd.primitive({v1:"STRING",v2:Z_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=pd.container(Ev.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new H5t({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:r.collect({message:`Unsupported parameter location: ${this.parameter.in}`,path:this.breadcrumbs});return}}};var eNo=class extends Oy{channel;channelPath;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[];this.channel.parameters&&await this.convertQueryParameters({context:t,errorCollector:r,queryParameters:n}),this.channel.bindings?.ws!=null&&(await this.convertHeaders({context:t,errorCollector:r,headers:a}),await this.convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:n}));let u;this.channel.subscribe!=null&&(u=await this.convertMessage({context:t,errorCollector:r,operation:this.channel.subscribe,defaultId:"subscribeEvent",breadcrumbName:"subscribeEvent"}));let l;this.channel.publish!=null&&(l=await this.convertMessage({context:t,errorCollector:r,operation:this.channel.publish,defaultId:"publishEvent",breadcrumbName:"publishEvent"}));let d=[];return u!=null&&d.push(u),l!=null&&d.push(l),{channel:{name:t.casingsGenerator.generateName(this.channelPath),displayName:this.channelPath,baseUrl:this.channel.servers?.[0],path:{head:this.channel.address??this.channelPath,parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:d,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertMessage({context:t,errorCollector:r,operation:i,defaultId:n,breadcrumbName:a}){let u;if("$ref"in i.message){let l=await t.resolveReference(i.message);l.resolved&&(i.message=l.value)}if("oneOf"in i.message)u=await new Rze({id:i.operationId??n,breadcrumbs:[...this.breadcrumbs,a],schema:i.message}).convert({context:t,errorCollector:r});else if("payload"in i.message){let l;if(t.isReferenceObject(i.message.payload)){let d=await t.resolveReference(i.message.payload);d.resolved&&(l=d.value)}else l=i.message.payload;l!=null&&(u=await new Rze({id:i.operationId??n,breadcrumbs:[...this.breadcrumbs,a],schema:l}).convert({context:t,errorCollector:r}))}if(u!=null){this.inlinedTypes={...this.inlinedTypes,...u.inlinedTypes,[u.typeDeclaration.name.typeId]:u.typeDeclaration};let l=u.typeDeclaration,d=uc.TypeReference.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:l.name.name,typeId:l.name.typeId,default:void 0,inline:!1}),s=uc.WebSocketMessageBody.reference({bodyType:d,docs:i.description});return{type:l.name.typeId,displayName:l.name.name.originalName,origin:"server",body:s,availability:await t.getAvailability({node:i,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:i.description}}}async convertQueryParameters({context:t,errorCollector:r,queryParameters:i}){for(let[n,a]of Object.entries(this.channel.parameters??{})){let u=a;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(s.resolved)u=s.value;else continue}let d=await new Epi({breadcrumbs:this.breadcrumbs,parameter:{...u,name:n,in:"query",description:a.description,required:a.required??!1}}).convert({context:t,errorCollector:r});d!=null&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type==="query"&&i.push(d.parameter))}}async convertHeaders({context:t,errorCollector:r,headers:i}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new Epi({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"header",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}async convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:i}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.query.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new Epi({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"query",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}};var tNo=class extends Oy{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let n=Object.entries(this.servers)[0]?.[1];if(n==null)return;let a=[{id:"default",name:t.casingsGenerator.generateName("Default"),url:this.constructServerUrl(n.protocol,n.url),docs:void 0}];return{defaultEnvironment:a[0]?.id,environments:BU.singleBaseUrl({environments:a})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var _Js="$message.",RKp="#/channels/",NKp="#/servers/",rNo=class extends Oy{channel;channelPath;operations;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,operations:n}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.operations=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[];this.channel.parameters&&await this.convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a});let u=Object.entries(this.operations).reduce((d,[s,o])=>{try{this.getChannelPathFromOperation(o)===this.channelPath&&(d[s]=o)}catch{}return d},{}),l=[];for(let[d,s]of Object.entries(u))for(let o of s.messages){let c=await t.convertReferenceToTypeReference(o);if(c.ok){let b=uc.WebSocketMessageBody.reference({bodyType:c.reference,docs:s.description});l.push({type:d,displayName:d,origin:s.action==="send"?"client":"server",body:b,availability:await t.getAvailability({node:s,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:s.description})}}return{channel:{name:t.casingsGenerator.generateName(this.channelPath),displayName:this.channelPath,baseUrl:this.resolveChannelServersFromReference(this.channel.servers??[],r),path:{head:this.channel.address??this.channelPath,parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:l,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a}){for(let u of Object.values(this.channel.parameters??{})){let l=u;if(t.isReferenceObject(u)){let g=await t.resolveReference(u);if(g.resolved)l=g.value;else continue}let d=this.convertChannelParameterLocation(u.location,r);if(d==null)continue;let{type:s,parameterKey:o}=d,b=await new Epi({breadcrumbs:this.breadcrumbs,parameter:{...l,name:o,in:s,required:!0}}).convert({context:t,errorCollector:r});if(b!=null)switch(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},b.type){case"path":i.push(b.parameter);break;case"query":n.push(b.parameter);break;case"header":a.push(b.parameter);break}}}convertChannelParameterLocation(t,r){try{let[i,n]=t.split("#/");if(i==null||n==null){r.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!i.startsWith(_Js)){r.collect({message:`Invalid location format: ${t}; expected ${_Js} prefix`,path:this.breadcrumbs});return}let a=i.substring(_Js.length);if(a!=="header"&&a!=="path"&&a!=="payload"){r.collect({message:`Invalid message type: ${a}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return a==="payload"?{type:"query",parameterKey:n}:{type:a,parameterKey:n}}catch{r.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t,r){if(t==null||t.length===0||t[0]==null)return;let i=t[0];if(!i.$ref.startsWith(NKp)){r.collect({message:`Failed to resolve server name from server ref ${i.$ref}`,path:this.breadcrumbs});return}let n=i.$ref.substring(NKp.length);if(n==null){r.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(RKp))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(RKp.length)}};var iNo=class extends Oy{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let n=Object.entries(this.servers)[0]?.[1];if(n==null)return;let a=[{id:"default",name:t.casingsGenerator.generateName("Default"),url:this.constructServerUrl(n.protocol,n.host),docs:void 0}];return{defaultEnvironment:a[0]?.id,environments:BU.singleBaseUrl({environments:a})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var Vya=class extends Oy{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:uc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:uc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.isAsyncAPIV3(t)&&(t.spec=this.deduplicateChannelMessages({document:t.spec,context:t,errorCollector:r}),await this.convertChannelMessages({context:t,errorCollector:r})),await this.convertSchemas({context:t,errorCollector:r}),await this.convertServers({context:t,errorCollector:r}),await this.convertChannels({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...mNi({ir:i,exampleGeneration:{disabled:!1}})},i}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}deduplicateChannelMessages({document:t,context:r,errorCollector:i}){let n={};for(let[u,l]of Object.entries(t.channels??{}))for(let[d,s]of Object.entries(l.messages??{}))n[d]||(n[d]=[]),n[d].push({channelPath:u,message:s});let a={...t};a.channels={...t.channels};for(let[u,l]of Object.entries(n))if(l.length!==1)for(let{channelPath:d,message:s}of l){let o=a.channels[d];if(o==null||o.messages==null)continue;let c=`${d}_${u}`,b={...o.messages,[c]:s},{[u]:g,...O}=b;o.messages=O}return a}async convertChannelMessages({context:t,errorCollector:r}){let i=t.spec;for(let[n,a]of Object.entries(i.channels??{}))for(let[u,l]of Object.entries(a.messages??{})){if(l.payload==null)continue;let d;if(t.isReferenceObject(l.payload)){let c=await t.resolveReference(l.payload);c.resolved&&(d=c.value)}else d=l.payload;if(d==null)continue;let o=await new Rze({id:u,breadcrumbs:["channels",n,"messages",u],schema:d}).convert({context:t,errorCollector:r});o!=null&&(this.ir.rootPackage.types.push(u),this.ir.types={...this.ir.types,...o.inlinedTypes,[u]:o.typeDeclaration})}}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new Rze({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertServers({context:t,errorCollector:r}){if(this.isAsyncAPIV3(t)){let i=t.spec.servers,a=new iNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}else{let i=t.spec.servers,a=new tNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}}async convertChannels({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.channels??{}))if(this.isAsyncAPIV3(t)){let u=t.spec.operations??{},d=await new rNo({breadcrumbs:["channels",i],channel:n,channelPath:i,operations:u}).convert({context:t,errorCollector:r});d!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[i]:d.channel},this.ir.types={...this.ir.types,...d.inlinedTypes})}else{let u=await new eNo({breadcrumbs:["channels",i],channel:n,channelPath:i}).convert({context:t,errorCollector:r});u!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[i]:u.channel},this.ir.types={...this.ir.types,...u.inlinedTypes})}this.addWebsocketsToIr({websocketChannels:this.ir.websocketChannels,context:t})}addWebsocketsToIr({websocketChannels:t,context:r}){if(t!=null)for(let[i,n]of Object.entries(t))i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].websocket=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.websocket=i}};var Wya=class extends PNi{isReferenceObject(t){return t!=null&&"$ref"in t}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}async convertReferenceToTypeReference(t){let r;return t.$ref.includes("schemas")?r=this.getTypeIdFromSchemaReference(t):t.$ref.includes("messages")&&(r=this.getTypeIdFromMessageReference(t)),r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:pd.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return lSe.ReadOnly;if(r.writeOnly)return lSe.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new AG.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:a7.Deprecated,message:void 0}}};var B7=class extends n_a{specs;sources;loader;constructor({specs:t,...r}){super({...r,respectReadonlySchemas:t.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:t.every(i=>i.settings?.respectNullableSchemas),onlyIncludeReferencedSchemas:t.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:t.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:t.every(i=>i.settings?.objectQueryParameters),exampleGeneration:t[0]?.settings?.exampleGeneration}),this.specs=t,this.sources=this.convertSpecsToIdentifiableSources(t),this.loader=new U5t(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await qze({context:t,specs:this.specs,relativePathToDependency:r});return YRi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:i?.exampleGeneration??this.exampleGeneration}})}async getIntermediateRepresentation({context:t}){let r=await qze({context:t,specs:this.specs}),i=await this.loader.loadDocuments({context:t,specs:r}),n;for(let a of i){let u=new Rya({logger:t.logger}),l;if(a.type==="openapi"){let d=new Uya({generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new Lya({context:d}).convert({context:d,errorCollector:u})}else if(a.type==="asyncapi"){let d=new Wya({generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new Vya({context:d}).convert({context:d,errorCollector:u})}else u.collect({message:`Unsupported document type: ${a}`,path:[]});u.hasErrors()&&(t.logger.info(`${a.type==="openapi"?"OpenAPI":"AsyncAPI"} Importer encountered errors:`),u.logErrors()),l!=null&&(n=n===void 0?l:lJs(n,l))}if(n===void 0)throw new Error("Failed to generate intermediate representation");return n}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new USe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.specs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(Qb)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let u=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(u)||(r.add(u),n.push({type:a.type,id:fie(),absoluteFilePath:u})),n},i)}};var FKp={None:"none",Header:"header"};var DNo={};Co(DNo,{ConjureAliasDeclaration:()=>lNo,ConjureArgument:()=>jNo,ConjureArgumentWithParamType:()=>PNo,ConjureAuthDefinition:()=>FDn,ConjureAuthDefinitionType:()=>ONo,ConjureDefinitions:()=>bNo,ConjureEndpointDefinition:()=>wNo,ConjureEnumDeclaration:()=>yNo,ConjureEnumVariant:()=>hNo,ConjureEnumWithDocs:()=>_No,ConjureObjectDeclaration:()=>pNo,ConjureParamType:()=>mNo,ConjurePrimitive:()=>cNo,ConjureService:()=>SNo,ConjureServiceName:()=>sNo,ConjureType:()=>qpi,ConjureTypeDeclaration:()=>vNo,ConjureTypeReference:()=>Tpi,ConjureTypeWithDocs:()=>fNo,ConjureTypes:()=>gNo,ConjureUnionDeclaration:()=>dNo,DefinitionFile:()=>pYp,WithDocs:()=>zXt,commons:()=>gJs,conjure:()=>OJs,services:()=>mJs,types:()=>PJs});var gJs={};Co(gJs,{WithDocs:()=>zXt});var kd={};Co(kd,{JsonError:()=>zDn,ParseError:()=>RDn,any:()=>eYp,bigint:()=>UKp,boolean:()=>tYp,booleanLiteral:()=>kKp,date:()=>VKp,discriminant:()=>lYp,enum_:()=>aNo,getObjectLikeUtils:()=>$5t,getObjectUtils:()=>wNi,getSchemaUtils:()=>$A,isProperty:()=>Api,lazy:()=>WKp,lazyObject:()=>YKp,list:()=>uNo,number:()=>rYp,object:()=>oNo,objectWithoutOptionalProperties:()=>KKp,optional:()=>hJs,property:()=>$Kp,record:()=>oYp,set:()=>uYp,string:()=>iYp,stringLiteral:()=>ZKp,transform:()=>yJs,undiscriminatedUnion:()=>cYp,union:()=>dYp,unknown:()=>nYp,withParsedProperties:()=>bJs});var YP={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",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function qM(e,t){return`Expected ${t}. Received ${KKD(e)}.`}function KKD(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 A5(e){return{...e,json:LKp(e.json),parse:LKp(e.parse)}}function LKp(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
1947
+ `}async function qze({context:e,specs:t,relativePathToDependency:r}){let i=new hzo({context:e}),n=t.filter(l=>l.type==="openapi").map(l=>({...l,relativePathToDependency:r})),a=t.filter(l=>l.type==="protobuf"),u=await Promise.all(a.map(async l=>_GD({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u]}async function _GD({generator:e,protobufSpec:t,relativePathToDependency:r}){return{type:"openapi",absoluteFilepath:await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally}),absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}var sKp=require("fs"),qDn=require("fs/promises");var cKp=require("os"),lKp=yi(require("path"),1),fKp=require("stream/promises"),dKp=yi(jRo(),1),pKp=yi(Lte(),1);var rJs=yi(JBi(),1);var aP;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(aP||(aP={}));var HJD=BQr();async function _Kp({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:aP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:aP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${XJD(s)}`},async o=>{switch(s.type){case"version":l=await KJD({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await JJD({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:Fo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var hKp="dependencies";var $JD="metadata.json",GJD=".fern";function QJD(e){return Xu(Wl.of((0,cKp.homedir)()),Xa.of(GJD),Xa.of(hKp),Xa.of(e.organization),Xa.of(e.apiName),Xa.of(e.version))}async function JJD({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let u=await a.workspace.getDefinition({context:t,relativePathToDependency:Xa.of(e.path)},i);return t.logger.info("Loaded..."),u}async function KJD({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=QJD(e),u=Xu(a,Xa.of(hKp)),l=Xu(a,Xa.of($JD)),d;if(!await Cf(u)||!await Cf(l)){t.logger.info("Downloading manifest...");let c=await HJD.definitionRegistry.get(rJs.FernFiddle.OrganizationId(e.organization),rJs.FernFiddle.ApiId(e.apiName),e.version);if(!c.ok){c.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:m=>{t.failWithoutThrowing("Failed to download API manifest",m)}});return}let b=c.body.yamlSchemaVersion!=null?parseInt(c.body.yamlSchemaVersion):void 0,g=oRi(r),O=oRi(c.body.cliVersion);if(b!=null){if(b>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${c.body.cliVersion}`);return}else if(b<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(g.major!==O.major||g.minor!==O.minor){t.failWithoutThrowing(`CLI version is ${c.body.cliVersion}. Expected ${g.major}.${g.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+c.body.definitionS3DownloadUrl),await(0,qDn.mkdir)(u,{recursive:!0});try{await YJD({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,qDn.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,qDn.readFile)(l)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:u,context:t,cliVersion:d.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function YJD({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await xR.get(e,{responseType:"stream"}),i=await pKp.default.dir(),n=lKp.default.join(i.path,"api.tgz");await(0,fKp.pipeline)(r.data,(0,sKp.createWriteStream)(n)),await(0,dKp.extract)({file:n,cwd:t})}function XJD(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Fo(e)}}var MKp=yi(mKp(),1);function wRo(e,t){for(let[r,i]of CN(e))kJD({relativeFilepath:r,failure:i,logger:t})}function kJD({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case aP.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case aP.FILE_READ:r.error("Failed to open file: "+e);break;case aP.FILE_MISSING:r.error("Missing file: "+e);break;case aP.FILE_PARSE:t.error instanceof gna?r.error(jie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case aP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of eKD(i))r.error(jie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case aP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case aP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${GYa}: `+t.dependencyName);break;case aP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case aP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case aP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(jie({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));for(let i of t.error.allErrors)i!==t.error.error&&r.debug(jie({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:Fo(t)}}function eKD(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var PKp=require("fs/promises");async function jKp(e,t){let r=[];for(let i of await qBe(e,t))r.push(await tKD({relativeFilepath:aT(e,i),absoluteFilepath:i}));return r}async function tKD({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,PKp.readFile)(t)).toString()}}async function wKp(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Kd.load(n.fileContents,{schema:Kd.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:aP.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}async function SKp({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all(CN(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(nY(b)>0)d[s]={type:aP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=_p(s);if(D4t(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:aP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await _Kp({dependencyName:typeof o.contents.export=="string"?o.contents.export:o.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});m.didSucceed?l[_p(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),nY(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var DKp=yi(require("path"),1);var aJs={};Co(aJs,{additionalProperties:()=>aKD,default:()=>uKD,definitions:()=>oKD,properties:()=>iKD,required:()=>nKD,type:()=>rKD});var rKD="object",iKD={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},nKD=["name"],aKD=!1,oKD={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},uKD={type:rKD,properties:iKD,required:nKD,additionalProperties:aKD,definitions:oKD};var oJs={};Co(oJs,{additionalProperties:()=>lKD,default:()=>dKD,definitions:()=>fKD,properties:()=>cKD,type:()=>sKD});var sKD="object",cKD={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},lKD=!1,fKD={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},dKD={type:sKD,properties:cKD,additionalProperties:lKD,definitions:fKD};var uJs={};Co(uJs,{additionalProperties:()=>hKD,default:()=>vKD,definitions:()=>yKD,properties:()=>_KD,type:()=>pKD});var pKD="object",_KD={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},hKD=!1,yKD={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},vKD={type:pKD,properties:_KD,additionalProperties:hKD,definitions:yKD};function EKp({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of CN(e)){let d=l.contents,s=o=>{a[u]={type:aP.JSONSCHEMA_VALIDATION,error:o}};if(u===Q3){let o=DGr(d,aJs);if(o.success){let c=l2.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(DKp.default.basename(u)===X1){let o=DGr(d,uJs);if(o.success){let c=l2.serialization.PackageMarkerFileSchema.parseOrThrow(d);n[u]={defaultUrl:typeof c.export=="object"?c.export.url:void 0,contents:c,rawContents:l.rawContents}}else s(o)}else{let o=DGr(d,oJs);if(o.success){let c=l2.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:Xu(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[Xa.of(Q3)]:{type:aP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var wpi=class extends D5t{context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,MKp.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=Xu(this.absoluteFilePath,Xa.of(R8)),l=await Dys({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await jKp(u,"{yml,yaml}"),s=await wKp(d);if(!s.didSucceed)return wRo(s.failures,a.logger),a.failAndThrow();let o=EKp({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return wRo(o.failures,a.logger),a.failAndThrow();let c=await SKp({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return wRo(c.failures,a.logger),a.failAndThrow();n=new USe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:{absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions},cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};function SV(e){let t=gKD(e),{value:r,done:i}=sJs(t,"{");return i?{head:r,parts:[]}:{head:r,parts:[...bKD(t)]}}function*bKD(e){let t;do{let{value:r}=sJs(e,"}"),i=sJs(e,"{");t=i.done,yield{pathParameter:r,tail:i.value}}while(!t)}function*gKD(e){for(let t of e)yield t}function sJs(e,t){let r="",i=e.next();for(;i.done!==!0&&i.value!==t;)r+=i.value,i=e.next();return{value:r,done:i.done??!1}}function Iya(e){let t=2166136261;function r(n,a){if(typeof n=="object"&&n!=null){if(a>64){i("[MaxDepthExceeded]");return}if(Array.isArray(n)){i("[");for(let u=0;u<n.length;u++)u>0&&i(","),r(n[u],a+1);i("]")}else i("{"),Object.keys(n).sort().forEach((l,d)=>{d>0&&i(","),i(l),i(":"),r(n[l],a+1)}),i("}")}else i(String(n))}function i(n){for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);t^=u,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24),t>>>=0}}return r(e,0),t.toString(16)}function AKp({fieldName:e,containerType:t,maxDepth:r,currentDepth:i,typeDeclarations:n,skipOptionalProperties:a}){if(i>=r)return IXt({containerType:t});switch(t.type){case"list":{let u=ZT({fieldName:e,typeReference:t.list,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.list({list:[u.example,u.example],itemType:t.list}),jsonExample:[u.jsonExample,u.jsonExample]}}case"literal":return{type:"success",example:GO.literal({literal:t.literal._visit({boolean:u=>n_.boolean(u),string:u=>n_.string({original:u}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:t.literal._visit({boolean:u=>u,string:u=>u,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":{if(a)return IXt({containerType:t});let u=ZT({fieldName:e,typeReference:t.optional,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.optional({optional:u.example,valueType:t.optional}),jsonExample:u.jsonExample}}case"nullable":{if(a)return IXt({containerType:t});let u=ZT({fieldName:e,typeReference:t.nullable,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.nullable({nullable:u.example,valueType:t.nullable}),jsonExample:u.jsonExample}}case"set":{let u=ZT({fieldName:e,typeReference:t.set,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.set({set:[u.example],itemType:t.set}),jsonExample:[u.jsonExample]}}case"map":{let u=ZT({fieldName:e,typeReference:t.keyType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a}),l=ZT({fieldName:e,typeReference:t.valueType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"||l.type==="failure"?IXt({containerType:t}):{type:"success",example:GO.map({map:[{key:u.example,value:l.example}],keyType:t.keyType,valueType:t.valueType}),jsonExample:{[u.jsonExample]:l.jsonExample}}}default:Fo(t)}}function IXt({containerType:e}){switch(e.type){case"list":return{type:"success",example:GO.list({list:[],itemType:e.list}),jsonExample:[]};case"literal":return{type:"success",example:GO.literal({literal:e.literal._visit({boolean:t=>n_.boolean(t),string:t=>n_.string({original:t}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:e.literal._visit({boolean:t=>t,string:t=>t,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":return{type:"success",example:GO.optional({optional:void 0,valueType:e.optional}),jsonExample:void 0};case"nullable":return{type:"success",example:GO.nullable({nullable:void 0,valueType:e.nullable}),jsonExample:void 0};case"set":return{type:"success",example:GO.set({set:[],itemType:e.set}),jsonExample:[]};case"map":return{type:"success",example:GO.map({map:[],keyType:e.keyType,valueType:e.valueType}),jsonExample:{}};default:Fo(e)}}function TKp({fieldName:e,primitiveType:t}){switch(t.v1){case"STRING":return jKD({fieldName:e,validation:OKD(t.v2)});case"BASE_64":return{type:"success",example:n_.base64(Sg.BASE64),jsonExample:Sg.BASE64};case"BOOLEAN":return{type:"success",example:n_.boolean(Sg.BOOLEAN),jsonExample:Sg.BOOLEAN};case"DATE":return{type:"success",example:n_.date(Sg.DATE),jsonExample:Sg.DATE};case"DATE_TIME":return{type:"success",example:n_.datetime({datetime:new Date(Sg.DATE_TIME),raw:Sg.DATE_TIME}),jsonExample:Sg.DATE_TIME};case"DOUBLE":return wKD({fieldName:e,validation:mKD(t.v2)});case"FLOAT":return{type:"success",example:n_.float(Sg.FLOAT),jsonExample:Sg.FLOAT};case"INTEGER":return SKD({fieldName:e,validation:PKD(t.v2)});case"UINT_64":return{type:"success",example:n_.uint64(Sg.INT64),jsonExample:Sg.INT64};case"UINT":return{type:"success",example:n_.uint(Sg.UINT),jsonExample:Sg.UINT};case"BIG_INTEGER":return{type:"success",example:n_.bigInteger(Sg.INT64.toString()),jsonExample:`${Sg.INT64}`};case"LONG":return{type:"success",example:n_.long(Sg.INT64),jsonExample:Sg.INT64};case"UUID":return{type:"success",example:n_.uuid(Sg.UUID),jsonExample:Sg.UUID};default:Fo(t.v1)}}function OKD(e){if(e?.type==="string")return e.validation}function mKD(e){if(e?.type==="double")return e.validation}function PKD(e){if(e?.type==="integer")return e.validation}function qKp(e){if(e<=Sg.SAMPLE_STRINGS.length){let t=Sg.SAMPLE_STRINGS[e-1];if(t)return t;throw new Error(`Unexpected undefined value in SAMPLE_STRINGS at index ${e-1}`)}return Sg.SAMPLE_STRINGS[Sg.SAMPLE_STRINGS.length-1]+".".repeat(e-Sg.SAMPLE_STRINGS.length)}function jKD({fieldName:e,validation:t}){if(t){let i=t.minLength,n=t.maxLength;if(i){let a=qKp(i);return{type:"success",example:n_.string({original:a}),jsonExample:a}}else if(n){let a=qKp(n);return{type:"success",example:n_.string({original:a}),jsonExample:a}}}let r=e??Sg.STRING;return{type:"success",example:n_.string({original:r}),jsonExample:r}}function wKD({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:n_.double(r),jsonExample:r};if(i)return{type:"success",example:n_.double(i),jsonExample:i}}return{type:"success",example:n_.double(Sg.DOUBLE),jsonExample:Sg.DOUBLE}}function SKD({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:n_.integer(r),jsonExample:r};if(i)return{type:"success",example:n_.integer(i),jsonExample:i}}return{type:"success",example:n_.integer(Sg.INT),jsonExample:Sg.INT}}function ZT({fieldName:e,typeReference:t,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){if(n>i)return{type:"failure",message:"Exceeded max depth"};switch(t.type){case"named":{let u=r[t.typeId];if(u==null)return{type:"failure",message:`Failed to find type declaration with id ${t.typeId}`};let l=BDn({fieldName:e,typeDeclaration:u,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(l==null)return{type:"failure",message:"Failed to generate example for type declaration"};if(l.type==="failure")return l;let{example:d,jsonExample:s}=l;return{type:"success",example:{jsonExample:s,shape:Ab.named({shape:d,typeName:u.name})},jsonExample:s}}case"container":{let u=AKp({fieldName:e,containerType:t.container,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure"){let{example:s,jsonExample:o}=IXt({containerType:t.container});return{type:"success",example:{jsonExample:o,shape:Ab.container(s)},jsonExample:o}}let{example:l,jsonExample:d}=u;return{type:"success",example:{jsonExample:d,shape:Ab.container(l)},jsonExample:d}}case"primitive":{let{jsonExample:u,example:l}=TKp({fieldName:e,primitiveType:t.primitive});return{type:"success",example:{jsonExample:u,shape:Ab.primitive(l)},jsonExample:u}}case"unknown":{let u={key:"value"};return{type:"success",example:{jsonExample:u,shape:Ab.unknown(u)},jsonExample:u}}}}function xDn({typeReference:e,typeDeclarations:t}){if(e.type==="container"&&e.container.type==="optional")return!0;if(e.type==="named"){let r=t[e.typeId];if(r?.shape.type==="alias"&&r?.shape.resolvedType.type==="container"&&r?.shape.resolvedType.container.type==="optional")return!0}return!1}function BDn({fieldName:e,typeDeclarations:t,typeDeclaration:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){switch(r.shape.type){case"alias":{let u=ZT({fieldName:e,typeDeclarations:t,typeReference:r.shape.aliasOf,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure")return u;let{example:l,jsonExample:d}=u;return{type:"success",example:tw.alias({value:l}),jsonExample:d}}case"enum":{let u=r.shape.values[0];return u==null?{type:"failure",message:"No enum values present"}:{type:"success",example:tw.enum({value:u.name}),jsonExample:u.name.wireValue}}case"object":{let u={},l=[];if(r.shape.extends!=null)for(let c of r.shape.extends){let b=t[c.typeId];if(b==null)continue;let g=BDn({fieldName:e,typeDeclaration:b,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});g!=null&&g.type==="success"&&g.example.type==="object"&&(Object.assign(u,g.jsonExample),l.push(...g.example.properties))}let d=DKD({fieldName:e,typeDeclaration:r,objectTypeDeclaration:r.shape,typeDeclarations:t,currentDepth:n,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure")return d;let{example:s,jsonExample:o}=d;return{type:"success",example:tw.object({...s,properties:[...l,...s.properties]}),jsonExample:Object.assign({},u,o)}}case"undiscriminatedUnion":{let u=0;for(let l of r.shape.members){let d=ZT({fieldName:e,typeReference:l.type,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure"){++u;continue}let{example:s,jsonExample:o}=d;return{type:"success",example:tw.undiscriminatedUnion({index:u,singleUnionType:s}),jsonExample:o}}break}case"union":{let u=r.shape.discriminant,l={};if(r.shape.baseProperties!=null)for(let d of r.shape.baseProperties){let s=ZT({fieldName:d.name.wireValue,typeReference:d.valueType,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});s.type==="success"&&(l[d.name.wireValue]=s.jsonExample)}for(let d of r.shape.types){let s=d.shape._visit({noProperties:()=>({type:"success",example:tw.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:QN.noProperties()}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...l}}),samePropertiesAsObject:o=>{let c=t[o.typeId];if(c==null)return{type:"failure",message:`Failed to find type declaration with id ${o.typeId}`};let b=BDn({currentDepth:n,maxDepth:i,fieldName:e,typeDeclaration:c,typeDeclarations:t,skipOptionalProperties:a});if(b==null)return{type:"failure",message:"Failed to generate example for type reference"};if(b.type==="failure")return b;let{example:g,jsonExample:O}=b;return{type:"success",example:tw.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:QN.samePropertiesAsObject({typeId:c.name.typeId,object:g.type==="object"?g:{properties:[]}})}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...typeof O=="object"?O:{},...l}}},singleProperty:o=>{let c=ZT({currentDepth:n+1,maxDepth:i,fieldName:e,typeReference:o.type,typeDeclarations:t,skipOptionalProperties:a});if(c.type==="failure")return c;let{example:b,jsonExample:g}=c;return{type:"success",example:tw.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:QN.singleProperty(b)}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,[o.name.wireValue]:g,...l}}},_other:()=>{throw new Error("Encountered unknown union type")}});if(s.type!=="failure")return s}}}return{type:"failure",message:"Failed to generate example for type reference"}}function DKD({fieldName:e,typeDeclaration:t,objectTypeDeclaration:r,typeDeclarations:i,maxDepth:n,currentDepth:a,skipOptionalProperties:u}){let l={},d=[];for(let s of[...r.properties??[],...r.extendedProperties??[]]){let o=ZT({fieldName:s.name.wireValue,typeReference:s.valueType,typeDeclarations:i,currentDepth:a+1,maxDepth:n,skipOptionalProperties:u});if(o.type==="failure"&&!xDn({typeDeclarations:i,typeReference:s.valueType}))return{type:"failure",message:`Failed to generate required property ${s.name.wireValue} b/c ${o.message}`};if(o.type==="failure")continue;let{example:c,jsonExample:b}=o;d.push({name:s.name,originalTypeDeclaration:t.name,value:c}),l[s.name.wireValue]=b}return{type:"success",example:tw.object({properties:d}),jsonExample:l}}var cJs=pd.primitive({v1:g0.String,v2:Z_.string({default:void 0,validation:void 0})});function zya({ir:e,endpoint:t,service:r,typeDeclarations:i,skipOptionalRequestProperties:n,generationResponse:a}){let u={name:void 0,endpointHeaders:[],endpointPathParameters:[],queryParameters:[],servicePathParameters:[],serviceHeaders:[],rootPathParameters:[],request:void 0,response:Cq.ok(KT.body(void 0)),docs:void 0},l=[{params:t.pathParameters,add:s=>u.endpointPathParameters.push(s)},{params:r.pathParameters,add:s=>u.servicePathParameters.push(s)},{params:e.pathParameters,add:s=>u.rootPathParameters.push(s)}];for(let s of l)for(let o of s.params){let c=ZT({fieldName:o.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}for(let s of t.queryParameters){if(n&&xDn({typeDeclarations:i,typeReference:s.valueType}))continue;let o=ZT({fieldName:s.name.name.originalName,currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:s.valueType,skipOptionalProperties:n});if(o.type==="failure")return o;let{example:c}=o;u.queryParameters.push({name:s.name,shape:s.allowMultiple?f2.exploded():f2.single(),value:c})}let d=[{params:t.headers,add:s=>u.endpointHeaders.push(s)},{params:r.headers,add:s=>u.serviceHeaders.push(s)}];for(let s of d)for(let o of s.params){if(n&&xDn({typeDeclarations:i,typeReference:o.valueType}))continue;let c=ZT({fieldName:o.name.name.originalName,currentDepth:0,maxDepth:1,typeDeclarations:i,typeReference:o.valueType,skipOptionalProperties:n});if(c.type==="failure")return c;let{example:b}=c;s.add({name:o.name,value:b})}if(t.requestBody!=null)switch(t.requestBody.type){case"bytes":return{type:"failure",message:"Bytes request unsupported"};case"fileUpload":return{type:"failure",message:"File upload unsupported"};case"inlinedRequestBody":{let s={},o=[];if(t.requestBody.extends!=null)for(let c of t.requestBody.extends){let b=i[c.typeId];if(b==null)throw new Error(`Failed to find extended type declaration with id ${c.typeId}`);let g=BDn({typeDeclaration:b,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});g!=null&&g.type==="success"&&Object.assign(s,g.jsonExample)}for(let c of[...t.requestBody.properties??[],...t.requestBody.extendedProperties??[]]){let b=ZT({fieldName:c.name.wireValue,typeReference:c.valueType,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});if(b.type==="failure"&&!xDn({typeDeclarations:i,typeReference:c.valueType}))return{type:"failure",message:`Failed to generate required property ${c.name.wireValue} b/c ${b.message}`};if(b.type==="failure")continue;let{example:g,jsonExample:O}=b;o.push({name:c.name,originalTypeDeclaration:void 0,value:g}),s[c.name.wireValue]=O}u.request=U$.inlinedRequestBody({jsonExample:s,properties:o});break}case"reference":{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.requestBody.requestBodyType,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.request=U$.reference(o);break}default:Fo(t.requestBody)}if(a.type==="success"&&t.response?.body!=null)switch(t.response.body.type){case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.responseBodyType,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.body({...o,jsonExample:c}));break}case"streamParameter":{let s;switch(t.response.body.nonStreamResponse.type){case"bytes":return{type:"failure",message:"Bytes unsupported"};case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.nonStreamResponse.value.responseBodyType,skipOptionalProperties:!1});break;case"text":s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:cJs,skipOptionalProperties:!1});break;default:Fo(t.response.body.nonStreamResponse)}if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.body({...o,jsonExample:c}));break}case"streaming":{let s;switch(t.response.body.value.type){case"sse":{if(s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.sse([{data:{...o,jsonExample:c},event:""}]));break}case"json":{if(s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.stream([{...o,jsonExample:c}]));break}case"text":{if(s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:cJs,skipOptionalProperties:!1}),s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.stream([{...o,jsonExample:c}]));break}default:Fo(t.response.body.value)}break}case"text":{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:cJs,skipOptionalProperties:!1});if(s.type==="failure")return s;let{example:o,jsonExample:c}=s;u.response=Cq.ok(KT.body({...o,jsonExample:c}));break}case"bytes":return{type:"failure",message:"Bytes unsupported"};default:Fo(t.response.body)}else if(a.type==="error")if(a.declaration.type==null)u.response=Cq.error({body:void 0,error:a.declaration.name});else{let s=ZT({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:a.declaration.type,skipOptionalProperties:n});if(s.type==="failure")return s;let{example:o}=s;u.response=Cq.error({body:o,error:a.declaration.name})}try{return{type:"success",example:{id:Iya(u),url:EKD(t,u),...u},jsonExample:void 0}}catch(s){return{type:"failure",message:`Parse failure with exceptions ${s}`}}}function EKD(e,t){let r={};[...t.rootPathParameters,...t.servicePathParameters,...t.endpointPathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.fullPath.head+e.fullPath.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function mNi({ir:e,exampleGeneration:t}){for(let[r,i]of Object.entries(e.services))for(let n of i.endpoints){if(n.userSpecifiedExamples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let a=zya({ir:e,service:i,endpoint:n,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples,generationResponse:{type:"success"}});if(a.type==="failure")continue;let{example:u}=a;n.autogeneratedExamples=[{example:u}]}return e}function lJs(e,t){return{apiName:e.apiName,basePath:e.basePath,apiDisplayName:e.apiDisplayName??t.apiDisplayName,apiDocs:e.apiDocs??t.apiDocs,auth:e.auth??t.auth,headers:[...e.headers??[],...t.headers??[]],environments:e.environments??t.environments,types:{...e.types??{},...t.types??{}},constants:{...e.constants??{},...t.constants??{}},errors:{...e.errors??{},...t.errors??{}},services:{...e.services??{},...t.services??{}},webhookGroups:{...e.webhookGroups??{},...t.webhookGroups??{}},subpackages:{...e.subpackages??{},...t.subpackages??{}},websocketChannels:{...e.websocketChannels??{},...t.websocketChannels??{}},rootPackage:{service:e.rootPackage.service??t.rootPackage.service,types:[...e.rootPackage.types??[],...t.rootPackage.types??[]],errors:[...e.rootPackage.errors??[],...t.rootPackage.errors??[]],subpackages:[...e.rootPackage.subpackages??[],...t.rootPackage.subpackages??[]],fernFilepath:e.rootPackage.fernFilepath??t.rootPackage.fernFilepath,webhooks:e.rootPackage.webhooks??t.rootPackage.webhooks,websocket:e.rootPackage.websocket??t.rootPackage.websocket,hasEndpointsInTree:e.rootPackage.hasEndpointsInTree||t.rootPackage.hasEndpointsInTree,navigationConfig:e.rootPackage.navigationConfig??t.rootPackage.navigationConfig,docs:e.rootPackage.docs??t.rootPackage.docs},fdrApiDefinitionId:e.fdrApiDefinitionId??t.fdrApiDefinitionId,apiVersion:e.apiVersion??t.apiVersion,idempotencyHeaders:[...e.idempotencyHeaders??[],...t.idempotencyHeaders??[]],pathParameters:[...e.pathParameters??[],...t.pathParameters??[]],errorDiscriminationStrategy:e.errorDiscriminationStrategy??t.errorDiscriminationStrategy,variables:[...e.variables??[],...t.variables??[]],serviceTypeReferenceInfo:e.serviceTypeReferenceInfo??t.serviceTypeReferenceInfo,readmeConfig:e.readmeConfig??t.readmeConfig,sourceConfig:e.sourceConfig??t.sourceConfig,publishConfig:e.publishConfig??t.publishConfig,dynamic:e.dynamic??t.dynamic,sdkConfig:e.sdkConfig??t.sdkConfig}}var Oy=class{breadcrumbs=[];constructor({breadcrumbs:t=[]}={}){this.breadcrumbs=t}};var CKp={[Jb.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,G3(e)])),[Jb.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Jb.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Jb.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[Jb.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Jb.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[Jb.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Jb.GenerationLanguage.SWIFT]:new Set([])};var MKD=["go","ruby"];function ZSe({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:AKD({name:c,keywords:qKD({generationLanguage:e,keywords:t})})}),l=Dg(n),d=G3(l),s=aYa(n),o=Lra(l);return r&&(!BKD(o)&&(e==null||MKD.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=SRo(c);if(g!=null)return g;if(DRo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=SRo(c);return g??(DRo(c)?c.toUpperCase():b===0?G3(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(aYa).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function AKD({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":CKD(e)?"_"+e:e}function qKD({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return CKp[e]}var TKD=/^[0-9]/;function CKD(e){return TKD.test(e)}function BKD(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=SRo(i)!=null||DRo(i),a=SRo(t)!=null||DRo(t);return n&&a})}function SRo(e){return IKD.get(e.toUpperCase())}function DRo(e){return xKD.has(e.toUpperCase())}var xKD=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),IKD=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var PNi=class e{args;spec;settings;logger;generationLanguage;smartCasing;casingsGenerator;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.casingsGenerator=ZSe({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing})}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((n,a)=>!(/^\d+$/.test(n)||e.BREADCRUMBS_TO_IGNORE.includes(n)||a===0&&n==="components"||a===1&&n==="schemas"||t[0]==="paths"&&(a===0||a===1&&["get","post","put","delete","patch"].includes(n)||a===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&n==="parameters"))),i=Dg(r.join("_"));return i.charAt(0).toUpperCase()+i.slice(1)}createPackage(t={}){return{fernFilepath:{allParts:[],packagePath:[],file:t.name!=null?this.casingsGenerator.generateName(t.name):void 0},service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,navigationConfig:void 0}}async resolveReference(t){let r=this.spec,i;if(t.$ref.startsWith("http://")||t.$ref.startsWith("https://")){let a=t.$ref.split("#"),u=a[0];if(i=a[1],!u)return{resolved:!1};let l=await fetch(u);if(!l.ok)return{resolved:!1};try{let d=await l.text();try{r=JSON.parse(d)}catch{r=Kd.load(d)}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!i)return{resolved:!0,value:r}}let n=(i??t.$ref).replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(a=>a.replace(/~1/g,"/"));for(let a of n){if(typeof r!="object"||r==null)return{resolved:!1};r=r[a]}return r==null?{resolved:!1}:{resolved:!0,value:r}}createNamedTypeReference(t){return pd.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t??"defaultName"),typeId:t,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type!=="named")return;let r=t.typeId;return{typeId:r,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r)}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){return Object.fromEntries(Object.entries(r).filter(([i])=>i!==t))}maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}};var sz=class extends Oy{getExtensionValue(t){if(!(typeof t!="object"||t==null))return t[this.key]}};var Rya=class{errors=[];logger;constructor({logger:t}){this.logger=t}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}logErrors(){for(let t of this.errors)this.logger.log(V0.Info,jie({title:t.message,breadcrumbs:t.path,subtitle:t.path!=null?k_.dim(t.path.join(" -> ")):void 0}))}};var AG={};Co(AG,{FernAvailabilityExtension:()=>ERo,FernEnumExtension:()=>MRo,FernIgnoreExtension:()=>ARo});var ERo=class extends sz{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r}){super({breadcrumbs:t}),this.node=r}async convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.node);if(i==null||typeof i!="string")return;switch(i.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return a7.InDevelopment;case"PRE_RELEASE":return a7.PreRelease;case"GENERAL_AVAILABILITY":return a7.GeneralAvailability;case"DEPRECATED":return a7.Deprecated;default:return}}};var zKD=Yu.object({snake:Yu.string().optional(),camel:Yu.string().optional(),screamingSnake:Yu.string().optional(),pascal:Yu.string().optional()}),RKD=Yu.object({description:Yu.string().optional(),name:Yu.string().optional(),casing:zKD.optional()}),BKp=Yu.record(RKD);var MRo=class extends sz{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i==null)return;let n=BKp.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-enum extension: ${n.error.message}`,path:this.breadcrumbs});return}return n.data}};var ARo=class extends sz{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return i}}};function jNi(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","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 u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${jNi(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${jNi(a)}`}var pJs=yi(xKp(),1);var IKp=["get","post","put","delete","patch"];var qRo=class extends sz{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return i}}};var LKD=Yu.object({cursor:Yu.string(),next_cursor:Yu.string(),results:Yu.string()}),UKD=Yu.object({offset:Yu.string(),results:Yu.string(),step:Yu.string().optional(),"has-next-page":Yu.string().optional()}),fJs=Yu.union([Yu.boolean(),LKD,UKD]);var dJs="$request.",TRo="$response.",CRo=class extends sz{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i}){super({breadcrumbs:t}),this.operation=r,this.document=i}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=fJs.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){let a=this.getExtensionValue(this.document);if(a==null)return;if(typeof a=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let u=fJs.safeParse(a);if(!u.success){r.collect({message:`Invalid x-fern-pagination extension: ${u.error.message}`,path:this.breadcrumbs});return}if(typeof u.data=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig(u.data,t)}if(typeof n.data=="boolean"){r.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig(n.data,t)}convertPaginationConfig(t,r){let i=t;if("cursor"in i)return{type:"cursor",cursor:r.maybeTrimPrefix(i.cursor,dJs),nextCursor:r.maybeTrimPrefix(i.next_cursor,TRo),results:r.maybeTrimPrefix(i.results,TRo)};let n=t;return{type:"offset",offset:r.maybeTrimPrefix(n.offset,dJs),results:r.maybeTrimPrefix(n.results,TRo),step:n.step!=null?r.maybeTrimPrefix(n.step,dJs):void 0,hasNextPage:n["has-next-page"]!=null?r.maybeTrimPrefix(n["has-next-page"],TRo):void 0}}};var VKD="$request.",WKD=Yu.object({"stream-condition":Yu.string().optional(),format:Yu.enum(["sse","json"]).optional(),"stream-description":Yu.string().optional(),"response-stream":Yu.any(),response:Yu.any()}),HKD=Yu.union([Yu.boolean(),WKD]),BRo=class extends sz{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=HKD.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-streaming extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean")return n.data?{type:"stream",format:"json"}:void 0;if(n.data["stream-condition"]==null&&n.data.format!=null)return{type:"stream",format:n.data.format};if(n.data["stream-condition"]==null){r.collect({message:"Missing required stream-condition property",path:this.breadcrumbs});return}return{type:"streamCondition",format:n.data.format??"json",streamDescription:n.data["stream-description"],streamConditionProperty:t.maybeTrimPrefix(n.data["stream-condition"],VKD),responseStream:n.data["response-stream"],response:n.data.response}}};var xRo=class extends sz{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return i}}};var IRo=class extends sz{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=Array.isArray(i)?i.filter(a=>typeof a=="string"):typeof i=="string"?[i]:[];if(n.length!==0)return{groups:n}}};var zRo=class extends sz{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null&&typeof i=="string")return{methodName:i}}};var RRo=class e extends Oy{static LIST_UNKNOWN=pd.container(Ev.list(pd.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new cX({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:pd.container(Ev.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var NRo=class extends Oy{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:a0.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var FRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:a0.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new cX({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new cX({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:a0.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(Qb),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var LRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator!=null){for(let[a,u]of Object.entries(this.schema.discriminator.mapping??{})){let l=new cX({schemaOrReference:{$ref:u},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",a]}),d=t.getTypeIdFromSchemaReference({$ref:u}),s=await l.convert({context:t,errorCollector:r});if(s?.type!=null&&d!=null){let o=t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:a});i.push({docs:void 0,discriminantValue:o,availability:s.availability,displayName:void 0,shape:Z8.samePropertiesAsObject({typeId:d,name:t.casingsGenerator.generateName(d),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...s.inlinedTypes}}}return{union:a0.union({baseProperties:[],discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf||this.schema.oneOf.length===0)return;let i=[],n={};for(let[a,u]of this.schema.oneOf.entries()){let l=[...this.breadcrumbs,"oneOf",jNi(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new Dpi({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:a0.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var URo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?pd.container(Ev.literal(k8.string(i))):pd.primitive({v1:"STRING",v2:Z_.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":case void 0:return pd.primitive({v1:"DOUBLE",v2:Z_.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return pd.primitive({v1:"FLOAT",v2:Z_.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return pd.primitive({v1:"LONG",v2:Z_.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return pd.primitive({v1:"UINT",v2:Z_.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return pd.primitive({v1:"UINT_64",v2:Z_.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?pd.container(Ev.literal(k8.boolean(i))):pd.primitive({v1:"BOOLEAN",v2:Z_.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var Dpi=class extends Oy{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){if(this.schema.enum?.length){let u=new AG.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),d=new NRo({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:u}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let n=new URo({schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:n,resolvedType:n}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let u=await new RRo({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:u.typeReference,resolvedType:u.typeReference}),context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.oneOf!=null){let u=await new LRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.union,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let u=await new FRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.object,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:t.casingsGenerator.generateName(this.id)}}};var cX=class extends Oy{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:l.reference,inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new Dpi({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return pd.container(Ev.optional(t))}wrapInNullable(t){return pd.container(Ev.nullable(t))}};var Nya=class e extends Oy{static STRING=pd.primitive({v1:"STRING",v2:Z_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=pd.container(Ev.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new cX({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??e.STRING,location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:return}}};var VRo=class extends Oy{requestBody;group;method;constructor({breadcrumbs:t,requestBody:r,group:i,method:n}){super({breadcrumbs:t}),this.requestBody=r,this.group=i,this.method=n}async convert({context:t,errorCollector:r}){if(!this.requestBody.content)return;let i=Object.keys(this.requestBody.content).filter(u=>u.includes("json"));for(let u of i){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}let n=Object.keys(this.requestBody.content).filter(u=>u.includes("multipart"));for(let u of n){let l=[...this.group,this.method,"Request"].join("_"),d=await this.convertRequestSchemaForMediaType({schemaId:l,contentType:u,context:t,errorCollector:r});if(d!=null&&d.schema?.shape.type==="object")return{requestBody:eI.fileUpload({docs:this.requestBody.description,name:t.casingsGenerator.generateName(l),properties:d.schema?.shape.properties.map(o=>this.convertRequestBodyProperty({context:t,property:o,contentType:u}))}),inlinedTypes:t.removeSchemaFromInlinedTypes({id:l,inlinedTypes:d.inlinedTypes}),examples:d.examples}}let a=Object.keys(this.requestBody.content).filter(u=>u.includes("urlencoded"));for(let u of a){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}}async convertRequestSchemaForMediaType({schemaId:t,contentType:r,context:i,errorCollector:n}){let a=this.requestBody.content[r];if(a==null||a.schema==null)return;let l=await new cX({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:t}).convert({context:i,errorCollector:n});if(l==null)return;let d=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([s,o])=>[s,i.isReferenceObject(o)?await i.resolveReference(o):o]))):void 0;return{...l,examples:d}}async handleJsonOrFormContent({contentType:t,context:r,errorCollector:i}){let n=[...this.group,this.method,"Request"].join("_"),a=await this.convertRequestSchemaForMediaType({schemaId:n,contentType:t,context:r,errorCollector:i});if(a!=null)return a.schema?.shape.type==="object"?{requestBody:eI.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:r.casingsGenerator.generateName(n),extendedProperties:a.schema?.shape.extendedProperties,extends:a.schema?.shape.extends,properties:a.schema?.shape.properties,extraProperties:a.schema?.shape.extraProperties}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}:{requestBody:eI.reference({contentType:t,docs:this.requestBody.description,requestBodyType:a.type}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}}convertRequestBodyProperty({context:t,property:r,contentType:i}){return t.isFile(r.valueType)?GN.file(xU.file({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isFile(r.valueType.container.optional)?GN.file(xU.file({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isFile(r.valueType.container.list)?GN.file(xU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isOptional(r.valueType.container.list)&&t.isFile(r.valueType.container.list.container.optional)?GN.file(xU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isList(r.valueType.container.optional)&&t.isFile(r.valueType.container.optional.container.list)?GN.file(xU.fileArray({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):GN.bodyProperty({...r,contentType:i,style:void 0,name:r.name})}};var WRo=class extends Oy{responseBody;group;method;statusCode;constructor({breadcrumbs:t,responseBody:r,group:i,method:n,statusCode:a}){super({breadcrumbs:t}),this.responseBody=r,this.group=i,this.method=n,this.statusCode=a}async convert({context:t,errorCollector:r}){if(!this.responseBody.content)return;let i=Object.keys(this.responseBody.content).filter(n=>n.includes("json"));for(let n of[...i]){let a=this.responseBody.content[n];if(a==null||a.schema==null)continue;let u=[...this.group,this.method,"Response",this.statusCode].join("_"),d=await new cX({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:u}).convert({context:t,errorCollector:r});if(d==null)continue;let s=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([o,c])=>[o,t.isReferenceObject(c)?await t.resolveReference(c):c]))):void 0;if(n.includes("json"))return{responseBody:cT.json(sSe.response({responseBodyType:d.type,docs:this.responseBody.description})),inlinedTypes:d.inlinedTypes,examples:s}}}};var $KD=/{([^}]+)}/g,IDn=class extends Oy{operation;method;path;inlinedTypes={};constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t}),this.operation=r,this.method=i,this.path=n}convertHttpMethod(){switch(this.method){case"get":return o7.Get;case"post":return o7.Post;case"put":return o7.Put;case"delete":return o7.Delete;case"patch":return o7.Patch;default:return}}async convertParameters({context:t,errorCollector:r,breadcrumbs:i}){let n=[],a=[],u=[];if(!this.operation.parameters)return{pathParameters:n,queryParameters:a,headers:u};for(let s of this.operation.parameters){if(t.isReferenceObject(s)){let b=await t.resolveReference(s);if(b.resolved)s=b.value;else continue}let c=await new Nya({breadcrumbs:i,parameter:s}).convert({context:t,errorCollector:r});if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":n.push(c.parameter);break;case"query":a.push(c.parameter);break;case"header":u.push(c.parameter);break}}let d=[...this.path.matchAll($KD)].map(s=>s[1]).filter(s=>!n.some(o=>o.name.originalName===s));for(let s of d)s!=null&&n.push({name:t.casingsGenerator.generateName(s),valueType:Nya.STRING,docs:void 0,location:"ENDPOINT",variable:void 0});return{pathParameters:n,queryParameters:a,headers:u}}async convertRequestBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.requestBody==null)return;let u;if(t.isReferenceObject(this.operation.requestBody)){let s=await t.resolveReference(this.operation.requestBody);s.resolved&&(u=s.value)}else u=this.operation.requestBody;if(u==null)return null;let d=await new VRo({breadcrumbs:i,requestBody:u,group:n??[],method:a}).convert({context:t,errorCollector:r});if(d!=null)return this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},{value:d.requestBody,examples:d.examples}}async convertResponseBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.responses!=null)for(let[u,l]of Object.entries(this.operation.responses)){let d=parseInt(u);if(isNaN(d)||d<200||d>=300)continue;let s;if(t.isReferenceObject(l)){let b=await t.resolveReference(l);b.resolved&&(s=b.value)}else s=l;if(s==null)continue;let c=await new WRo({breadcrumbs:[...i,u],responseBody:s,group:n??[],method:a,statusCode:u}).convert({context:t,errorCollector:r});if(c!=null)return this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},{value:{statusCode:d,body:c.responseBody},examples:c.examples}}}computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r}){let n=new zRo({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.methodName,u=new IRo({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.groups??[];if(n!=null)return{group:u,method:n}}computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}){let i=this.operation.tags?.[0],n=this.operation.operationId;if(n==null){let l=this.operation.summary!=null?Dg(this.operation.summary):Dg(`${this.method}_${this.path.split("/").join("_")}`);return i!=null?{group:[i],method:l}:{method:l}}if(i==null)return{method:n};let a=zKp(i),u=zKp(n);return F1e(a,u)?{method:i}:this.computeGroupAndMethodFromTokens({tag:i,tagTokens:a,operationId:n,operationIdTokens:u})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,operationId:i,operationIdTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:Dg(u.join("_"))}}};function zKp(e){let t=GKD(e)?QKD(e):JKD(e);return t=t.map(r=>r.toLowerCase()),t=vBe(t),t}function GKD(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function QKD(e){return e.split(/(?=[A-Z])/)}function JKD(e){return e.split(/[^a-zA-Z0-9]+/)}var HRo=class extends IDn{idempotent;constructor({breadcrumbs:t,operation:r,method:i,path:n,idempotent:a}){super({breadcrumbs:t,operation:r,method:i,path:n}),this.idempotent=a}async convert({context:t,errorCollector:r}){let i=this.convertHttpMethod();if(i==null)return;let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),{headers:u,pathParameters:l,queryParameters:d}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"parameters"]}),s=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"requestBody"],group:n,method:a}),o=s?.value,c=await this.convertResponseBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"responses"],group:n,method:a});return{group:n,endpoint:{id:`${n?.join(".")??""}.${a}`,displayName:this.operation.summary,method:i,name:t.casingsGenerator.generateName(a),baseUrl:void 0,path:SV(this.path),pathParameters:l,queryParameters:d,headers:u,requestBody:o,sdkRequest:void 0,response:c?.value,errors:[],auth:this.operation.security!=null||t.spec.security!=null,availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description,userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:SV(this.path),allPathParameters:l,pagination:void 0,transport:void 0},inlinedTypes:this.inlinedTypes}}convertExamples({requestExamples:t,responseExamples:r,context:i}){return[]}};var $Ro=class extends IDn{constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t,operation:r,method:i,path:n})}async convert({context:t,errorCollector:r}){if(this.operation.operationId==null){r.collect({message:"Skipping webhook because no operation id present",path:this.breadcrumbs});return}if(this.operation.requestBody==null){r.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let i=this.convertHttpMethod();if(i==null)return;if(i!=="POST"&&i!=="GET"){r.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=[...this.breadcrumbs,"Payload"],{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:u}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:u,group:n,method:a}),c;if(o?.value.type==="inlinedRequestBody")c=RU.inlinedPayload({name:o.value.name,extends:o.value.extends,properties:o.value.properties});else if(o?.value.type==="reference")c=RU.reference({payloadType:o.value.requestBodyType,docs:o.value.docs});else return;return{group:n,webhook:{id:`${n?.join(".")??""}.${a}`,name:t.casingsGenerator.generateName(a),displayName:this.operation.summary,method:i,headers:l,payload:c,examples:[],availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description},inlinedTypes:this.inlinedTypes}}};var GRo=class extends Oy{pathItem;path;constructor({breadcrumbs:t,pathItem:r,path:i}){super({breadcrumbs:t}),this.pathItem=r,this.path=i}async convert({context:t,errorCollector:r}){let i=[],n=[],a={};for(let u of IKp){let l=this.pathItem[u];if(l==null)continue;let d=[...this.breadcrumbs,u],s=await this.tryParseAsWebhook({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});if(s!=null){n.push(s),Object.assign(a,s.inlinedTypes);continue}new BRo({breadcrumbs:d,operation:l}).convert({context:t,errorCollector:r})!=null;let b=await this.tryParseAsHttpEndpoint({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});b!=null&&(i.push(b),Object.assign(a,b.inlinedTypes))}return{endpoints:i,webhooks:n,inlinedTypes:a}}async tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){return new xRo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a})?await new $Ro({breadcrumbs:i,operation:t,method:pJs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert({context:n,errorCollector:a}):void 0}async tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){new CRo({breadcrumbs:i,operation:t,document:n.spec}).convert({context:n,errorCollector:a})!=null;let s=new qRo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a});return await new HRo({breadcrumbs:i,operation:t,method:pJs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:s}).convert({context:n,errorCollector:a})}};var QRo=class extends Oy{securityScheme;constructor({breadcrumbs:t,securityScheme:r}){super({breadcrumbs:t}),this.securityScheme=r}convert({context:t,errorCollector:r}){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return DR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return DR.basic({username:t.casingsGenerator.generateName("username"),password:t.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return DR.header({name:{name:t.casingsGenerator.generateName(this.securityScheme.name),wireValue:this.securityScheme.name},valueType:pd.container(Ev.optional(pd.primitive({v1:"STRING",v2:Z_.string({default:void 0,validation:void 0})}))),prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return DR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var Fya=class extends sz{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r}){super({breadcrumbs:t}),this.server=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.server);if(!(i==null||typeof i!="string"))return i}};var JRo=class extends Oy{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;let i;return this.servers.some(a=>new Fya({breadcrumbs:this.breadcrumbs,server:a}).convert({context:t,errorCollector:r})!=null)?i=this.servers.map(a=>{let l=new Fya({breadcrumbs:this.breadcrumbs,server:a}).convert({context:t,errorCollector:r});if(l!=null)return{id:l,name:t.casingsGenerator.generateName(l),url:this.getServerUrl(a),docs:a.description}}).filter(Qb):i=[{id:"default",name:t.casingsGenerator.generateName("Default"),url:this.getServerUrl(this.servers[0]),docs:this.servers[0].description}],{defaultEnvironment:i[0]?.id,environments:BU.singleBaseUrl({environments:i})}}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[i,n]of Object.entries(t.variables))n.default!=null&&(r=r.replace(`{${i}}`,n.default));return r}};var Lya=class extends Oy{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:uc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:uc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.convertServers({context:t,errorCollector:r}),await this.convertSecuritySchemes({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertPaths({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...mNi({ir:i,exampleGeneration:{disabled:!1}})},i}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertSecuritySchemes({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.components?.securitySchemes??{})){let u;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(!s.resolved)continue;u=s.value}else u=a;let d=new QRo({breadcrumbs:["components","securitySchemes",n],securityScheme:u}).convert({context:t,errorCollector:r});d!=null&&i.push(d)}i.length>0&&(this.ir.auth={requirement:"ANY",schemes:i,docs:void 0})}convertServers({context:t,errorCollector:r}){let n=new JRo({breadcrumbs:["servers"],servers:t.spec.servers}).convert({context:t,errorCollector:r});n!=null&&(this.ir.environments=n)}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new Dpi({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertPaths({context:t,errorCollector:r}){let i={};for(let[n,a]of Object.entries(t.spec.paths??{})){if(a==null)continue;let l=await new GRo({breadcrumbs:["paths",n],pathItem:a,path:n}).convert({context:t,errorCollector:r});if(l!=null){for(let d of l.endpoints){let s=d.group?.join(".")??"";i[s]==null&&(i[s]=[]),i[s].push(d.endpoint)}for(let d of l.webhooks){let s=d.group?.join(".")??"";this.ir.webhookGroups[s]==null&&(this.ir.webhookGroups[s]=[]),this.ir.webhookGroups[s].push(d.webhook)}this.ir.types={...this.ir.types,...l.inlinedTypes}}}this.addServicesToIr({groupToEndpoints:i,context:t}),this.addWebhookGroupsToIr({webhookGroups:this.ir.webhookGroups,context:t})}addServicesToIr({groupToEndpoints:t,context:r}){for(let[i,n]of Object.entries(t)){let a=i.split(".").map(l=>r.casingsGenerator.generateName(l)),u=a[a.length-1]??r.casingsGenerator.generateName("");this.ir.services[i]={name:{fernFilepath:{allParts:a,packagePath:a.slice(0,-1),file:u}},displayName:void 0,basePath:SV(""),headers:[],pathParameters:[],availability:void 0,endpoints:n,transport:void 0,encoding:void 0},i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].service=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.service=i}}addWebhookGroupsToIr({webhookGroups:t,context:r}){for(let[i,n]of Object.entries(t))this.ir.webhookGroups[i]=n,i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].webhooks=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.webhooks=i}};var Uya=class extends PNi{isReferenceObject(t){return t!=null&&"$ref"in t}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}async convertReferenceToTypeReference(t){let r=this.getTypeIdFromSchemaReference(t);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:pd.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return lSe.ReadOnly;if(r.writeOnly)return lSe.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new AG.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:a7.Deprecated,message:void 0}}};var KRo=class e extends Oy{static LIST_UNKNOWN=pd.container(Ev.list(pd.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new H5t({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:pd.container(Ev.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var YRo=class extends Oy{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:a0.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var XRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:a0.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new H5t({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new H5t({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:a0.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(Qb),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var ZRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator!=null){for(let[a,u]of Object.entries(this.schema.discriminator.mapping??{})){let l=new H5t({schemaOrReference:{$ref:u},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",a]}),d=t.getTypeIdFromSchemaReference({$ref:u}),s=await l.convert({context:t,errorCollector:r});if(s?.type!=null&&d!=null){let o=t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:a});i.push({docs:void 0,discriminantValue:o,availability:s.availability,displayName:void 0,shape:Z8.samePropertiesAsObject({typeId:d,name:t.casingsGenerator.generateName(d),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...s.inlinedTypes}}}return{union:a0.union({baseProperties:[],discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf||this.schema.oneOf.length===0)return;let i=[],n={};for(let[a,u]of this.schema.oneOf.entries()){let l=[...this.breadcrumbs,"oneOf",jNi(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new Rze({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:a0.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var kRo=class extends Oy{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?pd.container(Ev.literal(k8.string(i))):pd.primitive({v1:"STRING",v2:Z_.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":case void 0:return pd.primitive({v1:"DOUBLE",v2:Z_.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return pd.primitive({v1:"FLOAT",v2:Z_.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return pd.primitive({v1:"LONG",v2:Z_.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return pd.primitive({v1:"UINT",v2:Z_.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return pd.primitive({v1:"UINT_64",v2:Z_.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return pd.primitive({v1:"INTEGER",v2:Z_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?pd.container(Ev.literal(k8.boolean(i))):pd.primitive({v1:"BOOLEAN",v2:Z_.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var Rze=class extends Oy{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){if(this.schema.enum?.length){let u=new AG.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),d=new YRo({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:u}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let n=new kRo({schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:n,resolvedType:n}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let u=await new KRo({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:a0.alias({aliasOf:u.typeReference,resolvedType:u.typeReference}),context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.oneOf!=null){let u=await new ZRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.union,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let u=await new XRo({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:u.object,context:t,errorCollector:r}),inlinedTypes:u.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:t.casingsGenerator.generateName(this.id)}}};var H5t=class extends Oy{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:l.reference,inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new Rze({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return pd.container(Ev.optional(t))}wrapInNullable(t){return pd.container(Ev.nullable(t))}};var Epi=class e extends Oy{static STRING=pd.primitive({v1:"STRING",v2:Z_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=pd.container(Ev.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new H5t({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??(this.parameter.required?e.STRING:e.OPTIONAL_STRING),location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:r.collect({message:`Unsupported parameter location: ${this.parameter.in}`,path:this.breadcrumbs});return}}};var eNo=class extends Oy{channel;channelPath;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[];this.channel.parameters&&await this.convertQueryParameters({context:t,errorCollector:r,queryParameters:n}),this.channel.bindings?.ws!=null&&(await this.convertHeaders({context:t,errorCollector:r,headers:a}),await this.convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:n}));let u;this.channel.subscribe!=null&&(u=await this.convertMessage({context:t,errorCollector:r,origin:"server",operation:this.channel.subscribe,defaultId:"subscribeEvent",breadcrumbName:"subscribeEvent"}));let l;this.channel.publish!=null&&(l=await this.convertMessage({context:t,errorCollector:r,origin:"client",operation:this.channel.publish,defaultId:"publishEvent",breadcrumbName:"publishEvent"}));let d=[];return u!=null&&d.push(u),l!=null&&d.push(l),{channel:{name:t.casingsGenerator.generateName(this.channelPath),displayName:this.channelPath,baseUrl:this.channel.servers?.[0],path:{head:this.channel.address??this.channelPath,parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:d,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertMessage({context:t,errorCollector:r,origin:i,operation:n,defaultId:a,breadcrumbName:u}){let l;if("$ref"in n.message){let d=await t.resolveReference(n.message);d.resolved&&(n.message=d.value)}if("oneOf"in n.message)l=await new Rze({id:n.operationId??a,breadcrumbs:[...this.breadcrumbs,u],schema:n.message}).convert({context:t,errorCollector:r});else if("payload"in n.message){let d;if(t.isReferenceObject(n.message.payload)){let s=await t.resolveReference(n.message.payload);s.resolved&&(d=s.value)}else d=n.message.payload;d!=null&&(l=await new Rze({id:n.operationId??a,breadcrumbs:[...this.breadcrumbs,u],schema:d}).convert({context:t,errorCollector:r}))}if(l!=null){this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes,[l.typeDeclaration.name.typeId]:l.typeDeclaration};let d=l.typeDeclaration,s=uc.TypeReference.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:d.name.name,typeId:d.name.typeId,default:void 0,inline:!1}),o=uc.WebSocketMessageBody.reference({bodyType:s,docs:n.description});return{type:d.name.typeId,displayName:d.name.name.originalName,origin:i,body:o,availability:await t.getAvailability({node:n,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:n.description}}}async convertQueryParameters({context:t,errorCollector:r,queryParameters:i}){for(let[n,a]of Object.entries(this.channel.parameters??{})){let u=a;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(s.resolved)u=s.value;else continue}let d=await new Epi({breadcrumbs:this.breadcrumbs,parameter:{...u,name:n,in:"query",description:a.description,required:a.required??!1}}).convert({context:t,errorCollector:r});d!=null&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type==="query"&&i.push(d.parameter))}}async convertHeaders({context:t,errorCollector:r,headers:i}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new Epi({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"header",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}async convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:i}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.query.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new Epi({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"query",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}};var tNo=class extends Oy{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let n=Object.entries(this.servers)[0]?.[1];if(n==null)return;let a=[{id:"default",name:t.casingsGenerator.generateName("Default"),url:this.constructServerUrl(n.protocol,n.url),docs:void 0}];return{defaultEnvironment:a[0]?.id,environments:BU.singleBaseUrl({environments:a})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var _Js="$message.",RKp="#/channels/",NKp="#/servers/",rNo=class extends Oy{channel;channelPath;operations;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,operations:n}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.operations=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[];this.channel.parameters&&await this.convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a});let u=Object.entries(this.operations).reduce((d,[s,o])=>{try{this.getChannelPathFromOperation(o)===this.channelPath&&(d[s]=o)}catch{}return d},{}),l=[];for(let[d,s]of Object.entries(u))for(let o of s.messages){let c=await t.convertReferenceToTypeReference(o);if(c.ok){let b=uc.WebSocketMessageBody.reference({bodyType:c.reference,docs:s.description});l.push({type:d,displayName:d,origin:s.action==="send"?"client":"server",body:b,availability:await t.getAvailability({node:s,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:s.description})}}return{channel:{name:t.casingsGenerator.generateName(this.channelPath),displayName:this.channelPath,baseUrl:this.resolveChannelServersFromReference(this.channel.servers??[],r),path:{head:this.channel.address??this.channelPath,parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:l,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a}){for(let u of Object.values(this.channel.parameters??{})){let l=u;if(t.isReferenceObject(u)){let g=await t.resolveReference(u);if(g.resolved)l=g.value;else continue}let d=this.convertChannelParameterLocation(u.location,r);if(d==null)continue;let{type:s,parameterKey:o}=d,b=await new Epi({breadcrumbs:this.breadcrumbs,parameter:{...l,name:o,in:s,required:!0}}).convert({context:t,errorCollector:r});if(b!=null)switch(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},b.type){case"path":i.push(b.parameter);break;case"query":n.push(b.parameter);break;case"header":a.push(b.parameter);break}}}convertChannelParameterLocation(t,r){try{let[i,n]=t.split("#/");if(i==null||n==null){r.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!i.startsWith(_Js)){r.collect({message:`Invalid location format: ${t}; expected ${_Js} prefix`,path:this.breadcrumbs});return}let a=i.substring(_Js.length);if(a!=="header"&&a!=="path"&&a!=="payload"){r.collect({message:`Invalid message type: ${a}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return a==="payload"?{type:"query",parameterKey:n}:{type:a,parameterKey:n}}catch{r.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t,r){if(t==null||t.length===0||t[0]==null)return;let i=t[0];if(!i.$ref.startsWith(NKp)){r.collect({message:`Failed to resolve server name from server ref ${i.$ref}`,path:this.breadcrumbs});return}let n=i.$ref.substring(NKp.length);if(n==null){r.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(RKp))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(RKp.length)}};var iNo=class extends Oy{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let n=Object.entries(this.servers)[0]?.[1];if(n==null)return;let a=[{id:"default",name:t.casingsGenerator.generateName("Default"),url:this.constructServerUrl(n.protocol,n.host),docs:void 0}];return{defaultEnvironment:a[0]?.id,environments:BU.singleBaseUrl({environments:a})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var Vya=class extends Oy{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:uc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:uc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.isAsyncAPIV3(t)&&(t.spec=this.deduplicateChannelMessages({document:t.spec,context:t,errorCollector:r}),await this.convertChannelMessages({context:t,errorCollector:r})),await this.convertSchemas({context:t,errorCollector:r}),await this.convertServers({context:t,errorCollector:r}),await this.convertChannels({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...mNi({ir:i,exampleGeneration:{disabled:!1}})},i}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new AG.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}deduplicateChannelMessages({document:t,context:r,errorCollector:i}){let n={};for(let[u,l]of Object.entries(t.channels??{}))for(let[d,s]of Object.entries(l.messages??{}))n[d]||(n[d]=[]),n[d].push({channelPath:u,message:s});let a={...t};a.channels={...t.channels};for(let[u,l]of Object.entries(n))if(l.length!==1)for(let{channelPath:d,message:s}of l){let o=a.channels[d];if(o==null||o.messages==null)continue;let c=`${d}_${u}`,b={...o.messages,[c]:s},{[u]:g,...O}=b;o.messages=O}return a}async convertChannelMessages({context:t,errorCollector:r}){let i=t.spec;for(let[n,a]of Object.entries(i.channels??{}))for(let[u,l]of Object.entries(a.messages??{})){if(l.payload==null)continue;let d;if(t.isReferenceObject(l.payload)){let c=await t.resolveReference(l.payload);c.resolved&&(d=c.value)}else d=l.payload;if(d==null)continue;let o=await new Rze({id:u,breadcrumbs:["channels",n,"messages",u],schema:d}).convert({context:t,errorCollector:r});o!=null&&(this.ir.rootPackage.types.push(u),this.ir.types={...this.ir.types,...o.inlinedTypes,[u]:o.typeDeclaration})}}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new Rze({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertServers({context:t,errorCollector:r}){if(this.isAsyncAPIV3(t)){let i=t.spec.servers,a=new iNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}else{let i=t.spec.servers,a=new tNo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}}async convertChannels({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.channels??{}))if(this.isAsyncAPIV3(t)){let u=t.spec.operations??{},d=await new rNo({breadcrumbs:["channels",i],channel:n,channelPath:i,operations:u}).convert({context:t,errorCollector:r});d!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[i]:d.channel},this.ir.types={...this.ir.types,...d.inlinedTypes})}else{let u=await new eNo({breadcrumbs:["channels",i],channel:n,channelPath:i}).convert({context:t,errorCollector:r});u!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[i]:u.channel},this.ir.types={...this.ir.types,...u.inlinedTypes})}this.addWebsocketsToIr({websocketChannels:this.ir.websocketChannels,context:t})}addWebsocketsToIr({websocketChannels:t,context:r}){if(t!=null)for(let[i,n]of Object.entries(t))i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].websocket=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.websocket=i}};var Wya=class extends PNi{isReferenceObject(t){return t!=null&&"$ref"in t}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}async convertReferenceToTypeReference(t){let r;return t.$ref.includes("schemas")?r=this.getTypeIdFromSchemaReference(t):t.$ref.includes("messages")&&(r=this.getTypeIdFromMessageReference(t)),r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:pd.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return lSe.ReadOnly;if(r.writeOnly)return lSe.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new AG.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:a7.Deprecated,message:void 0}}};var B7=class extends n_a{specs;sources;loader;constructor({specs:t,...r}){super({...r,respectReadonlySchemas:t.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:t.every(i=>i.settings?.respectNullableSchemas),onlyIncludeReferencedSchemas:t.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:t.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:t.every(i=>i.settings?.objectQueryParameters),exampleGeneration:t[0]?.settings?.exampleGeneration}),this.specs=t,this.sources=this.convertSpecsToIdentifiableSources(t),this.loader=new U5t(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await qze({context:t,specs:this.specs,relativePathToDependency:r});return YRi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:i?.exampleGeneration??this.exampleGeneration}})}async getIntermediateRepresentation({context:t}){let r=await qze({context:t,specs:this.specs}),i=await this.loader.loadDocuments({context:t,specs:r}),n;for(let a of i){let u=new Rya({logger:t.logger}),l;if(a.type==="openapi"){let d=new Uya({generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new Lya({context:d}).convert({context:d,errorCollector:u})}else if(a.type==="asyncapi"){let d=new Wya({generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new Vya({context:d}).convert({context:d,errorCollector:u})}else u.collect({message:`Unsupported document type: ${a}`,path:[]});u.hasErrors()&&(t.logger.info(`${a.type==="openapi"?"OpenAPI":"AsyncAPI"} Importer encountered errors:`),u.logErrors()),l!=null&&(n=n===void 0?l:lJs(n,l))}if(n===void 0)throw new Error("Failed to generate intermediate representation");return n}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new USe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.specs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(Qb)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let u=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(u)||(r.add(u),n.push({type:a.type,id:fie(),absoluteFilePath:u})),n},i)}};var FKp={None:"none",Header:"header"};var DNo={};Co(DNo,{ConjureAliasDeclaration:()=>lNo,ConjureArgument:()=>jNo,ConjureArgumentWithParamType:()=>PNo,ConjureAuthDefinition:()=>FDn,ConjureAuthDefinitionType:()=>ONo,ConjureDefinitions:()=>bNo,ConjureEndpointDefinition:()=>wNo,ConjureEnumDeclaration:()=>yNo,ConjureEnumVariant:()=>hNo,ConjureEnumWithDocs:()=>_No,ConjureObjectDeclaration:()=>pNo,ConjureParamType:()=>mNo,ConjurePrimitive:()=>cNo,ConjureService:()=>SNo,ConjureServiceName:()=>sNo,ConjureType:()=>qpi,ConjureTypeDeclaration:()=>vNo,ConjureTypeReference:()=>Tpi,ConjureTypeWithDocs:()=>fNo,ConjureTypes:()=>gNo,ConjureUnionDeclaration:()=>dNo,DefinitionFile:()=>pYp,WithDocs:()=>zXt,commons:()=>gJs,conjure:()=>OJs,services:()=>mJs,types:()=>PJs});var gJs={};Co(gJs,{WithDocs:()=>zXt});var kd={};Co(kd,{JsonError:()=>zDn,ParseError:()=>RDn,any:()=>eYp,bigint:()=>UKp,boolean:()=>tYp,booleanLiteral:()=>kKp,date:()=>VKp,discriminant:()=>lYp,enum_:()=>aNo,getObjectLikeUtils:()=>$5t,getObjectUtils:()=>wNi,getSchemaUtils:()=>$A,isProperty:()=>Api,lazy:()=>WKp,lazyObject:()=>YKp,list:()=>uNo,number:()=>rYp,object:()=>oNo,objectWithoutOptionalProperties:()=>KKp,optional:()=>hJs,property:()=>$Kp,record:()=>oYp,set:()=>uYp,string:()=>iYp,stringLiteral:()=>ZKp,transform:()=>yJs,undiscriminatedUnion:()=>cYp,union:()=>dYp,unknown:()=>nYp,withParsedProperties:()=>bJs});var YP={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",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function qM(e,t){return`Expected ${t}. Received ${KKD(e)}.`}function KKD(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 A5(e){return{...e,json:LKp(e.json),parse:LKp(e.parse)}}function LKp(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
1948
1948
  `)),{ok:!0,value:t}):i}}function nNo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var zDn=class e extends Error{errors;constructor(t){super(t.map(nNo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var RDn=class e extends Error{errors;constructor(t){super(t.map(nNo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function $A(e){return{optional:()=>hJs(e),transform:t=>yJs(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new RDn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new zDn(i.errors)}}}function hJs(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>YP.OPTIONAL};return{...t,...$A(t)}}function yJs(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...$A(r)}}function UKp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:qM(t,"string")}]}:{ok:!0,value:BigInt(t)},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t.toString()}:{ok:!1,errors:[{path:r,message:qM(t,"bigint")}]},getType:()=>YP.BIGINT};return{...A5(e),...$A(e)}}var YKD=/^([+-]?\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 VKp(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:qM(t,"string")}]}:YKD.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:qM(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:qM(t,"Date object")}]},getType:()=>YP.DATE};return{...A5(e),...$A(e)}}function qG(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...A5(r),...$A(r)}}}function aNo(e){let t=new Set(e);return qG(YP.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:qM(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:qM(i,"enum")}]}:{ok:!0,value:i})()}function WKp(e){let t=vJs(e);return{...t,...$A(t)}}function vJs(e){return{parse:(t,r)=>NDn(e).parse(t,r),json:(t,r)=>NDn(e).json(t,r),getType:()=>NDn(e).getType()}}function NDn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function Hya(e){return Object.entries(e)}function $ya(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function Mpi(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 Gya(e){return Object.keys(e)}function HKp(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function $5t(e){return{withParsedProperties:t=>bJs(e,t)}}function bJs(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let u=Object.entries(t).reduce((l,[d,s])=>({...l,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(i,n)=>{if(!Mpi(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:qM(i,"object")}]};let a=new Set(Object.keys(t)),u=$ya(i,Object.keys(i).filter(l=>!a.has(l)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...$A(r),...$5t(r)}}function $Kp(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Api(e){return e.isProperty}function oNo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>Api(i)?i.rawKey:r),_getParsedProperties:()=>Gya(e),parse:(r,i)=>{let n={},a=[];for(let[u,l]of Hya(e)){let d=Api(l)?l.rawKey:u,s=Api(l)?l.valueSchema:l,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,JKp(s)&&a.push(d)}return GKp({value:r,requiredKeys:a,getProperty:u=>{let l=n[u];if(l!=null)return{transformedKey:l.parsedKey,transform:d=>l.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,u]of Hya(e)){let l=Api(u)?u.valueSchema:u;JKp(l)&&n.push(a)}return GKp({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return Api(u)?{transformedKey:u.rawKey,transform:l=>u.valueSchema.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:l=>u.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>YP.OBJECT};return{...A5(t),...$A(t),...$5t(t),...wNi(t)}}function GKp({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!Mpi(e))return{ok:!1,errors:[{path:a,message:qM(e,"object")}]};let u=new Set(t),l=[],d={};for(let[s,o]of Object.entries(e)){let c=r(s);if(c!=null){u.delete(s);let b=c.transform(o);b.ok?d[c.transformedKey]=b.value:(d[s]=o,l.push(...b.errors))}else switch(i){case"fail":l.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=o;break}}return l.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),l.length===0||n?{ok:!0,value:d}:{ok:!1,errors:l}}function wNi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>QKp({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>QKp({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>YP.OBJECT};return{...r,...$A(r),...$5t(r),...wNi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>YP.OBJECT};return{...t,...$A(t),...$5t(t),...wNi(t)}}}}function QKp({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=HKp(Gya(t),s=>n.has(s)),l=r($ya(t,u)),d=i($ya(t,a));return l.ok&&d.ok?{ok:!0,value:{...l.value,...d.value}}:{ok:!1,errors:[...l.ok?[]:l.errors,...d.ok?[]:d.errors]}}function JKp(e){return!XKD(e)}function XKD(e){switch(e.getType()){case YP.ANY:case YP.UNKNOWN:case YP.OPTIONAL:return!0;default:return!1}}function KKp(e){return oNo(e)}function YKp(e){let t={...vJs(e),_getRawProperties:()=>NDn(e)._getRawProperties(),_getParsedProperties:()=>NDn(e)._getParsedProperties()};return{...t,...$A(t),...$5t(t),...wNi(t)}}function uNo(e){let t={parse:(r,i)=>XKp(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>XKp(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>YP.LIST};return{...A5(t),...$A(t)}}function XKp(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:qM(e,"list"),path:[]}]}}function ZKp(e){return qG(YP.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:qM(r,`"${e}"`)}]})()}function kKp(e){return qG(YP.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:qM(r,`${e.toString()}`)}]})()}var eYp=qG(YP.ANY,e=>({ok:!0,value:e}));var tYp=qG(YP.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:qM(e,"boolean")}]});var rYp=qG(YP.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:qM(e,"number")}]});var iYp=qG(YP.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:qM(e,"string")}]});var nYp=qG(YP.UNKNOWN,e=>({ok:!0,value:e}));function oYp(e,t){let r={parse:(i,n)=>aYp({value:i,isKeyNumeric:e.getType()===YP.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>aYp({value:i,isKeyNumeric:e.getType()===YP.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>YP.RECORD};return{...A5(r),...$A(r)}}function aYp({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return Mpi(e)?Hya(e).reduce((a,[u,l])=>{if(l==null)return a;let d=a,s=u;if(t){let g=u.length>0?Number(u):NaN;isNaN(g)||(s=g)}let o=r(s),c=i(l,s);if(d.ok&&o.ok&&c.ok)return{ok:!0,value:{...d.value,[o.value]:c.value}};let b=[];return d.ok||b.push(...d.errors),o.ok||b.push(...o.errors),c.ok||b.push(...c.errors),{ok:!1,errors:b}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:qM(e,"object")}]}}function uYp(e){let t=uNo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:qM(i,"Set")}]},getType:()=>YP.SET};return{...A5(r),...$A(r)}}function cYp(e){let t={parse:(r,i)=>sYp((n,a)=>n.parse(r,a),e,i),json:(r,i)=>sYp((n,a)=>n.json(r,a),e,i),getType:()=>YP.UNDISCRIMINATED_UNION};return{...A5(t),...$A(t)}}function sYp(e,t,r){let i=[];for(let[n,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let l of u.errors)i.push({path:l.path,message:`[Variant ${n}] ${l.message}`})}return{ok:!1,errors:i}}function lYp(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function dYp(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=aNo(Gya(t)),a={parse:(u,l)=>fYp({value:u,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.parse(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),json:(u,l)=>fYp({value:u,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),getType:()=>YP.UNION};return{...A5(a),...$A(a),...$5t(a)}}function fYp({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:l=[]}){if(!Mpi(e))return{ok:!1,errors:[{path:l,message:qM(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:l,message:`Missing discriminant ("${t}")`}]};let o=i(d);if(!o.ok)return{ok:!1,errors:o.errors};let c=n(o.value);if(c==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...l,t],message:"Unexpected discriminant value"}]};let b=u(s,c);return b.ok?{ok:!0,value:{[r]:d,...b.value}}:b}var zXt=kd.objectWithoutOptionalProperties({docs:kd.string().optional()});var OJs={};Co(OJs,{ConjureServiceName:()=>sNo,DefinitionFile:()=>pYp});var sNo=kd.string();var cNo=kd.enum_(["rid","string","safelong","integer","double","boolean"]);var qpi=kd.undiscriminatedUnion([cNo,kd.string()]);var lNo=kd.objectWithoutOptionalProperties({alias:qpi,docs:kd.string().optional()});var fNo=kd.objectWithoutOptionalProperties({type:qpi,docs:kd.string().optional()});var Tpi=kd.undiscriminatedUnion([qpi,fNo]);var dNo=kd.objectWithoutOptionalProperties({union:kd.record(kd.string(),Tpi)});var pNo=kd.objectWithoutOptionalProperties({fields:kd.record(kd.string(),Tpi)});var _No=kd.objectWithoutOptionalProperties({value:kd.string()}).extend(zXt);var hNo=kd.undiscriminatedUnion([kd.string(),_No]);var yNo=kd.objectWithoutOptionalProperties({values:kd.list(hNo)});var vNo=kd.undiscriminatedUnion([lNo,dNo,pNo,yNo]);var bNo=kd.objectWithoutOptionalProperties({objects:kd.record(kd.string(),vNo).optional()});var gNo=kd.objectWithoutOptionalProperties({conjureImports:kd.property("conjure-imports",kd.record(kd.string(),kd.string()).optional()),definitions:bNo.optional()});var ONo=kd.enum_(["none","header"]);var FDn=kd.undiscriminatedUnion([ONo,kd.string()]);var mNo=kd.enum_(["path","query","body"]);var PNo=kd.objectWithoutOptionalProperties({paramType:kd.property("param-type",mNo),type:kd.string()}).extend(zXt);var jNo=kd.undiscriminatedUnion([kd.string(),PNo]);var wNo=kd.objectWithoutOptionalProperties({http:kd.string(),auth:FDn.optional(),args:kd.record(kd.string(),jNo).optional(),returns:Tpi.optional()}).extend(zXt);var SNo=kd.objectWithoutOptionalProperties({name:kd.string().optional(),package:kd.string().optional(),basePath:kd.property("base-path",kd.string().optional()),defaultAuth:kd.property("default-auth",FDn.optional()),endpoints:kd.record(kd.string(),wNo).optional()}).extend(zXt);var pYp=kd.objectWithoutOptionalProperties({types:gNo.optional(),services:kd.record(sNo,SNo).optional()});var mJs={};Co(mJs,{ConjureArgument:()=>jNo,ConjureArgumentWithParamType:()=>PNo,ConjureAuthDefinition:()=>FDn,ConjureAuthDefinitionType:()=>ONo,ConjureEndpointDefinition:()=>wNo,ConjureParamType:()=>mNo,ConjureService:()=>SNo});var PJs={};Co(PJs,{ConjureAliasDeclaration:()=>lNo,ConjureDefinitions:()=>bNo,ConjureEnumDeclaration:()=>yNo,ConjureEnumVariant:()=>hNo,ConjureEnumWithDocs:()=>_No,ConjureObjectDeclaration:()=>pNo,ConjurePrimitive:()=>cNo,ConjureType:()=>qpi,ConjureTypeDeclaration:()=>vNo,ConjureTypeReference:()=>Tpi,ConjureTypeWithDocs:()=>fNo,ConjureTypes:()=>gNo,ConjureUnionDeclaration:()=>dNo});var _Yp=require("fs/promises");async function hYp(e,t){let r=[];for(let i of await qBe(e,t))r.push(await ZKD({relativeFilepath:aT(e,i),absoluteFilepath:i}));return r}async function ZKD({relativeFilepath:e,absoluteFilepath:t}){let r=(await(0,_Yp.readFile)(t)).toString().replaceAll(/: rid(?:$|\s)/g,`: string
1949
1949
  `).replaceAll("<rid>","<string>").replaceAll("rid>","string>").replaceAll(": safelong",": long").replaceAll("<safelong>","<long>").replaceAll("safelong>","long>").replaceAll(": any",": unknown").replaceAll("<any>","<unknown>").replaceAll("any>","unknown>");return{relativeFilepath:e,absoluteFilepath:t,fileContents:DNo.DefinitionFile.parseOrThrow(Kd.load(r),{unrecognizedObjectKeys:"passthrough",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0})}}function yYp(e,t){if(kKD(e))return t.alias(e);if(eYD(e))return t.enum(e);if(tYD(e))return t.object(e);if(rYD(e))return t.union(e);Fo(e)}function kKD(e){return e?.alias!=null}function eYD(e){return e?.values!=null}function tYD(e){return e?.fields!=null}function rYD(e){return e?.union!=null}var Qya=class extends Jpa{fernDefinitionBuilder=new hRi(!1);conjureFilepathToFernFilepath={};async import({absolutePathToConjureFolder:t,authOverrides:r,environmentOverrides:i,globalHeaderOverrides:n}){if(r!=null){for(let[a,u]of Object.entries(r["auth-schemes"]??{}))this.fernDefinitionBuilder.addAuthScheme({name:a,schema:u});r.auth!=null&&this.fernDefinitionBuilder.setAuth(r.auth)}if(i!=null){for(let[a,u]of Object.entries(i.environments??{}))this.fernDefinitionBuilder.addEnvironment({name:a,schema:u});i["default-environment"]!=null&&this.fernDefinitionBuilder.setDefaultEnvironment(i["default-environment"]),i["default-url"]!=null&&this.fernDefinitionBuilder.setDefaultUrl(i["default-url"])}return await vYp(t,(a,u,l)=>{for(let[o,c]of Object.entries(l.services??{})){let b=uYa({value:o,suffix:"Service"});this.conjureFilepathToFernFilepath[u]=Xa.of(`${b}/__package__.yml`);return}let s=uys(u)?.split(".")[0];s!=null&&(this.conjureFilepathToFernFilepath[u]=Xa.of(`${s}/__package__.yml`))}),await vYp(t,(a,u,l)=>{if(l.services==null||Object.keys(l.services??{}).length===0){let d=this.conjureFilepathToFernFilepath[u];if(d==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${u}`);for(let[s,o]of Object.entries(l.types?.conjureImports??{})){let c=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:Xa.of(o)});this.fernDefinitionBuilder.addImport({file:d,fileToImport:Xa.of(c),alias:s})}this.importAllTypes({conjureFile:l,fernFilePath:d});return}for(let[d,s]of Object.entries(l.services)){let o=uYa({value:d,suffix:"Service"}),c=Xa.of(`${o}/__package__.yml`),b={};s.basePath!=null&&(b["base-path"]=s.basePath),s.docs!=null&&(b.docs=s.docs),this.fernDefinitionBuilder.setServiceInfo(c,b),this.importAllTypes({conjureFile:l,fernFilePath:c});for(let[g,O]of Object.entries(l.types?.conjureImports??{})){let m=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:Xa.of(O)});this.fernDefinitionBuilder.addImport({file:c,fileToImport:Xa.of(m),alias:g})}for(let[g,O]of Object.entries(s.endpoints??{})){let m=vds(O.http);if(m.type==="failure"){this.context?.logger.error(`Failed to parse ${O.http}. Skipping.`);continue}let E={auth:(O.auth??s.defaultAuth)!==FKp.None,path:m.path,method:m.method,response:O.returns==="binary"?"file":O.returns};O.docs!=null&&(E.docs=O.docs);let A={};if(O.args!=null)for(let q of m.pathParameters){let D=O.args[q];if(D==null)throw new Error(`Failed to find path parameter ${q} in ${O.http}`);A[q]=typeof D=="string"?D:{type:D.type}}Object.entries(A).length>0&&(E["path-parameters"]=A);for(let[q,D]of Object.entries(O.args??{}))if(A[q]==null)if(typeof D=="string")E.request?typeof E.request=="string"&&(E.request={body:E.request}):E.request={},E.request.body=D==="binary"?"bytes":D;else switch(D.paramType){case"body":E.request={body:D.type==="binary"?"bytes":D.type};break;case"query":E.request==null?E.request={"query-parameters":{[q]:D.type}}:typeof E.request!="string"&&E.request?.["query-parameters"]==null?E.request["query-parameters"]={[q]:D.type}:typeof E.request!="string"&&E.request?.["query-parameters"]!=null&&(E.request["query-parameters"][q]=D.type)}E.request!=null&&typeof E.request!="string"&&E.request?.["query-parameters"]!=null&&(E.request.name=`${g}Request`),this.fernDefinitionBuilder.addEndpoint(c,{name:g,schema:E,source:void 0})}}}),this.fernDefinitionBuilder.build()}importAllTypes({conjureFile:t,fernFilePath:r}){for(let[i,n]of Object.entries(t.types?.definitions?.objects??{}))yYp(n,{alias:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{type:a.alias,docs:a.docs}})},object:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{properties:a.fields}})},enum:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{enum:a.values}})},union:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{union:Object.fromEntries(Object.entries(a.union).map(([u,l])=>[u,{type:typeof l=="string"?l:l.type,docs:typeof l=="string"?void 0:l.docs,key:u}]))}})}})}getFernFileToImport({absoluteFilePathToConjureFile:t,importFilePath:r,absoluteFilePathToConjureFolder:i}){let n=Xu(_p(t),Xa.of(r)),a=gui(i,n),u=this.conjureFilepathToFernFilepath[a];if(u==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${a}`);return u}};async function vYp(e,t){for(let r of await hYp(e,"{yml,yaml}"))await t(r.absoluteFilepath,r.relativeFilepath,r.fileContents)}function bYp(e,t){return rd(e,t)}var ENo=class extends D5t{absolutePathToConjureFolder;constructor({relativePathToConjureDirectory:t,...r}){super(r),this.absolutePathToConjureFolder=Xu(r.absoluteFilePath,t)}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new USe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:void 0})}async getDefinition({context:t},r){let n=await new Qya(t).import({absolutePathToConjureFolder:this.absolutePathToConjureFolder,authOverrides:this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0,environmentOverrides:this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:Wl.of("/DUMMY_PATH"),rootApiFile:{defaultUrl:n.rootApiFile["default-url"],contents:n.rootApiFile,rawContents:Kd.dump(n.rootApiFile)},namedDefinitionFiles:{...bYp(n.definitionFiles,a=>({absoluteFilepath:Wl.of("/DUMMY_PATH"),rawContents:Kd.dump(a),contents:a})),[Xa.of(X1)]:{absoluteFilepath:Wl.of("/DUMMY_PATH"),rawContents:Kd.dump(n.packageMarkerFile),contents:n.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}getAbsoluteFilePaths(){return[this.absolutePathToConjureFolder]}};function jJs(e,t){for(let[r,i]of CN(e.failures))iYD({relativeFilepath:r,failure:i,logger:t})}function iYD({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case aP.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case aP.FILE_READ:r.error("Failed to open file: "+e);break;case aP.FILE_MISSING:r.error("Missing file: "+e);break;case aP.FILE_PARSE:t.error instanceof gna?r.error(jie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case aP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of nYD(i))r.error(jie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case aP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case aP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${GYa}: `+t.dependencyName);break;case aP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case aP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case aP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(jie({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));break;default:Fo(t)}}function nYD(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var gYp=require("fs/promises");async function OYp(e,t){let r=[];for(let i of await qBe(e,t))r.push(await aYD({relativeFilepath:aT(e,i),absoluteFilepath:i}));return r}async function aYD({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,gYp.readFile)(t)).toString()}}async function mYp({absolutePathToWorkspace:e}){let t=Xu(e,Xa.of(uLf));if(!await Cf(t))return;let i=await OYp(t,"{md,mdx}");return{files:await Promise.all(i.map(n=>({absoluteFilepath:n.absoluteFilepath,contents:n.fileContents})))}}async function wJs({absolutePathToWorkspace:e,namespace:t,definitions:r}){let i=[];for(let n of r){let a=n.overrides!=null?Xu(e,Xa.of(n.overrides)):void 0;if(n.schema.type==="protobuf"){let l=Xa.of(n.schema.root),d=Xu(e,l);if(!await Cf(d))return{didSucceed:!1,failures:{[Xa.of(n.schema.root)]:{type:aP.FILE_MISSING}}};let s=Xu(e,Xa.of(n.schema.target));if(!await Cf(s))return{didSucceed:!1,failures:{[Xa.of(n.schema.target)]:{type:aP.FILE_MISSING}}};i.push({type:"protobuf",absoluteFilepathToProtobufRoot:d,absoluteFilepathToProtobufTarget:s,absoluteFilepathToOverrides:a,relativeFilepathToProtobufRoot:l,generateLocally:n.schema.localGeneration,settings:{audiences:n.audiences??[],useTitlesAsName:n.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:n.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:n.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:n.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:n.settings?.objectQueryParameters??!1,respectReadonlySchemas:n.settings?.respectReadonlySchemas??!1,respectNullableSchemas:n.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:n.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:n.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:n.settings?.asyncApiMessageNaming??"v1",filter:n.settings?.filter,exampleGeneration:void 0,defaultFormParameterEncoding:n.settings?.defaultFormParameterEncoding}});continue}let u=Xu(e,Xa.of(n.schema.path));if(!await Cf(u))return{didSucceed:!1,failures:{[Xa.of(n.schema.path)]:{type:aP.FILE_MISSING}}};if(n.overrides!=null&&a!=null&&!await Cf(a))return{didSucceed:!1,failures:{[Xa.of(n.overrides)]:{type:aP.FILE_MISSING}}};i.push({type:"openapi",absoluteFilepath:u,absoluteFilepathToOverrides:a,settings:{audiences:n.audiences??[],useTitlesAsName:n.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:n.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:n.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:n.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:n.settings?.objectQueryParameters??!1,respectReadonlySchemas:n.settings?.respectReadonlySchemas??!1,respectNullableSchemas:n.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:n.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:n.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:n.settings?.asyncApiMessageNaming??"v1",filter:n.settings?.filter,exampleGeneration:n.settings?.exampleGeneration,defaultFormParameterEncoding:n.settings?.defaultFormParameterEncoding},source:{type:"openapi",file:u},namespace:t})}return i}async function Jya({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:i}){let n=await v8t({absolutePathToWorkspace:e,context:t}),a;try{a=await mYp({absolutePathToWorkspace:e})}catch{}if(n?.api!=null&&n?.api.type==="conjure")return{didSucceed:!0,workspace:new ENo({workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r,context:t,relativePathToConjureDirectory:Xa.of(n.api.pathToConjureDefinition)})};if(n?.api!=null&&(n.api.type==="singleNamespace"&&n.api.definitions.length>0||n.api.type==="multiNamespace")){let u=[];if(n.api.type==="singleNamespace"){let l=await wJs({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.definitions});if(!Array.isArray(l))return l;u.push(...l)}else{for(let[l,d]of Object.entries(n.api.definitions)){let s=await wJs({absolutePathToWorkspace:e,namespace:l,definitions:d});if(!Array.isArray(s))return s;u.push(...s)}if(n.api.rootDefinitions!=null){let l=await wJs({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.rootDefinitions});if(!Array.isArray(l))return l;u.push(...l)}}return{didSucceed:!0,workspace:new B7({specs:u,workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r})}}return await Cf(Xu(e,Xa.of(R8)))?{didSucceed:!0,workspace:new wpi({absoluteFilePath:e,generatorsConfiguration:n,workspaceName:i,changelog:a,context:t,cliVersion:r,loadAPIWorkspace:Jya})}:{didSucceed:!1,failures:{[Xa.of(QTi)]:{type:aP.MISCONFIGURED_DIRECTORY}}}}var PYp=require("fs/promises");var SJs={};Co(SJs,{additionalProperties:()=>cYD,default:()=>fYD,definitions:()=>lYD,properties:()=>uYD,required:()=>sYD,type:()=>oYD});var oYD="object",uYD={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{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"}]},"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"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{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"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]}},sYD=["instances"],cYD=!1,lYD={"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.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]}},additionalProperties:!1},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},private:{oneOf:[{type:"boolean"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]}},required:["url"],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.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"}]},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"}]}},required:["display-name","path"],additionalProperties:!1},"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"}]}},required:["page","path"],additionalProperties:!1},"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:[{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"}]}},required:["section","contents"],additionalProperties:!1},"docs.AudienceId":{type:"string"},"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"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{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"}]},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"}]},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"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{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.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:[{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{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.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.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItem":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfig":{type:"string"},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","primary","secondary"]}},required:["type"],oneOf:[{properties:{type:{const:"filled"},href:{oneOf:[{type:"string"},{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"},href:{oneOf:[{type:"string"},{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"},href:{oneOf:[{type:"string"},{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:"primary"},href:{oneOf:[{type:"string"},{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"},href:{oneOf:[{type:"string"},{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.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"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"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"}]}},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.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"}]}},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"}]}},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.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"}]},"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"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{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"}}]}},fYD={type:oYD,properties:uYD,required:sYD,additionalProperties:cYD,definitions:lYD};async function DJs({fernDirectory:e,context:t}){let r=Xu(e,Xa.of(B4t));if(!await Cf(r))return;let i=await dYD({absolutePathToDocsDefinition:e,context:t});if(i!=null)return{type:"docs",absoluteFilePath:e,config:i,workspaceName:void 0,absoluteFilepathToDocsConfig:Xu(e,Xa.of(B4t))}}async function dYD({absolutePathToDocsDefinition:e,context:t}){if(!await Cf(e))return;let r=Xu(e,Xa.of(B4t));return await pYD({absolutePathOfConfiguration:r,context:t})}async function pYD({absolutePathOfConfiguration:e,context:t}){let r=await(0,PYp.readFile)(e),i=Kd.load(r.toString()),n=DGr(i,SJs);if(n.success)return z4t.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(i);throw new Error(`Failed to parse docs.yml because of ${n.error?.message??"Unknown error"}`)}async function EJs({context:e,nameOverride:t,...r}){let i=await H4t(t);return i==null?e.failAndThrow(`Directory "${t??hU}" not found.`):await wYp({absolutePathToFernDirectory:i,context:e,nameOverride:t,...r})}async function wYp({absolutePathToFernDirectory:e,cliName:t,cliVersion:r,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n,context:a}){let u=[];return(await Cf(Xu(e,Xa.of(Xoi)))||await Cf(Xu(e,Xa.of(R8)))||await Cf(Xu(e,Xa.of(xN)))||await Cf(Xu(e,Xa.of(QTi)))||await Cf(Xu(e,Xa.of(sLf))))&&(u=await SYp({cliName:t,fernDirectory:e,cliVersion:r,context:a,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n})),{config:await nQr({directory:e,context:a}),apiWorkspaces:u,docsWorkspaces:await DJs({fernDirectory:e,context:a}),loadAPIWorkspace:l=>l==null?u[0]:u.find(d=>d.workspaceName===l)}}async function SYp({cliName:e,fernDirectory:t,context:r,cliVersion:i,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:a}){let u=Xu(t,Xa.of(Xoi));if(await Cf(u)){let o=(await(0,jYp.readdir)(u,{withFileTypes:!0})).reduce((g,O)=>(O.isDirectory()&&g.push(O.name),g),[]);if(n!=null){if(!o.includes(n))return r.failAndThrow("API does not exist: "+n)}else{if(o.length===0)return r.failAndThrow("No APIs found.");if(o.length>1&&!a){let g=`There are multiple workspaces. You must specify one with --api:
1950
1950
  `,O=Math.max(...o.map(m=>m.length));return g+=o.map(m=>{let w=`${e} ${process.argv.slice(2).join(" ")} --api ${m}`;return` \u203A ${Js.bold(m.padEnd(O))} ${Js.dim(w)}`}).join(`
@@ -1993,7 +1993,7 @@ ${U.stack}`)),O}};O=await A();let q=g.apiWorkspaces.flatMap($=>$.getAbsoluteFile
1993
1993
  `}),r.push(e[i]);return t&&e.length>0&&r.push({type:"text",value:`
1994
1994
  `}),r}function jv_(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Frc(e,t){let r=wv_(e,t),i=r.one(e,void 0),n=Pv_(r),a=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return n&&("children"in a,a.children.push({type:"text",value:`
1995
1995
  `},n)),a}var Sv_=require("fs");var ByE=["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"];function xyE({readFile:e=r=>(0,Sv_.readFileSync)(r,"utf-8"),...t}){let r=new Set,i=[t],n=[],a=[],u=1e3,l=0;do{if(l++,l>u)throw new Error("Infinite loop detected while collecting links and sources");let d=i.shift();if(d==null)break;let{content:s,absoluteFilepath:o}=d;if(o!=null){if(r.has(o))throw new Error(`Circular import detected: ${o}`);r.add(o)}let c=rEn(s),b=Frc(c,{allowDangerousHtml:!0,passThrough:[...ByE]});Rf(b,g=>{if(g.type==="mdxjsEsm"&&o!=null)return g.data?.estree&&WXt(g.data.estree,{enter:m=>{if(m.type==="ImportDeclaration"&&m.source.type==="Literal"&&typeof m.source.value=="string"){let w=Xa.of(m.source.value),E=MO(_p(o),w);(E.endsWith(".mdx")||E.endsWith(".md"))&&i.push({content:e(E),absoluteFilepath:E})}}}),"skip";if(g.type==="element"){let m=g.properties.href;typeof m=="string"&&n.push({href:m,sourceFilepath:o,position:g.position});let w=g.properties.src;typeof w=="string"&&a.push({src:w,sourceFilepath:o,position:g.position})}function O(m,w){iEn(m,{src:E=>{let A=NKr(E.value);typeof A=="string"&&a.push({src:A,sourceFilepath:o,position:w})},href:E=>{let A=NKr(E.value);typeof A=="string"&&n.push({href:A,sourceFilepath:o,position:w})}})}if(g.type==="mdxJsxFlowElement"||g.type==="mdxJsxTextElement"){let m=Fpi(g.attributes.filter(FKr).find(E=>E.name==="href")?.value),w=Fpi(g.attributes.filter(FKr).find(E=>E.name==="src")?.value);if(g.name==="Markdown"){if(o&&typeof w=="string"){let E=MO(_p(o),w);i.push({content:e(E),absoluteFilepath:E})}return"skip"}typeof m=="string"&&n.push({href:m,sourceFilepath:o,position:g.position}),typeof w=="string"&&a.push({src:w,sourceFilepath:o,position:g.position}),g.attributes.forEach(E=>{E.type==="mdxJsxAttribute"&&typeof E.value!="string"&&E.value!=null&&E.value.data?.estree?O(E.value.data.estree,E.position):E.type==="mdxJsxExpressionAttribute"&&E.data?.estree&&O(E.data.estree,E.position)})}(g.type==="mdxFlowExpression"||g.type==="mdxTextExpression")&&g.data?.estree&&O(g.data.estree,g.position)})}while(i.length>0);return{links:n,sources:a}}function Dv_({content:e,absoluteFilepath:t}){try{return xyE({content:e,absoluteFilepath:t})}catch{return{links:[],sources:[]}}}function Ev_({relativeFilepath:e,allRuleVisitors:t,addViolations:r}){function i(n){let a=async(u,l)=>{for(let d of t){let s=d[n];if(s!=null){let o=await s(u);r(o.map(c=>({name:c.name,severity:c.severity,relativeFilepath:c.relativeFilepath??Xa.of(""),nodePath:l,message:c.message})))}}};return{[n]:a}}return{...i("file"),...i("filepath"),...i("markdownPage"),...i("versionFile"),...i("apiSection"),...i("permissions")}}var qv_=require("fs/promises");async function IV({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:t,visitor:r,nodePath:i,willBeUploaded:n=!0}){let a=MO(_p(e),t);await r.filepath?.({absoluteFilepath:a,value:t,willBeUploaded:n},[a])}var Mv_=require("fs/promises");async function Urc({absolutePathToFernFolder:e,navigation:t,fernWorkspaces:r,visitor:i,absoluteFilepathToConfiguration:n,context:a,nodePath:u}){RyE(t)?await Promise.all(t.map(async(l,d)=>{l.layout!=null&&await Promise.all(l.layout.map(async(s,o)=>{await Lrc({absolutePathToFernFolder:e,navigationItem:s,visitor:i,nodePath:[...u,`${d}`,"layout",`${o}`],absoluteFilepathToConfiguration:n,fernWorkspaces:r,context:a})}))})):await Promise.all(t.map(async(l,d)=>{await Lrc({absolutePathToFernFolder:e,navigationItem:l,visitor:i,nodePath:[...u,`${d}`],absoluteFilepathToConfiguration:n,fernWorkspaces:r,context:a})}))}async function Lrc({absolutePathToFernFolder:e,navigationItem:t,visitor:r,nodePath:i,absoluteFilepathToConfiguration:n,fernWorkspaces:a,context:u}){if(await M$t(t,{alphabetized:Jo,api:Jo,apiName:Jo,audiences:Jo,openrpc:async l=>{l!=null&&await IV({absoluteFilepathToConfiguration:n,rawUnresolvedFilepath:l,visitor:r,nodePath:[...i,"openrpc"],willBeUploaded:!1})},displayErrors:Jo,snippets:Jo,summary:Jo,title:Jo,layout:Jo,icon:Jo,slug:Jo,hidden:Jo,skipSlug:Jo,paginated:Jo,playground:Jo,flattened:Jo,featureFlag:Jo,path:async l=>{l!=null&&await IV({absoluteFilepathToConfiguration:n,rawUnresolvedFilepath:l,visitor:r,nodePath:[...i,"path"],willBeUploaded:!1})},page:Jo,contents:async l=>{l!=null&&await Promise.all(l.map(async(d,s)=>{await Lrc({absolutePathToFernFolder:e,navigationItem:d,visitor:r,nodePath:[...i,"contents",`${s}`],absoluteFilepathToConfiguration:n,fernWorkspaces:a,context:u})}))},viewers:async l=>{l!=null&&l.length>0&&await r.permissions?.({viewers:l},[...i,"viewers"])},orphaned:Jo}),IyE(t)){let l=MO(_p(n),t.path);if(await Cf(l)){let d=(await(0,Mv_.readFile)(l)).toString();await r.markdownPage?.({title:t.page,content:d,absoluteFilepath:l},[...i,t.path]);try{let{filepaths:s}=Mva(d,{absolutePathToFernFolder:e,absolutePathToMarkdownFile:l});for(let o of s)await r.filepath?.({absoluteFilepath:o,value:aT(e,o),willBeUploaded:!0},[...i,t.path])}catch{}}}if(zyE(t)){let l=a.find(d=>d.workspaceName===t.apiName);l!=null&&await r.apiSection?.({config:t,workspace:l,context:u},[...i,"api"])}}function IyE(e){return e.page!=null}function zyE(e){return e.api!=null}function RyE(e){return e[0]?.tab!=null}async function Tv_({contents:e,visitor:t,absoluteFilepathToConfiguration:r,context:i,fernWorkspaces:n,absolutePathToFernFolder:a}){await t.file?.({config:e},[]),await M$t(e,{instances:Jo,analytics:Jo,announcement:Jo,backgroundImage:async u=>{u!=null&&(typeof u=="string"?await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u,visitor:t,nodePath:["background-image"]}):(u.dark!=null&&await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u.dark,visitor:t,nodePath:["background-image","dark"]}),u.light!=null&&await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u.light,visitor:t,nodePath:["background-image","light"]})))},colors:Jo,css:async u=>{u!=null&&(Array.isArray(u)?await Promise.all(u.map((l,d)=>IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:l,visitor:t,nodePath:["css",`${d}`],willBeUploaded:!1}))):await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u,visitor:t,nodePath:["css"],willBeUploaded:!1}))},defaultLanguage:Jo,experimental:Jo,favicon:async u=>{u!=null&&await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u,visitor:t,nodePath:["favicon"]})},footerLinks:Jo,integrations:Jo,js:async u=>{u!=null&&(Array.isArray(u)?await Promise.all(u.map((l,d)=>Av_({absoluteFilepathToConfiguration:r,visitor:t,script:l,nodePath:["js",`${d}`]}))):await Av_({absoluteFilepathToConfiguration:r,visitor:t,script:u,nodePath:["js"]}))},landingPage:Jo,layout:Jo,logo:async u=>{e.logo?.dark!=null&&await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:e.logo.dark,visitor:t,nodePath:["logo","dark"]}),e.logo?.light!=null&&await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:e.logo.light,visitor:t,nodePath:["logo","light"]})},metadata:Jo,navbarLinks:Jo,navigation:async u=>{u!=null&&await Urc({absolutePathToFernFolder:a,navigation:u,visitor:t,nodePath:["navigation"],absoluteFilepathToConfiguration:r,fernWorkspaces:n,context:i})},redirects:Jo,tabs:Jo,title:Jo,typography:async u=>{u!=null&&await M$t(u,{bodyFont:async l=>{l!=null&&await Vrc({absoluteFilepathToConfiguration:r,visitor:t,font:l,nodePath:["typography","bodyFont"]})},codeFont:async l=>{l!=null&&await Vrc({absoluteFilepathToConfiguration:r,visitor:t,font:l,nodePath:["typography","codeFont"]})},headingsFont:async l=>{l!=null&&await Vrc({absoluteFilepathToConfiguration:r,visitor:t,font:l,nodePath:["typography","headingsFont"]})}})},versions:async u=>{u!=null&&await Promise.all(u.map(async(l,d)=>{await IV({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:l.path,visitor:t,nodePath:["versions",`${d}`],willBeUploaded:!1});let s=MO(_p(r),l.path),o=Kd.load((await(0,qv_.readFile)(s)).toString());await Cf(s)&&await t.versionFile?.({path:l.path,content:o},[l.path]);let c=await C6o({value:o});c.type==="success"&&await Urc({absolutePathToFernFolder:a,navigation:c.contents.navigation,visitor:t,nodePath:["navigation"],absoluteFilepathToConfiguration:s,fernWorkspaces:n,context:i})}))},roles:Jo})}async function Vrc({absoluteFilepathToConfiguration:e,visitor:t,font:r,nodePath:i}){r.path!=null&&await IV({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:r.path,visitor:t,nodePath:i,willBeUploaded:!0});for(let n of r.paths??[])typeof n=="string"?await IV({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:n,visitor:t,nodePath:i,willBeUploaded:!0}):await IV({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:n.path,visitor:t,nodePath:i,willBeUploaded:!0})}async function Av_({absoluteFilepathToConfiguration:e,visitor:t,script:r,nodePath:i}){let n=typeof r=="string"?r:"path"in r?r.path:null;n&&await IV({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:n,visitor:t,nodePath:i,willBeUploaded:!0})}var Cv_={name:"accent-color-contrast",create:()=>({file:async({config:e})=>{if(e.colors==null)return[];let t=Aeo(e.colors);return t==="dark"?I6o(e.colors,"dark"):t==="light"?I6o(e.colors,"light"):t==="darkAndLight"?[...I6o(e.colors,"dark"),...I6o(e.colors,"light")]:[]}})};function I6o(e,t){let r=mna(e.accentPrimary??e.accentPrimaryDeprecated,"accent-primary",t),i=mna(e.background,"background",t)??(t==="dark"?"#000":"#FFF"),n=[];if(!i_(i).isValid())n.push({severity:"fatal",message:`Invalid background color provided for colors.background.${t}: ${i}.`});else{let a=NyE(i_(i),t);i_(i).toHexString()!==a.toHexString()&&n.push({severity:"warning",message:`The provided background color for ${t} mode is not ${t} enough. It will be adjusted to ${a.toHexString()}.`}),i=a.toHexString()}if(r==null)n.push({severity:"warning",message:`No accent-color provided for ${t} mode. A random color will be used.`});else if(!i_(r).isValid())n.push({severity:"fatal",message:`Invalid accent-color provided for colors.accent-primary.${t}: ${r}.`});else{let a=i_.readability(r,i),u=`${a.toFixed(2)}:1`;a<3?n.push({severity:"warning",message:`The contrast ratio between the accent color and the background color for ${t} mode is ${u}. It should be at least 3:1.`}):a<4.5?n.push({severity:"warning",message:`The contrast ratio between the accent color and the background color for ${t} mode is ${u}. Fern will adjust the color to meet the minimum contrast ratio of 4.5:1 for WCAG AA and 7:1 for WCAG AAA.`}):a<7&&n.push({severity:"warning",message:`The contrast ratio between the accent color and the background color for ${t} mode is ${u}. Fern will adjust the color to meet the minimum contrast ratio of 7:1 for WCAG AAA.`})}return n}function NyE(e,t){return t==="dark"&&e.isDark()||t==="light"&&e.isLight()?e:FyE(e)}function FyE(e){if(e==null)return;let{h:t,s:r,v:i}=e.toHsv();return i_({h:t,s:r,v:1-i})}var Bv_={name:"all-roles-must-be-declared",create:e=>{let t=e.workspace.config.roles;return{permissions:r=>{let i=[...r.viewers??[]],n=[];for(let a of i)(t==null||!t.includes(a))&&n.push({severity:"fatal",message:`Role "${a}" is used but not declared at the top level of the docs.yml file.`});return n}}}};var Wrc={name:"filepaths-exist",create:()=>({filepath:async({absoluteFilepath:e,value:t})=>await Cf(e)?[]:[{severity:"fatal",message:`Path ${t} does not exist`}]})};var Hrc={name:"only-versioned-navigation",create:()=>({file:async({config:e})=>e.navigation!=null&&e.versions!=null?[{severity:"fatal",message:"Cannot contain both navigation and versions. If you want versioned docs, use versions. Otherwise use navigation."}]:[]})};var $rc={name:"playground-environments-exist",create:()=>({apiSection:async({workspace:e,context:t,config:r})=>{let i=(await e.getDefinition({context:t})).rootApiFile.contents.environments,n=new Set(Object.keys(i??{})),a=r.playground?.environments;if(a==null||a.length==null)return[];let u=a.filter(l=>!n.has(l));return u.length===0?[]:u.length===1?[{severity:"fatal",message:`The API does not contain the ${u[0]} environment. ${xv_(Array.from(n))??""}`}]:[{severity:"fatal",message:`The API does not contain the following environments: ${u.join(", ")}. ${xv_(Array.from(n))??""}`}]}})};function xv_(e){if(e.length!==0)return e.length===1&&e[0]!=null?`The only configured environment is ${e[0]}`:`Existing environments include ${e.join(", ")}.`}var Grc={name:"valid-docs-endpoints",create:()=>({file:async({config:e})=>!e.analytics||!Object.keys(e.analytics).length?[]:[[e.analytics.intercom?.apiBase,"Intercom API Base"],[e.analytics.posthog?.endpoint,"Posthog Host Endpoint"]].filter(([i])=>i&&!LyE(i)).map(([i,n])=>({severity:"warning",message:`${n} <${i}> is malformed. Make sure it includes a protocol (e.g. 'https://')!`}))})};function LyE(e){try{return!!new URL(e).protocol}catch{return!1}}var fb_=yi(Qv_(),1);var lvE="End-Of-Stream",_z=class extends Error{constructor(){super(lvE)}};var V6o=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise((t,r)=>{this.reject=r,this.resolve=t})}};var fvE=1*1024*1024,$ba=class{constructor(t){if(this.s=t,this.deferred=null,this.endOfStream=!1,this.peekQueue=[],!t.read||!t.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",()=>this.reject(new _z)),this.s.once("error",r=>this.reject(r)),this.s.once("close",()=>this.reject(new Error("Stream closed")))}async peek(t,r,i){let n=await this.read(t,r,i);return this.peekQueue.push(t.subarray(r,r+n)),n}async read(t,r,i){if(i===0)return 0;if(this.peekQueue.length===0&&this.endOfStream)throw new _z;let n=i,a=0;for(;this.peekQueue.length>0&&n>0;){let u=this.peekQueue.pop();if(!u)throw new Error("peekData should be defined");let l=Math.min(u.length,n);t.set(u.subarray(0,l),r+a),a+=l,n-=l,l<u.length&&this.peekQueue.push(u.subarray(l))}for(;n>0&&!this.endOfStream;){let u=Math.min(n,fvE),l=await this.readFromStream(t,r+a,u);if(a+=l,l<u)break;n-=l}return a}async readFromStream(t,r,i){let n=this.s.read(i);if(n)return t.set(n,r),n.length;{let a={buffer:t,offset:r,length:i,deferred:new V6o};return this.deferred=a.deferred,this.s.once("readable",()=>{this.readDeferred(a)}),a.deferred.promise}}readDeferred(t){let r=this.s.read(t.length);r?(t.buffer.set(r,t.offset),t.deferred.resolve(r.length),this.deferred=null):this.s.once("readable",()=>{this.readDeferred(t)})}reject(t){this.endOfStream=!0,this.deferred&&(this.deferred.reject(t),this.deferred=null)}};var wic=require("buffer"),eMn=class{constructor(t){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=t||{}}async readToken(t,r=this.position){let i=wic.Buffer.alloc(t.len);if(await this.readBuffer(i,{position:r})<t.len)throw new _z;return t.get(i,0)}async peekToken(t,r=this.position){let i=wic.Buffer.alloc(t.len);if(await this.peekBuffer(i,{position:r})<t.len)throw new _z;return t.get(i,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new _z;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new _z;return t.get(this.numBuffer,0)}async ignore(t){if(this.fileInfo.size!==void 0){let r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){}normalizeOptions(t,r){if(r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return r?{mayBeLess:r.mayBeLess===!0,offset:r.offset?r.offset:0,length:r.length?r.length:t.length-(r.offset?r.offset:0),position:r.position?r.position:this.position}:{mayBeLess:!1,offset:0,length:t.length,position:this.position}}};var dvE=256e3,W6o=class extends eMn{constructor(t,r){super(r),this.streamReader=new $ba(t)}async getFileInfo(){return this.fileInfo}async readBuffer(t,r){let i=this.normalizeOptions(t,r),n=i.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(t,r);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(i.length===0)return 0;let a=await this.streamReader.read(t,i.offset,i.length);if(this.position+=a,(!r||!r.mayBeLess)&&a<i.length)throw new _z;return a}async peekBuffer(t,r){let i=this.normalizeOptions(t,r),n=0;if(i.position){let a=i.position-this.position;if(a>0){let u=new Uint8Array(i.length+a);return n=await this.peekBuffer(u,{mayBeLess:i.mayBeLess}),t.set(u.subarray(a),i.offset),n-a}else if(a<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{n=await this.streamReader.peek(t,i.offset,i.length)}catch(a){if(r&&r.mayBeLess&&a instanceof _z)return 0;throw a}if(!i.mayBeLess&&n<i.length)throw new _z}return n}async ignore(t){let r=Math.min(dvE,t),i=new Uint8Array(r),n=0;for(;n<t;){let a=t-n,u=await this.readBuffer(i,{length:Math.min(r,a)});if(u<0)return u;n+=u}return n}};var H6o=class extends eMn{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:t.length}async readBuffer(t,r){if(r&&r.position){if(r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=r.position}let i=await this.peekBuffer(t,r);return this.position+=i,i}async peekBuffer(t,r){let i=this.normalizeOptions(t,r),n=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new _z;return t.set(this.uint8Array.subarray(i.position,i.position+n),i.offset),n}async close(){}};function Jv_(e,t){return t=t||{},new W6o(e,t)}function Kv_(e,t){return new H6o(e,t)}var rYr=require("buffer");var Xv_=yi(Yv_(),1),Zv_=require("buffer");function Qie(e){return new DataView(e.buffer,e.byteOffset)}var kv_={len:1,get(e,t){return Qie(e).getUint8(t)},put(e,t,r){return Qie(e).setUint8(t,r),t+1}},$6o={len:2,get(e,t){return Qie(e).getUint16(t,!0)},put(e,t,r){return Qie(e).setUint16(t,r,!0),t+2}},G6o={len:2,get(e,t){return Qie(e).getUint16(t)},put(e,t,r){return Qie(e).setUint16(t,r),t+2}};var eb_={len:4,get(e,t){return Qie(e).getUint32(t,!0)},put(e,t,r){return Qie(e).setUint32(t,r,!0),t+4}},tb_={len:4,get(e,t){return Qie(e).getUint32(t)},put(e,t,r){return Qie(e).setUint32(t,r),t+4}};var rb_={len:4,get(e,t){return Qie(e).getInt32(t)},put(e,t,r){return Qie(e).setInt32(t,r),t+4}};var ib_={len:8,get(e,t){return Qie(e).getBigUint64(t,!0)},put(e,t,r){return Qie(e).setBigUint64(t,r,!0),t+8}};var tYr=class{constructor(t,r){this.len=t,this.encoding=r}get(t,r){return Zv_.Buffer.from(t).toString(this.encoding,r,r+this.len)}},Dic=class e{constructor(t){this.len=t}static decode(t,r,i){let n="";for(let a=r;a<i;++a)n+=e.codePointToString(e.singleByteDecoder(t[a]));return n}static inRange(t,r,i){return r<=t&&t<=i}static codePointToString(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}static singleByteDecoder(t){if(e.inRange(t,0,127))return t;let r=e.windows1252[t-128];if(r===null)throw Error("invaliding encoding");return r}get(t,r=0){return e.decode(t,r,r+this.len)}};Dic.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];function nb_(e){return[...e].map(t=>t.charCodeAt(0))}function ab_(e,t=0){let r=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let i=8*32;for(let n=t;n<t+148;n++)i+=e[n];for(let n=t+156;n<t+512;n++)i+=e[n];return r===i}var ob_={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4};var ub_=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx"],sb_=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx"];var cb_=4100;async function lb_(e){return new Eic().fromBuffer(e)}function dZt(e,t,r){r={offset:0,...r};for(let[i,n]of t.entries())if(r.mask){if(n!==(r.mask[i]&e[i+r.offset]))return!1}else if(n!==e[i+r.offset])return!1;return!0}var Eic=class{constructor(t){this.detectors=t?.customDetectors,this.fromTokenizer=this.fromTokenizer.bind(this),this.fromBuffer=this.fromBuffer.bind(this),this.parse=this.parse.bind(this)}async fromTokenizer(t){let r=t.position;for(let i of this.detectors||[]){let n=await i(t);if(n)return n;if(r!==t.position)return}return this.parse(t)}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof t}\``);let r=t instanceof Uint8Array?t:new Uint8Array(t);if(r?.length>1)return this.fromTokenizer(Kv_(r))}async fromBlob(t){let r=await t.arrayBuffer();return this.fromBuffer(new Uint8Array(r))}async fromStream(t){let r=await Jv_(t);try{return await this.fromTokenizer(r)}finally{await r.close()}}async toDetectionStream(t,r={}){let{default:i}=await import("stream"),{sampleSize:n=cb_}=r;return new Promise((a,u)=>{t.on("error",u),t.once("readable",()=>{(async()=>{try{let l=new i.PassThrough,d=i.pipeline?i.pipeline(t,l,()=>{}):t.pipe(l),s=t.read(n)??t.read()??rYr.Buffer.alloc(0);try{l.fileType=await this.fromBuffer(s)}catch(o){o instanceof _z?l.fileType=void 0:u(o)}a(d)}catch(l){u(l)}})()})})}check(t,r){return dZt(this.buffer,t,r)}checkString(t,r){return this.check(nb_(t),r)}async parse(t){if(this.buffer=rYr.Buffer.alloc(cb_),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,await t.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(t);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await t.ignore(6);let r=await t.readToken(ob_);return t.position+r>t.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await t.ignore(r),this.fromTokenizer(t))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;t.position+30<t.fileInfo.size;){await t.readBuffer(this.buffer,{length:30});let r={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(r.filename=await t.readToken(new tYr(r.filenameLength,"utf-8")),await t.ignore(r.extraFieldLength),r.filename==="META-INF/mozilla.rsa")return{ext:"xpi",mime:"application/x-xpinstall"};if(r.filename.endsWith(".rels")||r.filename.endsWith(".xml"))switch(r.filename.split("/")[0]){case"_rels":break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};default:break}if(r.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(r.filename.startsWith("3D/")&&r.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if(r.filename==="mimetype"&&r.compressedSize===r.uncompressedSize){let i=await t.readToken(new tYr(r.compressedSize,"utf-8"));switch(i=i.trim(),i){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};default:}}if(r.compressedSize===0){let i=-1;for(;i<0&&t.position<t.fileInfo.size;)await t.peekBuffer(this.buffer,{mayBeLess:!0}),i=this.buffer.indexOf("504B0304",0,"hex"),await t.ignore(i>=0?i:this.buffer.length)}else await t.ignore(r.compressedSize)}}catch(r){if(!(r instanceof _z))throw r}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let r=rYr.Buffer.alloc(8);return await t.readBuffer(r),dZt(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:dZt(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:dZt(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:dZt(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:dZt(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:dZt(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){let r=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(r){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return r.startsWith("3g")?r.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{await t.ignore(1350);let r=10*1024*1024,i=rYr.Buffer.alloc(Math.min(r,t.fileInfo.size));if(await t.readBuffer(i,{mayBeLess:!0}),i.includes(rYr.Buffer.from("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}catch(r){if(!(r instanceof _z))throw r}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let r=await this.readTiffHeader(!1);if(r)return r}if(this.check([77,77])){let r=await this.readTiffHeader(!0);if(r)return r}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function r(){let l=await t.peekNumber(kv_),d=128,s=0;for(;!(l&d)&&d!==0;)++s,d>>=1;let o=rYr.Buffer.alloc(s+1);return await t.readBuffer(o),o}async function i(){let l=await r(),d=await r();d[0]^=128>>d.length-1;let s=Math.min(6,d.length);return{id:l.readUIntBE(0,l.length),len:d.readUIntBE(d.length-s,s)}}async function n(l){for(;l>0;){let d=await i();if(d.id===17026)return(await t.readToken(new tYr(d.len,"utf-8"))).replaceAll(/\00.*$/g,"");await t.ignore(d.len),--l}}let a=await i();switch(await n(a.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let r=this.buffer.toString("binary",2,6);if(r.match("^d*")&&r>=1e3&&r<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new tYr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("**ACE",{offset:7})&&(await t.peekBuffer(this.buffer,{length:14,mayBeLess:!0}),this.checkString("**",{offset:12})))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.check([137,80,78,71,13,10,26,10])){await t.ignore(8);async function r(){return{length:await t.readToken(rb_),type:await t.readToken(new tYr(4,"binary"))}}do{let i=await r();if(i.length<0)return;switch(i.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await t.ignore(i.length+4)}}while(t.position+8<t.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function r(){let i=rYr.Buffer.alloc(16);return await t.readBuffer(i),{id:i,size:Number(await t.readToken(ib_))}}for(await t.ignore(30);t.position+24<t.fileInfo.size;){let i=await r(),n=i.size-24;if(dZt(i.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let a=rYr.Buffer.alloc(16);if(n-=await t.readBuffer(a),dZt(a,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(dZt(a,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await t.ignore(n)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new tYr(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let r=this.buffer.readUInt32LE(12);if(r>12&&this.buffer.length>=r+16)try{let i=this.buffer.slice(16,r+16).toString();if(JSON.parse(i).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),ab_(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(t){let r=await this.tokenizer.readToken(t?G6o:$6o);switch(this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let r=await this.tokenizer.readToken(t?G6o:$6o);for(let i=0;i<r;++i){let n=await this.readTiffTag(t);if(n)return n}}async readTiffHeader(t){let r=(t?G6o:$6o).get(this.buffer,2),i=(t?tb_:eb_).get(this.buffer,4);if(r===42){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}return await this.tokenizer.ignore(i),await this.readTiffIFD(t)??{ext:"tif",mime:"image/tiff"}}if(r===43)return{ext:"tif",mime:"image/tiff"}}};var pl8=new Set(ub_),_l8=new Set(sb_);var db_=require("fs/promises"),pb_=yi(require("path"),1);var hvE=new Set(["image/jpeg","image/png","image/gif","image/webp","image/tiff","image/x-icon","video/quicktime","video/mp4","video/webm","audio/mpeg","audio/ogg","audio/wav","application/pdf","application/xml","font/woff","font/woff2","font/otf","font/ttf"]),yvE=new Set(["ASCII","UTF-8","UTF-16","ISO-8859-1","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","WINDOWS-1250","WINDOWS-1251","WINDOWS-1252","WINDOWS-1253","WINDOWS-1254","WINDOWS-1255","WINDOWS-1256","WINDOWS-1257","WINDOWS-1258","SHIFT_JIS","SHIFT-JIS","EUC-JP","ISO-2022-JP","BIG5","GB2312","GB18030","KOI8-R"]),Mic={name:"valid-file-types",create:()=>({filepath:async({absoluteFilepath:e,willBeUploaded:t})=>t?await Cf(e)?vvE(e):[]:[]})},vvE=async e=>{let t=new Uint8Array(await(0,db_.readFile)(e)),r=await lb_(t);if(r!=null)return hvE.has(r.mime)?[]:[{severity:"fatal",message:`The file type of ${r.mime} is not allowed: ${e}`}];let i=pb_.default.extname(e).toLowerCase();i.startsWith(".")&&(i=i.substring(1));let n=fb_.default.detect(t);return n==null?[{severity:"fatal",message:`The encoding of the file could not be detected: ${e}`}]:yvE.has(n.toUpperCase())?[]:[{severity:"fatal",message:`The encoding of ${n} is not allowed: ${e}`}]};var _b_=require("fs/promises"),hb_=yi(J8t(),1),Aic={name:"valid-frontmatter",create:()=>({filepath:async({absoluteFilepath:e})=>{if(!e.endsWith(".md")&&!e.endsWith(".mdx"))return[];try{let t=await(0,_b_.readFile)(e,"utf-8");return(0,hb_.default)(t),[]}catch(t){return[{severity:"fatal",message:`Failed to parse frontmatter${t instanceof Error?`: ${t.message}`:""}`}]}}})};var Eb_=require("crypto"),Ric=yi(require("path"),1);var yb_=require("fs"),Q6o=class{parse({absoluteFilePath:t}){let r=(0,yb_.readFileSync)(t,"utf-8"),i=r.match(/option\s+csharp_namespace\s*=\s*"([^"]+)";/),n=r.match(/package\s+([a-zA-Z_][\w.]*);/),a=r.match(/service\s+([a-zA-Z_]\w*)\s*{/);return{csharpNamespace:i?.[1],packageName:n?.[1],serviceName:a?.[1]}}};var J6o=class{context;workspace;sourceCache;constructor(t,r){this.context=t,this.workspace=r,this.sourceCache=new Map}resolveSourceOrThrow({source:t,relativeFilepath:r}){let i=this.resolveSource({source:t});if(i==null){if(CQt(t))throw new Error(`Cannot resolve source ${t.proto} from file ${r}`);this.context.logger.warn(`Cannot resolve source ${t.openapi} from file ${r}`)}return i}resolveSource({source:t}){return CQt(t)?this.resolveProtobufSource({source:t}):this.resolveOpenAPISource({source:t})}resolveProtobufSource({source:t}){let r=Xu(this.workspace.absoluteFilePath,Xa.of(t.proto));if(this.sourceCache.has(r))return this.sourceCache.get(r);if(!TGr(r))return;let n=new Q6o().parse({absoluteFilePath:r}),a={type:"protobuf",absoluteFilePath:r,relativeFilePath:Xa.of(t.proto),csharpNamespace:n.csharpNamespace,packageName:n.packageName,serviceName:n.serviceName};return this.sourceCache.set(r,a),a}resolveOpenAPISource({source:t}){let r=Xu(this.workspace.absoluteFilePath,Xa.of(t.openapi));if(this.sourceCache.has(r))return this.sourceCache.get(r);if(!TGr(r))return;let i={type:"openapi",absoluteFilePath:r,relativeFilePath:Xa.of(t.openapi)};return this.sourceCache.set(r,i),i}};function bvE(e){for(var t=[],r=0;r<e.length;){var i=e[r];if(i==="*"||i==="+"||i==="?"){t.push({type:"MODIFIER",index:r,value:e[r++]});continue}if(i==="\\"){t.push({type:"ESCAPED_CHAR",index:r++,value:e[r++]});continue}if(i==="{"){t.push({type:"OPEN",index:r,value:e[r++]});continue}if(i==="}"){t.push({type:"CLOSE",index:r,value:e[r++]});continue}if(i===":"){for(var n="",a=r+1;a<e.length;){var u=e.charCodeAt(a);if(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||u===95){n+=e[a++];continue}break}if(!n)throw new TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:n}),r=a;continue}if(i==="("){var l=1,d="",a=r+1;if(e[a]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(a));for(;a<e.length;){if(e[a]==="\\"){d+=e[a++]+e[a++];continue}if(e[a]===")"){if(l--,l===0){a++;break}}else if(e[a]==="("&&(l++,e[a+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(a));d+=e[a++]}if(l)throw new TypeError("Unbalanced pattern at ".concat(r));if(!d)throw new TypeError("Missing pattern at ".concat(r));t.push({type:"PATTERN",index:r,value:d}),r=a;continue}t.push({type:"CHAR",index:r,value:e[r++]})}return t.push({type:"END",index:r,value:""}),t}function vb_(e,t){t===void 0&&(t={});for(var r=bvE(e),i=t.prefixes,n=i===void 0?"./":i,a=t.delimiter,u=a===void 0?"/#?":a,l=[],d=0,s=0,o="",c=function(U){if(s<r.length&&r[s].type===U)return r[s++].value},b=function(U){var H=c(U);if(H!==void 0)return H;var k=r[s],K=k.type,ee=k.index;throw new TypeError("Unexpected ".concat(K," at ").concat(ee,", expected ").concat(U))},g=function(){for(var U="",H;H=c("CHAR")||c("ESCAPED_CHAR");)U+=H;return U},O=function(U){for(var H=0,k=u;H<k.length;H++){var K=k[H];if(U.indexOf(K)>-1)return!0}return!1},m=function(U){var H=l[l.length-1],k=U||(H&&typeof H=="string"?H:"");if(H&&!k)throw new TypeError('Must have text between two parameters, missing text after "'.concat(H.name,'"'));return!k||O(k)?"[^".concat(f_i(u),"]+?"):"(?:(?!".concat(f_i(k),")[^").concat(f_i(u),"])+?")};s<r.length;){var w=c("CHAR"),E=c("NAME"),A=c("PATTERN");if(E||A){var q=w||"";n.indexOf(q)===-1&&(o+=q,q=""),o&&(l.push(o),o=""),l.push({name:E||d++,prefix:q,suffix:"",pattern:A||m(q),modifier:c("MODIFIER")||""});continue}var D=w||c("ESCAPED_CHAR");if(D){o+=D;continue}o&&(l.push(o),o="");var C=c("OPEN");if(C){var q=g(),R=c("NAME")||"",$=c("PATTERN")||"",I=g();b("CLOSE"),l.push({name:R||($?d++:""),pattern:R&&!$?m(q):$,prefix:q,suffix:I,modifier:c("MODIFIER")||""});continue}b("END")}return l}function bb_(e,t){return gvE(vb_(e,t),t)}function gvE(e,t){t===void 0&&(t={});var r=qic(t),i=t.encode,n=i===void 0?function(d){return d}:i,a=t.validate,u=a===void 0?!0:a,l=e.map(function(d){if(typeof d=="object")return new RegExp("^(?:".concat(d.pattern,")$"),r)});return function(d){for(var s="",o=0;o<e.length;o++){var c=e[o];if(typeof c=="string"){s+=c;continue}var b=d?d[c.name]:void 0,g=c.modifier==="?"||c.modifier==="*",O=c.modifier==="*"||c.modifier==="+";if(Array.isArray(b)){if(!O)throw new TypeError('Expected "'.concat(c.name,'" to not repeat, but got an array'));if(b.length===0){if(g)continue;throw new TypeError('Expected "'.concat(c.name,'" to not be empty'))}for(var m=0;m<b.length;m++){var w=n(b[m],c);if(u&&!l[o].test(w))throw new TypeError('Expected all "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(w,'"'));s+=c.prefix+w+c.suffix}continue}if(typeof b=="string"||typeof b=="number"){var w=n(String(b),c);if(u&&!l[o].test(w))throw new TypeError('Expected "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(w,'"'));s+=c.prefix+w+c.suffix;continue}if(!g){var E=O?"an array":"a string";throw new TypeError('Expected "'.concat(c.name,'" to be ').concat(E))}}return s}}function gb_(e,t){var r=[],i=Ob_(e,r,t);return OvE(i,r,t)}function OvE(e,t,r){r===void 0&&(r={});var i=r.decode,n=i===void 0?function(a){return a}:i;return function(a){var u=e.exec(a);if(!u)return!1;for(var l=u[0],d=u.index,s=Object.create(null),o=function(b){if(u[b]===void 0)return"continue";var g=t[b-1];g.modifier==="*"||g.modifier==="+"?s[g.name]=u[b].split(g.prefix+g.suffix).map(function(O){return n(O,g)}):s[g.name]=n(u[b],g)},c=1;c<u.length;c++)o(c);return{path:l,index:d,params:s}}}function f_i(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function qic(e){return e&&e.sensitive?"":"i"}function mvE(e,t){if(!t)return e;for(var r=/\((?:\?<(.*?)>)?(?!\?)/g,i=0,n=r.exec(e.source);n;)t.push({name:n[1]||i++,prefix:"",suffix:"",modifier:"",pattern:""}),n=r.exec(e.source);return e}function PvE(e,t,r){var i=e.map(function(n){return Ob_(n,t,r).source});return new RegExp("(?:".concat(i.join("|"),")"),qic(r))}function jvE(e,t,r){return wvE(vb_(e,r),t,r)}function wvE(e,t,r){r===void 0&&(r={});for(var i=r.strict,n=i===void 0?!1:i,a=r.start,u=a===void 0?!0:a,l=r.end,d=l===void 0?!0:l,s=r.encode,o=s===void 0?function(H){return H}:s,c=r.delimiter,b=c===void 0?"/#?":c,g=r.endsWith,O=g===void 0?"":g,m="[".concat(f_i(O),"]|$"),w="[".concat(f_i(b),"]"),E=u?"^":"",A=0,q=e;A<q.length;A++){var D=q[A];if(typeof D=="string")E+=f_i(o(D));else{var C=f_i(o(D.prefix)),R=f_i(o(D.suffix));if(D.pattern)if(t&&t.push(D),C||R)if(D.modifier==="+"||D.modifier==="*"){var $=D.modifier==="*"?"?":"";E+="(?:".concat(C,"((?:").concat(D.pattern,")(?:").concat(R).concat(C,"(?:").concat(D.pattern,"))*)").concat(R,")").concat($)}else E+="(?:".concat(C,"(").concat(D.pattern,")").concat(R,")").concat(D.modifier);else{if(D.modifier==="+"||D.modifier==="*")throw new TypeError('Can not repeat "'.concat(D.name,'" without a prefix and suffix'));E+="(".concat(D.pattern,")").concat(D.modifier)}else E+="(?:".concat(C).concat(R,")").concat(D.modifier)}}if(d)n||(E+="".concat(w,"?")),E+=r.endsWith?"(?=".concat(m,")"):"$";else{var I=e[e.length-1],U=typeof I=="string"?w.indexOf(I[I.length-1])>-1:I===void 0;n||(E+="(?:".concat(w,"(?=").concat(m,"))?")),U||(E+="(?=".concat(w,"|").concat(m,")"))}return new RegExp(E,qic(r))}function Ob_(e,t,r){return e instanceof RegExp?mvE(e,t):Array.isArray(e)?PvE(e,t,r):jvE(e,t,r)}function mb_(e){return e.split(/[?#]/)[0]??""}function K6o(e){return e.startsWith("/")?e.slice(1):e}function Tic(e){return e.startsWith("/")?e:`/${e}`}function Y6o(e){return e.endsWith("/")?e.slice(0,-1):e}function Pb_(e){let t=[];return e.config.instances.forEach(r=>{t.push(r.url),typeof r.customDomain=="string"?t.push(r.customDomain):Array.isArray(r.customDomain)&&t.push(...r.customDomain)}),t}function jb_(e){let t=new URL(nDe(e));return{domain:t.host,basePath:t.pathname==="/"||t.pathname===""?void 0:t.pathname}}function SvE(e,t){if(e===t)return{params:{},path:t,index:0};try{return gb_(e)(t)}catch(r){return console.error(r,{pattern:e,path:t}),!1}}function DvE(e,t){try{return bb_(e)(t.params)}catch(r){return console.error(r,{match:t,destination:e}),e}}function wb_(e,t,r=[]){for(let i of r){let n=Y6o(EvE(i.source,t.basePath)),a=SvE(n,e);if(a){let u=DvE(i.destination,a);if(!u.startsWith("/"))try{new URL(u)}catch{console.error("Invalid redirect destination:",u);return}return{redirect:{destination:encodeURI(u),permanent:i.permanent??!1}}}}}function EvE(e,t){return t==null||e.startsWith(t)?e:Fv(t,e)}async function xic({pathname:e,markdown:t,absoluteFilepath:r,workspaceAbsoluteFilePath:i,pageSlugs:n,absoluteFilePathsToSlugs:a,redirects:u=[],baseUrl:l}){e=Y6o(e);let d=r!=null?a.get(r)??[]:[];if(e.trim()==="")return!0;if(e=Bic(e),e.startsWith("/")){let o=Bic(Cic(e,l,u));for(let b=0;b<5;++b){let g=Bic(Cic(o,l,u));if(o===g)break;o=g}if(t&&n.has(K6o(o)))return!0;let c=Xu(i,Xa.of(K6o(e)));return await Cf(c,"file")?!0:d.map(b=>Tic(b))}if(r!=null){if(e==="."){let c=_p(r);if(await Cf(c,"directory"))return!0}let o=Xu(_p(r),Xa.of(e));if(await Cf(o,"file"))return!0}if(!t)return d.map(o=>Tic(o));let s=[];for(let o of d){let c=new URL(`/${o}`,nDe(l.domain)),b=Cic(new URL(e,c).pathname,l,u);n.has(K6o(b))||s.push(o)}return s.length>0?s:!0}function Cic(e,t,r){let i=wb_(e,t,r);return i==null?e:i.redirect.destination}function Bic(e){let t=e.indexOf("#");return t===-1?e:e.substring(0,t)}var Sb_=/^(?:[a-z+]+:)/gi;function MvE(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);return r?(r[0].match(/\n/g)||[]).length+1:0}function Iic(e,t){return e&&{...e,start:{...e.start,line:e.start.line+t},end:{...e.end,line:e.end.line+t}}}function zic(e,{absoluteFilepath:t,instanceUrls:r}){let i=[],n=[],a=MvE(e),{links:u,sources:l}=Dv_({content:e,absoluteFilepath:t});return u.forEach(d=>{if(d.href.trimStart().match(Sb_)){if(!d.href.trimStart().startsWith("http"))return;try{let o=new URL(d.href);if(!r.some(c=>d.href.includes(c)))return;n.push({pathname:o.pathname,sourceFilepath:d.sourceFilepath,position:Iic(d.position,a),markdown:!0})}catch{i.push({severity:"warning",message:`Invalid URL: ${d.href}`})}return}let s=mb_(d.href);s.trim()!==""&&n.push({pathname:s,sourceFilepath:d.sourceFilepath,position:Iic(d.position,a),markdown:!0})}),l.forEach(d=>{if(d.src.match(Sb_))try{new URL(d.src)}catch{i.push({severity:"warning",message:`Invalid URL: ${d.src}`});return}else n.push({pathname:d.src,sourceFilepath:d.sourceFilepath,position:Iic(d.position,a),markdown:!1})}),{pathnamesToCheck:n,violations:i}}var X6o=fys({logger:FGr(Jo)}),jFi={name:"valid-markdown-links",create:async({workspace:e,fernWorkspaces:t,ossWorkspaces:r})=>{let i=Pb_(e),n=i[0]??"http://localhost",a=jb_(i[0]??"http://localhost"),l=await new o9t(n,e,r,t,X6o).resolve();if(!l.config.root)throw new Error("Root node not found");let d=zo.migrate.FernNavigationV1ToLatest.create().root(l.config.root),s=zo.NodeCollector.collect(d),o=new Set,c=new Map,b=[];return s.slugMap.forEach((g,O)=>{if(o.add(O),g==null||!zo.isPage(g))return;zo.isApiLeaf(g)&&b.push(g);let m=zo.getPageId(g);if(m==null)return;let w=Xu(e.absoluteFilePath,Xa.of(m)),E=c.get(w)??[];E.push(O),c.set(w,E)}),{markdownPage:async({content:g,absoluteFilepath:O})=>{let m=c.get(O);if(!m||m.length===0)return[];let{pathnamesToCheck:w,violations:E}=zic(g,{absoluteFilepath:O,instanceUrls:i}),A=await Promise.all(w.map(async q=>{let D=await xic({pathname:q.pathname,markdown:q.markdown,absoluteFilepath:O,workspaceAbsoluteFilePath:e.absoluteFilePath,pageSlugs:o,absoluteFilePathsToSlugs:c,redirects:e.config.redirects,baseUrl:a});return D===!0?[]:D.map(C=>{let[R,$]=Db_({pathnameToCheck:q,targetPathname:C,absoluteFilepathToWorkspace:e.absoluteFilePath});return{name:jFi.name,severity:"error",message:R,relativeFilepath:$}})}));return[...E,...A.flat()]},apiSection:async({workspace:g,config:O})=>{let m=await g.toFernWorkspace({context:X6o},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1}),w=C2({workspace:m,audiences:O.audiences?{type:"select",audiences:O.audiences}:{type:"all"},generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:X6o,sourceResolver:new J6o(X6o,m)}),E=AvE(uba(w,(0,Eb_.randomUUID)())),A=[];for(let q of b){let D=await qvE(Hpi.prune(E,q));for(let C of D){let{pathnamesToCheck:R,violations:$}=zic(C,{instanceUrls:i});A.push(...$);let I=await Promise.all(R.map(async U=>{let H=await xic({pathname:U.pathname,markdown:U.markdown,workspaceAbsoluteFilePath:e.absoluteFilePath,pageSlugs:o,absoluteFilePathsToSlugs:c,redirects:e.config.redirects,baseUrl:a});return H===!0?[]:H.map(k=>{let[K,ee]=Db_({pathnameToCheck:U,targetPathname:k,absoluteFilepathToWorkspace:e.absoluteFilePath});return{name:jFi.name,severity:"error",message:K,relFilepath:ee}})}));A.push(...I.flat())}}return A}}}};function Db_({pathnameToCheck:e,targetPathname:t,absoluteFilepathToWorkspace:r}){let i=`${t} links to non-existent page ${Js.bold(e.pathname)}`,{position:n,sourceFilepath:a}=e;if(a==null||n==null)return[i,Xa.of("")];i=`broken link to ${Js.bold(e.pathname)}`,e.pathname.length>0&&!Ric.default.isAbsolute(e.pathname)&&(i+=` (resolved path: ${Ric.default.join(t,e.pathname)})`);let u=aT(r,a);return i+=`
1996
- fix here: ${u}:${n.start.line}:${n.start.column}`,[i,u]}function AvE(e){return Hpi.ApiDefinitionV1ToLatest.from(e,{useJavaScriptAsTypeScript:!1,alwaysEnableJavaScriptFetch:!1,usesApplicationJsonInFormDataValue:!1}).migrate()}async function qvE(e){let t=[];return Hpi.Transformer.descriptions(r=>(typeof r=="string"&&t.push(r),r)).apiDefinition(e),t}var Nic={name:"validate-version-file",create:()=>({versionFile:async({path:e,content:t})=>{let r=await C6o({value:t});return r.type==="success"?[]:[{severity:"fatal",message:`${r.message}`}]}})};var Mb_=[Wrc,Hrc,Nic,Cv_,jFi,Mic,$rc,Grc,Bv_,Aic];function Ab_(e){if(!e)return Mb_;let t=new Set(e);return Mb_.filter(r=>!t.has(r.name))}async function Gba(e,t,r,i,n,a){let u=n?[jFi]:Ab_(a);return TvE({workspace:e,rules:u,context:t,fernWorkspaces:r,ossWorkspaces:i})}async function TvE({workspace:e,rules:t,context:r,fernWorkspaces:i,ossWorkspaces:n}){let a=[],u=await Promise.all(t.map(d=>d.create({workspace:e,fernWorkspaces:i,ossWorkspaces:n,logger:r.logger}))),l=Ev_({relativeFilepath:Xa.of(B4t),allRuleVisitors:u,addViolations:d=>{a.push(...d)}});return await Tv_({contents:e.config,visitor:l,absoluteFilepathToConfiguration:Xu(e.absoluteFilePath,Xa.of(B4t)),absolutePathToFernFolder:e.absoluteFilePath,context:r,fernWorkspaces:i}),a}async function Z6o({workspace:e,fernWorkspaces:t,ossWorkspaces:r,context:i,logWarnings:n,errorOnBrokenLinks:a,logSummary:u=!0,excludeRules:l}){let d=performance.now(),s=await Gba(e,i,t,r,!1,l),o=performance.now()-d,{hasErrors:c}=ZEn({violations:s,context:i,logWarnings:n,logSummary:u,logBreadcrumbs:!1,elapsedMillis:o});return a&&(c=c||s.some(b=>b.name==="valid-markdown-links")),{hasErrors:c}}async function k6o({workspace:e,fernWorkspaces:t,ossWorkspaces:r,context:i,logWarnings:n,errorOnBrokenLinks:a,excludeRules:u}){let{hasErrors:l}=await Z6o({workspace:e,context:i,logWarnings:n,fernWorkspaces:t,ossWorkspaces:r,errorOnBrokenLinks:a,excludeRules:u});l&&i.failAndThrow()}async function qb_({loadProject:e,cliContext:t,port:r,bundlePath:i,brokenLinks:n}){let a=await e(),u=a.docsWorkspaces;u!=null&&(await t.instrumentPostHogEvent({orgId:a.config.organization,command:"fern docs dev"}),await t.runTaskForWorkspace(u,async l=>{l.logger.info(`Starting server on port ${r}`),await jtc({initialProject:a,reloadProject:e,validateProject:async d=>{let s=d.docsWorkspaces;if(s==null)return;let o=n?[]:["valid-markdown-links"];if(s.config.experimental?.openapiParserV3)await Z6o({workspace:s,context:l,logWarnings:!0,logSummary:!1,fernWorkspaces:[],ossWorkspaces:await _X(d),excludeRules:o});else{let c=await Promise.all(d.apiWorkspaces.map(async b=>b.toFernWorkspace({context:l})));await Z6o({workspace:s,context:l,logWarnings:!0,logSummary:!1,fernWorkspaces:c,ossWorkspaces:await _X(d),excludeRules:o});for(let b of c)await t.runTaskForWorkspace(b,async g=>{await zrc({workspace:b,context:g,logWarnings:!1,logSummary:!1})})}},context:l,port:r,bundlePath:i})}))}async function Tb_({project:e,cliContext:t,shouldFix:r}){await Promise.all(e.apiWorkspaces.map(async i=>{i instanceof B7||await t.runTaskForWorkspace(i,async n=>{await bxs({workspace:await i.toFernWorkspace({context:n}),context:n,shouldFix:r})})}))}var Cb_=yi(require("path"),1);async function tMn({workspace:e,context:t,generationLanguage:r,keywords:i,smartCasing:n,disableExamples:a,audiences:u,readme:l,includeDynamicExamples:d}){return await cZt({workspace:e,context:t,logWarnings:!1}),C2({workspace:e,generationLanguage:r,keywords:i,smartCasing:n,exampleGeneration:{disabled:a},audiences:u,readme:l,version:void 0,packageName:void 0,context:t,sourceResolver:new q2(t,e),includeDynamicExamples:d})}async function Bb_({project:e,irFilepath:t,cliContext:r,generationLanguage:i,audiences:n,version:a,keywords:u,smartCasing:l,includeDynamicExamples:d}){await Promise.all(e.apiWorkspaces.map(async s=>{await r.runTaskForWorkspace(s,async o=>{r.logger.info(`Generating IR for workspace ${s.workspaceName??"api"}`);let c=await s.toFernWorkspace({context:o}),b=await tMn({workspace:c,context:o,generationLanguage:i,keywords:u,smartCasing:l,disableExamples:!1,audiences:n,readme:void 0,includeDynamicExamples:d});if(b.dynamic==null)throw new Error("Internal error; dynamic IR was not generated");let g=Cb_.default.resolve(t);await xGr(Wl.of(g),b.dynamic),o.logger.info(`Wrote IR to ${g}`)})}))}var xb_=require("fs/promises"),Ib_=yi(require("path"),1);async function zb_({project:e,outputFilepath:t,cliContext:r,audiences:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await r.runTaskForWorkspace(n,async a=>{let u=await n.toFernWorkspace({context:a}),l=await tMn({workspace:u,context:a,generationLanguage:void 0,audiences:i,keywords:void 0,smartCasing:!1,disableExamples:!1,readme:void 0,includeDynamicExamples:!1}),d=iDe({ir:l,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0}}),s=Ib_.default.resolve(t);await(0,xb_.writeFile)(s,await RGr(d,{pretty:!0})),a.logger.info(`Wrote FDR API definition to ${s}`)})}))}var RqP=yi(require("path"),1);var We=Symbol(),ri=Symbol();var Rb_={laterVersion:"v2",earlierVersion:"v1",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.246",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({apiName:e.apiName,auth:e.auth,headers:e.headers,types:e.types,services:e.services,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,errors:e.errors.map(t=>({name:t.name,docs:t.docs,discriminantValue:{originalValue:t.discriminantValueV4.name.unsafeName.originalValue,camelCase:t.discriminantValueV4.name.unsafeName.camelCase,pascalCase:t.discriminantValueV4.name.unsafeName.pascalCase,snakeCase:t.discriminantValueV4.name.unsafeName.snakeCase,screamingSnakeCase:t.discriminantValueV4.name.unsafeName.screamingSnakeCase,wireValue:t.discriminantValueV4.wireValue},discriminantValueV2:t.discriminantValueV2,discriminantValueV3:t.discriminantValueV3,discriminantValueV4:t.discriminantValueV4,type:t.type,typeV2:t.typeV2,typeV3:t.typeV3,http:t.http,statusCode:t.statusCode}))})};var he={};Co(he,{V1:()=>WAB,V10:()=>HAB,V11:()=>$AB,V12:()=>GAB,V13:()=>QAB,V14:()=>JAB,V15:()=>KAB,V16:()=>YAB,V17:()=>XAB,V18:()=>ZAB,V19:()=>kAB,V2:()=>eqB,V20:()=>tqB,V21:()=>rqB,V22:()=>iqB,V23:()=>Fsg.FernIrV23,V24:()=>Lsg.FernIrV24,V25:()=>Usg.FernIrV25,V26:()=>Vsg.FernIrV26,V27:()=>Wsg.FernIrV27,V28:()=>Hsg.FernIrV28,V29:()=>$sg.FernIrV29,V3:()=>nqB,V30:()=>Gsg.FernIrV30,V31:()=>Qsg.FernIrV31,V32:()=>Jsg.FernIrV32,V33:()=>Ksg.FernIrV33,V34:()=>Ysg.FernIrV34,V35:()=>Xsg.FernIrV35,V36:()=>Zsg.FernIrV36,V37:()=>ksg.FernIrV37,V38:()=>ecg.FernIrV38,V39:()=>tcg.FernIrV39,V4:()=>aqB,V40:()=>rcg.FernIrV40,V41:()=>icg.FernIrV41,V42:()=>ncg.FernIrV42,V43:()=>acg.FernIrV43,V44:()=>ocg.FernIrV44,V45:()=>ucg.FernIrV45,V46:()=>scg.FernIrV46,V47:()=>ccg.FernIrV47,V48:()=>lcg.FernIrV48,V49:()=>fcg.FernIrV49,V5:()=>oqB,V50:()=>dcg.FernIrV50,V51:()=>pcg.FernIrV51,V52:()=>_cg.FernIrV52,V53:()=>hcg.FernIrV53,V54:()=>ycg.FernIrV54,V55:()=>vcg.FernIrV55,V56:()=>bcg.FernIrV56,V57:()=>uc,V6:()=>uqB,V7:()=>sqB,V8:()=>cqB,V9:()=>lqB});var WAB=yi(Cj_(),1),HAB=yi(kM_(),1),$AB=yi(jI_(),1),GAB=yi(O6_(),1),QAB=yi(vU_(),1),JAB=yi(_J_(),1),KAB=yi(fth(),1),YAB=yi(jsh(),1),XAB=yi(Ihh(),1),ZAB=yi(Qmh(),1),kAB=yi(sMh(),1),eqB=yi(ixh(),1),tqB=yi(B7h(),1),rqB=yi(dUh(),1),iqB=yi($Jh(),1),Fsg=yi(lkh(),1),Lsg=yi(Jiy(),1),Usg=yi(Isy(),1),Vsg=yi(Dpy(),1),Wsg=yi(mby(),1),Hsg=yi(vPy(),1),$sg=yi(pDy(),1),nqB=yi(rBy(),1),Gsg=yi(nNy(),1),Qsg=yi(o2y(),1),Jsg=yi(vLy(),1),Ksg=yi(NPc(),1),Ysg=yi(LXy(),1),Xsg=yi(Iiv(),1),Zsg=yi(qcv(),1),ksg=yi(Ehv(),1),ecg=yi(EOv(),1),tcg=yi(HSv(),1),aqB=yi(VCv(),1),rcg=yi(aFv(),1),icg=yi(w8v(),1),ncg=yi(QWv(),1),acg=yi(bYv(),1),ocg=yi(Hrb(),1),ucg=yi(Tcb(),1),scg=yi(wyb(),1),ccg=yi(mPb(),1),lcg=yi(bMb(),1),fcg=yi(bIb(),1),oqB=yi(i7b(),1),dcg=yi(dLb(),1),pcg=yi(TQb(),1),_cg=yi(tt0(),1),hcg=yi(Ad0(),1),ycg=yi(fj0(),1),vcg=yi(kB0(),1),bcg=yi(V80(),1),uqB=yi(YW0(),1),sqB=yi(nY0(),1),cqB=yi(drg(),1),lqB=yi(Nsg(),1);function gcg({inlinedRequest:e,allTypes:t}){let r=new Set,i=t.reduce((n,a)=>({...n,[Bzc(a.name)]:a}),{});for(let n of e.extends)Ocg({typeName:n,typeNameToDeclaration:i,referencedTypes:r});for(let n of e.properties)FTn({reference:n.valueType,typeNameToDeclaration:i,referencedTypes:r});return[...r].reduce((n,a)=>{let u=i[a];if(u==null)throw new Error("Cannot find declaration for ID: "+a);return[...n,u.name]},[])}function FTn({reference:e,typeNameToDeclaration:t,referencedTypes:r}){he.V2.types.TypeReference._visit(e,{primitive:Jo,container:i=>{fqB({container:i,typeNameToDeclaration:t,referencedTypes:r})},named:i=>{Ocg({typeName:i,typeNameToDeclaration:t,referencedTypes:r})},unknown:Jo,void:Jo,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function fqB({container:e,typeNameToDeclaration:t,referencedTypes:r}){he.V2.types.ContainerType._visit(e,{list:i=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},set:i=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},optional:i=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},map:({keyType:i,valueType:n})=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r}),FTn({reference:n,typeNameToDeclaration:t,referencedTypes:r})},literal:Jo,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function Ocg({typeName:e,typeNameToDeclaration:t,referencedTypes:r}){let i=Bzc(e);r.add(i);let n=t[i];if(n==null)throw new Error("Cannot locate type: "+i);for(let a of n.referencedTypes)r.add(Bzc(a))}function Bzc(e){return[...e.fernFilepathV2.map(t=>t.unsafeName.originalValue),e.nameV3.unsafeName.originalValue].join(".")}var mcg={laterVersion:"v3",earlierVersion:"v2",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.249",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:"0.0.134-3-g97d4964",[J.JAVA_SDK]:"0.0.134-3-g97d4964",[J.JAVA_SPRING]:"0.0.134-3-g97d4964",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=[...e.types];return{apiName:e.apiName,auth:e.auth,headers:e.headers,types:t,errors:e.errors,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,services:{websocket:e.services.websocket,http:e.services.http.map(r=>({availability:r.availability,docs:r.docs,name:r.name,basePath:r.basePath,basePathV2:r.basePathV2,headers:r.headers,pathParameters:r.pathParameters,endpoints:r.endpoints.map(i=>dqB(r,i,e.types,n=>{t.push(n)}))}))}}}};function dqB(e,t,r,i){return{docs:t.docs,availability:t.availability,id:t.id,name:t.name,nameV2:t.nameV2,method:t.method,headers:t.headers,path:t.path,pathParameters:t.pathParameters,queryParameters:t.queryParameters,request:pqB(t,e,r,i),response:t.response,errors:t.errors,errorsV2:t.errorsV2,auth:t.auth}}function pqB(e,t,r,i){let n=e.requestBody;return n==null?{docs:void 0,type:he.V2.types.TypeReference.void(),typeV2:void 0}:he.V3.services.http.HttpRequestBody._visit(n,{reference:a=>({docs:a.docs,type:a.requestBodyType,typeV2:a.requestBodyType}),inlinedRequestBody:a=>{let u={fernFilepath:t.name.fernFilepath,fernFilepathV2:t.name.fernFilepathV2,name:a.name.unsafeName.originalValue,nameV2:{originalValue:a.name.unsafeName.originalValue,camelCase:a.name.unsafeName.camelCase,pascalCase:a.name.unsafeName.pascalCase,snakeCase:a.name.unsafeName.snakeCase,screamingSnakeCase:a.name.unsafeName.screamingSnakeCase},nameV3:a.name},l=he.V2.types.Type.object({extends:a.extends,properties:a.properties.map(s=>({availability:e.availability,docs:s.docs,name:{originalValue:s.name.name.unsafeName.originalValue,camelCase:s.name.name.unsafeName.camelCase,pascalCase:s.name.name.unsafeName.pascalCase,snakeCase:s.name.name.unsafeName.snakeCase,screamingSnakeCase:s.name.name.unsafeName.screamingSnakeCase,wireValue:s.name.wireValue},nameV2:s.name,valueType:s.valueType}))});i({docs:void 0,availability:e.availability,name:u,shape:l,referencedTypes:gcg({inlinedRequest:a,allTypes:r}),examples:[]});let d=he.V2.types.TypeReference.named(u);return{docs:void 0,type:d,typeV2:d}},_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+n.type)}})}var wcg={laterVersion:"v4",earlierVersion:"v3",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:"0.0.11-4-g1c29f6c",[J.POSTMAN]:"0.0.32-rc0",[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({apiName:e.apiName,auth:e.auth,headers:e.headers,types:e.types.map(t=>({docs:t.docs,availability:t.availability,name:t.name,shape:t.shape,examples:t.examples.map(r=>Scg(r.shape)),referencedTypes:t.referencedTypes})),errors:e.errors,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,services:{...e.services,http:e.services.http.map(t=>({...t,endpoints:t.endpoints.map(r=>({...r,examples:r.examples.map(i=>bqB(i))}))}))}})};function Scg(e){return he.V4.types.ExampleTypeShape._visit(e,{object:t=>he.V3.types.ExampleType.object(_qB(t)),union:t=>he.V3.types.ExampleType.union(yqB(t)),alias:t=>he.V3.types.ExampleType.alias(vqB(t)),enum:he.V3.types.ExampleType.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function _qB(e){return{properties:e.properties.map(t=>({wireKey:t.wireKey,value:$Z(t.value),originalTypeDeclaration:t.originalTypeDeclaration}))}}function $Z(e){return he.V4.types.ExampleTypeReferenceShape._visit(e.shape,{primitive:he.V3.types.ExampleTypeReference.primitive,container:t=>he.V3.types.ExampleTypeReference.container(hqB(t)),named:t=>he.V3.types.ExampleTypeReference.named(Dcg(t)),unknown:he.V3.types.ExampleTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReference: "+e.shape.type)}})}function hqB(e){return he.V4.types.ExampleContainer._visit(e,{list:t=>he.V3.types.ExampleContainer.list(t.map($Z)),set:t=>he.V3.types.ExampleContainer.set(t.map($Z)),optional:t=>he.V3.types.ExampleContainer.optional(t!=null?$Z(t):void 0),map:t=>he.V3.types.ExampleContainer.map(t.map(r=>({key:$Z(r.key),value:$Z(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function Dcg(e){return{typeName:e.typeName,shape:Scg(e.shape)}}function yqB(e){return{wireDiscriminantValue:e.wireDiscriminantValue,properties:he.V4.types.ExampleSingleUnionTypeProperties._visit(e.properties,{samePropertiesAsObject:t=>he.V3.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject(Dcg(t)),singleProperty:t=>he.V3.types.ExampleSingleUnionTypeProperties.singleProperty($Z(t)),noProperties:()=>he.V3.types.ExampleSingleUnionTypeProperties.noProperties(),_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.properties.type)}})}}function vqB(e){return{value:$Z(e.value)}}function bqB(e){return{servicePathParameters:e.servicePathParameters.map(t=>Pcg(t)),endpointPathParameters:e.servicePathParameters.map(t=>Pcg(t)),serviceHeaders:e.serviceHeaders.map(t=>jcg(t)),endpointHeaders:e.endpointHeaders.map(t=>jcg(t)),queryParameters:e.queryParameters.map(t=>gqB(t)),request:e.request!=null?OqB(e.request):void 0,response:PqB(e.response)}}function Pcg(e){return{key:e.key,value:$Z(e.value)}}function jcg(e){return{key:e.wireKey,value:$Z(e.value)}}function gqB(e){return{key:e.wireKey,value:$Z(e.value)}}function OqB(e){return he.V4.services.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V3.services.http.ExampleRequestBody.inlinedRequestBody({properties:t.properties.map(r=>mqB(r))}),reference:t=>he.V3.services.http.ExampleRequestBody.reference($Z(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function mqB(e){return{wireKey:e.wireKey,value:$Z(e.value),originalTypeDeclaration:e.originalTypeDeclaration}}function PqB(e){return he.V4.services.http.ExampleResponse._visit(e,{ok:t=>he.V3.services.http.ExampleResponse.ok({body:t.body!=null?$Z(t.body):void 0}),error:t=>he.V3.services.http.ExampleResponse.error({error:t.error,body:t.body!=null?$Z(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var hVo=class{errors;constructor(t){this.errors=t.errors.reduce((r,i)=>({...r,[Ecg(i.name)]:i}),{})}getDeclaration(t){let r=Ecg(t),i=this.errors[r];if(i==null)throw new Error("Error does not exist: "+r);return i}};function Ecg(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function $Lt(e){return{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}function EEe(e){return{...$Lt(e.name),wireValue:e.wireValue}}function $2(e){return{safeName:{originalValue:e.originalName,camelCase:e.camelCase.safeName,pascalCase:e.pascalCase.safeName,snakeCase:e.snakeCase.safeName,screamingSnakeCase:e.screamingSnakeCase.safeName},unsafeName:{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}}function G2(e){return{wireValue:e.wireValue,name:$2(e.name)}}function DVi(e){return e.map(t=>$Lt(t))}function EVi(e){return e.map(t=>$2(t))}function v9(e){return{fernFilepath:DVi(e.fernFilepath),fernFilepathV2:EVi(e.fernFilepath),name:e.name.originalName,nameV2:$Lt(e.name),nameV3:$2(e.name)}}function Mz(e){return he.V5.types.TypeReference._visit(e,{named:t=>he.V4.types.TypeReference.named(v9(t)),container:t=>he.V4.types.TypeReference.container(LTn(t)),primitive:t=>he.V4.types.TypeReference.primitive(t),unknown:he.V4.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function LTn(e){return he.V5.types.ContainerType._visit(e,{list:t=>he.V4.types.ContainerType.list(Mz(t)),set:t=>he.V4.types.ContainerType.set(Mz(t)),map:({keyType:t,valueType:r})=>he.V4.types.ContainerType.map({keyType:Mz(t),valueType:Mz(r)}),optional:t=>he.V4.types.ContainerType.optional(Mz(t)),literal:t=>he.V5.types.Literal._visit(t,{string:r=>he.V4.types.ContainerType.literal(he.V4.types.Literal.string(r)),_unknown:()=>{throw new Error("Unknown Literal: "+t.type)}}),_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}var yVo=class{types;constructor(t){this.types=t.types.reduce((r,i)=>({...r,[Mcg(i.name)]:i}),{})}resolveTypeReference(t){return he.V5.types.TypeReference._visit(t,{container:r=>he.V4.types.ResolvedTypeReference.container(LTn(r)),named:r=>{let i=this.getTypeDeclaration(r);return i.shape._type==="alias"?this.resolveTypeReference(i.shape.aliasOf):he.V4.types.ResolvedTypeReference.named({name:v9(r),shape:jqB(i.shape._type)})},primitive:he.V4.types.ResolvedTypeReference.primitive,unknown:he.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+t._type)}})}getTypeDeclaration(t){let r=Mcg(t),i=this.types[r];if(i==null)throw new Error("Type does not exist: "+i);return i}};function Mcg(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function jqB(e){switch(e){case"object":return he.V4.types.ShapeType.Object;case"union":return he.V4.types.ShapeType.Union;case"enum":return he.V4.types.ShapeType.Enum;default:Fo(e)}}function MVi(e){return{name:EEe(e.name),nameV2:G2(e.name),valueType:Mz(e.valueType),availability:e.availability,docs:e.docs}}function Acg(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>wqB(t))}}function wqB(e){return he.V5.auth.AuthScheme._visit(e,{basic:he.V4.auth.AuthScheme.basic,bearer:he.V4.auth.AuthScheme.bearer,header:t=>he.V4.auth.AuthScheme.header(MVi(t)),_unknown:()=>{throw new Error("Unknown AuthScheme: "+e._type)}})}function qcg(e){return{docs:e.docs,id:e.id,url:e.url,name:$2(e.name)}}function Tcg({errorDeclaration:e,errorDiscriminationStrategy:t,typeReferenceResolver:r}){let i=e.type!=null?he.V4.types.Type.alias({aliasOf:Mz(e.type),resolvedType:r.resolveTypeReference(e.type)}):void 0;return{docs:e.docs,name:{name:e.name.name.originalName,nameV2:$Lt(e.name.name),nameV3:$2(e.name.name),fernFilepath:DVi(e.name.fernFilepath),fernFilepathV2:EVi(e.name.fernFilepath)},discriminantValueV2:G2(e.discriminantValue),discriminantValueV3:he.V5.ir.ErrorDiscriminationStrategy._visit(t,{statusCode:he.V4.errors.ErrorDeclarationDiscriminantValue.statusCode,property:n=>he.V4.errors.ErrorDeclarationDiscriminantValue.property(G2(n.contentProperty)),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+t.type)}}),discriminantValueV4:G2(e.discriminantValue),type:i??he.V4.types.Type.alias({aliasOf:he.V4.types.TypeReference.void(),resolvedType:he.V4.types.ResolvedTypeReference.void()}),typeV2:i,typeV3:e.type!=null?Mz(e.type):e.type,http:{statusCode:e.statusCode},statusCode:e.statusCode}}function GZ(e){return{jsonExample:e.jsonExample,shape:Ccg(e.shape)}}function Ccg(e){return he.V5.types.ExampleTypeReferenceShape._visit(e,{primitive:he.V4.types.ExampleTypeReferenceShape.primitive,container:t=>he.V4.types.ExampleTypeReferenceShape.container(DqB(t)),unknown:he.V4.types.ExampleTypeReferenceShape.unknown,named:t=>he.V4.types.ExampleTypeReferenceShape.named(SqB(t)),_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function SqB(e){return{typeName:v9(e.typeName),shape:vVo(e.shape)}}function DqB(e){return he.V5.types.ExampleContainer._visit(e,{list:t=>he.V4.types.ExampleContainer.list(t.map(r=>GZ(r))),set:t=>he.V4.types.ExampleContainer.set(t.map(r=>GZ(r))),optional:t=>he.V4.types.ExampleContainer.optional(t!=null?GZ(t):void 0),map:t=>he.V4.types.ExampleContainer.map(t.map(r=>({key:GZ(r.key),value:GZ(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function vVo(e){return he.V5.types.ExampleTypeShape._visit(e,{alias:t=>he.V4.types.ExampleTypeShape.alias({value:GZ(t.value)}),object:t=>he.V4.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:GZ(r.value),originalTypeDeclaration:v9(r.originalTypeDeclaration)}))}),union:t=>he.V4.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:he.V5.types.ExampleSingleUnionTypeProperties._visit(t.properties,{samePropertiesAsObject:r=>he.V4.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:v9(r.typeName),shape:vVo(r.shape)}),singleProperty:r=>he.V4.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:r.jsonExample,shape:Ccg(r.shape)}),noProperties:he.V4.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+t.properties.type)}})}),enum:t=>he.V4.types.ExampleTypeShape.enum({wireValue:t.wireValue}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Icg({service:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,displayName:e.displayName,name:EqB(e.name),basePath:MqB(e.basePath),basePathV2:e.basePath,endpoints:e.endpoints.map(r=>AqB({endpoint:r,errorResolver:t})),headers:e.headers.map(r=>MVi(r)),pathParameters:e.pathParameters.map(r=>zcg(r))}}function EqB(e){return{name:e.name.pascalCase.unsafeName,fernFilepath:DVi(e.fernFilepath),fernFilepathV2:EVi(e.fernFilepath)}}function MqB(e){return e.parts.reduce((t,r)=>t+`{${r.pathParameter}}`+r.tail,e.head)}function AqB({endpoint:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,id:e.name.originalName,name:$Lt(e.name),nameV2:$2(e.name),displayName:e.displayName,method:e.method,headers:e.headers.map(r=>MVi(r)),path:e.path,pathParameters:e.pathParameters.map(r=>zcg(r)),queryParameters:e.queryParameters.map(r=>qqB(r)),requestBody:e.requestBody!=null?TqB(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?CqB(e.sdkRequest):void 0,response:BqB(e.response),errors:e.errors.map(r=>xqB(r)),errorsV2:IqB({responseErrors:e.errors,errorResolver:t}),auth:e.auth,examples:e.examples.map(r=>NqB(r))}}function zcg(e){return{docs:e.docs,availability:e.availability,name:$Lt(e.name),nameV2:$2(e.name),valueType:Mz(e.valueType)}}function qqB(e){return{docs:e.docs,availability:e.availability,name:EEe(e.name),nameV2:G2(e.name),valueType:Mz(e.valueType),allowMultiple:e.allowMultiple}}function TqB(e){return he.V5.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V4.services.http.HttpRequestBody.inlinedRequestBody({name:$2(t.name),extends:t.extends.map(r=>v9(r)),properties:t.properties.map(r=>({docs:r.docs,name:G2(r.name),valueType:Mz(r.valueType)}))}),reference:t=>he.V4.services.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:Mz(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.type)}})}function CqB(e){return{requestParameterName:$2(e.requestParameterName),shape:he.V5.http.SdkRequestShape._visit(e.shape,{justRequestBody:t=>he.V4.services.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:Mz(t.requestBodyType)}),wrapper:t=>he.V4.services.http.SdkRequestShape.wrapper({wrapperName:$2(t.wrapperName),bodyKey:$2(t.bodyKey)}),_unknown:()=>{throw new Error("Unknown SdkRequestShape type: "+e.shape.type)}})}}function BqB(e){let t=e.type!=null?Mz(e.type):void 0;return{docs:e.docs,type:t??he.V4.types.TypeReference.void(),typeV2:t}}function xqB(e){return{docs:e.docs,error:xzc(e.error)}}function IqB({responseErrors:e,errorResolver:t}){return{discriminant:{originalValue:"errorName",camelCase:"errorName",snakeCase:"error_name",pascalCase:"ErrorName",screamingSnakeCase:"ERROR_NAME",wireValue:"errorName"},types:e.map(r=>zqB({responseError:r,errorResolver:t}))}}function zqB({responseError:e,errorResolver:t}){let r=t.getDeclaration(e.error);return{docs:e.docs,discriminantValue:EEe(r.discriminantValue),shape:RqB({responseError:e,declaration:r})}}function RqB({responseError:e,declaration:t}){return t.type==null?he.V4.services.commons.ResponseErrorShape.noProperties():he.V4.services.commons.ResponseErrorShape.singleProperty({name:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT",wireValue:"content"},error:xzc(e.error)})}function xzc(e){return{name:e.name.originalName,nameV2:$Lt(e.name),nameV3:$2(e.name),fernFilepath:DVi(e.fernFilepath),fernFilepathV2:EVi(e.fernFilepath)}}function NqB(e){return{docs:e.docs,name:e.name?.originalName,servicePathParameters:e.servicePathParameters.map(t=>Bcg(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Bcg(t)),serviceHeaders:e.serviceHeaders.map(t=>xcg(t)),endpointHeaders:e.endpointHeaders.map(t=>xcg(t)),queryParameters:e.queryParameters.map(t=>FqB(t)),request:e.request!=null?LqB(e.request):void 0,response:VqB(e.response)}}function Bcg(e){return{key:e.key,value:GZ(e.value)}}function xcg(e){return{wireKey:e.wireKey,value:GZ(e.value)}}function FqB(e){return{wireKey:e.wireKey,value:GZ(e.value)}}function LqB(e){return he.V5.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V4.services.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>UqB(r))}),reference:t=>he.V4.services.http.ExampleRequestBody.reference(GZ(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function UqB(e){return{wireKey:e.wireKey,value:GZ(e.value),originalTypeDeclaration:e.originalTypeDeclaration!=null?v9(e.originalTypeDeclaration):void 0}}function VqB(e){return he.V5.http.ExampleResponse._visit(e,{ok:t=>he.V4.services.http.ExampleResponse.ok({body:t.body!=null?GZ(t.body):void 0}),error:t=>he.V4.services.http.ExampleResponse.error({error:xzc(t.error),body:t.body!=null?GZ(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function Rcg(e){return{docs:e.docs,availability:e.availability,name:v9(e.name),shape:WqB(e.shape),examples:e.examples.map(t=>HqB(t)),referencedTypes:e.referencedTypes.map(t=>v9(t))}}function WqB(e){return he.V5.types.Type._visit(e,{alias:({aliasOf:t,resolvedType:r})=>he.V4.types.Type.alias({aliasOf:Mz(t),resolvedType:$qB(r)}),enum:t=>he.V4.types.Type.enum({values:t.values.map(r=>({docs:r.docs,availability:r.availability,name:EEe(r.name),nameV2:G2(r.name),value:r.name.wireValue}))}),object:t=>he.V4.types.Type.object({extends:t.extends.map(r=>v9(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:EEe(r.name),nameV2:G2(r.name),valueType:Mz(r.valueType)}))}),union:t=>he.V4.types.Type.union({discriminant:t.discriminant.wireValue,discriminantV2:EEe(t.discriminant),discriminantV3:G2(t.discriminant),types:t.types.map(r=>({docs:r.docs,discriminantValue:EEe(r.discriminantValue),discriminantValueV2:G2(r.discriminantValue),valueType:he.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:i=>he.V4.types.TypeReference.named(v9(i)),singleProperty:i=>Mz(i.type),noProperties:he.V4.types.TypeReference.void,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}}),shape:he.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:i=>he.V4.types.SingleUnionTypeProperties.samePropertiesAsObject(v9(i)),singleProperty:i=>he.V4.types.SingleUnionTypeProperties.singleProperty({name:EEe(i.name),nameV2:G2(i.name),type:Mz(i.type)}),noProperties:he.V4.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}})}))}),_unknown:()=>{throw new Error("Unknown shape: "+e._type)}})}function HqB(e){return{docs:e.docs,jsonExample:e.jsonExample,name:e.name?.originalName,shape:vVo(e.shape)}}function $qB(e){return he.V5.types.ResolvedTypeReference._visit(e,{named:t=>he.V4.types.ResolvedTypeReference.named({name:v9(t.name),shape:GqB(t.shape)}),container:t=>he.V4.types.ResolvedTypeReference.container(LTn(t)),primitive:he.V4.types.ResolvedTypeReference.primitive,unknown:he.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function GqB(e){return he.V5.types.ShapeType._visit(e,{enum:()=>he.V5.types.ShapeType.Enum,object:()=>he.V5.types.ShapeType.Object,union:()=>he.V5.types.ShapeType.Union,_unknown:()=>{throw new Error("Unknown ShapeType: "+e)}})}var Ncg={laterVersion:"v5",earlierVersion:"v4",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.257-2-g46fe4ff",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.33-9-gf683b5e",[J.PYTHON_PYDANTIC]:"0.0.33-9-gf683b5e",[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=new yVo(e),r=new hVo(e);return{apiName:e.apiName.originalName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:Acg(e.auth),headers:e.headers.map(i=>MVi(i)),types:e.types.map(i=>Rcg(i)),services:{http:e.services.map(i=>Icg({service:i,errorResolver:r})),websocket:[]},errors:e.errors.map(i=>Tcg({errorDeclaration:i,errorDiscriminationStrategy:e.errorDiscriminationStrategy,typeReferenceResolver:t})),constants:{errorDiscriminant:"_error",errorInstanceIdKey:"_errorInstanceId",unknownErrorDiscriminantValue:"_unknown"},constantsV2:{errors:{errorInstanceIdKey:EEe(e.constants.errorInstanceIdKey),errorDiscriminant:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR",wireValue:"error"},errorContentKey:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT",wireValue:"content"}},errorsV2:{errorInstanceIdKey:G2(e.constants.errorInstanceIdKey),errorDiscriminant:{name:{unsafeName:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR"},safeName:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR"}},wireValue:"error"},errorContentKey:{name:{unsafeName:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT"},safeName:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT"}},wireValue:"content"}}},defaultEnvironment:e.defaultEnvironment,environments:e.environments.map(i=>qcg(i)),errorDiscriminant:e.errorDiscriminationStrategy.type==="property"?$2(e.errorDiscriminationStrategy.discriminant.name):void 0,errorDiscriminationStrategy:he.V5.ir.ErrorDiscriminationStrategy._visit(e.errorDiscriminationStrategy,{statusCode:he.V4.ir.ErrorDiscriminationStrategy.statusCode,property:i=>he.V4.ir.ErrorDiscriminationStrategy.property({discriminant:G2(i.discriminant),contentProperty:G2(i.contentProperty)}),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+e.errorDiscriminationStrategy.type)}}),sdkConfig:e.sdkConfig}}};var Fcg={laterVersion:"v6",earlierVersion:"v5",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.257-4-ge56e5d2",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.35-1-g071a04a",[J.PYTHON_PYDANTIC]:"0.0.35-1-g071a04a",[J.OPENAPI]:"0.0.16-1-ga2c0ada",[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,defaultEnvironment:e.environments?.defaultEnvironment,environments:e.environments!=null?he.V6.environment.Environments._visit(e.environments.environments,{singleBaseUrl:i=>i.environments,multipleBaseUrls:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying multiple URLs for a single environment. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a multiple URls for a single environment."),_unknown:()=>{throw new Error("Unknown Environments: "+e.environments?.environments.type)}}):[]})};var Lcg={laterVersion:"v7",earlierVersion:"v6",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.268",[J.TYPESCRIPT_EXPRESS]:"0.0.268",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:e.services.map(t=>{let r=t.name.fernFilepath[t.name.fernFilepath.length-1],i=r!=null?`${r.pascalCase.safeName}Service`:"Service",n=r!=null?`${r.camelCase.unsafeName}Service`:"Service",a=r!=null?`${r.snakeCase.unsafeName}_service`:"service",u=a.toUpperCase(),l=G3(n);return{...t,name:{name:{originalName:i,camelCase:{safeName:n,unsafeName:n},snakeCase:{safeName:a,unsafeName:a},screamingSnakeCase:{safeName:u,unsafeName:u},pascalCase:{safeName:l,unsafeName:l}},fernFilepath:t.name.fernFilepath}}})})};var Wcg={laterVersion:"v8",earlierVersion:"v7",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.273-5-g1b00245b",[J.TYPESCRIPT_EXPRESS]:"0.0.273-5-g1b00245b",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.45-1-g8bb600f",[J.PYTHON_PYDANTIC]:"0.0.45-1-g8bb600f",[J.OPENAPI_PYTHON_CLIENT]:"0.0.0",[J.OPENAPI]:"0.0.20-1-gbbeb9bd",[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,auth:QqB(e.auth),headers:e.headers.map(t=>bVo(t)),types:e.types.map(t=>JqB(t)),errors:e.errors.map(t=>tTB(t)),services:e.services.map(t=>rTB(t))})};function Izc(e){return e.allParts}function QqB(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V7.auth.AuthScheme.header(bVo(t)))}}function bVo(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:jQ(e.valueType)}}function jQ(e){return he.V8.types.TypeReference._visit(e,{container:t=>he.V7.types.TypeReference.container(Hcg(t)),named:t=>he.V7.types.TypeReference.named(GLt(t)),primitive:he.V7.types.TypeReference.primitive,unknown:he.V7.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function Hcg(e){return he.V8.types.ContainerType._visit(e,{list:t=>he.V7.types.ContainerType.list(jQ(t)),optional:t=>he.V7.types.ContainerType.optional(jQ(t)),set:t=>he.V7.types.ContainerType.set(jQ(t)),map:({keyType:t,valueType:r})=>he.V7.types.ContainerType.map({keyType:jQ(t),valueType:jQ(r)}),literal:he.V7.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function GLt(e){return{name:e.name,fernFilepath:Izc(e.fernFilepath)}}function JqB(e){return{docs:e.docs,availability:e.availability,name:GLt(e.name),shape:KqB(e.shape),examples:e.examples.map(t=>kqB(t)),referencedTypes:e.referencedTypes.map(t=>GLt(t))}}function KqB(e){return he.V8.types.Type._visit(e,{alias:t=>he.V7.types.Type.alias({aliasOf:jQ(t.aliasOf),resolvedType:YqB(t.resolvedType)}),enum:he.V7.types.Type.enum,object:t=>he.V7.types.Type.object({extends:t.extends.map(r=>GLt(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:r.name,valueType:jQ(r.valueType)}))}),union:t=>he.V7.types.Type.union({discriminant:t.discriminant,types:t.types.map(r=>XqB(r))}),_unknown:()=>{throw new Error("Unknown Type shape: "+e._type)}})}function YqB(e){return he.V8.types.ResolvedTypeReference._visit(e,{container:t=>he.V7.types.ResolvedTypeReference.container(Hcg(t)),named:t=>he.V7.types.ResolvedTypeReference.named({name:GLt(t.name),shape:t.shape}),primitive:he.V7.types.ResolvedTypeReference.primitive,unknown:he.V7.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function XqB(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:ZqB(e.shape)}}function ZqB(e){return he.V8.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V7.types.SingleUnionTypeProperties.samePropertiesAsObject(GLt(t)),singleProperty:t=>he.V7.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:jQ(t.type)}),noProperties:he.V7.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function kqB(e){return{jsonExample:e.jsonExample,docs:e.docs,name:e.name,shape:zzc(e.shape)}}function zzc(e){return he.V8.types.ExampleTypeShape._visit(e,{alias:t=>he.V7.types.ExampleTypeShape.alias({value:Tae(t.value)}),enum:he.V7.types.ExampleTypeShape.enum,object:t=>he.V7.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:Tae(r.value),originalTypeDeclaration:GLt(r.originalTypeDeclaration)}))}),union:t=>he.V7.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:eTB(t.properties)}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Tae(e){return{jsonExample:e.jsonExample,shape:$cg(e.shape)}}function $cg(e){return he.V8.types.ExampleTypeReferenceShape._visit(e,{named:t=>he.V7.types.ExampleTypeReferenceShape.named({typeName:GLt(t.typeName),shape:zzc(t.shape)}),container:t=>he.V7.types.ExampleTypeReferenceShape.container(he.V8.types.ExampleContainer._visit(t,{list:r=>he.V7.types.ExampleContainer.list(r.map(i=>Tae(i))),set:r=>he.V7.types.ExampleContainer.set(r.map(i=>Tae(i))),optional:r=>he.V7.types.ExampleContainer.optional(r!=null?Tae(r):void 0),map:r=>he.V7.types.ExampleContainer.map(r.map(i=>({key:Tae(i.key),value:Tae(i.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+t.type)}})),primitive:he.V7.types.ExampleTypeReferenceShape.primitive,unknown:he.V7.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function eTB(e){return he.V8.types.ExampleSingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V7.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:GLt(t.typeName),shape:zzc(t.shape)}),singleProperty:t=>he.V7.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:t.jsonExample,shape:$cg(t.shape)}),noProperties:he.V7.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.type)}})}function tTB(e){return{docs:e.docs,name:Rzc(e.name),discriminantValue:e.discriminantValue,type:e.type!=null?jQ(e.type):void 0,statusCode:e.statusCode}}function Rzc(e){return{name:e.name,fernFilepath:Izc(e.fernFilepath)}}function rTB(e){return{docs:e.docs,availability:e.availability,name:{fernFilepath:Izc(e.name.fernFilepath)},displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>Gcg(t)),headers:e.headers.map(t=>bVo(t)),endpoints:e.endpoints.map(t=>iTB(t))}}function Gcg(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:jQ(e.valueType)}}function iTB(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors.map(t=>nTB(t)),auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>Gcg(t)),sdkRequest:e.sdkRequest!=null?oTB(e.sdkRequest):void 0,requestBody:e.requestBody!=null?sTB(e.requestBody):void 0,response:cTB(e.response),headers:e.headers.map(t=>bVo(t)),queryParameters:e.queryParameters.map(t=>aTB(t)),examples:e.examples.map(t=>lTB(t))}}function nTB(e){return{docs:e.docs,error:Rzc(e.error)}}function aTB(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:jQ(e.valueType),allowMultiple:e.allowMultiple}}function oTB(e){return{requestParameterName:e.requestParameterName,shape:uTB(e.shape)}}function uTB(e){return he.V8.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V7.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:jQ(t.requestBodyType)}),wrapper:he.V7.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function sTB(e){return he.V8.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V7.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends.map(r=>GLt(r)),properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:jQ(r.valueType)}))}),reference:t=>he.V7.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:jQ(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function cTB(e){return{docs:e.docs,type:e.type!=null?jQ(e.type):void 0}}function lTB(e){return{name:e.name,docs:e.docs,servicePathParameters:e.servicePathParameters.map(t=>Ucg(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Ucg(t)),queryParameters:e.queryParameters.map(t=>fTB(t)),serviceHeaders:e.serviceHeaders.map(t=>Vcg(t)),endpointHeaders:e.endpointHeaders.map(t=>Vcg(t)),request:e.request!=null?dTB(e.request):void 0,response:pTB(e.response)}}function Ucg(e){return{key:e.key,value:Tae(e.value)}}function fTB(e){return{wireKey:e.wireKey,value:Tae(e.value)}}function Vcg(e){return{wireKey:e.wireKey,value:Tae(e.value)}}function dTB(e){return he.V8.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V7.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>({wireKey:r.wireKey,value:Tae(r.value),originalTypeDeclaration:r.originalTypeDeclaration!=null?GLt(r.originalTypeDeclaration):void 0}))}),reference:t=>he.V7.http.ExampleRequestBody.reference(Tae(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function pTB(e){return he.V8.http.ExampleResponse._visit(e,{ok:t=>he.V7.http.ExampleResponse.ok({body:t.body!=null?Tae(t.body):void 0}),error:t=>he.V7.http.ExampleResponse.error({error:Rzc(t.error),body:t.body!=null?Tae(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var Qcg={laterVersion:"v9",earlierVersion:"v8",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.3.0-2-g85e8aa08",[J.TYPESCRIPT_EXPRESS]:"0.3.0-2-g85e8aa08",[J.JAVA]:We,[J.JAVA_MODEL]:"0.0.134-4-gef1ec4f",[J.JAVA_SDK]:"0.0.134-4-gef1ec4f",[J.JAVA_SPRING]:"0.0.134-4-gef1ec4f",[J.PYTHON_FASTAPI]:"0.0.51-1-g977dd1f",[J.PYTHON_PYDANTIC]:"0.0.51-1-g977dd1f",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[i,n]of Object.entries(e.types))n.shape._type==="union"&&n.shape.baseProperties.length>0&&t.failWithoutThrowing(r!=null?`Type ${n.name.name.originalName} uses base-properties. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a union with base-properties.");return t.getResult()===wC.Failure&&t.failAndThrow(),{...e,types:Object.values(e.types),errors:Object.values(e.errors),services:Object.values(e.services)}}};var Jcg={laterVersion:"v10",earlierVersion:"v9",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.STOPLIGHT]:ri,[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=rd(e.services,r=>({docs:void 0,...r}));for(let r of Object.values(e.subpackages))if(r.docs!=null&&r.service!=null){let i=t[r.service];if(i==null)throw new Error("Service does not exist: "+r.service);i.docs=r.docs}return{...e,services:t}}};var Kcg={laterVersion:"v11",earlierVersion:"v10",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.0-rc0-1-g83a12940",[J.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-1-g83a12940",[J.JAVA]:We,[J.JAVA_MODEL]:"0.0.134-15-ge1ac358",[J.JAVA_SDK]:"0.0.134-15-ge1ac358",[J.JAVA_SPRING]:"0.0.134-15-ge1ac358",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.STOPLIGHT]:ri,[J.OPENAPI]:We,[J.POSTMAN]:"0.0.40-1-g9aa2117",[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,auth:_TB(e.auth,t)})};function _TB(e,t){return{...e,schemes:e.schemes.map(r=>hTB(r,t))}}function hTB(e,{taskContext:t,targetGenerator:r}){return he.V11.auth.AuthScheme._visit(e,{bearer:he.V10.auth.AuthScheme.bearer,basic:he.V10.auth.AuthScheme.basic,header:i=>i.prefix!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying an auth header prefix. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains an auth header prefix."):he.V10.auth.AuthScheme.header({docs:i.docs,availability:{status:he.V10.commons.AvailabilityStatus.GeneralAvailability,message:void 0},name:{name:i.name,wireValue:i.header},valueType:i.valueType}),_unknown:()=>{throw new Error("Unknown auth scheme: "+e._type)}})}var Xcg={laterVersion:"v12",earlierVersion:"v11",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.0-rc0-6-g80f89f98",[J.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-6-g80f89f98",[J.JAVA]:We,[J.JAVA_MODEL]:"0.1.0-1-gdb5c636",[J.JAVA_SDK]:"0.1.0-1-gdb5c636",[J.JAVA_SPRING]:"0.1.0-1-gdb5c636",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.STOPLIGHT]:"0.0.23-8-g479c860",[J.OPENAPI]:"0.0.22-1-g1c86b58",[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{let i=rd(e.types,n=>({...n,shape:he.V12.types.Type._visit(n.shape,{union:he.V11.types.Type.union,enum:he.V11.types.Type.enum,object:he.V11.types.Type.object,alias:a=>he.V11.types.Type.alias({aliasOf:a.aliasOf,resolvedType:he.V12.types.ResolvedTypeReference._visit(a.resolvedType,{container:he.V11.types.ResolvedTypeReference.container,primitive:he.V11.types.ResolvedTypeReference.primitive,named:u=>u.shape==="UNDISCRIMINATED_UNION"?t.failAndThrow(Ycg({taskContext:t,targetGenerator:r})):he.V11.types.ResolvedTypeReference.named({shape:u.shape,name:u.name}),unknown:he.V11.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Encountered unknown alias")}})}),undiscriminatedUnion:()=>t.failAndThrow(Ycg({taskContext:t,targetGenerator:r})),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,types:i,services:rd(e.services,n=>yTB(n,{taskContext:t,targetGenerator:r}))}}};function Ycg(e){return e.targetGenerator!=null?`Generator ${e.targetGenerator.name}@${e.targetGenerator.version} does not support undiscriminated unions If you'd like to use this feature, please upgrade ${e.targetGenerator.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains an undiscriminated union."}function yTB(e,t){return{...e,endpoints:e.endpoints.map(r=>vTB(r,t))}}function vTB(e,{taskContext:t,targetGenerator:r}){return e.streamingResponse!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support streaming responses. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a streaming response."):{...e,requestBody:e.requestBody!=null?he.V12.http.HttpRequestBody._visit(e.requestBody,{inlinedRequestBody:he.V11.http.HttpRequestBody.inlinedRequestBody,reference:he.V11.http.HttpRequestBody.reference,fileUpload:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support file upload requests. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a file upload request."),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.requestBody?.type)}}):void 0,response:e.response!=null?{docs:e.response.docs,type:e.response.responseBodyType}:{docs:void 0,type:void 0}}}var Zcg={laterVersion:"v13",earlierVersion:"v12",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,types:rd(e.types,t=>t.shape._type!=="undiscriminatedUnion"?{...t,shape:t.shape}:{...t,shape:he.V12.types.Type.undiscriminatedUnion({docs:void 0,members:t.shape.members})}),auth:{...e.auth,schemes:e.auth.schemes.map(t=>t._type!=="header"?t:{...t,name:t.name.name,header:t.name.wireValue})}})};var kcg={laterVersion:"v14",earlierVersion:"v13",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V14.types.Type._visit(r.shape,{union:i=>he.V13.types.Type.union({discriminant:i.discriminant,baseProperties:i.baseProperties.map(n=>({...n,valueType:HF(n.valueType)})),types:i.types.map(n=>OTB(n))}),enum:he.V13.types.Type.enum,object:i=>he.V13.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:HF(n.valueType)}))}),alias:i=>he.V13.types.Type.alias({aliasOf:HF(i.aliasOf),resolvedType:PTB(i.resolvedType)}),undiscriminatedUnion:i=>he.V13.types.Type.undiscriminatedUnion(jTB(i)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:bTB(e.auth),headers:e.headers.map(r=>Lzc(r)),types:t,services:rd(e.services,r=>wTB(r)),errors:rd(e.errors,r=>TTB(r))}}};function bTB(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V13.auth.AuthScheme.header(gTB(t)))}}function gTB(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:HF(e.valueType)}}function Lzc(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:HF(e.valueType)}}function HF(e){return he.V14.types.TypeReference._visit(e,{container:t=>he.V13.types.TypeReference.container(elg(t)),primitive:t=>t==="DATE"?he.V13.types.TypeReference.primitive(he.V13.types.PrimitiveType.String):he.V13.types.TypeReference.primitive(t),named:he.V13.types.TypeReference.named,unknown:he.V13.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function elg(e){return he.V14.types.ContainerType._visit(e,{list:t=>he.V13.types.ContainerType.list(HF(t)),optional:t=>he.V13.types.ContainerType.optional(HF(t)),set:t=>he.V13.types.ContainerType.set(HF(t)),map:({keyType:t,valueType:r})=>he.V13.types.ContainerType.map({keyType:HF(t),valueType:HF(r)}),literal:he.V13.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function OTB(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:mTB(e.shape)}}function mTB(e){return he.V14.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V13.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V13.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:HF(t.type)}),noProperties:he.V13.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function PTB(e){return he.V14.types.ResolvedTypeReference._visit(e,{container:t=>he.V13.types.ResolvedTypeReference.container(elg(t)),named:he.V13.types.ResolvedTypeReference.named,primitive:t=>t==="DATE"?he.V13.types.ResolvedTypeReference.primitive(he.V13.types.PrimitiveType.String):he.V13.types.ResolvedTypeReference.primitive(t),unknown:he.V13.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function jTB(e){return{members:e.members.map(t=>({...t,type:HF(t.type)}))}}function wTB(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>tlg(t)),headers:e.headers.map(t=>Lzc(t)),endpoints:e.endpoints.map(t=>STB(t))}}function tlg(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:HF(e.valueType)}}function STB(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors,auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>tlg(t)),sdkRequest:e.sdkRequest!=null?ETB(e.sdkRequest):void 0,requestBody:e.requestBody!=null?ATB(e.requestBody):void 0,response:e.response!=null?Nzc(e.response):void 0,headers:e.headers.map(t=>Lzc(t)),queryParameters:e.queryParameters.map(t=>DTB(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?Fzc(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?qTB(e.sdkResponse):void 0}}function DTB(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:HF(e.valueType),allowMultiple:e.allowMultiple}}function ETB(e){return{requestParameterName:e.requestParameterName,shape:MTB(e.shape)}}function MTB(e){return he.V14.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V13.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:HF(t.requestBodyType)}),wrapper:he.V13.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function ATB(e){return he.V14.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V13.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:HF(r.valueType)}))}),reference:t=>he.V13.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:HF(t.requestBodyType)}),fileUpload:t=>he.V13.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:HF(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Nzc(e){return{docs:e.docs,responseBodyType:HF(e.responseBodyType)}}function Fzc(e){return{dataEventType:HF(e.dataEventType),terminator:e.terminator}}function qTB(e){return he.V14.http.SdkResponse._visit(e,{streaming:t=>he.V13.http.SdkResponse.streaming(Fzc(t)),nonStreaming:t=>he.V13.http.SdkResponse.nonStreaming(Nzc(t)),maybeStreaming:t=>he.V13.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Nzc(t.nonStreaming),streaming:Fzc(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function TTB(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?HF(e.type):void 0,statusCode:e.statusCode}}var rlg={laterVersion:"v15",earlierVersion:"v14",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.52-3-gd9df38df",[J.PYTHON_PYDANTIC]:"0.0.52-3-gd9df38df",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.0.52-3-gd9df38df",[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V15.types.Type._visit(r.shape,{union:i=>he.V14.types.Type.union({discriminant:i.discriminant,baseProperties:i.baseProperties.map(n=>({...n,valueType:$F(n.valueType)})),types:i.types.map(n=>xTB(n))}),enum:he.V14.types.Type.enum,object:i=>he.V14.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:$F(n.valueType)}))}),alias:i=>he.V14.types.Type.alias({aliasOf:$F(i.aliasOf),resolvedType:zTB(i.resolvedType)}),undiscriminatedUnion:i=>he.V14.types.Type.undiscriminatedUnion(RTB(i)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:CTB(e.auth),headers:e.headers.map(r=>Wzc(r)),types:t,services:rd(e.services,r=>NTB(r)),errors:rd(e.errors,r=>$TB(r))}}};function CTB(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V14.auth.AuthScheme.header(BTB(t)))}}function BTB(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:$F(e.valueType)}}function Wzc(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:$F(e.valueType)}}function $F(e){return he.V15.types.TypeReference._visit(e,{container:t=>he.V14.types.TypeReference.container(ilg(t)),primitive:t=>t==="BASE_64"?he.V14.types.TypeReference.primitive(he.V14.types.PrimitiveType.String):he.V14.types.TypeReference.primitive(t),named:he.V14.types.TypeReference.named,unknown:he.V14.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function ilg(e){return he.V15.types.ContainerType._visit(e,{list:t=>he.V14.types.ContainerType.list($F(t)),optional:t=>he.V14.types.ContainerType.optional($F(t)),set:t=>he.V14.types.ContainerType.set($F(t)),map:({keyType:t,valueType:r})=>he.V14.types.ContainerType.map({keyType:$F(t),valueType:$F(r)}),literal:he.V14.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function xTB(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:ITB(e.shape)}}function ITB(e){return he.V15.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V14.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V14.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:$F(t.type)}),noProperties:he.V14.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function zTB(e){return he.V15.types.ResolvedTypeReference._visit(e,{container:t=>he.V14.types.ResolvedTypeReference.container(ilg(t)),named:he.V14.types.ResolvedTypeReference.named,primitive:t=>t==="BASE_64"?he.V14.types.ResolvedTypeReference.primitive(he.V14.types.PrimitiveType.String):he.V14.types.ResolvedTypeReference.primitive(t),unknown:he.V14.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function RTB(e){return{members:e.members.map(t=>({...t,type:$F(t.type)}))}}function NTB(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>nlg(t)),headers:e.headers.map(t=>Wzc(t)),endpoints:e.endpoints.map(t=>FTB(t))}}function nlg(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:$F(e.valueType)}}function FTB(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors,auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>nlg(t)),sdkRequest:e.sdkRequest!=null?UTB(e.sdkRequest):void 0,requestBody:e.requestBody!=null?WTB(e.requestBody):void 0,response:e.response!=null?Uzc(e.response):void 0,headers:e.headers.map(t=>Wzc(t)),queryParameters:e.queryParameters.map(t=>LTB(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?Vzc(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?HTB(e.sdkResponse):void 0}}function LTB(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:$F(e.valueType),allowMultiple:e.allowMultiple}}function UTB(e){return{requestParameterName:e.requestParameterName,shape:VTB(e.shape)}}function VTB(e){return he.V15.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V14.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:$F(t.requestBodyType)}),wrapper:he.V14.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function WTB(e){return he.V15.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V14.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:$F(r.valueType)}))}),reference:t=>he.V14.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:$F(t.requestBodyType)}),fileUpload:t=>he.V14.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:$F(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Uzc(e){return{docs:e.docs,responseBodyType:$F(e.responseBodyType)}}function Vzc(e){return{dataEventType:$F(e.dataEventType),terminator:e.terminator}}function HTB(e){return he.V15.http.SdkResponse._visit(e,{streaming:t=>he.V14.http.SdkResponse.streaming(Vzc(t)),nonStreaming:t=>he.V14.http.SdkResponse.nonStreaming(Uzc(t)),maybeStreaming:t=>he.V14.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Uzc(t.nonStreaming),streaming:Vzc(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function $TB(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?$F(e.type):void 0,statusCode:e.statusCode}}var alg={laterVersion:"v16",earlierVersion:"v15",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.4-1-g4e69d312",[J.TYPESCRIPT_EXPRESS]:"0.5.4-1-g4e69d312",[J.JAVA]:We,[J.JAVA_MODEL]:"0.3.8-rc6-1-gcf4b372",[J.JAVA_SDK]:"0.3.8-rc6-1-gcf4b372",[J.JAVA_SPRING]:"0.3.8-rc6-1-gcf4b372",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>e.basePath!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying a base-path in api.yml. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a root base-path."):{...e,services:rd(e.services,i=>({...i,pathParameters:Hzc(i.pathParameters),endpoints:i.endpoints.map(n=>({...n,allPathParameters:Hzc(n.allPathParameters),pathParameters:Hzc(n.pathParameters)}))}))}};function Hzc(e){return e.map(t=>GTB(t))}function GTB(e){return{...e,availability:{status:he.V15.commons.AvailabilityStatus.GeneralAvailability,message:void 0}}}var olg={laterVersion:"v17",earlierVersion:"v16",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[i,n]of Object.entries(e.types))if(n.shape._type==="union"&&n.shape.extends.length>0)return t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support union types with extensions. See ${i} in file ${n.name.fernFilepath.allParts.join("/")}. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains union types with extensions.");return{...e}}};var ulg={laterVersion:"v18",earlierVersion:"v17",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.14-1-ga6817141",[J.TYPESCRIPT_EXPRESS]:"0.5.14-1-ga6817141",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.3.0-3-ge125e311",[J.PYTHON_PYDANTIC]:"0.3.0-3-ge125e311",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.3.0-3-ge125e311",[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,services:rd(e.services,i=>{let n=i.endpoints[0]?.baseUrl;return i.endpoints.some(a=>a.baseUrl!==n)?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support endpoint-level server URLs. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains endpoint-level server URLs."):{...i,baseUrl:n}})})};var clg={laterVersion:"v19",earlierVersion:"v18",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.19-1-gef223230",[J.TYPESCRIPT_EXPRESS]:"0.5.19-1-gef223230",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.3.4-rc0-9-ge815162f",[J.PYTHON_PYDANTIC]:"0.3.4-rc0-9-ge815162f",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:"0.0.44-1-gbf4b0f3",[J.PYTHON_SDK]:"0.3.4-rc0-9-ge815162f",[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:rd(e.services,r=>QTB(r,t)),types:rd(e.types,r=>kTB(r,t))})};function QTB(e,t){return{...e,endpoints:e.endpoints.map(r=>JTB(r,t))}}function JTB(e,t){return{...e,examples:e.examples.map(r=>KTB(r,t))}}function KTB(e,t){return{docs:e.docs,name:e.name,url:e.url,rootPathParameters:e.rootPathParameters.map(r=>$zc(r,t)),servicePathParameters:e.servicePathParameters.map(r=>$zc(r,t)),endpointPathParameters:e.endpointPathParameters.map(r=>$zc(r,t)),serviceHeaders:e.serviceHeaders.map(r=>slg(r,t)),endpointHeaders:e.endpointHeaders.map(r=>slg(r,t)),queryParameters:e.queryParameters.map(r=>YTB(r,t)),request:e.request!=null?XTB(e.request,t):void 0,response:ZTB(e.response,t)}}function $zc(e,t){return{key:e.key,value:Cae(e.value,t)}}function slg(e,t){return{wireKey:e.wireKey,value:Cae(e.value,t)}}function YTB(e,t){return{wireKey:e.wireKey,value:Cae(e.value,t)}}function XTB(e,t){return he.V19.http.ExampleRequestBody._visit(e,{inlinedRequestBody:r=>he.V18.http.ExampleRequestBody.inlinedRequestBody({jsonExample:r.jsonExample,properties:r.properties.map(i=>({wireKey:i.wireKey,value:Cae(i.value,t),originalTypeDeclaration:i.originalTypeDeclaration}))}),reference:r=>he.V18.http.ExampleRequestBody.reference(Cae(r,t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function ZTB(e,t){return he.V19.http.ExampleResponse._visit(e,{ok:r=>he.V18.http.ExampleResponse.ok({body:r.body!=null?Cae(r.body,t):void 0}),error:r=>he.V18.http.ExampleResponse.error({error:r.error,body:r.body!=null?Cae(r.body,t):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function kTB(e,t){return{...e,examples:e.examples.map(r=>eCB(r,t))}}function eCB(e,t){return{...e,shape:Gzc(e.shape,t)}}function Gzc(e,t){return he.V19.types.ExampleTypeShape._visit(e,{alias:r=>he.V18.types.ExampleTypeShape.alias({value:Cae(r.value,t)}),object:r=>he.V18.types.ExampleTypeShape.object({properties:r.properties.map(i=>({wireKey:i.wireKey,value:Cae(i.value,t),originalTypeDeclaration:i.originalTypeDeclaration}))}),union:r=>he.V18.types.ExampleTypeShape.union({wireDiscriminantValue:r.wireDiscriminantValue,properties:he.V19.types.ExampleSingleUnionTypeProperties._visit(r.properties,{singleProperty:i=>he.V18.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:i.jsonExample,shape:llg(i.shape,t)}),samePropertiesAsObject:i=>he.V18.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:i.typeName,shape:Gzc(i.shape,t)}),noProperties:he.V18.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+r.properties.type)}})}),enum:he.V18.types.ExampleTypeShape.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Cae(e,t){return{jsonExample:e.jsonExample,shape:llg(e.shape,t)}}function llg(e,t){return he.V19.types.ExampleTypeReferenceShape._visit(e,{primitive:r=>he.V18.types.ExampleTypeReferenceShape.primitive(tCB(r,t)),named:r=>he.V18.types.ExampleTypeReferenceShape.named({typeName:r.typeName,shape:Gzc(r.shape,t)}),container:r=>he.V18.types.ExampleTypeReferenceShape.container(he.V19.types.ExampleContainer._visit(r,{list:i=>he.V18.types.ExampleContainer.list(i.map(n=>Cae(n,t))),set:i=>he.V18.types.ExampleContainer.set(i.map(n=>Cae(n,t))),optional:i=>he.V18.types.ExampleContainer.optional(i!=null?Cae(i,t):void 0),map:i=>he.V18.types.ExampleContainer.map(i.map(n=>({key:Cae(n.key,t),value:Cae(n.value,t)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+r.type)}})),unknown:he.V18.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function tCB(e,{taskContext:t,targetGenerator:r}){return e.type==="date"?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support examples for dates. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains date examples."):e}var flg={laterVersion:"v20",earlierVersion:"v19",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.5.26-rc0-3-gdfabd674",[J.TYPESCRIPT_BROWSER_SDK]:"0.5.26-rc0-3-gdfabd674",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.20-3-g2505487f",[J.TYPESCRIPT_EXPRESS]:"0.5.20-3-g2505487f",[J.JAVA]:We,[J.JAVA_MODEL]:"0.3.10-rc2-1-g1c0d853",[J.JAVA_SDK]:"0.3.10-rc2-1-g1c0d853",[J.JAVA_SPRING]:"0.3.10-rc2-1-g1c0d853",[J.PYTHON_FASTAPI]:"0.3.6-rc1-2-g6050f7f8",[J.PYTHON_PYDANTIC]:"0.3.6-rc1-2-g6050f7f8",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.3.6-rc1-2-g6050f7f8",[J.GO_FIBER]:ri,[J.GO_MODEL]:"0.0.0",[J.GO_SDK]:"0.0.0",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:rd(e.services,r=>rCB(r,t))})};function rCB(e,t){return{...e,endpoints:e.endpoints.map(r=>iCB(r,t))}}function iCB(e,t){return{...e,response:e.response!=null?dlg(e.response,t):void 0,sdkResponse:e.sdkResponse!=null?nCB(e.sdkResponse,t):void 0}}function dlg(e,t){return he.V20.http.HttpResponse._visit(e,{fileDownload:()=>plg(t),json:r=>r,_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.type)}})}function nCB(e,t){return he.V20.http.SdkResponse._visit(e,{fileDownload:()=>plg(t),streaming:he.V19.http.SdkResponse.streaming,maybeStreaming:r=>he.V19.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:r.streaming,nonStreaming:dlg(r.nonStreaming,t)}),json:he.V19.http.SdkResponse.nonStreaming,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}function plg({targetGenerator:e,taskContext:t}){return t.failAndThrow(e!=null?`Generator ${e.name}@${e.version} does not support file download. If you'd like to use this feature, please upgrade ${e.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains file download.")}var _lg={laterVersion:"v21",earlierVersion:"v20",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:ri,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:rd(e.services,r=>aCB(r,t))})};function aCB(e,t){return{...e,endpoints:e.endpoints.map(r=>oCB(r,t))}}function oCB(e,t){return{...e,streamingResponse:e.streamingResponse!=null?Qzc(e.streamingResponse,t):void 0,sdkResponse:e.sdkResponse!=null?uCB(e.sdkResponse,t):void 0}}function Qzc(e,{taskContext:t,targetGenerator:r}){return{dataEventType:he.V21.http.StreamingResponseChunkType._visit(e.dataEventType,{json:i=>i,text:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support streaming text responses. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains streaming text responses."),_unknown:()=>{throw new Error("Unknown StreamingResponseChunkType: "+e.dataEventType.type)}}),terminator:e.terminator}}function uCB(e,t){return he.V21.http.SdkResponse._visit(e,{fileDownload:he.V20.http.SdkResponse.fileDownload,streaming:r=>he.V20.http.SdkResponse.streaming(Qzc(r,t)),maybeStreaming:r=>he.V20.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:Qzc(r.streaming,t),nonStreaming:r.nonStreaming}),json:he.V20.http.SdkResponse.json,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}var hlg={laterVersion:"v22",earlierVersion:"v21",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.5.0-3-gac7ce7c",[J.GO_MODEL]:"0.0.14-8-g2fa39f7",[J.GO_SDK]:"0.0.14-8-g2fa39f7",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:rd(e.services,t=>sCB(t))})};function sCB(e){return{...e,endpoints:e.endpoints.map(t=>cCB(t))}}function cCB(e){return{...e,...e.response!=null?he.V22.http.HttpResponse._visit(e.response,{json:t=>({response:he.V21.http.HttpResponse.json(t),streamingResponse:void 0,sdkResponse:he.V21.http.SdkResponse.json(t)}),fileDownload:t=>({response:he.V21.http.HttpResponse.fileDownload(t),streamingResponse:void 0,sdkResponse:he.V21.http.SdkResponse.fileDownload(t)}),streaming:t=>({response:void 0,streamingResponse:t,sdkResponse:he.V21.http.SdkResponse.streaming(t)}),_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.response?.type)}}):{response:void 0,streamingResponse:void 0,sdkResponse:void 0}}}var blg={laterVersion:"v23",earlierVersion:"v22",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.7.4-rc3-4-g6cf92f81",[J.TYPESCRIPT_BROWSER_SDK]:"0.7.4-rc3-4-g6cf92f81",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.7.4-rc3-4-g6cf92f81",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:"0.0.28-3-g112d3dd",[J.STOPLIGHT]:"0.0.28-3-g112d3dd",[J.POSTMAN]:"0.0.44-4-gddab2ae",[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>{let r=[],i={};for(let[n,a]of Object.entries(e.services)){let u=[];for(let l of a.endpoints){let d=lCB(l);d==null?r.push(l):u.push(d)}i[n]={...a,endpoints:u,headers:a.headers.map(l=>Kzc(l)),pathParameters:a.pathParameters.map(l=>gVo(l))}}return r.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support bytes requests. `),r.length===1&&r[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${r[0].name.originalName} will be skipped.`):t.taskContext.logger.warn(`Therefore, endpoints ${r.map(n=>n.name.originalName).join(", ")} will be skipped.`)),{...e,auth:{...e.auth,schemes:e.auth.schemes.map(n=>dCB(n))},headers:e.headers.map(n=>Kzc(n)),types:rd(e.types,n=>pCB(n)),services:i,errors:rd(e.errors,n=>gCB(n)),subpackages:e.subpackages,pathParameters:e.pathParameters.map(n=>gVo(n)),variables:e.variables.map(n=>OCB(n))}}};function lCB(e){let t;if(!(e.requestBody!=null&&(t=fCB(e.requestBody),t==null)))return{...e,headers:e.headers.map(r=>Kzc(r)),pathParameters:e.pathParameters.map(r=>gVo(r)),allPathParameters:e.allPathParameters.map(r=>gVo(r)),queryParameters:e.queryParameters.map(r=>mCB(r)),requestBody:t,sdkRequest:e.sdkRequest!=null?{requestParameterName:e.sdkRequest.requestParameterName,shape:PCB(e.sdkRequest.shape)}:void 0,response:e.response!=null?jCB(e.response):void 0,examples:e.examples.map(r=>wCB(r))}}function fCB(e){switch(e.type){case"bytes":return;case"fileUpload":return he.V22.http.HttpRequestBody.fileUpload({...e,properties:e.properties.map(t=>DCB(t))});case"inlinedRequestBody":return he.V22.http.HttpRequestBody.inlinedRequestBody({...e,properties:e.properties.map(t=>ECB(t))});case"reference":return he.V22.http.HttpRequestBody.reference({...e,requestBodyType:GF(e.requestBodyType)});default:Fo(e)}}function Kzc(e){return{...e,valueType:GF(e.valueType)}}function dCB(e){return e._visit({bearer:he.V22.auth.AuthScheme.bearer,basic:he.V22.auth.AuthScheme.basic,header:t=>he.V22.auth.AuthScheme.header({...t,valueType:GF(t.valueType)}),_other:()=>{throw new Error("Unknown auth scheme: "+e.type)}})}function pCB(e){return{...e,shape:_CB(e.shape),examples:e.examples.map(t=>hCB(t))}}function _CB(e){return e._visit({alias:t=>he.V22.types.Type.alias({...t,aliasOf:GF(t.aliasOf),resolvedType:vCB(t.resolvedType)}),enum:he.V22.types.Type.enum,object:t=>he.V22.types.Type.object({...t,properties:t.properties.map(r=>ylg(r))}),union:t=>he.V22.types.Type.union({...t,baseProperties:t.baseProperties.map(r=>ylg(r)),types:t.types.map(r=>({...r,shape:bCB(r.shape)}))}),undiscriminatedUnion:t=>he.V22.types.Type.undiscriminatedUnion({...t,members:t.members.map(r=>({...r,type:GF(r.type)}))}),_other:()=>{throw new Error("Unknown type shape: "+e.type)}})}function hCB(e){return{...e,shape:Yzc(e.shape)}}function Yzc(e){return e._visit({alias:t=>he.V22.types.ExampleTypeShape.alias({...t,value:MEe(t.value)}),enum:he.V22.types.ExampleTypeShape.enum,object:t=>he.V22.types.ExampleTypeShape.object({...t,properties:t.properties.map(r=>({...r,value:MEe(r.value)}))}),union:t=>he.V22.types.ExampleTypeShape.union({...t,properties:yCB(t.properties)}),_other:()=>{throw new Error("Unknown example type shape: "+e.type)}})}function MEe(e){return{...e,shape:Xzc(e.shape)}}function Xzc(e){return e._visit({primitive:t=>he.V22.types.ExampleTypeReferenceShape.primitive(t._visit({integer:he.V22.types.ExamplePrimitive.integer,double:he.V22.types.ExamplePrimitive.double,string:he.V22.types.ExamplePrimitive.string,boolean:he.V22.types.ExamplePrimitive.boolean,long:he.V22.types.ExamplePrimitive.long,datetime:r=>he.V22.types.ExamplePrimitive.datetime(r.toISOString()),date:he.V22.types.ExamplePrimitive.date,uuid:he.V22.types.ExamplePrimitive.uuid,_other:()=>{throw new Error("Unknown example primitive: "+t.type)}})),named:t=>he.V22.types.ExampleTypeReferenceShape.named({...t,shape:Yzc(t.shape)}),container:t=>he.V22.types.ExampleTypeReferenceShape.container(t._visit({list:r=>he.V22.types.ExampleContainer.list(r.map(i=>MEe(i))),set:r=>he.V22.types.ExampleContainer.set(r.map(i=>MEe(i))),optional:r=>he.V22.types.ExampleContainer.optional(r!=null?MEe(r):void 0),map:r=>he.V22.types.ExampleContainer.map(r.map(i=>({key:MEe(i.key),value:MEe(i.value)}))),_other:()=>{throw new Error("Unknown example container: "+t.type)}})),unknown:he.V22.types.ExampleTypeReferenceShape.unknown,_other:()=>{throw new Error("Unknown example type reference shape: "+e.type)}})}function yCB(e){return e._visit({singleProperty:t=>he.V22.types.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:Xzc(t.shape)}),noProperties:he.V22.types.ExampleSingleUnionTypeProperties.noProperties,samePropertiesAsObject:t=>he.V22.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,shape:Yzc(t.shape)}),_other:()=>{throw new Error("Unknown example single union type properties: "+e.type)}})}function GF(e){return e._visit({container:t=>he.V22.types.TypeReference.container(glg(t)),primitive:he.V22.types.TypeReference.primitive,named:he.V22.types.TypeReference.named,unknown:he.V22.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function glg(e){return e._visit({list:t=>he.V22.types.ContainerType.list(GF(t)),set:t=>he.V22.types.ContainerType.set(GF(t)),optional:t=>he.V22.types.ContainerType.optional(GF(t)),map:t=>he.V22.types.ContainerType.map({keyType:GF(t.keyType),valueType:GF(t.valueType)}),literal:he.V22.types.ContainerType.literal,_other:()=>{throw new Error("Unknown container type: "+e.type)}})}function vCB(e){return e._visit({container:t=>he.V22.types.ResolvedTypeReference.container(glg(t)),primitive:he.V22.types.ResolvedTypeReference.primitive,named:he.V22.types.ResolvedTypeReference.named,unknown:he.V22.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown resolved type reference: "+e.type)}})}function ylg(e){return{...e,valueType:GF(e.valueType)}}function bCB(e){return e._visit({noProperties:he.V22.types.SingleUnionTypeProperties.noProperties,singleProperty:t=>he.V22.types.SingleUnionTypeProperties.singleProperty({...t,type:GF(t.type)}),samePropertiesAsObject:he.V22.types.SingleUnionTypeProperties.samePropertiesAsObject,_other:()=>{throw new Error("Unknown single union type properties: "+e.propertiesType)}})}function gCB(e){return{...e,type:e.type!=null?GF(e.type):void 0}}function OCB(e){return{...e,type:GF(e.type)}}function gVo(e){return{...e,valueType:GF(e.valueType)}}function mCB(e){return{...e,valueType:GF(e.valueType)}}function PCB(e){return e._visit({justRequestBody:t=>he.V22.http.SdkRequestShape.justRequestBody({...t,requestBodyType:GF(t.requestBodyType)}),wrapper:he.V22.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SDK request shape: "+e.type)}})}function jCB(e){return e._visit({json:t=>he.V22.http.HttpResponse.json({...t,responseBodyType:GF(t.responseBodyType)}),fileDownload:he.V22.http.HttpResponse.fileDownload,streaming:t=>he.V22.http.HttpResponse.streaming({...t,dataEventType:t.dataEventType._visit({json:r=>he.V22.http.StreamingResponseChunkType.json(GF(r)),text:he.V22.http.StreamingResponseChunkType.text,_other:()=>{throw new Error("Unknown streaming data event type: "+t.dataEventType.type)}})}),_other:()=>{throw new Error("Unknown response: "+e.type)}})}function wCB(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Jzc(t)),servicePathParameters:e.servicePathParameters.map(t=>Jzc(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Jzc(t)),serviceHeaders:e.serviceHeaders.map(t=>vlg(t)),endpointHeaders:e.endpointHeaders.map(t=>vlg(t)),queryParameters:e.queryParameters.map(t=>SCB(t)),request:e.request!=null?e.request._visit({inlinedRequestBody:t=>he.V22.http.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,value:MEe(r.value)}))}),reference:t=>he.V22.http.ExampleRequestBody.reference({...t,shape:Xzc(t.shape)}),_other:()=>{throw new Error("Unknown example request body: "+e.request?.type)}}):void 0,response:e.response._visit({ok:t=>he.V22.http.ExampleResponse.ok({...t,body:t.body!=null?MEe(t.body):void 0}),error:t=>he.V22.http.ExampleResponse.error({...t,body:t.body!=null?MEe(t.body):void 0}),_other:()=>{throw new Error("Unknown example response: "+e.response.type)}})}}function Jzc(e){return{...e,value:MEe(e.value)}}function SCB(e){return{...e,value:MEe(e.value)}}function vlg(e){return{...e,value:MEe(e.value)}}function DCB(e){return e._visit({file:he.V22.http.FileUploadRequestProperty.file,bodyProperty:t=>he.V22.http.FileUploadRequestProperty.bodyProperty({...t,valueType:GF(t.valueType)}),_other:()=>{throw new Error("Unknown file upload request body property: "+e.type)}})}function ECB(e){return{...e,valueType:GF(e.valueType)}}var m_={};Co(m_,{V23:()=>Eo3,V24:()=>Mo3,V25:()=>Ao3,V26:()=>qo3,V27:()=>To3,V28:()=>Co3,V29:()=>Bo3,V30:()=>xo3,V31:()=>Io3,V32:()=>zo3,V33:()=>Ro3,V34:()=>No3,V35:()=>Fo3,V36:()=>Lo3,V37:()=>Uo3,V38:()=>Vo3,V39:()=>Wo3,V40:()=>Ho3,V41:()=>$o3,V42:()=>Go3,V43:()=>Qo3,V44:()=>Jo3,V45:()=>Ko3,V46:()=>Yo3,V47:()=>Xo3,V48:()=>Zo3,V49:()=>ko3,V50:()=>eu3,V51:()=>tu3,V52:()=>ru3,V53:()=>iu3,V54:()=>nu3,V55:()=>au3,V56:()=>a_});var Eo3=yi(Eo(),1),Mo3=yi(so(),1),Ao3=yi(Za(),1),qo3=yi(Ja(),1),To3=yi(Ua(),1),Co3=yi(Va(),1),Bo3=yi(Wa(),1),xo3=yi(Ia(),1),Io3=yi(xa(),1),zo3=yi(ma(),1),Ro3=yi(Wn(),1),No3=yi(Vn(),1),Fo3=yi(Tn(),1),Lo3=yi(Cn(),1),Uo3=yi(qn(),1),Vo3=yi(Dn(),1),Wo3=yi(ln(),1),Ho3=yi(fn(),1),$o3=yi(sn(),1),Go3=yi(tn(),1),Qo3=yi(en(),1),Jo3=yi(Zi(),1),Ko3=yi($i(),1),Yo3=yi(Li(),1),Xo3=yi(Fi(),1),Zo3=yi(Ri(),1),ko3=yi(xi(),1),eu3=yi(Ai(),1),tu3=yi(Ei(),1),ru3=yi(gi(),1),iu3=yi(Gt(),1),nu3=yi(ay(),1),au3=yi(Uh(),1);var eAP={laterVersion:"v24",earlierVersion:"v23",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V23.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e})};var tAP={laterVersion:"v25",earlierVersion:"v24",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:"0.4.9-1-ge0997b3",[J.JAVA_SDK]:"0.4.9-1-ge0997b3",[J.JAVA_SPRING]:"0.4.9-1-ge0997b3",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V24.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:(e,t)=>{let r=[],i=[],n={};for(let[a,u]of Object.entries(e.services)){let l=[];for(let d of u.endpoints){let s;if(d.sdkRequest!=null&&(s=ou3(d.sdkRequest),s==null)){r.push(d);continue}if(d.response!=null){let o=d.response._visit({fileDownload:c=>he.V24.HttpResponse.fileDownload(c),json:c=>he.V24.HttpResponse.json(c),streaming:c=>he.V24.HttpResponse.streaming(c),text:()=>(i.push(d),he.V24.HttpResponse.json({docs:void 0,responseBodyType:he.V24.TypeReference.unknown()})),_other:()=>{throw new Error("Encountered unknown response type")}});l.push({...d,sdkRequest:s,response:o})}else l.push({...d,sdkRequest:s,response:void 0})}n[a]={...u,endpoints:l}}return i.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support text/plain responses. `),i.length===1&&i[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${i[0].name.originalName} response type will be casted to unknown.`):t.taskContext.logger.warn(`Therefore, endpoints ${i.map(a=>a.name.originalName).join(", ")} response types will be casted to unknown.`)),r.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support bytes requests. `),r.length===1&&r[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${r[0].name.originalName} will be skipped.`):t.taskContext.logger.warn(`Therefore, endpoints ${r.map(a=>a.name.originalName).join(", ")} will be skipped.`)),{...e,services:n}}};function ou3(e){let t=e.shape;if(t.type==="wrapper")return{shape:he.V24.SdkRequestShape.wrapper({...t}),requestParameterName:e.requestParameterName};if(t.value.type==="typeReference")return{shape:he.V24.SdkRequestShape.justRequestBody({...t.value}),requestParameterName:e.requestParameterName}}var iAP={laterVersion:"v26",earlierVersion:"v25",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.5.0-rc2-16-g4177fafd",[J.PYTHON_PYDANTIC]:"0.5.0-rc2-16-g4177fafd",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.5.0-rc2-16-g4177fafd",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V25.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,fu3(r)])),headers:e.headers.map(t=>jJu(t)),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,r.map(i=>uu3(i))])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,su3(r)]))})};function uu3(e){return{...e,headers:e.headers.map(t=>jJu(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function su3(e){return{...e,endpoints:e.endpoints.map(t=>cu3(t)),headers:e.headers.map(t=>jJu(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function cu3(e){return{...e,headers:e.headers.map(t=>jJu(t)),queryParameters:e.queryParameters.map(t=>lu3(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function jJu(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function lu3(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function fu3(e){return{...e,shape:e.shape._visit({union:t=>he.V25.Type.union({...t,baseProperties:t.baseProperties.map(r=>rAP(r))}),object:t=>he.V25.Type.object({...t,properties:t.properties.map(r=>rAP(r))}),enum:t=>he.V25.Type.enum({...t,values:t.values.map(r=>du3(r))}),alias:t=>he.V25.Type.alias(t),undiscriminatedUnion:t=>he.V25.Type.undiscriminatedUnion(t),_other:()=>{throw new Error("Encountered unknown shape")}}),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function rAP(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function du3(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}var nAP={laterVersion:"v27",earlierVersion:"v26",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.6.1-3-g94ee67a",[J.GO_MODEL]:"0.6.1-3-g94ee67a",[J.GO_SDK]:"0.6.1-3-g94ee67a",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V26.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,pu3(r)]))})};function pu3(e){return{...e,endpoints:e.endpoints.map(t=>_u3(t))}}function _u3(e){return{...e,response:e.response!=null?hu3(e.response):void 0}}function hu3(e){if(e.type!=="json")return e;let t=e.value;return t.type==="response"?he.V26.HttpResponse.json(t):he.V26.HttpResponse.json({docs:t.docs,responseBodyType:t.responseBodyType})}var aAP={laterVersion:"v28",earlierVersion:"v27",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.8.1-1-g0f40bf18",[J.TYPESCRIPT_BROWSER_SDK]:"0.8.1-1-g0f40bf18",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.8.1-1-g0f40bf18",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.9.0-2-g6b0be0e",[J.GO_MODEL]:"0.9.0-2-g6b0be0e",[J.GO_SDK]:"0.9.0-2-g6b0be0e",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V27.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,auth:Hu3(e.auth),headers:SJu(e.headers),types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,Ku3(r)])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,Su3(r)])),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,gu3(r)])),errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,bu3(r)])),pathParameters:wJu(e.pathParameters),variables:yu3(e.variables)})};function yu3(e){return e.map(t=>vu3(t))}function vu3(e){return{...e,type:iN(e.type)}}function bu3(e){return{...e,type:e.type!=null?iN(e.type):void 0}}function gu3(e){return e.map(t=>Ou3(t))}function Ou3(e){return{...e,headers:SJu(e.headers),payload:mu3(e.payload)}}function mu3(e){switch(e.type){case"inlinedPayload":return he.V27.WebhookPayload.inlinedPayload(Pu3(e));case"reference":return he.V27.WebhookPayload.reference({...e,payloadType:iN(e.payloadType)})}}function Pu3(e){return{...e,properties:ju3(e.properties)}}function ju3(e){return e.map(t=>wu3(t))}function wu3(e){return{...e,valueType:iN(e.valueType)}}function Su3(e){return{...e,endpoints:Du3(e.endpoints),headers:SJu(e.headers),pathParameters:wJu(e.pathParameters)}}function Du3(e){return e.map(t=>Eu3(t))}function Eu3(e){return{...e,headers:SJu(e.headers),pathParameters:wJu(e.pathParameters),allPathParameters:wJu(e.allPathParameters),queryParameters:Vu3(e.queryParameters),requestBody:e.requestBody!=null?Iu3(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?Cu3(e.sdkRequest):void 0,response:e.response!=null?Mu3(e.response):void 0}}function Mu3(e){switch(e.type){case"json":return he.V27.HttpResponse.json(Tu3(e.value));case"fileDownload":return he.V27.HttpResponse.fileDownload(e);case"text":return he.V27.HttpResponse.text(e);case"streaming":return he.V27.HttpResponse.streaming(Au3(e));default:Fo(e)}}function Au3(e){return{...e,dataEventType:qu3(e.dataEventType)}}function qu3(e){switch(e.type){case"json":return he.V27.StreamingResponseChunkType.json(iN(e.json));case"text":return he.V27.StreamingResponseChunkType.text();default:Fo(e)}}function Tu3(e){switch(e.type){case"response":return he.V27.JsonResponse.response({...e,responseBodyType:iN(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V27.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:iN(e.responseBodyType),responseProperty:e.responseProperty!=null?cAP(e.responseProperty):void 0});default:Fo(e)}}function Cu3(e){return{...e,shape:Bu3(e.shape)}}function Bu3(e){switch(e.type){case"justRequestBody":return he.V27.SdkRequestShape.justRequestBody(xu3(e.value));case"wrapper":return he.V27.SdkRequestShape.wrapper(e);default:Fo(e)}}function xu3(e){switch(e.type){case"typeReference":return he.V27.SdkRequestBodyType.typeReference(oAP(e));case"bytes":return he.V27.SdkRequestBodyType.bytes(e);default:Fo(e)}}function Iu3(e){switch(e.type){case"inlinedRequestBody":return he.V27.HttpRequestBody.inlinedRequestBody(Fu3(e));case"reference":return he.V27.HttpRequestBody.reference(oAP(e));case"fileUpload":return he.V27.HttpRequestBody.fileUpload(zu3(e));case"bytes":return he.V27.HttpRequestBody.bytes(e);default:Fo(e)}}function zu3(e){return{...e,properties:Ru3(e.properties)}}function Ru3(e){return e.map(t=>Nu3(t))}function Nu3(e){switch(e.type){case"file":return he.V27.FileUploadRequestProperty.file(e);case"bodyProperty":return he.V27.FileUploadRequestProperty.bodyProperty(uAP(e));default:Fo(e)}}function oAP(e){return{...e,requestBodyType:iN(e.requestBodyType)}}function Fu3(e){return{...e,properties:Lu3(e.properties)}}function Lu3(e){return e.map(t=>uAP(t))}function uAP(e){return{...e,valueType:iN(e.valueType)}}function wJu(e){return e.map(t=>Uu3(t))}function Uu3(e){return{...e,valueType:iN(e.valueType)}}function Vu3(e){return e.map(t=>Wu3(t))}function Wu3(e){return{...e,valueType:iN(e.valueType)}}function Hu3(e){return{...e,schemes:$u3(e.schemes)}}function $u3(e){return e.map(t=>Gu3(t))}function Gu3(e){switch(e.type){case"basic":return he.V27.AuthScheme.basic(e);case"bearer":return he.V27.AuthScheme.bearer(e);case"header":return Qu3(e);default:Fo(e)}}function Qu3(e){return he.V27.AuthScheme.header({...e,valueType:iN(e.valueType)})}function SJu(e){return e.map(t=>Ju3(t))}function Ju3(e){return{...e,valueType:iN(e.valueType)}}function Ku3(e){return{...e,shape:Yu3(e.shape)}}function Yu3(e){switch(e.type){case"alias":return he.V27.Type.alias(Xu3(e));case"enum":return he.V27.Type.enum(e);case"object":return he.V27.Type.object(Zu3(e));case"union":return he.V27.Type.union(ku3(e));case"undiscriminatedUnion":return he.V27.Type.undiscriminatedUnion(es3(e));default:Fo(e)}}function Xu3(e){return{aliasOf:iN(e.aliasOf),resolvedType:ns3(e.resolvedType)}}function Zu3(e){return{...e,properties:sAP(e.properties)}}function ku3(e){return{...e,types:ts3(e.types),baseProperties:sAP(e.baseProperties)}}function es3(e){return{members:is3(e.members)}}function sAP(e){return e.map(t=>cAP(t))}function cAP(e){return{...e,valueType:iN(e.valueType)}}function ts3(e){return e.map(t=>({...t,shape:rs3(t.shape)}))}function rs3(e){switch(e.propertiesType){case"samePropertiesAsObject":return he.V27.SingleUnionTypeProperties.samePropertiesAsObject(e);case"singleProperty":return he.V27.SingleUnionTypeProperties.singleProperty({name:e.name,type:iN(e.type)});case"noProperties":return he.V27.SingleUnionTypeProperties.noProperties();default:Fo(e)}}function is3(e){return e.map(t=>({...t,type:iN(t.type)}))}function ns3(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?he.V27.ResolvedTypeReference.primitive(he.V27.PrimitiveType.Boolean):he.V27.ResolvedTypeReference.container(he.V27.ContainerType.literal(he.V27.Literal.string(e.container.literal.string))):he.V27.ResolvedTypeReference.container(lAP(e.container));case"named":return he.V27.ResolvedTypeReference.named(e);case"primitive":return he.V27.ResolvedTypeReference.primitive(e.primitive);case"unknown":return he.V27.ResolvedTypeReference.unknown();default:Fo(e)}}function iN(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?he.V27.TypeReference.primitive(he.V27.PrimitiveType.Boolean):he.V27.TypeReference.container(he.V27.ContainerType.literal(he.V27.Literal.string(e.container.literal.string))):he.V27.TypeReference.container(lAP(e.container));case"named":return he.V27.TypeReference.named(e);case"primitive":return he.V27.TypeReference.primitive(e.primitive);case"unknown":return he.V27.TypeReference.unknown();default:Fo(e)}}function lAP(e){switch(e.type){case"list":return he.V27.ContainerType.list(iN(e.list));case"map":return he.V27.ContainerType.map({keyType:iN(e.keyType),valueType:iN(e.valueType)});case"optional":return he.V27.ContainerType.optional(iN(e.optional));case"set":return he.V27.ContainerType.set(iN(e.set));case"literal":if(e.literal.type==="boolean")throw new Error("Internal error; failed to transform boolean literal between IR versions");return he.V27.ContainerType.literal(he.V27.Literal.string(e.literal.string));default:Fo(e)}}var dAP={laterVersion:"v29",earlierVersion:"v28",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.8.6-1-g3d8d8591",[J.TYPESCRIPT_BROWSER_SDK]:"0.8.6-1-g3d8d8591",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.8.6-1-g3d8d8591",[J.JAVA]:We,[J.JAVA_MODEL]:"0.5.14-1-ge4bcd98",[J.JAVA_SDK]:"0.5.14-1-ge4bcd98",[J.JAVA_SPRING]:"0.5.14-1-ge4bcd98",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V28.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.keys(e.types).map(t=>[t,as3({typeId:t,allTypes:e.types})]))})};function as3({typeId:e,allTypes:t}){let r=fAP({typeId:e,allTypes:t});return{availability:r.availability,docs:r.docs,name:r.name,shape:r.shape,examples:r.examples,referencedTypes:Array.from(r.referencedTypes).map(i=>{let n=fAP({typeId:i,allTypes:t});return{typeId:i,fernFilepath:n.name.fernFilepath,name:n.name.name}})}}function fAP({typeId:e,allTypes:t}){let r=t[e];if(r==null)throw new Error(`Type definition for type id ${e} is undefined`);return r}var pAP={laterVersion:"v30",earlierVersion:"v29",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.6.5-1-g0ef31b7a",[J.PYTHON_PYDANTIC]:"0.6.5-1-g0ef31b7a",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.6.5-1-g0ef31b7a",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V29.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new qhf(e);return{...e,types:t.convertTypes(e.types),services:t.convertServices(e.services)}}},qhf=class{ir;constructor(t){this.ir=t}convertTypes(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,this.convertType(i)]))}convertServices(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,this.convertService(i)]))}convertService(t){return{...t,endpoints:this.convertEndpoints(t.endpoints)}}convertEndpoints(t){return t.map(r=>({...r,examples:this.convertExampleEndpointCalls(r.examples)}))}convertExampleEndpointCalls(t){return t.map(r=>({...r,rootPathParameters:this.convertExamplePathParameters(r.rootPathParameters),servicePathParameters:this.convertExamplePathParameters(r.servicePathParameters),endpointPathParameters:this.convertExamplePathParameters(r.endpointPathParameters),serviceHeaders:this.convertExampleHeaders(r.serviceHeaders),endpointHeaders:this.convertExampleHeaders(r.endpointHeaders),queryParameters:this.convertExampleQueryParameters(r.queryParameters),request:r.request!=null?this.convertExampleRequestBody(r.request):void 0,response:this.convertExampleResponse(r.response)}))}convertExamplePathParameters(t){return t.map(r=>({key:r.name.originalName,value:this.convertExampleTypeReference(r.value)}))}convertExampleHeaders(t){return t.map(r=>({wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}convertExampleQueryParameters(t){return t.map(r=>({wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}convertExampleRequestBody(t){switch(t.type){case"inlinedRequestBody":return he.V29.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))});case"reference":return he.V29.ExampleRequestBody.reference(this.convertExampleTypeReference(t));default:Fo(t)}}convertExampleResponse(t){switch(t.type){case"ok":return he.V29.ExampleResponse.ok({body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});case"error":return he.V29.ExampleResponse.error({...t,body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});default:Fo(t)}}convertType(t){return{...t,examples:this.convertExampleTypes(t.examples)}}convertExampleTypes(t){return t.map(r=>this.convertExampleType(r))}convertExampleType(t){return{...t,shape:this.convertExampleTypeShape(t.shape)}}convertExampleTypeReferences(t){return t.map(r=>this.convertExampleTypeReference(r))}convertExampleTypeReference(t){return{...t,shape:this.convertExampleTypeReferenceShape(t.shape)}}convertExampleTypeReferenceShape(t){switch(t.type){case"primitive":return he.V29.ExampleTypeReferenceShape.primitive(this.convertExamplePrimitive(t.primitive));case"container":return he.V29.ExampleTypeReferenceShape.container(this.convertExampleContainer(t.container));case"named":return he.V29.ExampleTypeReferenceShape.named(this.convertExampleNamedType(t));case"unknown":return he.V29.ExampleTypeReferenceShape.unknown(t);default:Fo(t)}}convertExamplePrimitive(t){switch(t.type){case"integer":return he.V29.ExamplePrimitive.integer(t.integer);case"double":return he.V29.ExamplePrimitive.double(t.double);case"string":return he.V29.ExamplePrimitive.string(t.string.original);case"boolean":return he.V29.ExamplePrimitive.boolean(t.boolean);case"long":return he.V29.ExamplePrimitive.long(t.long);case"datetime":return he.V29.ExamplePrimitive.datetime(t.datetime);case"date":return he.V29.ExamplePrimitive.date(t.date);case"uuid":return he.V29.ExamplePrimitive.uuid(t.uuid);default:Fo(t)}}convertExampleContainer(t){switch(t.type){case"list":return he.V29.ExampleContainer.list(this.convertExampleTypeReferences(t.list));case"set":return he.V29.ExampleContainer.set(this.convertExampleTypeReferences(t.set));case"optional":return he.V29.ExampleContainer.optional(t.optional!=null?this.convertExampleTypeReference(t.optional):void 0);case"map":return he.V29.ExampleContainer.map(this.convertKeyValuePairs(t.map));default:Fo(t)}}convertKeyValuePairs(t){return t.map(r=>({key:this.convertExampleTypeReference(r.key),value:this.convertExampleTypeReference(r.value)}))}convertExampleNamedType(t){return{...t,shape:this.convertExampleTypeShape(t.shape)}}convertExampleTypeShape(t){switch(t.type){case"alias":return he.V29.ExampleTypeShape.alias({value:this.convertExampleTypeReference(t.value)});case"enum":return he.V29.ExampleTypeShape.enum({wireValue:t.value.wireValue});case"object":return he.V29.ExampleTypeShape.object(this.convertExampleObjectType(t));case"union":return he.V29.ExampleTypeShape.union(this.convertExampleUnionType(t));default:Fo(t)}}convertExampleObjectType(t){return{properties:t.properties.map(r=>({...r,wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}}convertExampleUnionType(t){return{wireDiscriminantValue:t.singleUnionType.wireDiscriminantValue.wireValue,properties:this.convertExampleSingleUnionTypeProperties(t.singleUnionType.shape)}}convertExampleSingleUnionTypeProperties(t){switch(t.type){case"samePropertiesAsObject":{let r=this.ir.types[t.typeId]?.name;if(r==null)throw new Error(`Internal error; type ID ${t.typeId} does not exist in the IR`);return he.V29.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:r,shape:this.convertExampleTypeShape(he.V30.ExampleTypeShape.object({properties:t.object.properties}))})}case"singleProperty":return he.V29.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:this.convertExampleTypeReferenceShape(t.shape)});case"noProperties":return he.V29.ExampleSingleUnionTypeProperties.noProperties();default:Fo(t)}}};var _AP={laterVersion:"v31",earlierVersion:"v30",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.8.8",[J.TYPESCRIPT_BROWSER_SDK]:"0.8.8",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.8.8",[J.JAVA]:We,[J.JAVA_MODEL]:"0.7.0-rc0",[J.JAVA_SDK]:"0.7.0-rc0",[J.JAVA_SPRING]:"0.7.0-rc0",[J.PYTHON_FASTAPI]:"0.7.5-1-gb54fb677",[J.PYTHON_PYDANTIC]:"0.7.5-1-gb54fb677",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.7.5-1-gb54fb677",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V30.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({apiName:e.apiName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:e.auth,headers:e.headers,types:e.types,webhookGroups:e.webhookGroups,errors:e.errors,subpackages:e.subpackages,rootPackage:e.rootPackage,constants:e.constants,environments:e.environments,basePath:e.basePath,pathParameters:e.pathParameters,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,variables:e.variables,serviceTypeReferenceInfo:e.serviceTypeReferenceInfo,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{availability:r.availability,name:r.name,displayName:r.displayName,basePath:r.basePath,endpoints:r.endpoints.map(i=>({id:i.id,docs:i.docs,availability:i.availability,name:i.name,displayName:i.displayName,method:i.method,headers:i.headers,baseUrl:i.baseUrl,path:i.path,fullPath:i.fullPath,pathParameters:i.pathParameters,allPathParameters:i.allPathParameters,queryParameters:i.queryParameters,requestBody:i.requestBody,sdkRequest:i.sdkRequest,response:i.response,errors:i.errors,auth:i.auth,examples:i.examples})),headers:r.headers,pathParameters:r.pathParameters}]))})};var yAP={laterVersion:"v32",earlierVersion:"v31",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.9.4-2-g139cf36",[J.GO_MODEL]:"0.9.4-2-g139cf36",[J.GO_SDK]:"0.9.4-2-g139cf36",[J.RUBY_MODEL]:"0.0.0",[J.RUBY_SDK]:"0.0.0",[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V31.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:fs3(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(os3)}]))})};function Uin({examples:e,convert:t}){let r=[];for(let i of e){let n=t(i);n!=null&&r.push(n)}return r}function os3(e){return{...e,examples:Uin({examples:e.examples,convert:us3})}}function us3(e){let t;if(e.request!=null&&(t=ss3(e.request),t==null))return;let r=cs3(e.response);if(r!=null)return{...e,rootPathParameters:Uin({examples:e.rootPathParameters,convert:Thf}),endpointPathParameters:Uin({examples:e.endpointPathParameters,convert:Thf}),servicePathParameters:Uin({examples:e.servicePathParameters,convert:Thf}),endpointHeaders:Uin({examples:e.endpointHeaders,convert:hAP}),serviceHeaders:Uin({examples:e.serviceHeaders,convert:hAP}),queryParameters:Uin({examples:e.queryParameters,convert:ls3}),request:t,response:r}}function ss3(e){switch(e.type){case"inlinedRequestBody":{let t=[];for(let r of e.properties){let i=gje(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleRequestBody.inlinedRequestBody({...e,properties:t})}case"reference":{let t=Chf(e.shape);return t==null?void 0:he.V31.ExampleRequestBody.reference({...e,shape:t})}default:Fo(e)}}function cs3(e){switch(e.type){case"ok":{if(e.body==null)return he.V31.ExampleResponse.ok({body:void 0});let t=gje(e.body);return t==null?void 0:he.V31.ExampleResponse.ok({body:t})}case"error":{if(e.body==null)return he.V31.ExampleResponse.error({...e,body:void 0});let t=gje(e.body);return t==null?void 0:he.V31.ExampleResponse.error({...e,body:t})}}}function Thf(e){let t=gje(e.value);if(t!=null)return{...e,value:t}}function hAP(e){let t=gje(e.value);if(t!=null)return{...e,value:t}}function ls3(e){let t=gje(e.value);if(t!=null)return{...e,value:t}}function fs3(e){let t=[];for(let r of e){let i=ds3(r);i!=null&&t.push(i)}return t}function ds3(e){let t=vAP(e.shape);if(t!=null)return{...e,shape:t}}function vAP(e){switch(e.type){case"enum":return he.V31.ExampleTypeShape.enum(e);case"alias":{let t=gje(e.value);return t==null?void 0:he.V31.ExampleTypeShape.alias({value:t})}case"object":{let t=[];for(let r of e.properties){let i=gje(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleTypeShape.object({properties:t})}case"union":{let t=ps3(e.singleUnionType);return t==null?void 0:he.V31.ExampleTypeShape.union({...e,singleUnionType:t})}case"undiscriminatedUnion":return;default:Fo(e)}}function gje(e){let t=Chf(e.shape);if(t!=null)return{shape:t,jsonExample:e.jsonExample}}function ps3(e){let t=_s3(e.shape);if(t!=null)return{...e,shape:t}}function _s3(e){switch(e.type){case"noProperties":return he.V31.ExampleSingleUnionTypeProperties.noProperties();case"singleProperty":{let t=Chf(e.shape);return t==null?void 0:he.V31.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:t})}case"samePropertiesAsObject":{let t=[];for(let r of e.object.properties){let i=gje(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:{properties:t}})}default:Fo(e)}}function Chf(e){switch(e.type){case"container":{let t=hs3(e.container);return t==null?void 0:he.V31.ExampleTypeReferenceShape.container(t)}case"named":{let t=vAP(e.shape);return t==null?void 0:he.V31.ExampleTypeReferenceShape.named({...e,shape:t})}case"primitive":return he.V31.ExampleTypeReferenceShape.primitive(e.primitive);case"unknown":return he.V31.ExampleTypeReferenceShape.unknown(e.unknown);default:Fo(e)}}function hs3(e){switch(e.type){case"list":{let t=[];for(let r of e.list){let i=gje(r);i!=null&&t.push(i)}return he.V31.ExampleContainer.list(t)}case"set":{let t=[];for(let r of e.set){let i=gje(r);i!=null&&t.push(i)}return he.V31.ExampleContainer.set(t)}case"map":{let t=[];for(let r of e.map){let i=gje(r.key),n=gje(r.value);i!=null&&n!=null&&t.push({key:i,value:n})}return he.V31.ExampleContainer.map(t)}case"optional":{if(e.optional==null)return he.V31.ExampleContainer.optional();let t=gje(e.optional);return t==null?he.V31.ExampleContainer.optional():he.V31.ExampleContainer.optional(t)}default:Fo(e)}}var bAP={laterVersion:"v33",earlierVersion:"v32",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.12.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.12.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.13.0-3-g8c56a41",[J.GO_MODEL]:"0.13.0-3-g8c56a41",[J.GO_SDK]:"0.13.0-3-g8c56a41",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:"0.0.0",[J.CSHARP_SDK]:"0.0.0",[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V32.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new Bhf(e);return{...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>t.convertEndpoint(n))}]))}}},Bhf=class{ir;constructor(t){this.ir=t}convertEndpoint(t){return{...t,queryParameters:t.queryParameters.map(r=>this.isTypeReferenceObject(r.valueType)?{...r,valueType:he.V33.TypeReference.container(he.V33.ContainerType.optional(he.V33.TypeReference.primitive("STRING")))}:r),examples:ys3({examples:t.examples,convert:vs3})}}isTypeReferenceObject(t){switch(t.type){case"container":return this.isContainerObject(t.container);case"named":return this.isNamedTypeObject(t);case"primitive":return!1;case"unknown":return!0;default:Fo(t)}}isContainerObject(t){switch(t.type){case"map":case"list":case"set":return!0;case"optional":return this.isTypeReferenceObject(t.optional);case"literal":return!1;default:Fo(t)}}isNamedTypeObject(t){let r=this.ir.types[t.typeId];if(r==null)return!0;switch(r.shape.type){case"alias":return this.isTypeReferenceObject(r.shape.aliasOf);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:Fo(r.shape)}}};function ys3({examples:e,convert:t}){let r=[];for(let i of e){let n=t(i);n!=null&&r.push(n)}return r}function vs3(e){return{...e,queryParameters:e.queryParameters.filter(t=>!xhf(t.value))}}function xhf(e){switch(e.shape.type){case"container":return bs3(e.shape.container);case"named":return gs3(e.shape);case"primitive":return!1;case"unknown":return!0;default:Fo(e.shape)}}function bs3(e){switch(e.type){case"map":case"list":case"set":return!0;case"optional":return e.optional!=null&&xhf(e.optional);default:Fo(e)}}function gs3(e){switch(e.shape.type){case"alias":return xhf(e.shape.value);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:Fo(e.shape)}}var BWn=yi(NPc(),1);var gAP={laterVersion:"v34",earlierVersion:"v33",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.10.4",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V33.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,requestBody:n.requestBody?._visit({inlinedRequestBody:a=>BWn.FernIrV33.HttpRequestBody.inlinedRequestBody(a),reference:a=>BWn.FernIrV33.HttpRequestBody.reference(a),fileUpload:a=>BWn.FernIrV33.HttpRequestBody.fileUpload({...a,properties:a.properties.map(u=>(u.type==="file"&&u.value.type==="fileArray"&&t.taskContext.logger.warn(`${n.method} ${n.fullPath.head} accepts a list of files however the ${t.targetGenerator?.name}@${t.targetGenerator?.version} only supports accepting a single file. File an [issue](https://github.com/fern-api/fern/issues) to add request for file arrays in ${t.targetGenerator?.name}@${t.targetGenerator?.version}!`),u.type==="file"?BWn.FernIrV33.FileUploadRequestProperty.file({...u.value}):u))}),bytes:a=>BWn.FernIrV33.HttpRequestBody.bytes(a),_other:a=>{}})}))}]))})};var OAP={laterVersion:"v35",earlierVersion:"v34",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.18.0",[J.GO_MODEL]:"0.18.0",[J.GO_SDK]:"0.18.0",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V34.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>({docs:i.docs,availability:i.availability,id:i.id,name:i.name,displayName:i.displayName,method:i.method,headers:i.headers,baseUrl:i.baseUrl,path:i.path,fullPath:i.fullPath,pathParameters:i.pathParameters,allPathParameters:i.allPathParameters,queryParameters:i.queryParameters,requestBody:i.requestBody,sdkRequest:i.sdkRequest,response:i.response,errors:i.errors,auth:i.auth,idempotent:i.idempotent,examples:i.examples}))}]))})};var mAP={laterVersion:"v36",earlierVersion:"v35",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.11.6",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V35.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var PAP={laterVersion:"v37",earlierVersion:"v36",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.13.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.13.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.13.0",[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.12.0",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V36.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,examples:n.examples.filter(a=>a.exampleType==="userProvided")}))}]))})};var jAP={laterVersion:"v38",earlierVersion:"v37",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.15.0-rc0",[J.TYPESCRIPT_BROWSER_SDK]:"0.15.0-rc0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.12.0-rc0",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.9.0-rc0",[J.PYTHON_PYDANTIC]:"0.9.0-rc0",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"1.2.0-rc0",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V37.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,response:n.response?._visit({fileDownload:a=>he.V37.HttpResponse.fileDownload(a),json:a=>he.V37.HttpResponse.json(a),streaming:a=>a._visit({json:u=>he.V37.HttpResponse.streaming({dataEventType:he.V37.StreamingResponseChunkType.json(u.payload),docs:u.docs,terminator:u.terminator}),sse:()=>{},text:u=>he.V37.HttpResponse.streaming({dataEventType:he.V37.StreamingResponseChunkType.text(),docs:u.docs,terminator:void 0}),_other:()=>{}}),text:a=>he.V37.HttpResponse.text(a),_other:()=>{}})}))}]))})};var wAP={laterVersion:"v39",earlierVersion:"v38",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.9.0-rc1",[J.PYTHON_PYDANTIC]:"0.9.0-rc1",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"1.4.0-rc1",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:"0.7.0-rc0",[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V38.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>Os3(r))}})};function Os3(e){switch(e.type){case"basic":return he.V38.AuthScheme.basic(e);case"bearer":return he.V38.AuthScheme.bearer(e);case"header":return he.V38.AuthScheme.header(e);case"oauth":return he.V38.AuthScheme.bearer({docs:e.docs,token:{originalName:"token",camelCase:{unsafeName:"token",safeName:"token"},pascalCase:{unsafeName:"Token",safeName:"Token"},snakeCase:{unsafeName:"token",safeName:"token"},screamingSnakeCase:{unsafeName:"TOKEN",safeName:"TOKEN"}},tokenEnvVar:void 0});default:Fo(e)}}var SAP={laterVersion:"v40",earlierVersion:"v39",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.20.0",[J.GO_MODEL]:"0.20.0",[J.GO_SDK]:"0.20.0",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V39.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var DAP={laterVersion:"v41",earlierVersion:"v40",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V40.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,errors:Object.fromEntries(Object.entries(e.errors).map(([r,i])=>[r,{name:i.name,discriminantValue:i.discriminantValue,type:i.type,statusCode:i.statusCode,docs:i.docs}]))})};var EAP={laterVersion:"v42",earlierVersion:"v41",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:"0.8.0-rc0",[J.JAVA_SDK]:"0.9.0-rc0",[J.JAVA_SPRING]:"0.8.0-rc0",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V41.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>ms3(r))}})};function ms3(e){switch(e.type){case"basic":return he.V41.AuthScheme.basic(e);case"bearer":return he.V41.AuthScheme.bearer(e);case"header":return he.V41.AuthScheme.header(e);case"oauth":return he.V41.AuthScheme.oauth(Ps3(e));default:Fo(e)}}function Ps3(e){switch(e.configuration.type){case"clientCredentials":return{...e,configuration:he.V41.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:{...e.configuration.tokenEndpoint,endpointReference:e.configuration.tokenEndpoint.endpointReference.endpointId},refreshEndpoint:e.configuration.refreshEndpoint!=null?{...e.configuration.refreshEndpoint,endpointReference:e.configuration.refreshEndpoint?.endpointReference.endpointId}:void 0})};default:Fo(e.configuration.type)}}var MAP={laterVersion:"v43",earlierVersion:"v42",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.17.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.17.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.13.0",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V42.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,response:n.response?.body}))}]))})};var qAP={laterVersion:"v44",earlierVersion:"v43",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V43.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,examples:n.examples.map(a=>js3({example:a})).filter(Qb)}))}]))})};function js3({example:e}){return e._visit({userProvided:t=>he.V43.HttpEndpointExample.userProvided(AAP({example:t})),generated:t=>he.V43.HttpEndpointExample.generated(AAP({example:t})),_other:()=>{}})}function AAP({example:e}){return{...e,response:ws3({example:e.response})}}function ws3({example:e}){switch(e.type){case"ok":return Ss3({example:e.value});case"error":return he.V43.ExampleResponse.error(e);default:Fo(e)}}function Ss3({example:e}){switch(e.type){case"body":return he.V43.ExampleResponse.ok({body:e.value});case"sse":return he.V43.ExampleResponse.ok({body:void 0});case"stream":return he.V43.ExampleResponse.ok({body:void 0});default:Fo(e)}}var TAP={laterVersion:"v45",earlierVersion:"v44",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V44.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V45.types.Type._visit(r.shape,{union:i=>he.V44.types.Type.union({...i,baseProperties:i.baseProperties.map(n=>({...n,valueType:Wq(n.valueType)})),types:i.types.map(n=>Rs3(n))}),enum:he.V44.types.Type.enum,object:i=>he.V44.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:Wq(n.valueType)}))}),alias:i=>he.V44.types.Type.alias({aliasOf:Wq(i.aliasOf),resolvedType:Fs3(i.resolvedType)}),undiscriminatedUnion:i=>he.V44.types.Type.undiscriminatedUnion(Ls3(i)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:Cs3(e.auth),headers:e.headers.map(r=>xWn(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>xWn(r)),types:t,services:rd(e.services,r=>Us3(r)),errors:rd(e.errors,r=>ic3(r)),webhookGroups:rd(e.webhookGroups,r=>As3(r)),websocketChannels:rd(e.websocketChannels,r=>Ds3(r)),pathParameters:e.pathParameters.map(r=>i5a(r)),variables:e.variables.map(r=>Vs3(r))}}};function Ds3(e){return{...e,headers:e.headers.map(t=>xWn(t)),queryParameters:e.queryParameters.map(t=>n5a(t)),pathParameters:e.pathParameters.map(t=>i5a(t)),messages:e.messages.map(t=>Es3(t))}}function Es3(e){return{...e,body:Ms3(e.body)}}function Ms3(e){switch(e.type){case"inlinedBody":return he.V44.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:Wq(t.valueType)}))});case"reference":return he.V44.websocket.WebSocketMessageBody.reference({...e,bodyType:Wq(e.bodyType)})}}function As3(e){return e.map(t=>qs3(t))}function qs3(e){return{...e,headers:e.headers.map(t=>xWn(t)),payload:Ts3(e.payload)}}function Ts3(e){switch(e.type){case"reference":return he.V44.webhooks.WebhookPayload.reference({...e,payloadType:Wq(e.payloadType)});case"inlinedPayload":return he.V44.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:Wq(t.valueType)}))})}}function Cs3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V44.auth.AuthScheme.basic(t);case"bearer":return he.V44.auth.AuthScheme.bearer(t);case"header":return he.V44.auth.AuthScheme.header(Bs3(t));case"oauth":return he.V44.auth.AuthScheme.oauth(xs3(t))}})}}function Bs3(e){return{...e,valueType:Wq(e.valueType)}}function xs3(e){return{...e,configuration:he.V44.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:Is3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?zs3(e.configuration.refreshEndpoint):void 0})}}function Is3(e){return{...e,requestProperties:{clientId:DJu(e.requestProperties.clientId),clientSecret:DJu(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?DJu(e.requestProperties.scopes):void 0},responseProperties:{accessToken:zri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?zri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?zri(e.responseProperties.refreshToken):void 0}}}function zs3(e){return{...e,requestProperties:{refreshToken:DJu(e.requestProperties.refreshToken)},responseProperties:{accessToken:zri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?zri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?zri(e.responseProperties.refreshToken):void 0}}}function xWn(e){return{...e,valueType:Wq(e.valueType)}}function Wq(e){return he.V45.types.TypeReference._visit(e,{container:t=>he.V44.types.TypeReference.container(CAP(t)),primitive:t=>t.v1==="BIG_INTEGER"?he.V44.types.TypeReference.primitive(he.V44.types.PrimitiveType.String):he.V44.types.TypeReference.primitive(t.v1),named:he.V44.types.TypeReference.named,unknown:he.V44.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function CAP(e){return he.V45.types.ContainerType._visit(e,{list:t=>he.V44.types.ContainerType.list(Wq(t)),optional:t=>he.V44.types.ContainerType.optional(Wq(t)),set:t=>he.V44.types.ContainerType.set(Wq(t)),map:({keyType:t,valueType:r})=>he.V44.types.ContainerType.map({keyType:Wq(t),valueType:Wq(r)}),literal:he.V44.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function Rs3(e){return{...e,shape:Ns3(e.shape)}}function Ns3(e){return he.V45.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V44.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V44.types.SingleUnionTypeProperties.singleProperty({...t,type:Wq(t.type)}),noProperties:he.V44.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function Fs3(e){return he.V45.types.ResolvedTypeReference._visit(e,{container:t=>he.V44.types.ResolvedTypeReference.container(CAP(t)),named:he.V44.types.ResolvedTypeReference.named,primitive:t=>t.v1==="BIG_INTEGER"?he.V44.types.ResolvedTypeReference.primitive(he.V44.types.PrimitiveType.String):he.V44.types.ResolvedTypeReference.primitive(t.v1),unknown:he.V44.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function Ls3(e){return{members:e.members.map(t=>({...t,type:Wq(t.type)}))}}function Us3(e){return{...e,pathParameters:e.pathParameters.map(t=>i5a(t)),headers:e.headers.map(t=>xWn(t)),endpoints:e.endpoints.map(t=>Ws3(t))}}function i5a(e){return{...e,valueType:Wq(e.valueType)}}function Vs3(e){return{...e,type:Wq(e.type)}}function Ws3(e){return{...e,pagination:e.pagination!=null?Js3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>i5a(t)),pathParameters:e.pathParameters.map(t=>i5a(t)),sdkRequest:e.sdkRequest!=null?Zs3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?tc3(e.requestBody):void 0,response:e.response!=null?Hs3(e.response):void 0,headers:e.headers.map(t=>xWn(t)),queryParameters:e.queryParameters.map(t=>n5a(t))}}function Hs3(e){return{...e,body:e.body!=null?$s3(e.body):void 0}}function $s3(e){switch(e.type){case"json":return he.V44.http.HttpResponseBody.json(Gs3(e.value));case"fileDownload":return he.V44.http.HttpResponseBody.fileDownload(e);case"text":return he.V44.http.HttpResponseBody.text(e);case"streaming":return he.V44.http.HttpResponseBody.streaming(Qs3(e.value))}}function Gs3(e){switch(e.type){case"response":return he.V44.http.JsonResponse.response({...e,responseBodyType:Wq(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V44.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:Wq(e.responseBodyType),responseProperty:e.responseProperty!=null?Ihf(e.responseProperty):void 0})}}function Qs3(e){switch(e.type){case"json":return he.V44.http.StreamingResponse.json({...e,payload:Wq(e.payload)});case"text":return he.V44.http.StreamingResponse.text(e);case"sse":return he.V44.http.StreamingResponse.sse({...e,payload:Wq(e.payload)})}}function Js3(e){switch(e.type){case"cursor":return he.V44.http.Pagination.cursor(Ks3(e));case"offset":return he.V44.http.Pagination.offset(Ys3(e))}}function Ks3(e){return{...e,page:n5a(e.page),next:zri(e.next),results:zri(e.results)}}function Ys3(e){return{...e,page:n5a(e.page),results:zri(e.results)}}function DJu(e){return{...e,property:Xs3(e.property)}}function Xs3(e){switch(e.type){case"query":return he.V44.RequestPropertyValue.query(n5a(e));case"body":return he.V44.RequestPropertyValue.body(Ihf(e))}}function zri(e){return{...e,property:Ihf(e.property)}}function Ihf(e){return{...e,valueType:Wq(e.valueType)}}function n5a(e){return{...e,valueType:Wq(e.valueType)}}function Zs3(e){return{...e,shape:ks3(e.shape)}}function ks3(e){return he.V45.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V44.http.SdkRequestShape.justRequestBody(ec3(t)),wrapper:he.V44.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function ec3(e){switch(e.type){case"bytes":return he.V44.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V44.http.SdkRequestBodyType.typeReference({...e,requestBodyType:Wq(e.requestBodyType)})}}function tc3(e){return he.V45.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V44.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:Wq(r.valueType)}))}),reference:t=>he.V44.http.HttpRequestBody.reference({...t,requestBodyType:Wq(t.requestBodyType)}),fileUpload:t=>he.V44.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V44.http.FileUploadRequestProperty.bodyProperty({...r,valueType:Wq(r.valueType)});case"file":return he.V44.http.FileUploadRequestProperty.file(rc3(r.value))}})}),bytes:t=>he.V44.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function rc3(e){switch(e.type){case"file":return he.V44.http.FileProperty.file(e);case"fileArray":return he.V44.http.FileProperty.fileArray(e)}}function ic3(e){return{...e,type:e.type!=null?Wq(e.type):void 0}}var xAP={laterVersion:"v46",earlierVersion:"v45",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.21.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.21.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.16.0",[J.JAVA]:We,[J.JAVA_MODEL]:"0.9.0",[J.JAVA_SDK]:"0.10.0",[J.JAVA_SPRING]:"0.9.0",[J.PYTHON_FASTAPI]:"0.10.1",[J.PYTHON_PYDANTIC]:"0.9.1",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"2.9.9",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V45.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:nc3(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>({...i,examples:ac3(i.examples)}))}])),websocketChannels:e.websocketChannels!=null?Object.fromEntries(Object.entries(e.websocketChannels).map(([t,r])=>[t,{...r,examples:oc3(r.examples)}])):void 0,errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,{...r,examples:r.examples.map(i=>({...i,shape:b3(i.shape)}))}]))})};function b3(e){return e.shape._visit({container:t=>({...e,shape:t._visit({list:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.list(r.map(i=>b3(i)))),set:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.set(r.map(i=>b3(i)))),map:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.map(r.map(i=>({key:b3(i.key),value:b3(i.value)})))),optional:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.optional(r!=null?b3(r):void 0)),literal:r=>he.V45.ExampleTypeReferenceShape.primitive(r._visit({string:i=>he.V45.ExamplePrimitive.string(i),integer:i=>he.V45.ExamplePrimitive.integer(i),double:i=>he.V45.ExamplePrimitive.double(i),long:i=>he.V45.ExamplePrimitive.long(i),boolean:i=>he.V45.ExamplePrimitive.boolean(i),datetime:i=>he.V45.ExamplePrimitive.datetime(i),date:i=>he.V45.ExamplePrimitive.date(i),uuid:i=>he.V45.ExamplePrimitive.uuid(i),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}})}),named:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.named({...t,shape:IAP(t.shape)})}),primitive:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.primitive(t._visit({string:r=>he.V45.ExamplePrimitive.string(r),integer:r=>he.V45.ExamplePrimitive.integer(r),double:r=>he.V45.ExamplePrimitive.double(r),long:r=>he.V45.ExamplePrimitive.long(r),boolean:r=>he.V45.ExamplePrimitive.boolean(r),datetime:r=>he.V45.ExamplePrimitive.datetime(r),date:r=>he.V45.ExamplePrimitive.date(r),uuid:r=>he.V45.ExamplePrimitive.uuid(r),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}}))}),unknown:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.unknown(t)}),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}function BAP(e){return{...e,properties:e.properties.map(t=>({...t,value:b3(t.value)}))}}function IAP(e){return e.type==="alias"?he.V45.ExampleTypeShape.alias({value:b3(e.value)}):e.type==="object"?he.V45.ExampleTypeShape.object(BAP(e)):e.type==="union"?he.V45.ExampleTypeShape.union({...e,singleUnionType:{...e.singleUnionType,shape:e.singleUnionType.shape._visit({samePropertiesAsObject:t=>he.V45.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,object:BAP(t.object)}),singleProperty:t=>he.V45.ExampleSingleUnionTypeProperties.singleProperty(b3(t)),noProperties:()=>he.V45.ExampleSingleUnionTypeProperties.noProperties(),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}}):e.type==="undiscriminatedUnion"?he.V45.ExampleTypeShape.undiscriminatedUnion({...e,singleUnionType:b3(e.singleUnionType)}):he.V45.ExampleTypeShape.enum(e)}function nc3(e){return e.map(t=>({...t,shape:IAP(t.shape)}))}function EJu(e){return e.map(t=>({...t,value:b3(t.value)}))}function zhf(e){return e.map(t=>({...t,value:b3(t.value)}))}function zAP(e){return e.map(t=>({...t,value:b3(t.value)}))}function ac3(e){return e.map(t=>{let r={...t,rootPathParameters:EJu(t.rootPathParameters),servicePathParameters:EJu(t.servicePathParameters),endpointPathParameters:EJu(t.endpointPathParameters),serviceHeaders:zhf(t.serviceHeaders),endpointHeaders:zhf(t.endpointHeaders),queryParameters:zAP(t.queryParameters),request:t.request?._visit({inlinedRequestBody:i=>he.V45.ExampleRequestBody.inlinedRequestBody({...i,properties:i.properties.map(n=>({...n,value:b3(n.value)}))}),reference:i=>he.V45.ExampleRequestBody.reference(b3(i)),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}}),response:t.response._visit({ok:i=>he.V45.ExampleResponse.ok(i._visit({body:n=>he.V45.ExampleEndpointSuccessResponse.body(n!=null?b3(n):void 0),stream:n=>he.V45.ExampleEndpointSuccessResponse.stream(n.map(b3)),sse:n=>he.V45.ExampleEndpointSuccessResponse.sse(n.map(a=>({...a,data:b3(a.data)}))),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})),error:i=>he.V45.ExampleResponse.error({...i,body:i.body!=null?b3(i.body):void 0}),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})};return t._visit({userProvided:()=>he.V45.HttpEndpointExample.userProvided(r),generated:()=>he.V45.HttpEndpointExample.generated(r),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})})}function oc3(e){return e.map(t=>({...t,pathParameters:EJu(t.pathParameters),headers:zhf(t.headers),queryParameters:zAP(t.queryParameters),messages:t.messages.map(r=>({...r,body:r.body._visit({inlinedBody:i=>he.V45.ExampleWebSocketMessageBody.inlinedBody({...i,properties:i.properties.map(n=>({...n,value:b3(n.value)}))}),reference:i=>he.V45.ExampleWebSocketMessageBody.reference(b3(i)),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})}))}))}var RAP={laterVersion:"v47",earlierVersion:"v46",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V46.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>{let i=r.endpoints.map(n=>{let{autogeneratedExamples:a,userSpecifiedExamples:u,...l}=n;return{...l,autogeneratedExamples:void 0,userSpecifiedExamples:void 0,examples:[...n.userSpecifiedExamples.map(s=>{if(s.example!=null)return he.V46.HttpEndpointExample.userProvided({...s.example,codeSamples:s.codeSamples})}).filter(Qb),...n.autogeneratedExamples.map(s=>he.V46.HttpEndpointExample.generated({...s.example,codeSamples:void 0}))]}});return[t,{...r,endpoints:i}]}))})};var NAP={laterVersion:"v48",earlierVersion:"v47",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.29.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.29.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.17.0",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V47.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,i])=>{let n=i.endpoints.map(a=>({...a,pagination:a.pagination!=null?sc3(a.pagination):void 0}));return[r,{...i,endpoints:n}]}));return{...e,sdkConfig:{...e.sdkConfig,hasPaginatedEndpoints:uc3(t)},services:t}}};function uc3(e){for(let t of Object.values(e))for(let r of t.endpoints)if(r.pagination!=null)return!0;return!1}function sc3(e){switch(e.type){case"cursor":{let t=cc3(e);return t!=null?he.V47.Pagination.cursor(t):void 0}case"offset":{let t=lc3(e);return t!=null?he.V47.Pagination.offset(t):void 0}default:Fo(e)}}function cc3(e){let t=FAP(e.page);if(t!=null)return{...e,page:t}}function lc3(e){if(e.step!=null)return;let t=FAP(e.page);if(t!=null)return{...e,page:t}}function FAP(e){switch(e.property.type){case"query":return e.property}}var LAP={laterVersion:"v49",earlierVersion:"v48",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.11.0-rc0",[J.PYTHON_PYDANTIC]:"0.10.0-rc0",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"2.11.0-rc0",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V48.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,i])=>{let n=i.endpoints.flatMap(a=>{let u;return a.response?.body!=null&&(u=a.response.body?._visit({json:d=>he.V48.HttpResponseBody.json({...d}),fileDownload:d=>he.V48.HttpResponseBody.fileDownload({...d}),text:d=>he.V48.HttpResponseBody.text({...d}),streaming:d=>he.V48.HttpResponseBody.streaming({...d}),streamParameter:()=>{},_other:()=>{}}),u==null)?[]:{...a,response:a.response==null?void 0:{statusCode:a.response?.statusCode,body:u}}});return[r,{...i,endpoints:n}]}));return{...e,services:t}}};var UAP={laterVersion:"v50",earlierVersion:"v49",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.34.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.34.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.17.2",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:"0.0.0",[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V49.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V50.types.Type._visit(r.shape,{union:i=>he.V49.types.Type.union({...i,baseProperties:i.baseProperties.map(n=>({...n,valueType:Hq(n.valueType)})),types:i.types.map(n=>Pc3(n))}),enum:he.V49.types.Type.enum,object:i=>he.V49.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:Hq(n.valueType)}))}),alias:i=>he.V49.types.Type.alias({aliasOf:Hq(i.aliasOf),resolvedType:wc3(i.resolvedType)}),undiscriminatedUnion:i=>he.V49.types.Type.undiscriminatedUnion(Sc3(i)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:vc3(e.auth),headers:e.headers.map(r=>IWn(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>IWn(r)),types:t,services:rd(e.services,r=>Dc3(r)),errors:rd(e.errors,r=>Vc3(r)),webhookGroups:rd(e.webhookGroups,r=>_c3(r)),websocketChannels:rd(e.websocketChannels,r=>fc3(r)),pathParameters:e.pathParameters.map(r=>a5a(r)),variables:e.variables.map(r=>Ec3(r))}}};function fc3(e){return{...e,headers:e.headers.map(t=>IWn(t)),queryParameters:e.queryParameters.map(t=>Nhf(t)),pathParameters:e.pathParameters.map(t=>a5a(t)),messages:e.messages.map(t=>dc3(t))}}function dc3(e){return{...e,body:pc3(e.body)}}function pc3(e){switch(e.type){case"inlinedBody":return he.V49.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:Hq(t.valueType)}))});case"reference":return he.V49.websocket.WebSocketMessageBody.reference({...e,bodyType:Hq(e.bodyType)})}}function _c3(e){return e.map(t=>hc3(t))}function hc3(e){return{...e,headers:e.headers.map(t=>IWn(t)),payload:yc3(e.payload)}}function yc3(e){switch(e.type){case"reference":return he.V49.webhooks.WebhookPayload.reference({...e,payloadType:Hq(e.payloadType)});case"inlinedPayload":return he.V49.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:Hq(t.valueType)}))})}}function vc3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V49.auth.AuthScheme.basic(t);case"bearer":return he.V49.auth.AuthScheme.bearer(t);case"header":return he.V49.auth.AuthScheme.header(bc3(t));case"oauth":return he.V49.auth.AuthScheme.oauth(gc3(t))}})}}function bc3(e){return{...e,valueType:Hq(e.valueType)}}function gc3(e){return{...e,configuration:he.V49.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:Oc3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?mc3(e.configuration.refreshEndpoint):void 0})}}function Oc3(e){return{...e,requestProperties:{clientId:q1i(e.requestProperties.clientId),clientSecret:q1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?q1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:Rri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Rri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Rri(e.responseProperties.refreshToken):void 0}}}function mc3(e){return{...e,requestProperties:{refreshToken:q1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:Rri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Rri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Rri(e.responseProperties.refreshToken):void 0}}}function IWn(e){return{...e,valueType:Hq(e.valueType)}}function Hq(e){return he.V50.types.TypeReference._visit(e,{container:t=>he.V49.types.TypeReference.container(VAP(t)),primitive:t=>t.v2?.type==="integer"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.string(t.v2)}):he.V49.types.TypeReference.primitive({v1:t.v1,v2:void 0}),named:he.V49.types.TypeReference.named,unknown:he.V49.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function VAP(e){return he.V50.types.ContainerType._visit(e,{list:t=>he.V49.types.ContainerType.list(Hq(t)),optional:t=>he.V49.types.ContainerType.optional(Hq(t)),set:t=>he.V49.types.ContainerType.set(Hq(t)),map:({keyType:t,valueType:r})=>he.V49.types.ContainerType.map({keyType:Hq(t),valueType:Hq(r)}),literal:he.V49.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function Pc3(e){return{...e,shape:jc3(e.shape)}}function jc3(e){return he.V50.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V49.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V49.types.SingleUnionTypeProperties.singleProperty({...t,type:Hq(t.type)}),noProperties:he.V49.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function wc3(e){return he.V50.types.ResolvedTypeReference._visit(e,{container:t=>he.V49.types.ResolvedTypeReference.container(VAP(t)),named:he.V49.types.ResolvedTypeReference.named,primitive:t=>t.v2?.type==="integer"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.string(t.v2)}):he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:void 0}),unknown:he.V49.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function Sc3(e){return{members:e.members.map(t=>({...t,type:Hq(t.type)}))}}function Dc3(e){return{...e,pathParameters:e.pathParameters.map(t=>a5a(t)),headers:e.headers.map(t=>IWn(t)),endpoints:e.endpoints.map(t=>Mc3(t))}}function a5a(e){return{...e,valueType:Hq(e.valueType)}}function Ec3(e){return{...e,type:Hq(e.type)}}function Mc3(e){return{...e,pagination:e.pagination!=null?Bc3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>a5a(t)),pathParameters:e.pathParameters.map(t=>a5a(t)),sdkRequest:e.sdkRequest!=null?Rc3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Lc3(e.requestBody):void 0,response:e.response!=null?Ac3(e.response):void 0,headers:e.headers.map(t=>IWn(t)),queryParameters:e.queryParameters.map(t=>Nhf(t))}}function Ac3(e){return{...e,body:e.body!=null?qc3(e.body):void 0}}function qc3(e){switch(e.type){case"json":return he.V49.http.HttpResponseBody.json(WAP(e.value));case"fileDownload":return he.V49.http.HttpResponseBody.fileDownload(e);case"text":return he.V49.http.HttpResponseBody.text(e);case"streaming":return he.V49.http.HttpResponseBody.streaming(HAP(e.value));case"streamParameter":return he.V49.http.HttpResponseBody.streamParameter(Cc3(e))}}function WAP(e){switch(e.type){case"response":return he.V49.http.JsonResponse.response({...e,responseBodyType:Hq(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V49.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:Hq(e.responseBodyType),responseProperty:e.responseProperty!=null?Rhf(e.responseProperty):void 0})}}function HAP(e){switch(e.type){case"json":return he.V49.http.StreamingResponse.json({...e,payload:Hq(e.payload)});case"text":return he.V49.http.StreamingResponse.text(e);case"sse":return he.V49.http.StreamingResponse.sse({...e,payload:Hq(e.payload)})}}function Tc3(e){switch(e.type){case"json":return he.V49.http.NonStreamHttpResponseBody.json(WAP(e.value));case"text":return he.V49.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V49.http.NonStreamHttpResponseBody.fileDownload(e)}}function Cc3(e){return{nonStreamResponse:Tc3(e.nonStreamResponse),streamResponse:HAP(e.streamResponse)}}function Bc3(e){switch(e.type){case"cursor":return he.V49.http.Pagination.cursor(xc3(e));case"offset":return he.V49.http.Pagination.offset(Ic3(e))}}function xc3(e){return{...e,page:q1i(e.page),next:Rri(e.next),results:Rri(e.results)}}function Ic3(e){return{...e,page:q1i(e.page),results:Rri(e.results),step:e.step!=null?q1i(e.step):void 0}}function q1i(e){return{...e,property:zc3(e.property)}}function zc3(e){switch(e.type){case"query":return he.V49.RequestPropertyValue.query(Nhf(e));case"body":return he.V49.RequestPropertyValue.body(Rhf(e))}}function Rri(e){return{...e,property:Rhf(e.property)}}function Rhf(e){return{...e,valueType:Hq(e.valueType)}}function Nhf(e){return{...e,valueType:Hq(e.valueType)}}function Rc3(e){return{...e,streamParameter:e.streamParameter!=null?q1i(e.streamParameter):void 0,shape:Nc3(e.shape)}}function Nc3(e){return he.V50.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V49.http.SdkRequestShape.justRequestBody(Fc3(t)),wrapper:he.V49.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Fc3(e){switch(e.type){case"bytes":return he.V49.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V49.http.SdkRequestBodyType.typeReference({...e,requestBodyType:Hq(e.requestBodyType)})}}function Lc3(e){return he.V50.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V49.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:Hq(r.valueType)}))}),reference:t=>he.V49.http.HttpRequestBody.reference({...t,requestBodyType:Hq(t.requestBodyType)}),fileUpload:t=>he.V49.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V49.http.FileUploadRequestProperty.bodyProperty({...r,valueType:Hq(r.valueType)});case"file":return he.V49.http.FileUploadRequestProperty.file(Uc3(r.value))}})}),bytes:t=>he.V49.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Uc3(e){switch(e.type){case"file":return he.V49.http.FileProperty.file(e);case"fileArray":return he.V49.http.FileProperty.fileArray(e)}}function Vc3(e){return{...e,type:e.type!=null?Hq(e.type):void 0}}var QAP={laterVersion:"v51",earlierVersion:"v50",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"0.1.2",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V50.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=rd(e.types,r=>{let i=r.autogeneratedExamples.map(a=>$AP(a)),n=r.userProvidedExamples.map(a=>$AP(a));return{...r,examples:[...i,...n]}});return{...e,types:t,services:rd(e.services,r=>kc3(r)),errors:rd(e.errors,r=>nl3(r)),webhookGroups:rd(e.webhookGroups,r=>Gc3(r)),websocketChannels:rd(e.websocketChannels,r=>Wc3(r))}}};function Wc3(e){return{...e,examples:e.examples.map(t=>Hc3(t))}}function Hc3(e){return{...e,pathParameters:e.pathParameters.map(t=>MJu(t)),headers:e.headers.map(t=>Fhf(t)),queryParameters:e.queryParameters.map(t=>JAP(t)),messages:e.messages.map(t=>({...t,body:$c3(t.body)}))}}function JAP(e){return{...e,value:V4(e.value)}}function Fhf(e){return{...e,value:V4(e.value)}}function MJu(e){return{...e,value:V4(e.value)}}function $c3(e){switch(e.type){case"inlinedBody":return he.V50.ExampleWebSocketMessageBody.inlinedBody(KAP(e));case"reference":return he.V50.ExampleWebSocketMessageBody.reference(V4(e))}}function KAP(e){return{...e,properties:e.properties.map(t=>({...t,value:V4(t.value)}))}}function Gc3(e){return e.map(t=>({...t,examples:t.examples?.map(r=>({...r,payload:V4(r.payload)}))}))}function $AP(e){return{...e,shape:YAP(e.shape)}}function Lhf(e){switch(e.type){case"primitive":return he.V50.ExampleTypeReferenceShape.primitive({...e.primitive});case"container":return he.V50.ExampleTypeReferenceShape.container(Qc3(e));case"unknown":return he.V50.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V50.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:YAP(e.shape)})}}function Qc3(e){switch(e.container.type){case"list":return he.V50.ExampleContainer.list(e.container.list.map(t=>V4(t)));case"set":return he.V50.ExampleContainer.set(e.container.set.map(t=>V4(t)));case"optional":return he.V50.ExampleContainer.optional(e.container.optional!=null?V4(e.container.optional):void 0);case"map":return he.V50.ExampleContainer.map(e.container.map.map(t=>({key:V4(t.key),value:V4(t.value)})));case"literal":return he.V50.ExampleContainer.literal(e.container.literal)}}function V4(e){return{...e,shape:Lhf(e.shape)}}function YAP(e){switch(e.type){case"object":return he.V50.ExampleTypeShape.object({properties:e.properties.map(t=>XAP(t))});case"alias":return he.V50.ExampleTypeShape.alias({value:{...V4(e.value)}});case"enum":return he.V50.ExampleTypeShape.enum(e);case"union":return he.V50.ExampleTypeShape.union(Kc3(e));case"undiscriminatedUnion":return he.V50.ExampleTypeShape.undiscriminatedUnion(Jc3(e))}}function Jc3(e){return{...e,singleUnionType:V4(e.singleUnionType)}}function Kc3(e){return{...e,singleUnionType:Yc3(e.singleUnionType)}}function Yc3(e){return{...e,shape:Xc3(e.shape)}}function Xc3(e){switch(e.type){case"samePropertiesAsObject":return he.V50.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:Zc3(e.object)});case"singleProperty":return he.V50.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Lhf(e.shape)});case"noProperties":return he.V50.ExampleSingleUnionTypeProperties.noProperties()}}function Zc3(e){return{...e,properties:e.properties.map(t=>XAP(t))}}function XAP(e){return{...e,value:{...e.value,shape:Lhf(e.value.shape)}}}function kc3(e){return{...e,endpoints:e.endpoints.map(t=>el3(t))}}function el3(e){return{...e,autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:GAP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?GAP(t.example):void 0}))}}function GAP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>MJu(t)),servicePathParameters:e.servicePathParameters.map(t=>MJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>MJu(t)),serviceHeaders:e.serviceHeaders.map(t=>Fhf(t)),endpointHeaders:e.endpointHeaders.map(t=>Fhf(t)),queryParameters:e.queryParameters.map(t=>JAP(t)),request:e.request!=null?il3(e.request):void 0,response:tl3(e.response)}}function tl3(e){switch(e.type){case"error":return he.V50.ExampleResponse.error({...e,body:e.body!=null?V4(e.body):void 0});case"ok":return he.V50.ExampleResponse.ok(rl3(e))}}function rl3(e){switch(e.value.type){case"body":return he.V50.ExampleEndpointSuccessResponse.body(e.value.value!=null?V4(e.value.value):void 0);case"stream":return he.V50.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>V4(t)));case"sse":return he.V50.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:V4(t.data)})))}}function il3(e){switch(e.type){case"inlinedRequestBody":return he.V50.ExampleRequestBody.inlinedRequestBody(KAP(e));case"reference":return he.V50.ExampleRequestBody.reference(V4(e))}}function nl3(e){return{...e,examples:e.examples.map(t=>({...t,shape:V4(t.shape)}))}}var eqP={laterVersion:"v52",earlierVersion:"v51",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V51.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?ol3(e.apiVersion):void 0,auth:_l3(e.auth),headers:e.headers.map(t=>Vin(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>Vin(t)),types:al3(e.types),services:rd(e.services,t=>Sl3(t)),webhookGroups:rd(e.webhookGroups,t=>ll3(t)),websocketChannels:rd(e.websocketChannels,t=>ul3(t)),errors:rd(e.errors,t=>Ul3(t)),pathParameters:e.pathParameters.map(t=>o5a(t)),variables:e.variables.map(t=>Dl3(t))})};function al3(e){return rd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>ZAP(r)),userProvidedExamples:t.userProvidedExamples.map(r=>ZAP(r)),shape:he.V52.types.Type._visit(t.shape,{union:r=>he.V51.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:jE(i.valueType)})),types:r.types.map(i=>ml3(i))}),enum:he.V51.types.Type.enum,object:r=>he.V51.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:jE(i.valueType)}))}),alias:r=>he.V51.types.Type.alias({aliasOf:jE(r.aliasOf),resolvedType:jl3(r.resolvedType)}),undiscriminatedUnion:r=>he.V51.types.Type.undiscriminatedUnion(wl3(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function ol3(e){return he.V51.ApiVersionScheme.header({...e,header:Vin(e.header)})}function ul3(e){return{...e,headers:e.headers.map(t=>Vin(t)),queryParameters:e.queryParameters.map(t=>Whf(t)),pathParameters:e.pathParameters.map(t=>o5a(t)),messages:e.messages.map(t=>sl3(t)),examples:e.examples.map(t=>Vl3(t))}}function sl3(e){return{...e,body:cl3(e.body)}}function cl3(e){switch(e.type){case"inlinedBody":return he.V51.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:jE(t.valueType)}))});case"reference":return he.V51.websocket.WebSocketMessageBody.reference({...e,bodyType:jE(e.bodyType)})}}function ll3(e){return e.map(t=>fl3(t))}function fl3(e){return{...e,headers:e.headers.map(t=>Vin(t)),payload:dl3(e.payload),examples:e.examples!=null?e.examples.map(t=>pl3(t)):void 0}}function dl3(e){switch(e.type){case"reference":return he.V51.webhooks.WebhookPayload.reference({...e,payloadType:jE(e.payloadType)});case"inlinedPayload":return he.V51.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:jE(t.valueType)}))})}}function pl3(e){return{...e,payload:W4(e.payload)}}function _l3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V51.auth.AuthScheme.basic(t);case"bearer":return he.V51.auth.AuthScheme.bearer(t);case"header":return he.V51.auth.AuthScheme.header(hl3(t));case"oauth":return he.V51.auth.AuthScheme.oauth(yl3(t))}})}}function hl3(e){return{...e,valueType:jE(e.valueType)}}function yl3(e){return{...e,configuration:he.V51.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:vl3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?bl3(e.configuration.refreshEndpoint):void 0})}}function vl3(e){return{...e,requestProperties:{clientId:T1i(e.requestProperties.clientId),clientSecret:T1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?T1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:Nri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Nri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Nri(e.responseProperties.refreshToken):void 0}}}function bl3(e){return{...e,requestProperties:{refreshToken:T1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:Nri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Nri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Nri(e.responseProperties.refreshToken):void 0}}}function Vin(e){return{...e,valueType:jE(e.valueType)}}function jE(e){return he.V52.types.TypeReference._visit(e,{container:t=>he.V51.types.TypeReference.container(rqP(t)),primitive:t=>he.V51.types.TypeReference.primitive(tqP(t)),named:he.V51.types.TypeReference.named,unknown:he.V51.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function tqP(e){return{v1:gl3(e.v1),v2:e.v2!=null?Ol3(e.v2):void 0}}function gl3(e){switch(e){case"UINT":return he.V51.types.PrimitiveTypeV1.Integer;case"UINT_64":return he.V51.types.PrimitiveTypeV1.Long}return e}function Ol3(e){switch(e.type){case"integer":return he.V51.types.PrimitiveTypeV2.integer(e);case"double":return he.V51.types.PrimitiveTypeV2.double(e);case"string":return he.V51.types.PrimitiveTypeV2.string(e);case"boolean":return he.V51.types.PrimitiveTypeV2.boolean(e);case"long":return he.V51.types.PrimitiveTypeV2.long(e);case"bigInteger":return he.V51.types.PrimitiveTypeV2.bigInteger(e);case"uint":return;case"uint64":return;default:Fo(e)}}function rqP(e){return he.V52.types.ContainerType._visit(e,{list:t=>he.V51.types.ContainerType.list(jE(t)),optional:t=>he.V51.types.ContainerType.optional(jE(t)),set:t=>he.V51.types.ContainerType.set(jE(t)),map:({keyType:t,valueType:r})=>he.V51.types.ContainerType.map({keyType:jE(t),valueType:jE(r)}),literal:he.V51.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function ml3(e){return{...e,shape:Pl3(e.shape)}}function Pl3(e){return he.V52.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V51.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V51.types.SingleUnionTypeProperties.singleProperty({...t,type:jE(t.type)}),noProperties:he.V51.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function jl3(e){return he.V52.types.ResolvedTypeReference._visit(e,{container:t=>he.V51.types.ResolvedTypeReference.container(rqP(t)),named:he.V51.types.ResolvedTypeReference.named,primitive:t=>he.V51.types.ResolvedTypeReference.primitive(tqP(t)),unknown:he.V51.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function wl3(e){return{members:e.members.map(t=>({...t,type:jE(t.type)}))}}function Sl3(e){return{...e,pathParameters:e.pathParameters.map(t=>o5a(t)),headers:e.headers.map(t=>Vin(t)),endpoints:e.endpoints.map(t=>El3(t))}}function o5a(e){return{...e,valueType:jE(e.valueType)}}function Dl3(e){return{...e,type:jE(e.type)}}function El3(e){return{...e,pagination:e.pagination!=null?Cl3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>o5a(t)),pathParameters:e.pathParameters.map(t=>o5a(t)),sdkRequest:e.sdkRequest!=null?zl3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Fl3(e.requestBody):void 0,response:e.response!=null?Ml3(e.response):void 0,headers:e.headers.map(t=>Vin(t)),queryParameters:e.queryParameters.map(t=>Whf(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:kAP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?kAP(t.example):void 0}))}}function Ml3(e){return{...e,body:e.body!=null?Al3(e.body):void 0}}function Al3(e){switch(e.type){case"json":return he.V51.http.HttpResponseBody.json(iqP(e.value));case"fileDownload":return he.V51.http.HttpResponseBody.fileDownload(e);case"text":return he.V51.http.HttpResponseBody.text(e);case"streaming":return he.V51.http.HttpResponseBody.streaming(nqP(e.value));case"streamParameter":return he.V51.http.HttpResponseBody.streamParameter(Tl3(e))}}function iqP(e){switch(e.type){case"response":return he.V51.http.JsonResponse.response({...e,responseBodyType:jE(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V51.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:jE(e.responseBodyType),responseProperty:e.responseProperty!=null?Vhf(e.responseProperty):void 0})}}function nqP(e){switch(e.type){case"json":return he.V51.http.StreamingResponse.json({...e,payload:jE(e.payload)});case"text":return he.V51.http.StreamingResponse.text(e);case"sse":return he.V51.http.StreamingResponse.sse({...e,payload:jE(e.payload)})}}function ql3(e){switch(e.type){case"json":return he.V51.http.NonStreamHttpResponseBody.json(iqP(e.value));case"text":return he.V51.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V51.http.NonStreamHttpResponseBody.fileDownload(e)}}function Tl3(e){return{nonStreamResponse:ql3(e.nonStreamResponse),streamResponse:nqP(e.streamResponse)}}function Cl3(e){switch(e.type){case"cursor":return he.V51.http.Pagination.cursor(Bl3(e));case"offset":return he.V51.http.Pagination.offset(xl3(e))}}function Bl3(e){return{...e,page:T1i(e.page),next:Nri(e.next),results:Nri(e.results)}}function xl3(e){return{...e,page:T1i(e.page),results:Nri(e.results),step:e.step!=null?T1i(e.step):void 0}}function T1i(e){return{...e,property:Il3(e.property)}}function Il3(e){switch(e.type){case"query":return he.V51.RequestPropertyValue.query(Whf(e));case"body":return he.V51.RequestPropertyValue.body(Vhf(e))}}function Nri(e){return{...e,property:Vhf(e.property)}}function Vhf(e){return{...e,valueType:jE(e.valueType)}}function Whf(e){return{...e,valueType:jE(e.valueType)}}function zl3(e){return{...e,streamParameter:e.streamParameter!=null?T1i(e.streamParameter):void 0,shape:Rl3(e.shape)}}function Rl3(e){return he.V52.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V51.http.SdkRequestShape.justRequestBody(Nl3(t)),wrapper:he.V51.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Nl3(e){switch(e.type){case"bytes":return he.V51.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V51.http.SdkRequestBodyType.typeReference({...e,requestBodyType:jE(e.requestBodyType)})}}function Fl3(e){return he.V52.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V51.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:jE(r.valueType)}))}),reference:t=>he.V51.http.HttpRequestBody.reference({...t,requestBodyType:jE(t.requestBodyType)}),fileUpload:t=>he.V51.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V51.http.FileUploadRequestProperty.bodyProperty({...r,valueType:jE(r.valueType)});case"file":return he.V51.http.FileUploadRequestProperty.file(Ll3(r.value))}})}),bytes:t=>he.V51.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Ll3(e){switch(e.type){case"file":return he.V51.http.FileProperty.file(e);case"fileArray":return he.V51.http.FileProperty.fileArray(e)}}function Ul3(e){return{...e,type:e.type!=null?jE(e.type):void 0,examples:e.examples.map(t=>({...t,shape:W4(t.shape)}))}}function Vl3(e){return{...e,pathParameters:e.pathParameters.map(t=>AJu(t)),headers:e.headers.map(t=>Uhf(t)),queryParameters:e.queryParameters.map(t=>aqP(t)),messages:e.messages.map(t=>({...t,body:Wl3(t.body)}))}}function aqP(e){return{...e,value:W4(e.value)}}function Uhf(e){return{...e,value:W4(e.value)}}function AJu(e){return{...e,value:W4(e.value)}}function Wl3(e){switch(e.type){case"inlinedBody":return he.V51.ExampleWebSocketMessageBody.inlinedBody(oqP(e));case"reference":return he.V51.ExampleWebSocketMessageBody.reference(W4(e))}}function oqP(e){return{...e,properties:e.properties.map(t=>({...t,value:W4(t.value)}))}}function ZAP(e){return{...e,shape:sqP(e.shape)}}function Hhf(e){switch(e.type){case"primitive":return he.V51.ExampleTypeReferenceShape.primitive(Hl3(e));case"container":return he.V51.ExampleTypeReferenceShape.container($l3(e));case"unknown":return he.V51.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V51.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:sqP(e.shape)})}}function uqP(e){switch(e.type){case"integer":return he.V51.ExamplePrimitive.integer(e.integer);case"uint":return he.V51.ExamplePrimitive.integer(e.uint);case"uint64":return he.V51.ExamplePrimitive.integer(e.uint64);case"double":return he.V51.ExamplePrimitive.double(e.double);case"long":return he.V51.ExamplePrimitive.long(e.long);case"boolean":return he.V51.ExamplePrimitive.boolean(e.boolean);case"string":return he.V51.ExamplePrimitive.string(e.string);case"date":return he.V51.ExamplePrimitive.date(e.date);case"datetime":return he.V51.ExamplePrimitive.datetime(e.datetime);case"uuid":return he.V51.ExamplePrimitive.uuid(e.uuid)}}function Hl3(e){return uqP(e.primitive)}function $l3(e){switch(e.container.type){case"list":return he.V51.ExampleContainer.list({list:e.container.list.map(t=>W4(t)),itemType:jE(e.container.itemType)});case"set":return he.V51.ExampleContainer.set({set:e.container.set.map(t=>W4(t)),itemType:jE(e.container.itemType)});case"optional":return he.V51.ExampleContainer.optional({optional:e.container.optional!=null?W4(e.container.optional):void 0,valueType:jE(e.container.valueType)});case"map":return he.V51.ExampleContainer.map({map:e.container.map.map(t=>({key:W4(t.key),value:W4(t.value)})),keyType:jE(e.container.keyType),valueType:jE(e.container.valueType)});case"literal":return he.V51.ExampleContainer.literal({literal:uqP(e.container.literal)})}}function W4(e){return{...e,shape:Hhf(e.shape)}}function sqP(e){switch(e.type){case"object":return he.V51.ExampleTypeShape.object({properties:e.properties.map(t=>cqP(t))});case"alias":return he.V51.ExampleTypeShape.alias({value:{...W4(e.value)}});case"enum":return he.V51.ExampleTypeShape.enum(e);case"union":return he.V51.ExampleTypeShape.union(Ql3(e));case"undiscriminatedUnion":return he.V51.ExampleTypeShape.undiscriminatedUnion(Gl3(e))}}function Gl3(e){return{...e,singleUnionType:W4(e.singleUnionType)}}function Ql3(e){return{...e,singleUnionType:Jl3(e.singleUnionType)}}function Jl3(e){return{...e,shape:Kl3(e.shape)}}function Kl3(e){switch(e.type){case"samePropertiesAsObject":return he.V51.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:Yl3(e.object)});case"singleProperty":return he.V51.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Hhf(e.shape)});case"noProperties":return he.V51.ExampleSingleUnionTypeProperties.noProperties()}}function Yl3(e){return{...e,properties:e.properties.map(t=>cqP(t))}}function cqP(e){return{...e,value:{...e.value,shape:Hhf(e.value.shape)}}}function kAP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>AJu(t)),servicePathParameters:e.servicePathParameters.map(t=>AJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>AJu(t)),serviceHeaders:e.serviceHeaders.map(t=>Uhf(t)),endpointHeaders:e.endpointHeaders.map(t=>Uhf(t)),queryParameters:e.queryParameters.map(t=>aqP(t)),request:e.request!=null?kl3(e.request):void 0,response:Xl3(e.response)}}function Xl3(e){switch(e.type){case"error":return he.V51.ExampleResponse.error({...e,body:e.body!=null?W4(e.body):void 0});case"ok":return he.V51.ExampleResponse.ok(Zl3(e))}}function Zl3(e){switch(e.value.type){case"body":return he.V51.ExampleEndpointSuccessResponse.body(e.value.value!=null?W4(e.value.value):void 0);case"stream":return he.V51.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>W4(t)));case"sse":return he.V51.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:W4(t.data)})))}}function kl3(e){switch(e.type){case"inlinedRequestBody":return he.V51.ExampleRequestBody.inlinedRequestBody(oqP(e));case"reference":return he.V51.ExampleRequestBody.reference(W4(e))}}var dqP={laterVersion:"v53",earlierVersion:"v52",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.38.0-rc0",[J.TYPESCRIPT_BROWSER_SDK]:"0.38.0-rc0",[J.TYPESCRIPT]:"0.38.0-rc0",[J.TYPESCRIPT_SDK]:"0.38.0-rc0",[J.TYPESCRIPT_EXPRESS]:"0.17.3",[J.JAVA]:We,[J.JAVA_MODEL]:"1.3.0",[J.JAVA_SDK]:"2.5.0",[J.JAVA_SPRING]:"1.3.0",[J.PYTHON_FASTAPI]:"1.1.0-rc0",[J.PYTHON_PYDANTIC]:"1.1.0-rc0",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:"0.1.0",[J.STOPLIGHT]:We,[J.POSTMAN]:"0.2.0",[J.PYTHON_SDK]:"3.3.0-rc0",[J.GO_FIBER]:"0.23.5",[J.GO_MODEL]:"0.23.5",[J.GO_SDK]:"0.28.3",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"0.5.0",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:"0.1.0"},jsonifyEarlierVersion:e=>m_.V52.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?tf3(e.apiVersion):void 0,auth:cf3(e.auth),headers:e.headers.map(t=>Win(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>Win(t)),types:ef3(e.types),services:rd(e.services,t=>Of3(t)),webhookGroups:rd(e.webhookGroups,t=>af3(t)),websocketChannels:rd(e.websocketChannels,t=>rf3(t)),errors:rd(e.errors,t=>zf3(t)),pathParameters:e.pathParameters.map(t=>u5a(t)),variables:e.variables.map(t=>mf3(t))})};function ef3(e){return rd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>lqP(r)),userProvidedExamples:t.userProvidedExamples.map(r=>lqP(r)),shape:he.V53.types.Type._visit(t.shape,{union:r=>he.V52.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:wE(i.valueType)})),types:r.types.map(i=>yf3(i))}),enum:he.V52.types.Type.enum,object:r=>he.V52.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:wE(i.valueType)}))}),alias:r=>he.V52.types.Type.alias({aliasOf:wE(r.aliasOf),resolvedType:bf3(r.resolvedType)}),undiscriminatedUnion:r=>he.V52.types.Type.undiscriminatedUnion(gf3(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function tf3(e){return he.V52.ApiVersionScheme.header({...e,header:Win(e.header)})}function rf3(e){return{...e,headers:e.headers.map(t=>Win(t)),queryParameters:e.queryParameters.map(t=>Qhf(t)),pathParameters:e.pathParameters.map(t=>u5a(t)),messages:e.messages.map(t=>if3(t)),examples:e.examples.map(t=>Rf3(t))}}function if3(e){return{...e,body:nf3(e.body)}}function nf3(e){switch(e.type){case"inlinedBody":return he.V52.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:wE(t.valueType)}))});case"reference":return he.V52.websocket.WebSocketMessageBody.reference({...e,bodyType:wE(e.bodyType)})}}function af3(e){return e.map(t=>of3(t))}function of3(e){return{...e,headers:e.headers.map(t=>Win(t)),payload:uf3(e.payload),examples:e.examples!=null?e.examples.map(t=>sf3(t)):void 0}}function uf3(e){switch(e.type){case"reference":return he.V52.webhooks.WebhookPayload.reference({...e,payloadType:wE(e.payloadType)});case"inlinedPayload":return he.V52.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:wE(t.valueType)}))})}}function sf3(e){return{...e,payload:H4(e.payload)}}function cf3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V52.auth.AuthScheme.basic(t);case"bearer":return he.V52.auth.AuthScheme.bearer(t);case"header":return he.V52.auth.AuthScheme.header(lf3(t));case"oauth":return he.V52.auth.AuthScheme.oauth(ff3(t))}})}}function lf3(e){return{...e,valueType:wE(e.valueType)}}function ff3(e){return{...e,configuration:he.V52.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:df3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?pf3(e.configuration.refreshEndpoint):void 0})}}function df3(e){return{...e,requestProperties:{clientId:C1i(e.requestProperties.clientId),clientSecret:C1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?C1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:Fri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Fri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Fri(e.responseProperties.refreshToken):void 0}}}function pf3(e){return{...e,requestProperties:{refreshToken:C1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:Fri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Fri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Fri(e.responseProperties.refreshToken):void 0}}}function Win(e){return{...e,valueType:wE(e.valueType)}}function wE(e){return he.V53.types.TypeReference._visit(e,{container:t=>he.V52.types.TypeReference.container(_qP(t)),primitive:t=>he.V52.types.TypeReference.primitive(pqP(t)),named:he.V52.types.TypeReference.named,unknown:he.V52.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function pqP(e){return{v1:_f3(e.v1),v2:e.v2!=null?hf3(e.v2):void 0}}function _f3(e){switch(e){case"FLOAT":return he.V52.types.PrimitiveTypeV1.Double}return e}function hf3(e){switch(e.type){case"integer":return he.V52.types.PrimitiveTypeV2.integer(e);case"double":return he.V52.types.PrimitiveTypeV2.double(e);case"string":return he.V52.types.PrimitiveTypeV2.string(e);case"boolean":return he.V52.types.PrimitiveTypeV2.boolean(e);case"long":return he.V52.types.PrimitiveTypeV2.long(e);case"bigInteger":return he.V52.types.PrimitiveTypeV2.bigInteger(e);case"uint":return he.V52.types.PrimitiveTypeV2.uint();case"uint64":return he.V52.types.PrimitiveTypeV2.uint64();case"date":return;case"dateTime":return;case"uuid":return;case"base64":return;case"float":return;default:Fo(e)}}function _qP(e){return he.V53.types.ContainerType._visit(e,{list:t=>he.V52.types.ContainerType.list(wE(t)),optional:t=>he.V52.types.ContainerType.optional(wE(t)),set:t=>he.V52.types.ContainerType.set(wE(t)),map:({keyType:t,valueType:r})=>he.V52.types.ContainerType.map({keyType:wE(t),valueType:wE(r)}),literal:he.V52.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function yf3(e){return{...e,shape:vf3(e.shape)}}function vf3(e){return he.V53.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V52.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V52.types.SingleUnionTypeProperties.singleProperty({...t,type:wE(t.type)}),noProperties:he.V52.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function bf3(e){return he.V53.types.ResolvedTypeReference._visit(e,{container:t=>he.V52.types.ResolvedTypeReference.container(_qP(t)),named:he.V52.types.ResolvedTypeReference.named,primitive:t=>he.V52.types.ResolvedTypeReference.primitive(pqP(t)),unknown:he.V52.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function gf3(e){return{members:e.members.map(t=>({...t,type:wE(t.type)}))}}function Of3(e){return{...e,pathParameters:e.pathParameters.map(t=>u5a(t)),headers:e.headers.map(t=>Win(t)),endpoints:e.endpoints.map(t=>Pf3(t))}}function u5a(e){return{...e,valueType:wE(e.valueType)}}function mf3(e){return{...e,type:wE(e.type)}}function Pf3(e){return{...e,pagination:e.pagination!=null?Ef3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>u5a(t)),pathParameters:e.pathParameters.map(t=>u5a(t)),sdkRequest:e.sdkRequest!=null?Tf3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?xf3(e.requestBody):void 0,response:e.response!=null?jf3(e.response):void 0,headers:e.headers.map(t=>Win(t)),queryParameters:e.queryParameters.map(t=>Qhf(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:fqP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?fqP(t.example):void 0}))}}function jf3(e){return{...e,body:e.body!=null?wf3(e.body):void 0}}function wf3(e){switch(e.type){case"json":return he.V52.http.HttpResponseBody.json(hqP(e.value));case"fileDownload":return he.V52.http.HttpResponseBody.fileDownload(e);case"text":return he.V52.http.HttpResponseBody.text(e);case"streaming":return he.V52.http.HttpResponseBody.streaming(yqP(e.value));case"streamParameter":return he.V52.http.HttpResponseBody.streamParameter(Df3(e))}}function hqP(e){switch(e.type){case"response":return he.V52.http.JsonResponse.response({...e,responseBodyType:wE(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V52.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:wE(e.responseBodyType),responseProperty:e.responseProperty!=null?Ghf(e.responseProperty):void 0})}}function yqP(e){switch(e.type){case"json":return he.V52.http.StreamingResponse.json({...e,payload:wE(e.payload)});case"text":return he.V52.http.StreamingResponse.text(e);case"sse":return he.V52.http.StreamingResponse.sse({...e,payload:wE(e.payload)})}}function Sf3(e){switch(e.type){case"json":return he.V52.http.NonStreamHttpResponseBody.json(hqP(e.value));case"text":return he.V52.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V52.http.NonStreamHttpResponseBody.fileDownload(e)}}function Df3(e){return{nonStreamResponse:Sf3(e.nonStreamResponse),streamResponse:yqP(e.streamResponse)}}function Ef3(e){switch(e.type){case"cursor":return he.V52.http.Pagination.cursor(Mf3(e));case"offset":return he.V52.http.Pagination.offset(Af3(e))}}function Mf3(e){return{...e,page:C1i(e.page),next:Fri(e.next),results:Fri(e.results)}}function Af3(e){return{...e,page:C1i(e.page),results:Fri(e.results),step:e.step!=null?C1i(e.step):void 0}}function C1i(e){return{...e,property:qf3(e.property)}}function qf3(e){switch(e.type){case"query":return he.V52.RequestPropertyValue.query(Qhf(e));case"body":return he.V52.RequestPropertyValue.body(Ghf(e))}}function Fri(e){return{...e,property:Ghf(e.property)}}function Ghf(e){return{...e,valueType:wE(e.valueType)}}function Qhf(e){return{...e,valueType:wE(e.valueType)}}function Tf3(e){return{...e,streamParameter:e.streamParameter!=null?C1i(e.streamParameter):void 0,shape:Cf3(e.shape)}}function Cf3(e){return he.V53.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V52.http.SdkRequestShape.justRequestBody(Bf3(t)),wrapper:he.V52.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Bf3(e){switch(e.type){case"bytes":return he.V52.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V52.http.SdkRequestBodyType.typeReference({...e,requestBodyType:wE(e.requestBodyType)})}}function xf3(e){return he.V53.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V52.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:wE(r.valueType)}))}),reference:t=>he.V52.http.HttpRequestBody.reference({...t,requestBodyType:wE(t.requestBodyType)}),fileUpload:t=>he.V52.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V52.http.FileUploadRequestProperty.bodyProperty({...r,valueType:wE(r.valueType)});case"file":return he.V52.http.FileUploadRequestProperty.file(If3(r.value))}})}),bytes:t=>he.V52.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function If3(e){switch(e.type){case"file":return he.V52.http.FileProperty.file(e);case"fileArray":return he.V52.http.FileProperty.fileArray(e)}}function zf3(e){return{...e,type:e.type!=null?wE(e.type):void 0,examples:e.examples.map(t=>({...t,shape:H4(t.shape)}))}}function Rf3(e){return{...e,pathParameters:e.pathParameters.map(t=>qJu(t)),headers:e.headers.map(t=>$hf(t)),queryParameters:e.queryParameters.map(t=>vqP(t)),messages:e.messages.map(t=>({...t,body:Nf3(t.body)}))}}function vqP(e){return{...e,value:H4(e.value)}}function $hf(e){return{...e,value:H4(e.value)}}function qJu(e){return{...e,value:H4(e.value)}}function Nf3(e){switch(e.type){case"inlinedBody":return he.V52.ExampleWebSocketMessageBody.inlinedBody(bqP(e));case"reference":return he.V52.ExampleWebSocketMessageBody.reference(H4(e))}}function bqP(e){return{...e,properties:e.properties.map(t=>({...t,value:H4(t.value)}))}}function lqP(e){return{...e,shape:OqP(e.shape)}}function Jhf(e){switch(e.type){case"primitive":return he.V52.ExampleTypeReferenceShape.primitive(Ff3(e));case"container":return he.V52.ExampleTypeReferenceShape.container(Lf3(e));case"unknown":return he.V52.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V52.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:OqP(e.shape)})}}function gqP(e){switch(e.type){case"integer":return he.V52.ExamplePrimitive.integer(e.integer);case"uint":return he.V52.ExamplePrimitive.integer(e.uint);case"uint64":return he.V52.ExamplePrimitive.integer(e.uint64);case"float":return he.V52.ExamplePrimitive.double(e.float);case"double":return he.V52.ExamplePrimitive.double(e.double);case"long":return he.V52.ExamplePrimitive.long(e.long);case"boolean":return he.V52.ExamplePrimitive.boolean(e.boolean);case"string":return he.V52.ExamplePrimitive.string(e.string);case"date":return he.V52.ExamplePrimitive.date(e.date);case"datetime":return he.V52.ExamplePrimitive.datetime(e.datetime);case"uuid":return he.V52.ExamplePrimitive.uuid(e.uuid);case"base64":return he.V52.ExamplePrimitive.string({original:e.base64});case"bigInteger":return he.V52.ExamplePrimitive.string({original:e.bigInteger})}}function Ff3(e){return gqP(e.primitive)}function Lf3(e){switch(e.container.type){case"list":return he.V52.ExampleContainer.list({list:e.container.list.map(t=>H4(t)),itemType:wE(e.container.itemType)});case"set":return he.V52.ExampleContainer.set({set:e.container.set.map(t=>H4(t)),itemType:wE(e.container.itemType)});case"optional":return he.V52.ExampleContainer.optional({optional:e.container.optional!=null?H4(e.container.optional):void 0,valueType:wE(e.container.valueType)});case"map":return he.V52.ExampleContainer.map({map:e.container.map.map(t=>({key:H4(t.key),value:H4(t.value)})),keyType:wE(e.container.keyType),valueType:wE(e.container.valueType)});case"literal":return he.V52.ExampleContainer.literal({literal:gqP(e.container.literal)})}}function H4(e){return{...e,shape:Jhf(e.shape)}}function OqP(e){switch(e.type){case"object":return he.V52.ExampleTypeShape.object({properties:e.properties.map(t=>mqP(t))});case"alias":return he.V52.ExampleTypeShape.alias({value:{...H4(e.value)}});case"enum":return he.V52.ExampleTypeShape.enum(e);case"union":return he.V52.ExampleTypeShape.union(Vf3(e));case"undiscriminatedUnion":return he.V52.ExampleTypeShape.undiscriminatedUnion(Uf3(e))}}function Uf3(e){return{...e,singleUnionType:H4(e.singleUnionType)}}function Vf3(e){return{...e,singleUnionType:Wf3(e.singleUnionType)}}function Wf3(e){return{...e,shape:Hf3(e.shape)}}function Hf3(e){switch(e.type){case"samePropertiesAsObject":return he.V52.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:$f3(e.object)});case"singleProperty":return he.V52.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Jhf(e.shape)});case"noProperties":return he.V52.ExampleSingleUnionTypeProperties.noProperties()}}function $f3(e){return{...e,properties:e.properties.map(t=>mqP(t))}}function mqP(e){return{...e,value:{...e.value,shape:Jhf(e.value.shape)}}}function fqP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>qJu(t)),servicePathParameters:e.servicePathParameters.map(t=>qJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>qJu(t)),serviceHeaders:e.serviceHeaders.map(t=>$hf(t)),endpointHeaders:e.endpointHeaders.map(t=>$hf(t)),queryParameters:e.queryParameters.map(t=>vqP(t)),request:e.request!=null?Jf3(e.request):void 0,response:Gf3(e.response)}}function Gf3(e){switch(e.type){case"error":return he.V52.ExampleResponse.error({...e,body:e.body!=null?H4(e.body):void 0});case"ok":return he.V52.ExampleResponse.ok(Qf3(e))}}function Qf3(e){switch(e.value.type){case"body":return he.V52.ExampleEndpointSuccessResponse.body(e.value.value!=null?H4(e.value.value):void 0);case"stream":return he.V52.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>H4(t)));case"sse":return he.V52.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:H4(t.data)})))}}function Jf3(e){switch(e.type){case"inlinedRequestBody":return he.V52.ExampleRequestBody.inlinedRequestBody(bqP(e));case"reference":return he.V52.ExampleRequestBody.reference(H4(e))}}var PqP={laterVersion:"v54",earlierVersion:"v53",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:We},jsonifyEarlierVersion:e=>m_.V53.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:rd(e.services,t=>({...t,endpoints:t.endpoints.map(r=>({...r,response:Kf3(r.response)}))}))})};function Kf3(e){if(e!=null)return{statusCode:e.statusCode,body:e.body?.type==="bytes"?he.V53.HttpResponseBody.fileDownload({docs:void 0}):e.body}}var SqP={laterVersion:"v55",earlierVersion:"v54",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.47.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.47.0",[J.TYPESCRIPT]:"0.47.0",[J.TYPESCRIPT_SDK]:"0.47.0",[J.TYPESCRIPT_EXPRESS]:"0.17.7",[J.JAVA]:We,[J.JAVA_MODEL]:"1.7.0",[J.JAVA_SDK]:"2.16.0",[J.JAVA_SPRING]:"1.5.0",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"1.10.1",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:"0.3.2"},jsonifyEarlierVersion:e=>m_.V54.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?Xf3(e.apiVersion):void 0,auth:ad3(e.auth),headers:e.headers.map(t=>Hin(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>Hin(t)),types:Yf3(e.types),services:rd(e.services,t=>_d3(t)),webhookGroups:rd(e.webhookGroups,t=>td3(t)),websocketChannels:rd(e.websocketChannels,t=>Zf3(t)),errors:rd(e.errors,t=>qd3(t)),pathParameters:e.pathParameters.map(t=>s5a(t)),variables:e.variables.map(t=>hd3(t)),dynamic:e.dynamic!=null?Wd3(e.dynamic):void 0})};function Yf3(e){return rd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>jqP(r)),userProvidedExamples:t.userProvidedExamples.map(r=>jqP(r)),shape:he.V55.types.Type._visit(t.shape,{union:r=>he.V54.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:qP(i.valueType)})),types:r.types.map(i=>ld3(i))}),enum:he.V54.types.Type.enum,object:r=>he.V54.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:qP(i.valueType)})),extendedProperties:r.extendedProperties?.map(i=>({...i,valueType:qP(i.valueType)}))}),alias:r=>he.V54.types.Type.alias({aliasOf:qP(r.aliasOf),resolvedType:dd3(r.resolvedType)}),undiscriminatedUnion:r=>he.V54.types.Type.undiscriminatedUnion(pd3(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function Xf3(e){return he.V54.ApiVersionScheme.header({...e,header:Hin(e.header)})}function Zf3(e){return{...e,headers:e.headers.map(t=>Hin(t)),queryParameters:e.queryParameters.map(t=>Xhf(t)),pathParameters:e.pathParameters.map(t=>s5a(t)),messages:e.messages.map(t=>kf3(t)),examples:e.examples.map(t=>Td3(t))}}function kf3(e){return{...e,body:ed3(e.body)}}function ed3(e){switch(e.type){case"inlinedBody":return he.V54.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:qP(t.valueType)}))});case"reference":return he.V54.websocket.WebSocketMessageBody.reference({...e,bodyType:qP(e.bodyType)})}}function td3(e){return e.map(t=>rd3(t))}function rd3(e){return{...e,headers:e.headers.map(t=>Hin(t)),payload:id3(e.payload),examples:e.examples!=null?e.examples.map(t=>nd3(t)):void 0}}function id3(e){switch(e.type){case"reference":return he.V54.webhooks.WebhookPayload.reference({...e,payloadType:qP(e.payloadType)});case"inlinedPayload":return he.V54.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:qP(t.valueType)}))})}}function nd3(e){return{...e,payload:q6(e.payload)}}function ad3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V54.auth.AuthScheme.basic(t);case"bearer":return he.V54.auth.AuthScheme.bearer(t);case"header":return he.V54.auth.AuthScheme.header(od3(t));case"oauth":return he.V54.auth.AuthScheme.oauth(ud3(t))}})}}function od3(e){return{...e,valueType:qP(e.valueType)}}function ud3(e){return{...e,configuration:he.V54.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:sd3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?cd3(e.configuration.refreshEndpoint):void 0})}}function sd3(e){return{...e,requestProperties:{clientId:B1i(e.requestProperties.clientId),clientSecret:B1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?B1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:RVr(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?RVr(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?RVr(e.responseProperties.refreshToken):void 0}}}function cd3(e){return{...e,requestProperties:{refreshToken:B1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:RVr(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?RVr(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?RVr(e.responseProperties.refreshToken):void 0}}}function Hin(e){return{...e,valueType:qP(e.valueType)}}function qP(e){return e.type==="container"&&e.container.type==="nullable"?rp3(e.container.nullable):e.type==="container"&&e.container.type==="optional"?tp3(e.container.optional):he.V55.types.TypeReference._visit(e,{container:t=>he.V54.types.TypeReference.container(EqP(t)),primitive:t=>he.V54.types.TypeReference.primitive(DqP(t)),named:he.V54.types.TypeReference.named,unknown:he.V54.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function DqP(e){return{v1:e.v1,v2:e.v2!=null?e.v2:void 0}}function EqP(e){return he.V55.types.ContainerType._visit(e,{list:t=>he.V54.types.ContainerType.list(qP(t)),optional:t=>he.V54.types.ContainerType.optional(qP(t)),nullable:t=>he.V54.types.ContainerType.optional(qP(t)),set:t=>he.V54.types.ContainerType.set(qP(t)),map:({keyType:t,valueType:r})=>he.V54.types.ContainerType.map({keyType:qP(t),valueType:qP(r)}),literal:he.V54.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function ld3(e){return{...e,shape:fd3(e.shape)}}function fd3(e){return he.V55.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V54.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V54.types.SingleUnionTypeProperties.singleProperty({...t,type:qP(t.type)}),noProperties:he.V54.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function dd3(e){return he.V55.types.ResolvedTypeReference._visit(e,{container:t=>he.V54.types.ResolvedTypeReference.container(EqP(t)),named:he.V54.types.ResolvedTypeReference.named,primitive:t=>he.V54.types.ResolvedTypeReference.primitive(DqP(t)),unknown:he.V54.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function pd3(e){return{members:e.members.map(t=>({...t,type:qP(t.type)}))}}function _d3(e){return{...e,pathParameters:e.pathParameters.map(t=>s5a(t)),headers:e.headers.map(t=>Hin(t)),endpoints:e.endpoints.map(t=>yd3(t))}}function s5a(e){return{...e,valueType:qP(e.valueType)}}function hd3(e){return{...e,type:qP(e.type)}}function yd3(e){return{...e,pagination:e.pagination!=null?md3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>s5a(t)),pathParameters:e.pathParameters.map(t=>s5a(t)),sdkRequest:e.sdkRequest!=null?Sd3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Md3(e.requestBody):void 0,response:e.response!=null?vd3(e.response):void 0,headers:e.headers.map(t=>Hin(t)),queryParameters:e.queryParameters.map(t=>Xhf(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:wqP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?wqP(t.example):void 0}))}}function vd3(e){return{...e,body:e.body!=null?bd3(e.body):void 0}}function bd3(e){switch(e.type){case"json":return he.V54.http.HttpResponseBody.json(MqP(e.value));case"fileDownload":return he.V54.http.HttpResponseBody.fileDownload(e);case"bytes":return he.V54.http.HttpResponseBody.bytes(e);case"text":return he.V54.http.HttpResponseBody.text(e);case"streaming":return he.V54.http.HttpResponseBody.streaming(AqP(e.value));case"streamParameter":return he.V54.http.HttpResponseBody.streamParameter(Od3(e));default:Fo(e)}}function MqP(e){switch(e.type){case"response":return he.V54.http.JsonResponse.response({...e,responseBodyType:qP(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V54.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:qP(e.responseBodyType),responseProperty:e.responseProperty!=null?Yhf(e.responseProperty):void 0})}}function AqP(e){switch(e.type){case"json":return he.V54.http.StreamingResponse.json({...e,payload:qP(e.payload)});case"text":return he.V54.http.StreamingResponse.text(e);case"sse":return he.V54.http.StreamingResponse.sse({...e,payload:qP(e.payload)})}}function gd3(e){switch(e.type){case"json":return he.V54.http.NonStreamHttpResponseBody.json(MqP(e.value));case"bytes":return he.V54.http.NonStreamHttpResponseBody.bytes(e);case"text":return he.V54.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V54.http.NonStreamHttpResponseBody.fileDownload(e);default:Fo(e)}}function Od3(e){return{nonStreamResponse:gd3(e.nonStreamResponse),streamResponse:AqP(e.streamResponse)}}function md3(e){switch(e.type){case"cursor":return he.V54.http.Pagination.cursor(Pd3(e));case"offset":return he.V54.http.Pagination.offset(jd3(e))}}function Pd3(e){return{...e,page:B1i(e.page),next:RVr(e.next),results:RVr(e.results)}}function jd3(e){return{...e,page:B1i(e.page),results:RVr(e.results),step:e.step!=null?B1i(e.step):void 0,hasNextPage:e.hasNextPage!=null?RVr(e.hasNextPage):void 0}}function B1i(e){return{...e,property:wd3(e.property)}}function wd3(e){switch(e.type){case"query":return he.V54.RequestPropertyValue.query(Xhf(e));case"body":return he.V54.RequestPropertyValue.body(Yhf(e))}}function RVr(e){return{...e,property:Yhf(e.property)}}function Yhf(e){return{...e,valueType:qP(e.valueType)}}function Xhf(e){return{...e,valueType:qP(e.valueType)}}function Sd3(e){return{...e,streamParameter:e.streamParameter!=null?B1i(e.streamParameter):void 0,shape:Dd3(e.shape)}}function Dd3(e){return he.V55.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V54.http.SdkRequestShape.justRequestBody(Ed3(t)),wrapper:he.V54.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Ed3(e){switch(e.type){case"bytes":return he.V54.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V54.http.SdkRequestBodyType.typeReference({...e,requestBodyType:qP(e.requestBodyType)})}}function Md3(e){return he.V55.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V54.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:qP(r.valueType)})),extendedProperties:t.extendedProperties?.map(r=>({...r,valueType:qP(r.valueType)}))}),reference:t=>he.V54.http.HttpRequestBody.reference({...t,requestBodyType:qP(t.requestBodyType)}),fileUpload:t=>he.V54.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V54.http.FileUploadRequestProperty.bodyProperty({...r,valueType:qP(r.valueType)});case"file":return he.V54.http.FileUploadRequestProperty.file(Ad3(r.value))}})}),bytes:t=>he.V54.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Ad3(e){switch(e.type){case"file":return he.V54.http.FileProperty.file(e);case"fileArray":return he.V54.http.FileProperty.fileArray(e)}}function qd3(e){return{...e,type:e.type!=null?qP(e.type):void 0,examples:e.examples.map(t=>({...t,shape:q6(t.shape)}))}}function Td3(e){return{...e,pathParameters:e.pathParameters.map(t=>TJu(t)),headers:e.headers.map(t=>Khf(t)),queryParameters:e.queryParameters.map(t=>qqP(t)),messages:e.messages.map(t=>({...t,body:Cd3(t.body)}))}}function qqP(e){return{...e,value:q6(e.value)}}function Khf(e){return{...e,value:q6(e.value)}}function TJu(e){return{...e,value:q6(e.value)}}function Cd3(e){switch(e.type){case"inlinedBody":return he.V54.ExampleWebSocketMessageBody.inlinedBody(TqP(e));case"reference":return he.V54.ExampleWebSocketMessageBody.reference(q6(e))}}function TqP(e){return{...e,properties:e.properties.map(t=>({...t,value:q6(t.value)}))}}function jqP(e){return{...e,shape:CqP(e.shape)}}function Zhf(e){switch(e.type){case"primitive":return he.V54.ExampleTypeReferenceShape.primitive(Bd3(e));case"container":return he.V54.ExampleTypeReferenceShape.container(xd3(e));case"unknown":return he.V54.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V54.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:CqP(e.shape)})}}function Bd3(e){return e.primitive}function xd3(e){switch(e.container.type){case"list":return he.V54.ExampleContainer.list({list:e.container.list.map(t=>q6(t)),itemType:qP(e.container.itemType)});case"set":return he.V54.ExampleContainer.set({set:e.container.set.map(t=>q6(t)),itemType:qP(e.container.itemType)});case"optional":return he.V54.ExampleContainer.optional({optional:e.container.optional!=null?q6(e.container.optional):void 0,valueType:qP(e.container.valueType)});case"nullable":return he.V54.ExampleContainer.optional({optional:e.container.nullable!=null?q6(e.container.nullable):void 0,valueType:qP(e.container.valueType)});case"map":return he.V54.ExampleContainer.map({map:e.container.map.map(t=>({key:q6(t.key),value:q6(t.value)})),keyType:qP(e.container.keyType),valueType:qP(e.container.valueType)});case"literal":return he.V54.ExampleContainer.literal({literal:e.container.literal})}}function q6(e){return{...e,shape:Zhf(e.shape)}}function CqP(e){switch(e.type){case"object":return he.V54.ExampleTypeShape.object({properties:e.properties.map(t=>BqP(t))});case"alias":return he.V54.ExampleTypeShape.alias({value:{...q6(e.value)}});case"enum":return he.V54.ExampleTypeShape.enum(e);case"union":return he.V54.ExampleTypeShape.union(zd3(e));case"undiscriminatedUnion":return he.V54.ExampleTypeShape.undiscriminatedUnion(Id3(e))}}function Id3(e){return{...e,singleUnionType:q6(e.singleUnionType)}}function zd3(e){return{...e,singleUnionType:Rd3(e.singleUnionType)}}function Rd3(e){return{...e,shape:Nd3(e.shape)}}function Nd3(e){switch(e.type){case"samePropertiesAsObject":return he.V54.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:Fd3(e.object)});case"singleProperty":return he.V54.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Zhf(e.shape)});case"noProperties":return he.V54.ExampleSingleUnionTypeProperties.noProperties()}}function Fd3(e){return{...e,properties:e.properties.map(t=>BqP(t))}}function BqP(e){return{...e,value:{...e.value,shape:Zhf(e.value.shape)}}}function wqP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>TJu(t)),servicePathParameters:e.servicePathParameters.map(t=>TJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>TJu(t)),serviceHeaders:e.serviceHeaders.map(t=>Khf(t)),endpointHeaders:e.endpointHeaders.map(t=>Khf(t)),queryParameters:e.queryParameters.map(t=>qqP(t)),request:e.request!=null?Vd3(e.request):void 0,response:Ld3(e.response)}}function Ld3(e){switch(e.type){case"error":return he.V54.ExampleResponse.error({...e,body:e.body!=null?q6(e.body):void 0});case"ok":return he.V54.ExampleResponse.ok(Ud3(e))}}function Ud3(e){switch(e.value.type){case"body":return he.V54.ExampleEndpointSuccessResponse.body(e.value.value!=null?q6(e.value.value):void 0);case"stream":return he.V54.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>q6(t)));case"sse":return he.V54.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:q6(t.data)})))}}function Vd3(e){switch(e.type){case"inlinedRequestBody":return he.V54.ExampleRequestBody.inlinedRequestBody(TqP(e));case"reference":return he.V54.ExampleRequestBody.reference(q6(e))}}function Wd3(e){return{...e,types:rd(e.types,t=>Hd3(t)),endpoints:rd(e.endpoints,t=>$d3(t)),headers:e.headers?.map(t=>g6t(t))}}function Hd3(e){switch(e.type){case"alias":return he.V54.dynamic.NamedType.alias({...e,typeReference:NAe(e.typeReference)});case"enum":return he.V54.dynamic.NamedType.enum(e);case"object":return he.V54.dynamic.NamedType.object({...e,properties:e.properties.map(t=>g6t(t))});case"discriminatedUnion":return he.V54.dynamic.NamedType.discriminatedUnion({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,Qd3(r)]))});case"undiscriminatedUnion":return he.V54.dynamic.NamedType.undiscriminatedUnion({...e,types:e.types.map(t=>NAe(t))});default:Fo(e)}}function $d3(e){return{...e,auth:e.auth!=null?Gd3(e.auth):void 0,request:Jd3(e.request)}}function Gd3(e){switch(e.type){case"basic":return he.V54.dynamic.Auth.basic(e);case"bearer":return he.V54.dynamic.Auth.bearer(e);case"header":return he.V54.dynamic.Auth.header({header:g6t(e.header)})}}function NAe(e){switch(e.type){case"list":return he.V54.dynamic.TypeReference.list(NAe(e.value));case"optional":return np3(e.value);case"nullable":return ip3(e.value);case"map":return he.V54.dynamic.TypeReference.map({...e,key:NAe(e.key),value:NAe(e.value)});case"literal":return he.V54.dynamic.TypeReference.literal(e.value);case"named":return he.V54.dynamic.TypeReference.named(e.value);case"primitive":return he.V54.dynamic.TypeReference.primitive(e.value);case"set":return he.V54.dynamic.TypeReference.set(NAe(e.value));case"unknown":return he.V54.dynamic.TypeReference.unknown();default:Fo(e)}}function Qd3(e){switch(e.type){case"samePropertiesAsObject":return he.V54.dynamic.SingleDiscriminatedUnionType.samePropertiesAsObject({...e,properties:e.properties.map(t=>g6t(t))});case"singleProperty":return he.V54.dynamic.SingleDiscriminatedUnionType.singleProperty({...e,typeReference:NAe(e.typeReference),properties:e.properties?.map(t=>g6t(t))});case"noProperties":return he.V54.dynamic.SingleDiscriminatedUnionType.noProperties({...e,properties:e.properties?.map(t=>g6t(t))});default:Fo(e)}}function g6t(e){return{...e,typeReference:NAe(e.typeReference)}}function Jd3(e){switch(e.type){case"body":return he.V54.dynamic.Request.body(Kd3(e));case"inlined":return he.V54.dynamic.Request.inlined(Yd3(e));default:Fo(e)}}function Kd3(e){return{pathParameters:e.pathParameters?.map(t=>g6t(t)),body:e.body!=null?xqP(e.body):void 0}}function Yd3(e){return{...e,pathParameters:e.pathParameters?.map(t=>g6t(t)),queryParameters:e.queryParameters?.map(t=>g6t(t)),headers:e.headers?.map(t=>g6t(t)),body:e.body!=null?Xd3(e.body):void 0}}function Xd3(e){switch(e.type){case"properties":return he.V54.dynamic.InlinedRequestBody.properties(e.value.map(t=>g6t(t)));case"referenced":return he.V54.dynamic.InlinedRequestBody.referenced(Zd3(e));case"fileUpload":return he.V54.dynamic.InlinedRequestBody.fileUpload(kd3(e));default:Fo(e)}}function Zd3(e){return{...e,bodyType:xqP(e.bodyType)}}function xqP(e){switch(e.type){case"bytes":return he.V54.dynamic.ReferencedRequestBodyType.bytes();case"typeReference":return he.V54.dynamic.ReferencedRequestBodyType.typeReference(NAe(e.value));default:Fo(e)}}function kd3(e){return{properties:e.properties.map(t=>ep3(t))}}function ep3(e){switch(e.type){case"file":return he.V54.dynamic.FileUploadRequestBodyProperty.file(e);case"fileArray":return he.V54.dynamic.FileUploadRequestBodyProperty.fileArray(e);case"bodyProperty":return he.V54.dynamic.FileUploadRequestBodyProperty.bodyProperty(g6t(e));default:Fo(e)}}function tp3(e){return e.type==="container"&&e.container.type==="nullable"?he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(qP(e.container.nullable))):he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(qP(e)))}function rp3(e){return e.type==="container"&&e.container.type==="optional"?qP(e):he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(qP(e)))}function ip3(e){return e.type==="optional"?NAe(e):he.V54.dynamic.TypeReference.optional(NAe(e))}function np3(e){return e.type==="nullable"?he.V54.dynamic.TypeReference.optional(NAe(e.value)):he.V54.dynamic.TypeReference.optional(NAe(e))}var IqP={laterVersion:"v56",earlierVersion:"v55",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:"0.0.2",[J.CSHARP_SDK]:"1.12.0-rc0",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:We},jsonifyEarlierVersion:e=>m_.V55.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:rd(e.services,t=>ap3(t))})};function ap3(e){return{...e,endpoints:e.endpoints.map(t=>op3(t))}}function op3(e){return{...e,pagination:up3(e.pagination)}}function up3(e){if(e!=null)switch(e.type){case"cursor":return he.V55.http.Pagination.cursor({next:e.next,page:e.page,results:e.results});case"offset":return he.V55.http.Pagination.offset({hasNextPage:e.hasNextPage,page:e.page,results:e.results,step:e.step});case"custom":return;default:Fo(e)}}var zqP={laterVersion:"v57",earlierVersion:"v56",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.49.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.49.0",[J.TYPESCRIPT]:"0.49.0",[J.TYPESCRIPT_SDK]:"0.49.0",[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"1.12.0-rc11",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:"0.14.1"},jsonifyEarlierVersion:e=>m_.V56.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,dynamic:e.dynamic!=null?sp3(e.dynamic):void 0})};function sp3(e){return{...e,endpoints:cp3(e.endpoints)}}function cp3(e){return rd(e,t=>lp3(t))}function lp3(e){return{...e,auth:e.auth!=null?pp3(e.auth):void 0,examples:e.examples!=null?fp3(e.examples):void 0}}function fp3(e){return e.map(t=>dp3(t))}function dp3(e){return{...e,auth:e.auth!=null?_p3(e.auth):void 0}}function pp3(e){switch(e.type){case"basic":return he.V56.dynamic.Auth.basic(e);case"bearer":return he.V56.dynamic.Auth.bearer(e);case"header":return he.V56.dynamic.Auth.header(e);case"oauth":return;default:Fo(e)}}function _p3(e){switch(e.type){case"basic":return he.V56.dynamic.AuthValues.basic(e);case"bearer":return he.V56.dynamic.AuthValues.bearer(e);case"header":return he.V56.dynamic.AuthValues.header(e);case"oauth":return;default:Fo(e)}}function c5a(){return yp3}var CJu=class{migrations;constructor(t){this.migrations=t}withMigration(t){return new khf([...this.migrations,t])}},khf=class extends CJu{build(){return new eyf(this.migrations)}},eyf=class{migrations;constructor(t){this.migrations=t}migrateForGenerator({intermediateRepresentation:t,context:r,targetGenerator:i}){return this.migrate({intermediateRepresentation:t,shouldMigrate:n=>this.shouldRunMigration({migration:n,targetGenerator:i}),context:r,targetGenerator:i})}migrateThroughMigration({migration:t,intermediateRepresentation:r,context:i,targetGenerator:n}){return this.migrateThroughVersion({version:t.earlierVersion,intermediateRepresentation:r,context:i,targetGenerator:n})}migrateThroughVersion({version:t,intermediateRepresentation:r,context:i,targetGenerator:n}){let a=!1;if(this.migrations[0]?.laterVersion===t)return{ir:r,jsonify:()=>Promise.resolve().then(()=>a_.IntermediateRepresentation.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}))};let l=this.migrate({intermediateRepresentation:r,shouldMigrate:d=>{let s=d.earlierVersion===t;return a||=s,s||!a},context:i,targetGenerator:n});return a||i.failAndThrow(`IR ${t} does not exist`),l}migrate({intermediateRepresentation:t,shouldMigrate:r,context:i,targetGenerator:n}){let a=t,u=async()=>await a_.IntermediateRepresentation.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"});for(let l of this.migrations){if(!r(l))break;i.logger.debug(`Migrating IR from ${l.laterVersion} to ${l.earlierVersion}`),a=l.migrateBackwards(a,{taskContext:i,targetGenerator:n}),u=()=>Promise.resolve().then(()=>l.jsonifyEarlierVersion(a))}return{ir:a,jsonify:u}}shouldRunMigration({migration:t,targetGenerator:r}){let i=t.firstGeneratorVersionToConsumeNewIR[r.name];if(i==null)throw new Error(`Cannot migrate intermediate representation. Unrecognized generator: ${r.name}. If leveraging a custom generator, ensure you are specifying "ir-version" within the generator configuration.`);switch(i){case We:return!0;case ri:throw new Error(`Cannot migrate intermediate representation. Generator was created after intermediate representation ${t.laterVersion}.`)}return Pie(i,r.version)}getIRVersionForGenerator({targetGenerator:t}){let r=this.migrations[0]?.laterVersion;for(let i of this.migrations)if(this.shouldRunMigration({migration:i,targetGenerator:t}))r=i.earlierVersion;else break;return r}},hp3={Builder:new CJu([])},yp3=hp3.Builder.withMigration(zqP).withMigration(IqP).withMigration(SqP).withMigration(PqP).withMigration(dqP).withMigration(eqP).withMigration(QAP).withMigration(UAP).withMigration(LAP).withMigration(NAP).withMigration(RAP).withMigration(xAP).withMigration(TAP).withMigration(qAP).withMigration(MAP).withMigration(EAP).withMigration(DAP).withMigration(SAP).withMigration(wAP).withMigration(jAP).withMigration(PAP).withMigration(mAP).withMigration(OAP).withMigration(gAP).withMigration(bAP).withMigration(yAP).withMigration(_AP).withMigration(pAP).withMigration(dAP).withMigration(aAP).withMigration(nAP).withMigration(iAP).withMigration(tAP).withMigration(eAP).withMigration(blg).withMigration(hlg).withMigration(_lg).withMigration(flg).withMigration(clg).withMigration(ulg).withMigration(olg).withMigration(alg).withMigration(rlg).withMigration(kcg).withMigration(Zcg).withMigration(Xcg).withMigration(Kcg).withMigration(Jcg).withMigration(Qcg).withMigration(Wcg).withMigration(Lcg).withMigration(Fcg).withMigration(Ncg).withMigration(wcg).withMigration(mcg).withMigration(Rb_).build();function l5a({intermediateRepresentation:e,context:t,targetGenerator:r}){return c5a().migrateForGenerator({intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function tyf({intermediateRepresentation:e,context:t,targetGenerator:r,irVersion:i}){return c5a().migrateThroughVersion({version:i,intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function f5a({intermediateRepresentation:e,context:t,version:r}){return c5a().migrateThroughVersion({version:r,intermediateRepresentation:e,context:t}).jsonify()}async function NqP({project:e,irFilepath:t,cliContext:r,generationLanguage:i,audiences:n,version:a,keywords:u,smartCasing:l,readme:d,directFromOpenapi:s}){await Promise.all(e.apiWorkspaces.map(async o=>{await r.runTaskForWorkspace(o,async c=>{r.logger.info(`Generating IR for workspace ${o.workspaceName??"api"}`);let b=await vp3({workspace:o,context:c,generationLanguage:i,keywords:u,smartCasing:l,disableExamples:!1,audiences:n,version:a,readme:d,directFromOpenapi:s}),g=RqP.default.resolve(t);await xGr(Wl.of(g),b),c.logger.info(`Wrote IR to ${g}`)})}))}async function vp3({workspace:e,context:t,generationLanguage:r,audiences:i,keywords:n,smartCasing:a,disableExamples:u,version:l,readme:d,directFromOpenapi:s}){let o;if(s&&e instanceof B7)o=await e.getIntermediateRepresentation({context:t});else{let c=await e.toFernWorkspace({context:t});o=await tMn({workspace:c,context:t,generationLanguage:r,audiences:i,keywords:n,smartCasing:a,disableExamples:u,readme:d,includeDynamicExamples:!1})}return l==null?a_.IntermediateRepresentation.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}):f5a({intermediateRepresentation:o,version:l,context:t})}var FqP=require("fs/promises"),LqP=yi(require("path"),1);async function UqP({project:e,outputFilepath:t,cliContext:r}){await Promise.all(e.apiWorkspaces.map(async i=>{await r.runTaskForWorkspace(i,async n=>{let a=await _ba(i,n),u=LqP.default.resolve(t);await(0,FqP.writeFile)(u,await RGr(a,{pretty:!0})),n.logger.info(`Wrote FDR API definition to ${u}`)})}))}var VqP=require("fs/promises"),WqP=yi(require("path"),1);async function HqP({project:e,irFilepath:t,cliContext:r,sdkLanguage:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await r.runTaskForWorkspace(n,async a=>{if(n instanceof wpi){a.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(n instanceof B7))return;let u=new U5t(n.absoluteFilePath),l=await qze({context:a,specs:n.specs}),d=YRi({context:a,documents:await u.loadDocuments({context:a,specs:l})}),s=WqP.default.resolve(t),o=await uv.OpenApiIntermediateRepresentation.jsonOrThrow(d,{skipValidation:!0});await(0,VqP.writeFile)(s,await RGr(o,{pretty:!0})),a.logger.info(`Wrote IR to ${s}`)})}))}var BJu=require("fs/promises");async function GqP({project:e,includeModels:t,cliContext:r}){await Promise.all(e.apiWorkspaces.map(async i=>{await r.runTaskForWorkspace(i,async n=>{i instanceof B7?await gp3({workspace:i,context:n,includeModels:t}):n.logger.warn("Skipping fern workspace definition generation")})}))}async function bp3(e,t){let r=null;try{let i=(await(0,BJu.readFile)(e,"utf8")).toString();try{r=JSON.parse(i)}catch{r=Kd.load(i,{json:!0})}}catch{return t.failAndThrow(`Failed to read OpenAPI overrides from file ${e}`)}return r}async function gp3({workspace:e,includeModels:t,context:r}){let i=new U5t(e.absoluteFilePath),n=await qze({context:r,specs:e.specs});for(let a of n){let u=YRi({context:r,documents:await i.loadDocuments({context:r,specs:[a]})}),l={};a.absoluteFilepathToOverrides!==void 0&&(l=await bp3(a.absoluteFilepathToOverrides,r));let d="path"in l?l.path:{};for(let c of u.endpoints){let b=i_a(c);c.path in d||(d[c.path]={});let g=d[c.path];if(g!=null&&g[c.method]==null){let O=b.file.split("/").map(w=>w.replace(".yml","")).filter(w=>w!=="__package__"),m={};O.length>0&&(m["x-fern-sdk-group-name"]=O),m["x-fern-sdk-method-name"]=b.endpointId,g[c.method.toLowerCase()]=m}else l==null&&r.logger.warn(`Endpoint ${c.path} ${c.method} is defined multiple times`)}let s="path"in l?l.path:{};if(t){$qP(s,u.groupedSchemas.rootSchemas);for(let[c,b]of Object.entries(u.groupedSchemas.namespacedSchemas))$qP(s,b)}let o={schemas:s};await(0,BJu.writeFile)(Xu(_p(a.absoluteFilepath),Xa.of("openapi-overrides.yml")),Kd.dump({paths:d,components:o}))}}function $qP(e,t){for(let[r,i]of Object.entries(t)){if(r in e)continue;let n={};n["x-fern-type-name"]="nameOverride"in i?i.nameOverride??r:r,e[r]=n}}var xJu="api",QqP="group";var JqP=".preview",KqP="approved-output-directories",YqP=".fern";var rTP=require("fs/promises");var ZqP=require("fs/promises");var XqP=require("os");function d5a(){return Xu(Wl.of((0,XqP.homedir)()),Xa.of(YqP),Xa.of(KqP))}async function kqP(){let e=d5a();if(!await Cf(e))return[];let r=await(0,ZqP.readFile)(e,{encoding:"utf-8"});return JSON.parse(r)}var IJu=require("fs/promises"),eTP=yi(require("path"),1);async function tTP(e){await(0,IJu.mkdir)(eTP.default.dirname(d5a()),{recursive:!0}),await(0,IJu.writeFile)(d5a(),JSON.stringify(e,null,2))}async function iTP(e,t,r){if(!e||sys()||r)return{shouldProceed:!0};let i=await kqP();return i?.includes(e)?{shouldProceed:!0}:await Cf(e)?(await(0,rTP.readdir)(e)).length===0?{shouldProceed:!0}:await t.confirmPrompt(`Directory ${e} contains existing files that may be overwritten. Continue?`,!1)?(await tTP([...i??[],e]),{shouldProceed:!0}):{shouldProceed:!1}:{shouldProceed:!0}}var wRP=yi(Lg(),1),i2t=yi(ORP(),1),GAe=yi($q(),1);var K1i=yi(require("path"),1),onn="/fern",unn=K1i.default.join(onn,"output"),Ovf=K1i.default.join(onn,"config.json"),iYu=K1i.default.join(onn,"ir.json"),B5a=K1i.default.join(onn,"snippet.json"),x5a=K1i.default.join(onn,"snippet-templates.json"),K3V=K1i.default.join(onn,"generators"),mRP=K1i.default.join(onn,"sources");var xO3="0.0.1";function PRP(e){return e!=null?wRP.GithubPublishInfo._visit(e,{npm:t=>i2t.FernGeneratorExec.GithubPublishInfo.npm({registryUrl:t.registryUrl,packageName:t.packageName,tokenEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.token??"")}),maven:t=>i2t.FernGeneratorExec.GithubPublishInfo.maven({registryUrl:t.registryUrl,coordinate:t.coordinate,usernameEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.password??""),signature:t.signature!=null?{keyIdEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.signature.keyId??""),passwordEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.signature.password??""),secretKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.signature.secretKey??"")}:void 0}),pypi:t=>i2t.FernGeneratorExec.GithubPublishInfo.pypi({registryUrl:t.registryUrl,packageName:t.packageName,usernameEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.password??"")}),rubygems:t=>i2t.FernGeneratorExec.GithubPublishInfo.rubygems({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.apiKey??"")}),postman:t=>i2t.FernGeneratorExec.GithubPublishInfo.postman({apiKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.apiKey??""),workspaceIdEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.workspaceId??"")}),nuget:t=>i2t.FernGeneratorExec.GithubPublishInfo.nuget({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.apiKey??"")}),_other:()=>{}}):void 0}function SRP({generatorInvocation:e,customConfig:t,workspaceName:r,organization:i,outputVersion:n=xO3,absolutePathToSnippet:a,absolutePathToSnippetTemplates:u,writeUnitTests:l,generateOauthClients:d,generatePaginatedClients:s}){let o=[],c=e.outputMode._visit({publish:b=>({...jRP(n,b),publishingMetadata:e.publishMetadata}),publishV2:b=>({...jRP(n,b),publishingMetadata:e.publishMetadata}),downloadFiles:()=>({mode:i2t.FernGeneratorExec.OutputMode.downloadFiles(),path:unn,publishingMetadata:e.publishMetadata}),github:b=>{let g={mode:i2t.FernGeneratorExec.OutputMode.github({repoUrl:`https://github.com/${b.owner}/${b.repo}`,version:n,publishInfo:PRP(b.publishInfo),installationToken:void 0}),path:unn,publishingMetadata:e.publishMetadata};return a!==void 0&&(o.push(`${a}:${B5a}`),g.snippetFilepath=B5a),u!==void 0&&(o.push(`${u}:${x5a}`),g.snippetTemplateFilepath=x5a),g},githubV2:b=>{let g=b._visit({commitAndRelease:m=>`https://github.com/${m.owner}/${m.repo}`,push:m=>`https://github.com/${m.owner}/${m.repo}`,pullRequest:m=>`https://github.com/${m.owner}/${m.repo}`,_other:()=>{throw new Error("Encountered unknown github mode")}}),O={mode:i2t.FernGeneratorExec.OutputMode.github({repoUrl:g,version:n,publishInfo:PRP(b.publishInfo)}),path:unn,publishingMetadata:e.publishMetadata};return a!==void 0&&(o.push(`${a}:${B5a}`),O.snippetFilepath=B5a),u!==void 0&&(o.push(`${u}:${x5a}`),O.snippetTemplateFilepath=x5a),O},_other:()=>{throw new Error("Output type did not match any of the types supported by Fern")}});return{binds:o,config:{irFilepath:iYu,output:c,publish:void 0,customConfig:t,workspaceName:r,organization:i,environment:i2t.FernGeneratorExec.GeneratorEnvironment.local(),dryRun:!1,whitelabel:!1,writeUnitTests:l,generateOauthClients:d,generatePaginatedClients:s}}}function jRP(e,t){let r;return"registryOverrides"in t?r=t.registryOverrides.maven??t.registryOverrides.npm:r!=null&&(r=t._visit({mavenOverride:i=>i,npmOverride:i=>i,pypiOverride:i=>i,rubyGemsOverride:i=>i,postman:i=>i,nugetOverride:i=>i,_other:()=>{}})),{mode:i2t.FernGeneratorExec.OutputMode.publish({registries:{maven:{group:"",password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??""},npm:{registryUrl:r?.registryUrl??"",scope:"",token:r?.token??""}},publishTarget:void 0,registriesV2:{maven:{password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??"",coordinate:r?.coordinate??"",signature:r?.signature},npm:{registryUrl:r?.registryUrl??"",token:r?.token??"",packageName:r?.packageName??""},pypi:{packageName:r?.coordinate??"",password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??"",pypiMetadata:r?.pypiMetadata},rubygems:{registryUrl:r?.registryUrl??"",apiKey:r?.apiKey??"",packageName:r?.packageName??""},nuget:{registryUrl:r?.registryUrl??"",apiKey:r?.apiKey??"",packageName:r?.packageName??""}},version:e}),path:unn}}async function DRP({workspace:e,audiences:t,generatorInvocation:r,context:i,irVersionOverride:n,version:a,packageName:u,sourceConfig:l,includeOptionalRequestPropertyExamples:d}){let s=C2({workspace:e,audiences:t,generationLanguage:r.language,keywords:r.keywords,smartCasing:r.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:d,disabled:r.disableExamples},readme:r.readme,version:a,packageName:u,context:i,sourceResolver:new q2(i,e),includeDynamicExamples:!0});l!=null&&(s.sourceConfig=l),i.logger.debug("Generated IR");let o=n!=null?await f5a({intermediateRepresentation:s,context:i,version:n}):await l5a({intermediateRepresentation:s,context:i,targetGenerator:{name:r.name,version:r.version}});return{latest:s,migrated:o}}var TRP=require("fs/promises"),bHn=yi(Lte(),1);var ERP=require("fs/promises"),MRP=yi(Lte(),1);async function mvf({logger:e,imageName:t,args:r=[],binds:i=[],writeLogsToFile:n=!0,removeAfterCompletion:a=!1}){let u=()=>IO3({logger:e,imageName:t,args:r,binds:i,removeAfterCompletion:a,writeLogsToFile:n});try{await u()}catch(l){if(l instanceof Error&&l.message.includes("No such image"))await zO3(t),await u();else throw l}}async function IO3({logger:e,imageName:t,args:r,binds:i,removeAfterCompletion:n,writeLogsToFile:a}){let u=["run","--user","root",...i.flatMap(c=>["-v",c]),n?"--rm":"",t,...r].filter(Boolean),{stdout:l,stderr:d,exitCode:s}=await SG(e,"docker",u,{reject:!1,all:!0,doNotPipeOutput:!0}),o=l+d;if(a){let c=await MRP.default.file();await(0,ERP.writeFile)(c.path,o),e.info(`Generator logs here: ${c.path}`)}if(s!==0)throw new Error(`Docker exited with code ${s}.
1996
+ fix here: ${u}:${n.start.line}:${n.start.column}`,[i,u]}function AvE(e){return Hpi.ApiDefinitionV1ToLatest.from(e,{useJavaScriptAsTypeScript:!1,alwaysEnableJavaScriptFetch:!1,usesApplicationJsonInFormDataValue:!1}).migrate()}async function qvE(e){let t=[];return Hpi.Transformer.descriptions(r=>(typeof r=="string"&&t.push(r),r)).apiDefinition(e),t}var Nic={name:"validate-version-file",create:()=>({versionFile:async({path:e,content:t})=>{let r=await C6o({value:t});return r.type==="success"?[]:[{severity:"fatal",message:`${r.message}`}]}})};var Mb_=[Wrc,Hrc,Nic,Cv_,jFi,Mic,$rc,Grc,Bv_,Aic];function Ab_(e){if(!e)return Mb_;let t=new Set(e);return Mb_.filter(r=>!t.has(r.name))}async function Gba(e,t,r,i,n,a){let u=n?[jFi]:Ab_(a);return TvE({workspace:e,rules:u,context:t,fernWorkspaces:r,ossWorkspaces:i})}async function TvE({workspace:e,rules:t,context:r,fernWorkspaces:i,ossWorkspaces:n}){let a=[],u=await Promise.all(t.map(d=>d.create({workspace:e,fernWorkspaces:i,ossWorkspaces:n,logger:r.logger}))),l=Ev_({relativeFilepath:Xa.of(B4t),allRuleVisitors:u,addViolations:d=>{a.push(...d)}});return await Tv_({contents:e.config,visitor:l,absoluteFilepathToConfiguration:Xu(e.absoluteFilePath,Xa.of(B4t)),absolutePathToFernFolder:e.absoluteFilePath,context:r,fernWorkspaces:i}),a}async function Z6o({workspace:e,fernWorkspaces:t,ossWorkspaces:r,context:i,logWarnings:n,errorOnBrokenLinks:a,logSummary:u=!0,excludeRules:l}){let d=performance.now(),s=await Gba(e,i,t,r,!1,l),o=performance.now()-d,{hasErrors:c}=ZEn({violations:s,context:i,logWarnings:n,logSummary:u,logBreadcrumbs:!1,elapsedMillis:o});return a&&(c=c||s.some(b=>b.name==="valid-markdown-links")),{hasErrors:c}}async function k6o({workspace:e,fernWorkspaces:t,ossWorkspaces:r,context:i,logWarnings:n,errorOnBrokenLinks:a,excludeRules:u}){let{hasErrors:l}=await Z6o({workspace:e,context:i,logWarnings:n,fernWorkspaces:t,ossWorkspaces:r,errorOnBrokenLinks:a,excludeRules:u});l&&i.failAndThrow()}async function qb_({loadProject:e,cliContext:t,port:r,bundlePath:i,brokenLinks:n}){let a=await e(),u=a.docsWorkspaces;u!=null&&(await t.instrumentPostHogEvent({orgId:a.config.organization,command:"fern docs dev"}),await t.runTaskForWorkspace(u,async l=>{l.logger.info(`Starting server on port ${r}`),await jtc({initialProject:a,reloadProject:e,validateProject:async d=>{let s=d.docsWorkspaces;if(s==null)return;let o=n?[]:["valid-markdown-links"];if(s.config.experimental?.openapiParserV3)await Z6o({workspace:s,context:l,logWarnings:!0,logSummary:!1,fernWorkspaces:[],ossWorkspaces:await _X(d),excludeRules:o});else{let c=await Promise.all(d.apiWorkspaces.map(async b=>b.toFernWorkspace({context:l})));await Z6o({workspace:s,context:l,logWarnings:!0,logSummary:!1,fernWorkspaces:c,ossWorkspaces:await _X(d),excludeRules:o});for(let b of c)await t.runTaskForWorkspace(b,async g=>{await zrc({workspace:b,context:g,logWarnings:!1,logSummary:!1})})}},context:l,port:r,bundlePath:i})}))}async function Tb_({project:e,cliContext:t,shouldFix:r}){await Promise.all(e.apiWorkspaces.map(async i=>{i instanceof B7||await t.runTaskForWorkspace(i,async n=>{await bxs({workspace:await i.toFernWorkspace({context:n}),context:n,shouldFix:r})})}))}var Cb_=yi(require("path"),1);async function tMn({workspace:e,context:t,generationLanguage:r,keywords:i,smartCasing:n,disableExamples:a,audiences:u,readme:l,includeDynamicExamples:d}){return await cZt({workspace:e,context:t,logWarnings:!1}),C2({workspace:e,generationLanguage:r,keywords:i,smartCasing:n,exampleGeneration:{disabled:a},audiences:u,readme:l,version:void 0,packageName:void 0,context:t,sourceResolver:new q2(t,e),includeDynamicExamples:d})}async function Bb_({project:e,irFilepath:t,cliContext:r,generationLanguage:i,audiences:n,version:a,keywords:u,smartCasing:l,includeDynamicExamples:d}){await Promise.all(e.apiWorkspaces.map(async s=>{await r.runTaskForWorkspace(s,async o=>{r.logger.info(`Generating IR for workspace ${s.workspaceName??"api"}`);let c=await s.toFernWorkspace({context:o}),b=await tMn({workspace:c,context:o,generationLanguage:i,keywords:u,smartCasing:l,disableExamples:!1,audiences:n,readme:void 0,includeDynamicExamples:d});if(b.dynamic==null)throw new Error("Internal error; dynamic IR was not generated");let g=Cb_.default.resolve(t);await xGr(Wl.of(g),b.dynamic),o.logger.info(`Wrote IR to ${g}`)})}))}var xb_=require("fs/promises"),Ib_=yi(require("path"),1);async function zb_({project:e,outputFilepath:t,cliContext:r,audiences:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await r.runTaskForWorkspace(n,async a=>{let u=await n.toFernWorkspace({context:a}),l=await tMn({workspace:u,context:a,generationLanguage:void 0,audiences:i,keywords:void 0,smartCasing:!1,disableExamples:!1,readme:void 0,includeDynamicExamples:!1}),d=iDe({ir:l,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0}}),s=Ib_.default.resolve(t);await(0,xb_.writeFile)(s,await RGr(d,{pretty:!0})),a.logger.info(`Wrote FDR API definition to ${s}`)})}))}var RqP=yi(require("path"),1);var We=Symbol(),ri=Symbol();var Rb_={laterVersion:"v2",earlierVersion:"v1",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.246",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({apiName:e.apiName,auth:e.auth,headers:e.headers,types:e.types,services:e.services,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,errors:e.errors.map(t=>({name:t.name,docs:t.docs,discriminantValue:{originalValue:t.discriminantValueV4.name.unsafeName.originalValue,camelCase:t.discriminantValueV4.name.unsafeName.camelCase,pascalCase:t.discriminantValueV4.name.unsafeName.pascalCase,snakeCase:t.discriminantValueV4.name.unsafeName.snakeCase,screamingSnakeCase:t.discriminantValueV4.name.unsafeName.screamingSnakeCase,wireValue:t.discriminantValueV4.wireValue},discriminantValueV2:t.discriminantValueV2,discriminantValueV3:t.discriminantValueV3,discriminantValueV4:t.discriminantValueV4,type:t.type,typeV2:t.typeV2,typeV3:t.typeV3,http:t.http,statusCode:t.statusCode}))})};var he={};Co(he,{V1:()=>WAB,V10:()=>HAB,V11:()=>$AB,V12:()=>GAB,V13:()=>QAB,V14:()=>JAB,V15:()=>KAB,V16:()=>YAB,V17:()=>XAB,V18:()=>ZAB,V19:()=>kAB,V2:()=>eqB,V20:()=>tqB,V21:()=>rqB,V22:()=>iqB,V23:()=>Fsg.FernIrV23,V24:()=>Lsg.FernIrV24,V25:()=>Usg.FernIrV25,V26:()=>Vsg.FernIrV26,V27:()=>Wsg.FernIrV27,V28:()=>Hsg.FernIrV28,V29:()=>$sg.FernIrV29,V3:()=>nqB,V30:()=>Gsg.FernIrV30,V31:()=>Qsg.FernIrV31,V32:()=>Jsg.FernIrV32,V33:()=>Ksg.FernIrV33,V34:()=>Ysg.FernIrV34,V35:()=>Xsg.FernIrV35,V36:()=>Zsg.FernIrV36,V37:()=>ksg.FernIrV37,V38:()=>ecg.FernIrV38,V39:()=>tcg.FernIrV39,V4:()=>aqB,V40:()=>rcg.FernIrV40,V41:()=>icg.FernIrV41,V42:()=>ncg.FernIrV42,V43:()=>acg.FernIrV43,V44:()=>ocg.FernIrV44,V45:()=>ucg.FernIrV45,V46:()=>scg.FernIrV46,V47:()=>ccg.FernIrV47,V48:()=>lcg.FernIrV48,V49:()=>fcg.FernIrV49,V5:()=>oqB,V50:()=>dcg.FernIrV50,V51:()=>pcg.FernIrV51,V52:()=>_cg.FernIrV52,V53:()=>hcg.FernIrV53,V54:()=>ycg.FernIrV54,V55:()=>vcg.FernIrV55,V56:()=>bcg.FernIrV56,V57:()=>uc,V6:()=>uqB,V7:()=>sqB,V8:()=>cqB,V9:()=>lqB});var WAB=yi(Cj_(),1),HAB=yi(kM_(),1),$AB=yi(jI_(),1),GAB=yi(O6_(),1),QAB=yi(vU_(),1),JAB=yi(_J_(),1),KAB=yi(fth(),1),YAB=yi(jsh(),1),XAB=yi(Ihh(),1),ZAB=yi(Qmh(),1),kAB=yi(sMh(),1),eqB=yi(ixh(),1),tqB=yi(B7h(),1),rqB=yi(dUh(),1),iqB=yi($Jh(),1),Fsg=yi(lkh(),1),Lsg=yi(Jiy(),1),Usg=yi(Isy(),1),Vsg=yi(Dpy(),1),Wsg=yi(mby(),1),Hsg=yi(vPy(),1),$sg=yi(pDy(),1),nqB=yi(rBy(),1),Gsg=yi(nNy(),1),Qsg=yi(o2y(),1),Jsg=yi(vLy(),1),Ksg=yi(NPc(),1),Ysg=yi(LXy(),1),Xsg=yi(Iiv(),1),Zsg=yi(qcv(),1),ksg=yi(Ehv(),1),ecg=yi(EOv(),1),tcg=yi(HSv(),1),aqB=yi(VCv(),1),rcg=yi(aFv(),1),icg=yi(w8v(),1),ncg=yi(QWv(),1),acg=yi(bYv(),1),ocg=yi(Hrb(),1),ucg=yi(Tcb(),1),scg=yi(wyb(),1),ccg=yi(mPb(),1),lcg=yi(bMb(),1),fcg=yi(bIb(),1),oqB=yi(i7b(),1),dcg=yi(dLb(),1),pcg=yi(TQb(),1),_cg=yi(tt0(),1),hcg=yi(Ad0(),1),ycg=yi(fj0(),1),vcg=yi(kB0(),1),bcg=yi(V80(),1),uqB=yi(YW0(),1),sqB=yi(nY0(),1),cqB=yi(drg(),1),lqB=yi(Nsg(),1);function gcg({inlinedRequest:e,allTypes:t}){let r=new Set,i=t.reduce((n,a)=>({...n,[Bzc(a.name)]:a}),{});for(let n of e.extends)Ocg({typeName:n,typeNameToDeclaration:i,referencedTypes:r});for(let n of e.properties)FTn({reference:n.valueType,typeNameToDeclaration:i,referencedTypes:r});return[...r].reduce((n,a)=>{let u=i[a];if(u==null)throw new Error("Cannot find declaration for ID: "+a);return[...n,u.name]},[])}function FTn({reference:e,typeNameToDeclaration:t,referencedTypes:r}){he.V2.types.TypeReference._visit(e,{primitive:Jo,container:i=>{fqB({container:i,typeNameToDeclaration:t,referencedTypes:r})},named:i=>{Ocg({typeName:i,typeNameToDeclaration:t,referencedTypes:r})},unknown:Jo,void:Jo,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function fqB({container:e,typeNameToDeclaration:t,referencedTypes:r}){he.V2.types.ContainerType._visit(e,{list:i=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},set:i=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},optional:i=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},map:({keyType:i,valueType:n})=>{FTn({reference:i,typeNameToDeclaration:t,referencedTypes:r}),FTn({reference:n,typeNameToDeclaration:t,referencedTypes:r})},literal:Jo,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function Ocg({typeName:e,typeNameToDeclaration:t,referencedTypes:r}){let i=Bzc(e);r.add(i);let n=t[i];if(n==null)throw new Error("Cannot locate type: "+i);for(let a of n.referencedTypes)r.add(Bzc(a))}function Bzc(e){return[...e.fernFilepathV2.map(t=>t.unsafeName.originalValue),e.nameV3.unsafeName.originalValue].join(".")}var mcg={laterVersion:"v3",earlierVersion:"v2",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.249",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:"0.0.134-3-g97d4964",[J.JAVA_SDK]:"0.0.134-3-g97d4964",[J.JAVA_SPRING]:"0.0.134-3-g97d4964",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=[...e.types];return{apiName:e.apiName,auth:e.auth,headers:e.headers,types:t,errors:e.errors,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,services:{websocket:e.services.websocket,http:e.services.http.map(r=>({availability:r.availability,docs:r.docs,name:r.name,basePath:r.basePath,basePathV2:r.basePathV2,headers:r.headers,pathParameters:r.pathParameters,endpoints:r.endpoints.map(i=>dqB(r,i,e.types,n=>{t.push(n)}))}))}}}};function dqB(e,t,r,i){return{docs:t.docs,availability:t.availability,id:t.id,name:t.name,nameV2:t.nameV2,method:t.method,headers:t.headers,path:t.path,pathParameters:t.pathParameters,queryParameters:t.queryParameters,request:pqB(t,e,r,i),response:t.response,errors:t.errors,errorsV2:t.errorsV2,auth:t.auth}}function pqB(e,t,r,i){let n=e.requestBody;return n==null?{docs:void 0,type:he.V2.types.TypeReference.void(),typeV2:void 0}:he.V3.services.http.HttpRequestBody._visit(n,{reference:a=>({docs:a.docs,type:a.requestBodyType,typeV2:a.requestBodyType}),inlinedRequestBody:a=>{let u={fernFilepath:t.name.fernFilepath,fernFilepathV2:t.name.fernFilepathV2,name:a.name.unsafeName.originalValue,nameV2:{originalValue:a.name.unsafeName.originalValue,camelCase:a.name.unsafeName.camelCase,pascalCase:a.name.unsafeName.pascalCase,snakeCase:a.name.unsafeName.snakeCase,screamingSnakeCase:a.name.unsafeName.screamingSnakeCase},nameV3:a.name},l=he.V2.types.Type.object({extends:a.extends,properties:a.properties.map(s=>({availability:e.availability,docs:s.docs,name:{originalValue:s.name.name.unsafeName.originalValue,camelCase:s.name.name.unsafeName.camelCase,pascalCase:s.name.name.unsafeName.pascalCase,snakeCase:s.name.name.unsafeName.snakeCase,screamingSnakeCase:s.name.name.unsafeName.screamingSnakeCase,wireValue:s.name.wireValue},nameV2:s.name,valueType:s.valueType}))});i({docs:void 0,availability:e.availability,name:u,shape:l,referencedTypes:gcg({inlinedRequest:a,allTypes:r}),examples:[]});let d=he.V2.types.TypeReference.named(u);return{docs:void 0,type:d,typeV2:d}},_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+n.type)}})}var wcg={laterVersion:"v4",earlierVersion:"v3",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:"0.0.11-4-g1c29f6c",[J.POSTMAN]:"0.0.32-rc0",[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({apiName:e.apiName,auth:e.auth,headers:e.headers,types:e.types.map(t=>({docs:t.docs,availability:t.availability,name:t.name,shape:t.shape,examples:t.examples.map(r=>Scg(r.shape)),referencedTypes:t.referencedTypes})),errors:e.errors,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,services:{...e.services,http:e.services.http.map(t=>({...t,endpoints:t.endpoints.map(r=>({...r,examples:r.examples.map(i=>bqB(i))}))}))}})};function Scg(e){return he.V4.types.ExampleTypeShape._visit(e,{object:t=>he.V3.types.ExampleType.object(_qB(t)),union:t=>he.V3.types.ExampleType.union(yqB(t)),alias:t=>he.V3.types.ExampleType.alias(vqB(t)),enum:he.V3.types.ExampleType.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function _qB(e){return{properties:e.properties.map(t=>({wireKey:t.wireKey,value:$Z(t.value),originalTypeDeclaration:t.originalTypeDeclaration}))}}function $Z(e){return he.V4.types.ExampleTypeReferenceShape._visit(e.shape,{primitive:he.V3.types.ExampleTypeReference.primitive,container:t=>he.V3.types.ExampleTypeReference.container(hqB(t)),named:t=>he.V3.types.ExampleTypeReference.named(Dcg(t)),unknown:he.V3.types.ExampleTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReference: "+e.shape.type)}})}function hqB(e){return he.V4.types.ExampleContainer._visit(e,{list:t=>he.V3.types.ExampleContainer.list(t.map($Z)),set:t=>he.V3.types.ExampleContainer.set(t.map($Z)),optional:t=>he.V3.types.ExampleContainer.optional(t!=null?$Z(t):void 0),map:t=>he.V3.types.ExampleContainer.map(t.map(r=>({key:$Z(r.key),value:$Z(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function Dcg(e){return{typeName:e.typeName,shape:Scg(e.shape)}}function yqB(e){return{wireDiscriminantValue:e.wireDiscriminantValue,properties:he.V4.types.ExampleSingleUnionTypeProperties._visit(e.properties,{samePropertiesAsObject:t=>he.V3.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject(Dcg(t)),singleProperty:t=>he.V3.types.ExampleSingleUnionTypeProperties.singleProperty($Z(t)),noProperties:()=>he.V3.types.ExampleSingleUnionTypeProperties.noProperties(),_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.properties.type)}})}}function vqB(e){return{value:$Z(e.value)}}function bqB(e){return{servicePathParameters:e.servicePathParameters.map(t=>Pcg(t)),endpointPathParameters:e.servicePathParameters.map(t=>Pcg(t)),serviceHeaders:e.serviceHeaders.map(t=>jcg(t)),endpointHeaders:e.endpointHeaders.map(t=>jcg(t)),queryParameters:e.queryParameters.map(t=>gqB(t)),request:e.request!=null?OqB(e.request):void 0,response:PqB(e.response)}}function Pcg(e){return{key:e.key,value:$Z(e.value)}}function jcg(e){return{key:e.wireKey,value:$Z(e.value)}}function gqB(e){return{key:e.wireKey,value:$Z(e.value)}}function OqB(e){return he.V4.services.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V3.services.http.ExampleRequestBody.inlinedRequestBody({properties:t.properties.map(r=>mqB(r))}),reference:t=>he.V3.services.http.ExampleRequestBody.reference($Z(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function mqB(e){return{wireKey:e.wireKey,value:$Z(e.value),originalTypeDeclaration:e.originalTypeDeclaration}}function PqB(e){return he.V4.services.http.ExampleResponse._visit(e,{ok:t=>he.V3.services.http.ExampleResponse.ok({body:t.body!=null?$Z(t.body):void 0}),error:t=>he.V3.services.http.ExampleResponse.error({error:t.error,body:t.body!=null?$Z(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var hVo=class{errors;constructor(t){this.errors=t.errors.reduce((r,i)=>({...r,[Ecg(i.name)]:i}),{})}getDeclaration(t){let r=Ecg(t),i=this.errors[r];if(i==null)throw new Error("Error does not exist: "+r);return i}};function Ecg(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function $Lt(e){return{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}function EEe(e){return{...$Lt(e.name),wireValue:e.wireValue}}function $2(e){return{safeName:{originalValue:e.originalName,camelCase:e.camelCase.safeName,pascalCase:e.pascalCase.safeName,snakeCase:e.snakeCase.safeName,screamingSnakeCase:e.screamingSnakeCase.safeName},unsafeName:{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}}function G2(e){return{wireValue:e.wireValue,name:$2(e.name)}}function DVi(e){return e.map(t=>$Lt(t))}function EVi(e){return e.map(t=>$2(t))}function v9(e){return{fernFilepath:DVi(e.fernFilepath),fernFilepathV2:EVi(e.fernFilepath),name:e.name.originalName,nameV2:$Lt(e.name),nameV3:$2(e.name)}}function Mz(e){return he.V5.types.TypeReference._visit(e,{named:t=>he.V4.types.TypeReference.named(v9(t)),container:t=>he.V4.types.TypeReference.container(LTn(t)),primitive:t=>he.V4.types.TypeReference.primitive(t),unknown:he.V4.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function LTn(e){return he.V5.types.ContainerType._visit(e,{list:t=>he.V4.types.ContainerType.list(Mz(t)),set:t=>he.V4.types.ContainerType.set(Mz(t)),map:({keyType:t,valueType:r})=>he.V4.types.ContainerType.map({keyType:Mz(t),valueType:Mz(r)}),optional:t=>he.V4.types.ContainerType.optional(Mz(t)),literal:t=>he.V5.types.Literal._visit(t,{string:r=>he.V4.types.ContainerType.literal(he.V4.types.Literal.string(r)),_unknown:()=>{throw new Error("Unknown Literal: "+t.type)}}),_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}var yVo=class{types;constructor(t){this.types=t.types.reduce((r,i)=>({...r,[Mcg(i.name)]:i}),{})}resolveTypeReference(t){return he.V5.types.TypeReference._visit(t,{container:r=>he.V4.types.ResolvedTypeReference.container(LTn(r)),named:r=>{let i=this.getTypeDeclaration(r);return i.shape._type==="alias"?this.resolveTypeReference(i.shape.aliasOf):he.V4.types.ResolvedTypeReference.named({name:v9(r),shape:jqB(i.shape._type)})},primitive:he.V4.types.ResolvedTypeReference.primitive,unknown:he.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+t._type)}})}getTypeDeclaration(t){let r=Mcg(t),i=this.types[r];if(i==null)throw new Error("Type does not exist: "+i);return i}};function Mcg(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function jqB(e){switch(e){case"object":return he.V4.types.ShapeType.Object;case"union":return he.V4.types.ShapeType.Union;case"enum":return he.V4.types.ShapeType.Enum;default:Fo(e)}}function MVi(e){return{name:EEe(e.name),nameV2:G2(e.name),valueType:Mz(e.valueType),availability:e.availability,docs:e.docs}}function Acg(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>wqB(t))}}function wqB(e){return he.V5.auth.AuthScheme._visit(e,{basic:he.V4.auth.AuthScheme.basic,bearer:he.V4.auth.AuthScheme.bearer,header:t=>he.V4.auth.AuthScheme.header(MVi(t)),_unknown:()=>{throw new Error("Unknown AuthScheme: "+e._type)}})}function qcg(e){return{docs:e.docs,id:e.id,url:e.url,name:$2(e.name)}}function Tcg({errorDeclaration:e,errorDiscriminationStrategy:t,typeReferenceResolver:r}){let i=e.type!=null?he.V4.types.Type.alias({aliasOf:Mz(e.type),resolvedType:r.resolveTypeReference(e.type)}):void 0;return{docs:e.docs,name:{name:e.name.name.originalName,nameV2:$Lt(e.name.name),nameV3:$2(e.name.name),fernFilepath:DVi(e.name.fernFilepath),fernFilepathV2:EVi(e.name.fernFilepath)},discriminantValueV2:G2(e.discriminantValue),discriminantValueV3:he.V5.ir.ErrorDiscriminationStrategy._visit(t,{statusCode:he.V4.errors.ErrorDeclarationDiscriminantValue.statusCode,property:n=>he.V4.errors.ErrorDeclarationDiscriminantValue.property(G2(n.contentProperty)),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+t.type)}}),discriminantValueV4:G2(e.discriminantValue),type:i??he.V4.types.Type.alias({aliasOf:he.V4.types.TypeReference.void(),resolvedType:he.V4.types.ResolvedTypeReference.void()}),typeV2:i,typeV3:e.type!=null?Mz(e.type):e.type,http:{statusCode:e.statusCode},statusCode:e.statusCode}}function GZ(e){return{jsonExample:e.jsonExample,shape:Ccg(e.shape)}}function Ccg(e){return he.V5.types.ExampleTypeReferenceShape._visit(e,{primitive:he.V4.types.ExampleTypeReferenceShape.primitive,container:t=>he.V4.types.ExampleTypeReferenceShape.container(DqB(t)),unknown:he.V4.types.ExampleTypeReferenceShape.unknown,named:t=>he.V4.types.ExampleTypeReferenceShape.named(SqB(t)),_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function SqB(e){return{typeName:v9(e.typeName),shape:vVo(e.shape)}}function DqB(e){return he.V5.types.ExampleContainer._visit(e,{list:t=>he.V4.types.ExampleContainer.list(t.map(r=>GZ(r))),set:t=>he.V4.types.ExampleContainer.set(t.map(r=>GZ(r))),optional:t=>he.V4.types.ExampleContainer.optional(t!=null?GZ(t):void 0),map:t=>he.V4.types.ExampleContainer.map(t.map(r=>({key:GZ(r.key),value:GZ(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function vVo(e){return he.V5.types.ExampleTypeShape._visit(e,{alias:t=>he.V4.types.ExampleTypeShape.alias({value:GZ(t.value)}),object:t=>he.V4.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:GZ(r.value),originalTypeDeclaration:v9(r.originalTypeDeclaration)}))}),union:t=>he.V4.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:he.V5.types.ExampleSingleUnionTypeProperties._visit(t.properties,{samePropertiesAsObject:r=>he.V4.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:v9(r.typeName),shape:vVo(r.shape)}),singleProperty:r=>he.V4.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:r.jsonExample,shape:Ccg(r.shape)}),noProperties:he.V4.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+t.properties.type)}})}),enum:t=>he.V4.types.ExampleTypeShape.enum({wireValue:t.wireValue}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Icg({service:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,displayName:e.displayName,name:EqB(e.name),basePath:MqB(e.basePath),basePathV2:e.basePath,endpoints:e.endpoints.map(r=>AqB({endpoint:r,errorResolver:t})),headers:e.headers.map(r=>MVi(r)),pathParameters:e.pathParameters.map(r=>zcg(r))}}function EqB(e){return{name:e.name.pascalCase.unsafeName,fernFilepath:DVi(e.fernFilepath),fernFilepathV2:EVi(e.fernFilepath)}}function MqB(e){return e.parts.reduce((t,r)=>t+`{${r.pathParameter}}`+r.tail,e.head)}function AqB({endpoint:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,id:e.name.originalName,name:$Lt(e.name),nameV2:$2(e.name),displayName:e.displayName,method:e.method,headers:e.headers.map(r=>MVi(r)),path:e.path,pathParameters:e.pathParameters.map(r=>zcg(r)),queryParameters:e.queryParameters.map(r=>qqB(r)),requestBody:e.requestBody!=null?TqB(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?CqB(e.sdkRequest):void 0,response:BqB(e.response),errors:e.errors.map(r=>xqB(r)),errorsV2:IqB({responseErrors:e.errors,errorResolver:t}),auth:e.auth,examples:e.examples.map(r=>NqB(r))}}function zcg(e){return{docs:e.docs,availability:e.availability,name:$Lt(e.name),nameV2:$2(e.name),valueType:Mz(e.valueType)}}function qqB(e){return{docs:e.docs,availability:e.availability,name:EEe(e.name),nameV2:G2(e.name),valueType:Mz(e.valueType),allowMultiple:e.allowMultiple}}function TqB(e){return he.V5.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V4.services.http.HttpRequestBody.inlinedRequestBody({name:$2(t.name),extends:t.extends.map(r=>v9(r)),properties:t.properties.map(r=>({docs:r.docs,name:G2(r.name),valueType:Mz(r.valueType)}))}),reference:t=>he.V4.services.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:Mz(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.type)}})}function CqB(e){return{requestParameterName:$2(e.requestParameterName),shape:he.V5.http.SdkRequestShape._visit(e.shape,{justRequestBody:t=>he.V4.services.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:Mz(t.requestBodyType)}),wrapper:t=>he.V4.services.http.SdkRequestShape.wrapper({wrapperName:$2(t.wrapperName),bodyKey:$2(t.bodyKey)}),_unknown:()=>{throw new Error("Unknown SdkRequestShape type: "+e.shape.type)}})}}function BqB(e){let t=e.type!=null?Mz(e.type):void 0;return{docs:e.docs,type:t??he.V4.types.TypeReference.void(),typeV2:t}}function xqB(e){return{docs:e.docs,error:xzc(e.error)}}function IqB({responseErrors:e,errorResolver:t}){return{discriminant:{originalValue:"errorName",camelCase:"errorName",snakeCase:"error_name",pascalCase:"ErrorName",screamingSnakeCase:"ERROR_NAME",wireValue:"errorName"},types:e.map(r=>zqB({responseError:r,errorResolver:t}))}}function zqB({responseError:e,errorResolver:t}){let r=t.getDeclaration(e.error);return{docs:e.docs,discriminantValue:EEe(r.discriminantValue),shape:RqB({responseError:e,declaration:r})}}function RqB({responseError:e,declaration:t}){return t.type==null?he.V4.services.commons.ResponseErrorShape.noProperties():he.V4.services.commons.ResponseErrorShape.singleProperty({name:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT",wireValue:"content"},error:xzc(e.error)})}function xzc(e){return{name:e.name.originalName,nameV2:$Lt(e.name),nameV3:$2(e.name),fernFilepath:DVi(e.fernFilepath),fernFilepathV2:EVi(e.fernFilepath)}}function NqB(e){return{docs:e.docs,name:e.name?.originalName,servicePathParameters:e.servicePathParameters.map(t=>Bcg(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Bcg(t)),serviceHeaders:e.serviceHeaders.map(t=>xcg(t)),endpointHeaders:e.endpointHeaders.map(t=>xcg(t)),queryParameters:e.queryParameters.map(t=>FqB(t)),request:e.request!=null?LqB(e.request):void 0,response:VqB(e.response)}}function Bcg(e){return{key:e.key,value:GZ(e.value)}}function xcg(e){return{wireKey:e.wireKey,value:GZ(e.value)}}function FqB(e){return{wireKey:e.wireKey,value:GZ(e.value)}}function LqB(e){return he.V5.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V4.services.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>UqB(r))}),reference:t=>he.V4.services.http.ExampleRequestBody.reference(GZ(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function UqB(e){return{wireKey:e.wireKey,value:GZ(e.value),originalTypeDeclaration:e.originalTypeDeclaration!=null?v9(e.originalTypeDeclaration):void 0}}function VqB(e){return he.V5.http.ExampleResponse._visit(e,{ok:t=>he.V4.services.http.ExampleResponse.ok({body:t.body!=null?GZ(t.body):void 0}),error:t=>he.V4.services.http.ExampleResponse.error({error:xzc(t.error),body:t.body!=null?GZ(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function Rcg(e){return{docs:e.docs,availability:e.availability,name:v9(e.name),shape:WqB(e.shape),examples:e.examples.map(t=>HqB(t)),referencedTypes:e.referencedTypes.map(t=>v9(t))}}function WqB(e){return he.V5.types.Type._visit(e,{alias:({aliasOf:t,resolvedType:r})=>he.V4.types.Type.alias({aliasOf:Mz(t),resolvedType:$qB(r)}),enum:t=>he.V4.types.Type.enum({values:t.values.map(r=>({docs:r.docs,availability:r.availability,name:EEe(r.name),nameV2:G2(r.name),value:r.name.wireValue}))}),object:t=>he.V4.types.Type.object({extends:t.extends.map(r=>v9(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:EEe(r.name),nameV2:G2(r.name),valueType:Mz(r.valueType)}))}),union:t=>he.V4.types.Type.union({discriminant:t.discriminant.wireValue,discriminantV2:EEe(t.discriminant),discriminantV3:G2(t.discriminant),types:t.types.map(r=>({docs:r.docs,discriminantValue:EEe(r.discriminantValue),discriminantValueV2:G2(r.discriminantValue),valueType:he.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:i=>he.V4.types.TypeReference.named(v9(i)),singleProperty:i=>Mz(i.type),noProperties:he.V4.types.TypeReference.void,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}}),shape:he.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:i=>he.V4.types.SingleUnionTypeProperties.samePropertiesAsObject(v9(i)),singleProperty:i=>he.V4.types.SingleUnionTypeProperties.singleProperty({name:EEe(i.name),nameV2:G2(i.name),type:Mz(i.type)}),noProperties:he.V4.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}})}))}),_unknown:()=>{throw new Error("Unknown shape: "+e._type)}})}function HqB(e){return{docs:e.docs,jsonExample:e.jsonExample,name:e.name?.originalName,shape:vVo(e.shape)}}function $qB(e){return he.V5.types.ResolvedTypeReference._visit(e,{named:t=>he.V4.types.ResolvedTypeReference.named({name:v9(t.name),shape:GqB(t.shape)}),container:t=>he.V4.types.ResolvedTypeReference.container(LTn(t)),primitive:he.V4.types.ResolvedTypeReference.primitive,unknown:he.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function GqB(e){return he.V5.types.ShapeType._visit(e,{enum:()=>he.V5.types.ShapeType.Enum,object:()=>he.V5.types.ShapeType.Object,union:()=>he.V5.types.ShapeType.Union,_unknown:()=>{throw new Error("Unknown ShapeType: "+e)}})}var Ncg={laterVersion:"v5",earlierVersion:"v4",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.257-2-g46fe4ff",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.33-9-gf683b5e",[J.PYTHON_PYDANTIC]:"0.0.33-9-gf683b5e",[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.STOPLIGHT]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=new yVo(e),r=new hVo(e);return{apiName:e.apiName.originalName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:Acg(e.auth),headers:e.headers.map(i=>MVi(i)),types:e.types.map(i=>Rcg(i)),services:{http:e.services.map(i=>Icg({service:i,errorResolver:r})),websocket:[]},errors:e.errors.map(i=>Tcg({errorDeclaration:i,errorDiscriminationStrategy:e.errorDiscriminationStrategy,typeReferenceResolver:t})),constants:{errorDiscriminant:"_error",errorInstanceIdKey:"_errorInstanceId",unknownErrorDiscriminantValue:"_unknown"},constantsV2:{errors:{errorInstanceIdKey:EEe(e.constants.errorInstanceIdKey),errorDiscriminant:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR",wireValue:"error"},errorContentKey:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT",wireValue:"content"}},errorsV2:{errorInstanceIdKey:G2(e.constants.errorInstanceIdKey),errorDiscriminant:{name:{unsafeName:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR"},safeName:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR"}},wireValue:"error"},errorContentKey:{name:{unsafeName:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT"},safeName:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT"}},wireValue:"content"}}},defaultEnvironment:e.defaultEnvironment,environments:e.environments.map(i=>qcg(i)),errorDiscriminant:e.errorDiscriminationStrategy.type==="property"?$2(e.errorDiscriminationStrategy.discriminant.name):void 0,errorDiscriminationStrategy:he.V5.ir.ErrorDiscriminationStrategy._visit(e.errorDiscriminationStrategy,{statusCode:he.V4.ir.ErrorDiscriminationStrategy.statusCode,property:i=>he.V4.ir.ErrorDiscriminationStrategy.property({discriminant:G2(i.discriminant),contentProperty:G2(i.contentProperty)}),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+e.errorDiscriminationStrategy.type)}}),sdkConfig:e.sdkConfig}}};var Fcg={laterVersion:"v6",earlierVersion:"v5",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.257-4-ge56e5d2",[J.TYPESCRIPT_EXPRESS]:"0.0.264",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.35-1-g071a04a",[J.PYTHON_PYDANTIC]:"0.0.35-1-g071a04a",[J.OPENAPI]:"0.0.16-1-ga2c0ada",[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,defaultEnvironment:e.environments?.defaultEnvironment,environments:e.environments!=null?he.V6.environment.Environments._visit(e.environments.environments,{singleBaseUrl:i=>i.environments,multipleBaseUrls:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying multiple URLs for a single environment. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a multiple URls for a single environment."),_unknown:()=>{throw new Error("Unknown Environments: "+e.environments?.environments.type)}}):[]})};var Lcg={laterVersion:"v7",earlierVersion:"v6",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.268",[J.TYPESCRIPT_EXPRESS]:"0.0.268",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.OPENAPI_PYTHON_CLIENT]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:e.services.map(t=>{let r=t.name.fernFilepath[t.name.fernFilepath.length-1],i=r!=null?`${r.pascalCase.safeName}Service`:"Service",n=r!=null?`${r.camelCase.unsafeName}Service`:"Service",a=r!=null?`${r.snakeCase.unsafeName}_service`:"service",u=a.toUpperCase(),l=G3(n);return{...t,name:{name:{originalName:i,camelCase:{safeName:n,unsafeName:n},snakeCase:{safeName:a,unsafeName:a},screamingSnakeCase:{safeName:u,unsafeName:u},pascalCase:{safeName:l,unsafeName:l}},fernFilepath:t.name.fernFilepath}}})})};var Wcg={laterVersion:"v8",earlierVersion:"v7",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.0.273-5-g1b00245b",[J.TYPESCRIPT_EXPRESS]:"0.0.273-5-g1b00245b",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.45-1-g8bb600f",[J.PYTHON_PYDANTIC]:"0.0.45-1-g8bb600f",[J.OPENAPI_PYTHON_CLIENT]:"0.0.0",[J.OPENAPI]:"0.0.20-1-gbbeb9bd",[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,auth:QqB(e.auth),headers:e.headers.map(t=>bVo(t)),types:e.types.map(t=>JqB(t)),errors:e.errors.map(t=>tTB(t)),services:e.services.map(t=>rTB(t))})};function Izc(e){return e.allParts}function QqB(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V7.auth.AuthScheme.header(bVo(t)))}}function bVo(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:jQ(e.valueType)}}function jQ(e){return he.V8.types.TypeReference._visit(e,{container:t=>he.V7.types.TypeReference.container(Hcg(t)),named:t=>he.V7.types.TypeReference.named(GLt(t)),primitive:he.V7.types.TypeReference.primitive,unknown:he.V7.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function Hcg(e){return he.V8.types.ContainerType._visit(e,{list:t=>he.V7.types.ContainerType.list(jQ(t)),optional:t=>he.V7.types.ContainerType.optional(jQ(t)),set:t=>he.V7.types.ContainerType.set(jQ(t)),map:({keyType:t,valueType:r})=>he.V7.types.ContainerType.map({keyType:jQ(t),valueType:jQ(r)}),literal:he.V7.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function GLt(e){return{name:e.name,fernFilepath:Izc(e.fernFilepath)}}function JqB(e){return{docs:e.docs,availability:e.availability,name:GLt(e.name),shape:KqB(e.shape),examples:e.examples.map(t=>kqB(t)),referencedTypes:e.referencedTypes.map(t=>GLt(t))}}function KqB(e){return he.V8.types.Type._visit(e,{alias:t=>he.V7.types.Type.alias({aliasOf:jQ(t.aliasOf),resolvedType:YqB(t.resolvedType)}),enum:he.V7.types.Type.enum,object:t=>he.V7.types.Type.object({extends:t.extends.map(r=>GLt(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:r.name,valueType:jQ(r.valueType)}))}),union:t=>he.V7.types.Type.union({discriminant:t.discriminant,types:t.types.map(r=>XqB(r))}),_unknown:()=>{throw new Error("Unknown Type shape: "+e._type)}})}function YqB(e){return he.V8.types.ResolvedTypeReference._visit(e,{container:t=>he.V7.types.ResolvedTypeReference.container(Hcg(t)),named:t=>he.V7.types.ResolvedTypeReference.named({name:GLt(t.name),shape:t.shape}),primitive:he.V7.types.ResolvedTypeReference.primitive,unknown:he.V7.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function XqB(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:ZqB(e.shape)}}function ZqB(e){return he.V8.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V7.types.SingleUnionTypeProperties.samePropertiesAsObject(GLt(t)),singleProperty:t=>he.V7.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:jQ(t.type)}),noProperties:he.V7.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function kqB(e){return{jsonExample:e.jsonExample,docs:e.docs,name:e.name,shape:zzc(e.shape)}}function zzc(e){return he.V8.types.ExampleTypeShape._visit(e,{alias:t=>he.V7.types.ExampleTypeShape.alias({value:Tae(t.value)}),enum:he.V7.types.ExampleTypeShape.enum,object:t=>he.V7.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:Tae(r.value),originalTypeDeclaration:GLt(r.originalTypeDeclaration)}))}),union:t=>he.V7.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:eTB(t.properties)}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Tae(e){return{jsonExample:e.jsonExample,shape:$cg(e.shape)}}function $cg(e){return he.V8.types.ExampleTypeReferenceShape._visit(e,{named:t=>he.V7.types.ExampleTypeReferenceShape.named({typeName:GLt(t.typeName),shape:zzc(t.shape)}),container:t=>he.V7.types.ExampleTypeReferenceShape.container(he.V8.types.ExampleContainer._visit(t,{list:r=>he.V7.types.ExampleContainer.list(r.map(i=>Tae(i))),set:r=>he.V7.types.ExampleContainer.set(r.map(i=>Tae(i))),optional:r=>he.V7.types.ExampleContainer.optional(r!=null?Tae(r):void 0),map:r=>he.V7.types.ExampleContainer.map(r.map(i=>({key:Tae(i.key),value:Tae(i.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+t.type)}})),primitive:he.V7.types.ExampleTypeReferenceShape.primitive,unknown:he.V7.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function eTB(e){return he.V8.types.ExampleSingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V7.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:GLt(t.typeName),shape:zzc(t.shape)}),singleProperty:t=>he.V7.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:t.jsonExample,shape:$cg(t.shape)}),noProperties:he.V7.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.type)}})}function tTB(e){return{docs:e.docs,name:Rzc(e.name),discriminantValue:e.discriminantValue,type:e.type!=null?jQ(e.type):void 0,statusCode:e.statusCode}}function Rzc(e){return{name:e.name,fernFilepath:Izc(e.fernFilepath)}}function rTB(e){return{docs:e.docs,availability:e.availability,name:{fernFilepath:Izc(e.name.fernFilepath)},displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>Gcg(t)),headers:e.headers.map(t=>bVo(t)),endpoints:e.endpoints.map(t=>iTB(t))}}function Gcg(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:jQ(e.valueType)}}function iTB(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors.map(t=>nTB(t)),auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>Gcg(t)),sdkRequest:e.sdkRequest!=null?oTB(e.sdkRequest):void 0,requestBody:e.requestBody!=null?sTB(e.requestBody):void 0,response:cTB(e.response),headers:e.headers.map(t=>bVo(t)),queryParameters:e.queryParameters.map(t=>aTB(t)),examples:e.examples.map(t=>lTB(t))}}function nTB(e){return{docs:e.docs,error:Rzc(e.error)}}function aTB(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:jQ(e.valueType),allowMultiple:e.allowMultiple}}function oTB(e){return{requestParameterName:e.requestParameterName,shape:uTB(e.shape)}}function uTB(e){return he.V8.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V7.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:jQ(t.requestBodyType)}),wrapper:he.V7.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function sTB(e){return he.V8.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V7.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends.map(r=>GLt(r)),properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:jQ(r.valueType)}))}),reference:t=>he.V7.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:jQ(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function cTB(e){return{docs:e.docs,type:e.type!=null?jQ(e.type):void 0}}function lTB(e){return{name:e.name,docs:e.docs,servicePathParameters:e.servicePathParameters.map(t=>Ucg(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Ucg(t)),queryParameters:e.queryParameters.map(t=>fTB(t)),serviceHeaders:e.serviceHeaders.map(t=>Vcg(t)),endpointHeaders:e.endpointHeaders.map(t=>Vcg(t)),request:e.request!=null?dTB(e.request):void 0,response:pTB(e.response)}}function Ucg(e){return{key:e.key,value:Tae(e.value)}}function fTB(e){return{wireKey:e.wireKey,value:Tae(e.value)}}function Vcg(e){return{wireKey:e.wireKey,value:Tae(e.value)}}function dTB(e){return he.V8.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V7.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>({wireKey:r.wireKey,value:Tae(r.value),originalTypeDeclaration:r.originalTypeDeclaration!=null?GLt(r.originalTypeDeclaration):void 0}))}),reference:t=>he.V7.http.ExampleRequestBody.reference(Tae(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function pTB(e){return he.V8.http.ExampleResponse._visit(e,{ok:t=>he.V7.http.ExampleResponse.ok({body:t.body!=null?Tae(t.body):void 0}),error:t=>he.V7.http.ExampleResponse.error({error:Rzc(t.error),body:t.body!=null?Tae(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var Qcg={laterVersion:"v9",earlierVersion:"v8",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.3.0-2-g85e8aa08",[J.TYPESCRIPT_EXPRESS]:"0.3.0-2-g85e8aa08",[J.JAVA]:We,[J.JAVA_MODEL]:"0.0.134-4-gef1ec4f",[J.JAVA_SDK]:"0.0.134-4-gef1ec4f",[J.JAVA_SPRING]:"0.0.134-4-gef1ec4f",[J.PYTHON_FASTAPI]:"0.0.51-1-g977dd1f",[J.PYTHON_PYDANTIC]:"0.0.51-1-g977dd1f",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:ri,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[i,n]of Object.entries(e.types))n.shape._type==="union"&&n.shape.baseProperties.length>0&&t.failWithoutThrowing(r!=null?`Type ${n.name.name.originalName} uses base-properties. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a union with base-properties.");return t.getResult()===wC.Failure&&t.failAndThrow(),{...e,types:Object.values(e.types),errors:Object.values(e.errors),services:Object.values(e.services)}}};var Jcg={laterVersion:"v10",earlierVersion:"v9",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.STOPLIGHT]:ri,[J.OPENAPI]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=rd(e.services,r=>({docs:void 0,...r}));for(let r of Object.values(e.subpackages))if(r.docs!=null&&r.service!=null){let i=t[r.service];if(i==null)throw new Error("Service does not exist: "+r.service);i.docs=r.docs}return{...e,services:t}}};var Kcg={laterVersion:"v11",earlierVersion:"v10",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.0-rc0-1-g83a12940",[J.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-1-g83a12940",[J.JAVA]:We,[J.JAVA_MODEL]:"0.0.134-15-ge1ac358",[J.JAVA_SDK]:"0.0.134-15-ge1ac358",[J.JAVA_SPRING]:"0.0.134-15-ge1ac358",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.STOPLIGHT]:ri,[J.OPENAPI]:We,[J.POSTMAN]:"0.0.40-1-g9aa2117",[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,auth:_TB(e.auth,t)})};function _TB(e,t){return{...e,schemes:e.schemes.map(r=>hTB(r,t))}}function hTB(e,{taskContext:t,targetGenerator:r}){return he.V11.auth.AuthScheme._visit(e,{bearer:he.V10.auth.AuthScheme.bearer,basic:he.V10.auth.AuthScheme.basic,header:i=>i.prefix!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying an auth header prefix. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains an auth header prefix."):he.V10.auth.AuthScheme.header({docs:i.docs,availability:{status:he.V10.commons.AvailabilityStatus.GeneralAvailability,message:void 0},name:{name:i.name,wireValue:i.header},valueType:i.valueType}),_unknown:()=>{throw new Error("Unknown auth scheme: "+e._type)}})}var Xcg={laterVersion:"v12",earlierVersion:"v11",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.0-rc0-6-g80f89f98",[J.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-6-g80f89f98",[J.JAVA]:We,[J.JAVA_MODEL]:"0.1.0-1-gdb5c636",[J.JAVA_SDK]:"0.1.0-1-gdb5c636",[J.JAVA_SPRING]:"0.1.0-1-gdb5c636",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.STOPLIGHT]:"0.0.23-8-g479c860",[J.OPENAPI]:"0.0.22-1-g1c86b58",[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{let i=rd(e.types,n=>({...n,shape:he.V12.types.Type._visit(n.shape,{union:he.V11.types.Type.union,enum:he.V11.types.Type.enum,object:he.V11.types.Type.object,alias:a=>he.V11.types.Type.alias({aliasOf:a.aliasOf,resolvedType:he.V12.types.ResolvedTypeReference._visit(a.resolvedType,{container:he.V11.types.ResolvedTypeReference.container,primitive:he.V11.types.ResolvedTypeReference.primitive,named:u=>u.shape==="UNDISCRIMINATED_UNION"?t.failAndThrow(Ycg({taskContext:t,targetGenerator:r})):he.V11.types.ResolvedTypeReference.named({shape:u.shape,name:u.name}),unknown:he.V11.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Encountered unknown alias")}})}),undiscriminatedUnion:()=>t.failAndThrow(Ycg({taskContext:t,targetGenerator:r})),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,types:i,services:rd(e.services,n=>yTB(n,{taskContext:t,targetGenerator:r}))}}};function Ycg(e){return e.targetGenerator!=null?`Generator ${e.targetGenerator.name}@${e.targetGenerator.version} does not support undiscriminated unions If you'd like to use this feature, please upgrade ${e.targetGenerator.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains an undiscriminated union."}function yTB(e,t){return{...e,endpoints:e.endpoints.map(r=>vTB(r,t))}}function vTB(e,{taskContext:t,targetGenerator:r}){return e.streamingResponse!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support streaming responses. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a streaming response."):{...e,requestBody:e.requestBody!=null?he.V12.http.HttpRequestBody._visit(e.requestBody,{inlinedRequestBody:he.V11.http.HttpRequestBody.inlinedRequestBody,reference:he.V11.http.HttpRequestBody.reference,fileUpload:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support file upload requests. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a file upload request."),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.requestBody?.type)}}):void 0,response:e.response!=null?{docs:e.response.docs,type:e.response.responseBodyType}:{docs:void 0,type:void 0}}}var Zcg={laterVersion:"v13",earlierVersion:"v12",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,types:rd(e.types,t=>t.shape._type!=="undiscriminatedUnion"?{...t,shape:t.shape}:{...t,shape:he.V12.types.Type.undiscriminatedUnion({docs:void 0,members:t.shape.members})}),auth:{...e.auth,schemes:e.auth.schemes.map(t=>t._type!=="header"?t:{...t,name:t.name.name,header:t.name.wireValue})}})};var kcg={laterVersion:"v14",earlierVersion:"v13",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:ri,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V14.types.Type._visit(r.shape,{union:i=>he.V13.types.Type.union({discriminant:i.discriminant,baseProperties:i.baseProperties.map(n=>({...n,valueType:HF(n.valueType)})),types:i.types.map(n=>OTB(n))}),enum:he.V13.types.Type.enum,object:i=>he.V13.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:HF(n.valueType)}))}),alias:i=>he.V13.types.Type.alias({aliasOf:HF(i.aliasOf),resolvedType:PTB(i.resolvedType)}),undiscriminatedUnion:i=>he.V13.types.Type.undiscriminatedUnion(jTB(i)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:bTB(e.auth),headers:e.headers.map(r=>Lzc(r)),types:t,services:rd(e.services,r=>wTB(r)),errors:rd(e.errors,r=>TTB(r))}}};function bTB(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V13.auth.AuthScheme.header(gTB(t)))}}function gTB(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:HF(e.valueType)}}function Lzc(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:HF(e.valueType)}}function HF(e){return he.V14.types.TypeReference._visit(e,{container:t=>he.V13.types.TypeReference.container(elg(t)),primitive:t=>t==="DATE"?he.V13.types.TypeReference.primitive(he.V13.types.PrimitiveType.String):he.V13.types.TypeReference.primitive(t),named:he.V13.types.TypeReference.named,unknown:he.V13.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function elg(e){return he.V14.types.ContainerType._visit(e,{list:t=>he.V13.types.ContainerType.list(HF(t)),optional:t=>he.V13.types.ContainerType.optional(HF(t)),set:t=>he.V13.types.ContainerType.set(HF(t)),map:({keyType:t,valueType:r})=>he.V13.types.ContainerType.map({keyType:HF(t),valueType:HF(r)}),literal:he.V13.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function OTB(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:mTB(e.shape)}}function mTB(e){return he.V14.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V13.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V13.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:HF(t.type)}),noProperties:he.V13.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function PTB(e){return he.V14.types.ResolvedTypeReference._visit(e,{container:t=>he.V13.types.ResolvedTypeReference.container(elg(t)),named:he.V13.types.ResolvedTypeReference.named,primitive:t=>t==="DATE"?he.V13.types.ResolvedTypeReference.primitive(he.V13.types.PrimitiveType.String):he.V13.types.ResolvedTypeReference.primitive(t),unknown:he.V13.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function jTB(e){return{members:e.members.map(t=>({...t,type:HF(t.type)}))}}function wTB(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>tlg(t)),headers:e.headers.map(t=>Lzc(t)),endpoints:e.endpoints.map(t=>STB(t))}}function tlg(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:HF(e.valueType)}}function STB(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors,auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>tlg(t)),sdkRequest:e.sdkRequest!=null?ETB(e.sdkRequest):void 0,requestBody:e.requestBody!=null?ATB(e.requestBody):void 0,response:e.response!=null?Nzc(e.response):void 0,headers:e.headers.map(t=>Lzc(t)),queryParameters:e.queryParameters.map(t=>DTB(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?Fzc(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?qTB(e.sdkResponse):void 0}}function DTB(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:HF(e.valueType),allowMultiple:e.allowMultiple}}function ETB(e){return{requestParameterName:e.requestParameterName,shape:MTB(e.shape)}}function MTB(e){return he.V14.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V13.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:HF(t.requestBodyType)}),wrapper:he.V13.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function ATB(e){return he.V14.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V13.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:HF(r.valueType)}))}),reference:t=>he.V13.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:HF(t.requestBodyType)}),fileUpload:t=>he.V13.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:HF(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Nzc(e){return{docs:e.docs,responseBodyType:HF(e.responseBodyType)}}function Fzc(e){return{dataEventType:HF(e.dataEventType),terminator:e.terminator}}function qTB(e){return he.V14.http.SdkResponse._visit(e,{streaming:t=>he.V13.http.SdkResponse.streaming(Fzc(t)),nonStreaming:t=>he.V13.http.SdkResponse.nonStreaming(Nzc(t)),maybeStreaming:t=>he.V13.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Nzc(t.nonStreaming),streaming:Fzc(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function TTB(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?HF(e.type):void 0,statusCode:e.statusCode}}var rlg={laterVersion:"v15",earlierVersion:"v14",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.0.52-3-gd9df38df",[J.PYTHON_PYDANTIC]:"0.0.52-3-gd9df38df",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.0.52-3-gd9df38df",[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V15.types.Type._visit(r.shape,{union:i=>he.V14.types.Type.union({discriminant:i.discriminant,baseProperties:i.baseProperties.map(n=>({...n,valueType:$F(n.valueType)})),types:i.types.map(n=>xTB(n))}),enum:he.V14.types.Type.enum,object:i=>he.V14.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:$F(n.valueType)}))}),alias:i=>he.V14.types.Type.alias({aliasOf:$F(i.aliasOf),resolvedType:zTB(i.resolvedType)}),undiscriminatedUnion:i=>he.V14.types.Type.undiscriminatedUnion(RTB(i)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:CTB(e.auth),headers:e.headers.map(r=>Wzc(r)),types:t,services:rd(e.services,r=>NTB(r)),errors:rd(e.errors,r=>$TB(r))}}};function CTB(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V14.auth.AuthScheme.header(BTB(t)))}}function BTB(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:$F(e.valueType)}}function Wzc(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:$F(e.valueType)}}function $F(e){return he.V15.types.TypeReference._visit(e,{container:t=>he.V14.types.TypeReference.container(ilg(t)),primitive:t=>t==="BASE_64"?he.V14.types.TypeReference.primitive(he.V14.types.PrimitiveType.String):he.V14.types.TypeReference.primitive(t),named:he.V14.types.TypeReference.named,unknown:he.V14.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function ilg(e){return he.V15.types.ContainerType._visit(e,{list:t=>he.V14.types.ContainerType.list($F(t)),optional:t=>he.V14.types.ContainerType.optional($F(t)),set:t=>he.V14.types.ContainerType.set($F(t)),map:({keyType:t,valueType:r})=>he.V14.types.ContainerType.map({keyType:$F(t),valueType:$F(r)}),literal:he.V14.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function xTB(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:ITB(e.shape)}}function ITB(e){return he.V15.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V14.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V14.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:$F(t.type)}),noProperties:he.V14.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function zTB(e){return he.V15.types.ResolvedTypeReference._visit(e,{container:t=>he.V14.types.ResolvedTypeReference.container(ilg(t)),named:he.V14.types.ResolvedTypeReference.named,primitive:t=>t==="BASE_64"?he.V14.types.ResolvedTypeReference.primitive(he.V14.types.PrimitiveType.String):he.V14.types.ResolvedTypeReference.primitive(t),unknown:he.V14.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function RTB(e){return{members:e.members.map(t=>({...t,type:$F(t.type)}))}}function NTB(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>nlg(t)),headers:e.headers.map(t=>Wzc(t)),endpoints:e.endpoints.map(t=>FTB(t))}}function nlg(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:$F(e.valueType)}}function FTB(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors,auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>nlg(t)),sdkRequest:e.sdkRequest!=null?UTB(e.sdkRequest):void 0,requestBody:e.requestBody!=null?WTB(e.requestBody):void 0,response:e.response!=null?Uzc(e.response):void 0,headers:e.headers.map(t=>Wzc(t)),queryParameters:e.queryParameters.map(t=>LTB(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?Vzc(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?HTB(e.sdkResponse):void 0}}function LTB(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:$F(e.valueType),allowMultiple:e.allowMultiple}}function UTB(e){return{requestParameterName:e.requestParameterName,shape:VTB(e.shape)}}function VTB(e){return he.V15.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V14.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:$F(t.requestBodyType)}),wrapper:he.V14.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function WTB(e){return he.V15.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V14.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:$F(r.valueType)}))}),reference:t=>he.V14.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:$F(t.requestBodyType)}),fileUpload:t=>he.V14.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:$F(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Uzc(e){return{docs:e.docs,responseBodyType:$F(e.responseBodyType)}}function Vzc(e){return{dataEventType:$F(e.dataEventType),terminator:e.terminator}}function HTB(e){return he.V15.http.SdkResponse._visit(e,{streaming:t=>he.V14.http.SdkResponse.streaming(Vzc(t)),nonStreaming:t=>he.V14.http.SdkResponse.nonStreaming(Uzc(t)),maybeStreaming:t=>he.V14.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Uzc(t.nonStreaming),streaming:Vzc(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function $TB(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?$F(e.type):void 0,statusCode:e.statusCode}}var alg={laterVersion:"v16",earlierVersion:"v15",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.4-1-g4e69d312",[J.TYPESCRIPT_EXPRESS]:"0.5.4-1-g4e69d312",[J.JAVA]:We,[J.JAVA_MODEL]:"0.3.8-rc6-1-gcf4b372",[J.JAVA_SDK]:"0.3.8-rc6-1-gcf4b372",[J.JAVA_SPRING]:"0.3.8-rc6-1-gcf4b372",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>e.basePath!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying a base-path in api.yml. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a root base-path."):{...e,services:rd(e.services,i=>({...i,pathParameters:Hzc(i.pathParameters),endpoints:i.endpoints.map(n=>({...n,allPathParameters:Hzc(n.allPathParameters),pathParameters:Hzc(n.pathParameters)}))}))}};function Hzc(e){return e.map(t=>GTB(t))}function GTB(e){return{...e,availability:{status:he.V15.commons.AvailabilityStatus.GeneralAvailability,message:void 0}}}var olg={laterVersion:"v17",earlierVersion:"v16",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[i,n]of Object.entries(e.types))if(n.shape._type==="union"&&n.shape.extends.length>0)return t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support union types with extensions. See ${i} in file ${n.name.fernFilepath.allParts.join("/")}. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains union types with extensions.");return{...e}}};var ulg={laterVersion:"v18",earlierVersion:"v17",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.14-1-ga6817141",[J.TYPESCRIPT_EXPRESS]:"0.5.14-1-ga6817141",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.3.0-3-ge125e311",[J.PYTHON_PYDANTIC]:"0.3.0-3-ge125e311",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.3.0-3-ge125e311",[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,services:rd(e.services,i=>{let n=i.endpoints[0]?.baseUrl;return i.endpoints.some(a=>a.baseUrl!==n)?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support endpoint-level server URLs. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains endpoint-level server URLs."):{...i,baseUrl:n}})})};var clg={laterVersion:"v19",earlierVersion:"v18",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:ri,[J.TYPESCRIPT_BROWSER_SDK]:ri,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.19-1-gef223230",[J.TYPESCRIPT_EXPRESS]:"0.5.19-1-gef223230",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.3.4-rc0-9-ge815162f",[J.PYTHON_PYDANTIC]:"0.3.4-rc0-9-ge815162f",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:"0.0.44-1-gbf4b0f3",[J.PYTHON_SDK]:"0.3.4-rc0-9-ge815162f",[J.GO_FIBER]:ri,[J.GO_MODEL]:ri,[J.GO_SDK]:ri,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:rd(e.services,r=>QTB(r,t)),types:rd(e.types,r=>kTB(r,t))})};function QTB(e,t){return{...e,endpoints:e.endpoints.map(r=>JTB(r,t))}}function JTB(e,t){return{...e,examples:e.examples.map(r=>KTB(r,t))}}function KTB(e,t){return{docs:e.docs,name:e.name,url:e.url,rootPathParameters:e.rootPathParameters.map(r=>$zc(r,t)),servicePathParameters:e.servicePathParameters.map(r=>$zc(r,t)),endpointPathParameters:e.endpointPathParameters.map(r=>$zc(r,t)),serviceHeaders:e.serviceHeaders.map(r=>slg(r,t)),endpointHeaders:e.endpointHeaders.map(r=>slg(r,t)),queryParameters:e.queryParameters.map(r=>YTB(r,t)),request:e.request!=null?XTB(e.request,t):void 0,response:ZTB(e.response,t)}}function $zc(e,t){return{key:e.key,value:Cae(e.value,t)}}function slg(e,t){return{wireKey:e.wireKey,value:Cae(e.value,t)}}function YTB(e,t){return{wireKey:e.wireKey,value:Cae(e.value,t)}}function XTB(e,t){return he.V19.http.ExampleRequestBody._visit(e,{inlinedRequestBody:r=>he.V18.http.ExampleRequestBody.inlinedRequestBody({jsonExample:r.jsonExample,properties:r.properties.map(i=>({wireKey:i.wireKey,value:Cae(i.value,t),originalTypeDeclaration:i.originalTypeDeclaration}))}),reference:r=>he.V18.http.ExampleRequestBody.reference(Cae(r,t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function ZTB(e,t){return he.V19.http.ExampleResponse._visit(e,{ok:r=>he.V18.http.ExampleResponse.ok({body:r.body!=null?Cae(r.body,t):void 0}),error:r=>he.V18.http.ExampleResponse.error({error:r.error,body:r.body!=null?Cae(r.body,t):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function kTB(e,t){return{...e,examples:e.examples.map(r=>eCB(r,t))}}function eCB(e,t){return{...e,shape:Gzc(e.shape,t)}}function Gzc(e,t){return he.V19.types.ExampleTypeShape._visit(e,{alias:r=>he.V18.types.ExampleTypeShape.alias({value:Cae(r.value,t)}),object:r=>he.V18.types.ExampleTypeShape.object({properties:r.properties.map(i=>({wireKey:i.wireKey,value:Cae(i.value,t),originalTypeDeclaration:i.originalTypeDeclaration}))}),union:r=>he.V18.types.ExampleTypeShape.union({wireDiscriminantValue:r.wireDiscriminantValue,properties:he.V19.types.ExampleSingleUnionTypeProperties._visit(r.properties,{singleProperty:i=>he.V18.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:i.jsonExample,shape:llg(i.shape,t)}),samePropertiesAsObject:i=>he.V18.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:i.typeName,shape:Gzc(i.shape,t)}),noProperties:he.V18.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+r.properties.type)}})}),enum:he.V18.types.ExampleTypeShape.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Cae(e,t){return{jsonExample:e.jsonExample,shape:llg(e.shape,t)}}function llg(e,t){return he.V19.types.ExampleTypeReferenceShape._visit(e,{primitive:r=>he.V18.types.ExampleTypeReferenceShape.primitive(tCB(r,t)),named:r=>he.V18.types.ExampleTypeReferenceShape.named({typeName:r.typeName,shape:Gzc(r.shape,t)}),container:r=>he.V18.types.ExampleTypeReferenceShape.container(he.V19.types.ExampleContainer._visit(r,{list:i=>he.V18.types.ExampleContainer.list(i.map(n=>Cae(n,t))),set:i=>he.V18.types.ExampleContainer.set(i.map(n=>Cae(n,t))),optional:i=>he.V18.types.ExampleContainer.optional(i!=null?Cae(i,t):void 0),map:i=>he.V18.types.ExampleContainer.map(i.map(n=>({key:Cae(n.key,t),value:Cae(n.value,t)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+r.type)}})),unknown:he.V18.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function tCB(e,{taskContext:t,targetGenerator:r}){return e.type==="date"?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support examples for dates. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains date examples."):e}var flg={laterVersion:"v20",earlierVersion:"v19",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.5.26-rc0-3-gdfabd674",[J.TYPESCRIPT_BROWSER_SDK]:"0.5.26-rc0-3-gdfabd674",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.5.20-3-g2505487f",[J.TYPESCRIPT_EXPRESS]:"0.5.20-3-g2505487f",[J.JAVA]:We,[J.JAVA_MODEL]:"0.3.10-rc2-1-g1c0d853",[J.JAVA_SDK]:"0.3.10-rc2-1-g1c0d853",[J.JAVA_SPRING]:"0.3.10-rc2-1-g1c0d853",[J.PYTHON_FASTAPI]:"0.3.6-rc1-2-g6050f7f8",[J.PYTHON_PYDANTIC]:"0.3.6-rc1-2-g6050f7f8",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.3.6-rc1-2-g6050f7f8",[J.GO_FIBER]:ri,[J.GO_MODEL]:"0.0.0",[J.GO_SDK]:"0.0.0",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:rd(e.services,r=>rCB(r,t))})};function rCB(e,t){return{...e,endpoints:e.endpoints.map(r=>iCB(r,t))}}function iCB(e,t){return{...e,response:e.response!=null?dlg(e.response,t):void 0,sdkResponse:e.sdkResponse!=null?nCB(e.sdkResponse,t):void 0}}function dlg(e,t){return he.V20.http.HttpResponse._visit(e,{fileDownload:()=>plg(t),json:r=>r,_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.type)}})}function nCB(e,t){return he.V20.http.SdkResponse._visit(e,{fileDownload:()=>plg(t),streaming:he.V19.http.SdkResponse.streaming,maybeStreaming:r=>he.V19.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:r.streaming,nonStreaming:dlg(r.nonStreaming,t)}),json:he.V19.http.SdkResponse.nonStreaming,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}function plg({targetGenerator:e,taskContext:t}){return t.failAndThrow(e!=null?`Generator ${e.name}@${e.version} does not support file download. If you'd like to use this feature, please upgrade ${e.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains file download.")}var _lg={laterVersion:"v21",earlierVersion:"v20",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:ri,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:rd(e.services,r=>aCB(r,t))})};function aCB(e,t){return{...e,endpoints:e.endpoints.map(r=>oCB(r,t))}}function oCB(e,t){return{...e,streamingResponse:e.streamingResponse!=null?Qzc(e.streamingResponse,t):void 0,sdkResponse:e.sdkResponse!=null?uCB(e.sdkResponse,t):void 0}}function Qzc(e,{taskContext:t,targetGenerator:r}){return{dataEventType:he.V21.http.StreamingResponseChunkType._visit(e.dataEventType,{json:i=>i,text:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support streaming text responses. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains streaming text responses."),_unknown:()=>{throw new Error("Unknown StreamingResponseChunkType: "+e.dataEventType.type)}}),terminator:e.terminator}}function uCB(e,t){return he.V21.http.SdkResponse._visit(e,{fileDownload:he.V20.http.SdkResponse.fileDownload,streaming:r=>he.V20.http.SdkResponse.streaming(Qzc(r,t)),maybeStreaming:r=>he.V20.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:Qzc(r.streaming,t),nonStreaming:r.nonStreaming}),json:he.V20.http.SdkResponse.json,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}var hlg={laterVersion:"v22",earlierVersion:"v21",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.5.0-3-gac7ce7c",[J.GO_MODEL]:"0.0.14-8-g2fa39f7",[J.GO_SDK]:"0.0.14-8-g2fa39f7",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:rd(e.services,t=>sCB(t))})};function sCB(e){return{...e,endpoints:e.endpoints.map(t=>cCB(t))}}function cCB(e){return{...e,...e.response!=null?he.V22.http.HttpResponse._visit(e.response,{json:t=>({response:he.V21.http.HttpResponse.json(t),streamingResponse:void 0,sdkResponse:he.V21.http.SdkResponse.json(t)}),fileDownload:t=>({response:he.V21.http.HttpResponse.fileDownload(t),streamingResponse:void 0,sdkResponse:he.V21.http.SdkResponse.fileDownload(t)}),streaming:t=>({response:void 0,streamingResponse:t,sdkResponse:he.V21.http.SdkResponse.streaming(t)}),_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.response?.type)}}):{response:void 0,streamingResponse:void 0,sdkResponse:void 0}}}var blg={laterVersion:"v23",earlierVersion:"v22",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.7.4-rc3-4-g6cf92f81",[J.TYPESCRIPT_BROWSER_SDK]:"0.7.4-rc3-4-g6cf92f81",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.7.4-rc3-4-g6cf92f81",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:"0.0.28-3-g112d3dd",[J.STOPLIGHT]:"0.0.28-3-g112d3dd",[J.POSTMAN]:"0.0.44-4-gddab2ae",[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>{let r=[],i={};for(let[n,a]of Object.entries(e.services)){let u=[];for(let l of a.endpoints){let d=lCB(l);d==null?r.push(l):u.push(d)}i[n]={...a,endpoints:u,headers:a.headers.map(l=>Kzc(l)),pathParameters:a.pathParameters.map(l=>gVo(l))}}return r.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support bytes requests. `),r.length===1&&r[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${r[0].name.originalName} will be skipped.`):t.taskContext.logger.warn(`Therefore, endpoints ${r.map(n=>n.name.originalName).join(", ")} will be skipped.`)),{...e,auth:{...e.auth,schemes:e.auth.schemes.map(n=>dCB(n))},headers:e.headers.map(n=>Kzc(n)),types:rd(e.types,n=>pCB(n)),services:i,errors:rd(e.errors,n=>gCB(n)),subpackages:e.subpackages,pathParameters:e.pathParameters.map(n=>gVo(n)),variables:e.variables.map(n=>OCB(n))}}};function lCB(e){let t;if(!(e.requestBody!=null&&(t=fCB(e.requestBody),t==null)))return{...e,headers:e.headers.map(r=>Kzc(r)),pathParameters:e.pathParameters.map(r=>gVo(r)),allPathParameters:e.allPathParameters.map(r=>gVo(r)),queryParameters:e.queryParameters.map(r=>mCB(r)),requestBody:t,sdkRequest:e.sdkRequest!=null?{requestParameterName:e.sdkRequest.requestParameterName,shape:PCB(e.sdkRequest.shape)}:void 0,response:e.response!=null?jCB(e.response):void 0,examples:e.examples.map(r=>wCB(r))}}function fCB(e){switch(e.type){case"bytes":return;case"fileUpload":return he.V22.http.HttpRequestBody.fileUpload({...e,properties:e.properties.map(t=>DCB(t))});case"inlinedRequestBody":return he.V22.http.HttpRequestBody.inlinedRequestBody({...e,properties:e.properties.map(t=>ECB(t))});case"reference":return he.V22.http.HttpRequestBody.reference({...e,requestBodyType:GF(e.requestBodyType)});default:Fo(e)}}function Kzc(e){return{...e,valueType:GF(e.valueType)}}function dCB(e){return e._visit({bearer:he.V22.auth.AuthScheme.bearer,basic:he.V22.auth.AuthScheme.basic,header:t=>he.V22.auth.AuthScheme.header({...t,valueType:GF(t.valueType)}),_other:()=>{throw new Error("Unknown auth scheme: "+e.type)}})}function pCB(e){return{...e,shape:_CB(e.shape),examples:e.examples.map(t=>hCB(t))}}function _CB(e){return e._visit({alias:t=>he.V22.types.Type.alias({...t,aliasOf:GF(t.aliasOf),resolvedType:vCB(t.resolvedType)}),enum:he.V22.types.Type.enum,object:t=>he.V22.types.Type.object({...t,properties:t.properties.map(r=>ylg(r))}),union:t=>he.V22.types.Type.union({...t,baseProperties:t.baseProperties.map(r=>ylg(r)),types:t.types.map(r=>({...r,shape:bCB(r.shape)}))}),undiscriminatedUnion:t=>he.V22.types.Type.undiscriminatedUnion({...t,members:t.members.map(r=>({...r,type:GF(r.type)}))}),_other:()=>{throw new Error("Unknown type shape: "+e.type)}})}function hCB(e){return{...e,shape:Yzc(e.shape)}}function Yzc(e){return e._visit({alias:t=>he.V22.types.ExampleTypeShape.alias({...t,value:MEe(t.value)}),enum:he.V22.types.ExampleTypeShape.enum,object:t=>he.V22.types.ExampleTypeShape.object({...t,properties:t.properties.map(r=>({...r,value:MEe(r.value)}))}),union:t=>he.V22.types.ExampleTypeShape.union({...t,properties:yCB(t.properties)}),_other:()=>{throw new Error("Unknown example type shape: "+e.type)}})}function MEe(e){return{...e,shape:Xzc(e.shape)}}function Xzc(e){return e._visit({primitive:t=>he.V22.types.ExampleTypeReferenceShape.primitive(t._visit({integer:he.V22.types.ExamplePrimitive.integer,double:he.V22.types.ExamplePrimitive.double,string:he.V22.types.ExamplePrimitive.string,boolean:he.V22.types.ExamplePrimitive.boolean,long:he.V22.types.ExamplePrimitive.long,datetime:r=>he.V22.types.ExamplePrimitive.datetime(r.toISOString()),date:he.V22.types.ExamplePrimitive.date,uuid:he.V22.types.ExamplePrimitive.uuid,_other:()=>{throw new Error("Unknown example primitive: "+t.type)}})),named:t=>he.V22.types.ExampleTypeReferenceShape.named({...t,shape:Yzc(t.shape)}),container:t=>he.V22.types.ExampleTypeReferenceShape.container(t._visit({list:r=>he.V22.types.ExampleContainer.list(r.map(i=>MEe(i))),set:r=>he.V22.types.ExampleContainer.set(r.map(i=>MEe(i))),optional:r=>he.V22.types.ExampleContainer.optional(r!=null?MEe(r):void 0),map:r=>he.V22.types.ExampleContainer.map(r.map(i=>({key:MEe(i.key),value:MEe(i.value)}))),_other:()=>{throw new Error("Unknown example container: "+t.type)}})),unknown:he.V22.types.ExampleTypeReferenceShape.unknown,_other:()=>{throw new Error("Unknown example type reference shape: "+e.type)}})}function yCB(e){return e._visit({singleProperty:t=>he.V22.types.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:Xzc(t.shape)}),noProperties:he.V22.types.ExampleSingleUnionTypeProperties.noProperties,samePropertiesAsObject:t=>he.V22.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,shape:Yzc(t.shape)}),_other:()=>{throw new Error("Unknown example single union type properties: "+e.type)}})}function GF(e){return e._visit({container:t=>he.V22.types.TypeReference.container(glg(t)),primitive:he.V22.types.TypeReference.primitive,named:he.V22.types.TypeReference.named,unknown:he.V22.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function glg(e){return e._visit({list:t=>he.V22.types.ContainerType.list(GF(t)),set:t=>he.V22.types.ContainerType.set(GF(t)),optional:t=>he.V22.types.ContainerType.optional(GF(t)),map:t=>he.V22.types.ContainerType.map({keyType:GF(t.keyType),valueType:GF(t.valueType)}),literal:he.V22.types.ContainerType.literal,_other:()=>{throw new Error("Unknown container type: "+e.type)}})}function vCB(e){return e._visit({container:t=>he.V22.types.ResolvedTypeReference.container(glg(t)),primitive:he.V22.types.ResolvedTypeReference.primitive,named:he.V22.types.ResolvedTypeReference.named,unknown:he.V22.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown resolved type reference: "+e.type)}})}function ylg(e){return{...e,valueType:GF(e.valueType)}}function bCB(e){return e._visit({noProperties:he.V22.types.SingleUnionTypeProperties.noProperties,singleProperty:t=>he.V22.types.SingleUnionTypeProperties.singleProperty({...t,type:GF(t.type)}),samePropertiesAsObject:he.V22.types.SingleUnionTypeProperties.samePropertiesAsObject,_other:()=>{throw new Error("Unknown single union type properties: "+e.propertiesType)}})}function gCB(e){return{...e,type:e.type!=null?GF(e.type):void 0}}function OCB(e){return{...e,type:GF(e.type)}}function gVo(e){return{...e,valueType:GF(e.valueType)}}function mCB(e){return{...e,valueType:GF(e.valueType)}}function PCB(e){return e._visit({justRequestBody:t=>he.V22.http.SdkRequestShape.justRequestBody({...t,requestBodyType:GF(t.requestBodyType)}),wrapper:he.V22.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SDK request shape: "+e.type)}})}function jCB(e){return e._visit({json:t=>he.V22.http.HttpResponse.json({...t,responseBodyType:GF(t.responseBodyType)}),fileDownload:he.V22.http.HttpResponse.fileDownload,streaming:t=>he.V22.http.HttpResponse.streaming({...t,dataEventType:t.dataEventType._visit({json:r=>he.V22.http.StreamingResponseChunkType.json(GF(r)),text:he.V22.http.StreamingResponseChunkType.text,_other:()=>{throw new Error("Unknown streaming data event type: "+t.dataEventType.type)}})}),_other:()=>{throw new Error("Unknown response: "+e.type)}})}function wCB(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Jzc(t)),servicePathParameters:e.servicePathParameters.map(t=>Jzc(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Jzc(t)),serviceHeaders:e.serviceHeaders.map(t=>vlg(t)),endpointHeaders:e.endpointHeaders.map(t=>vlg(t)),queryParameters:e.queryParameters.map(t=>SCB(t)),request:e.request!=null?e.request._visit({inlinedRequestBody:t=>he.V22.http.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,value:MEe(r.value)}))}),reference:t=>he.V22.http.ExampleRequestBody.reference({...t,shape:Xzc(t.shape)}),_other:()=>{throw new Error("Unknown example request body: "+e.request?.type)}}):void 0,response:e.response._visit({ok:t=>he.V22.http.ExampleResponse.ok({...t,body:t.body!=null?MEe(t.body):void 0}),error:t=>he.V22.http.ExampleResponse.error({...t,body:t.body!=null?MEe(t.body):void 0}),_other:()=>{throw new Error("Unknown example response: "+e.response.type)}})}}function Jzc(e){return{...e,value:MEe(e.value)}}function SCB(e){return{...e,value:MEe(e.value)}}function vlg(e){return{...e,value:MEe(e.value)}}function DCB(e){return e._visit({file:he.V22.http.FileUploadRequestProperty.file,bodyProperty:t=>he.V22.http.FileUploadRequestProperty.bodyProperty({...t,valueType:GF(t.valueType)}),_other:()=>{throw new Error("Unknown file upload request body property: "+e.type)}})}function ECB(e){return{...e,valueType:GF(e.valueType)}}var m_={};Co(m_,{V23:()=>Eo3,V24:()=>Mo3,V25:()=>Ao3,V26:()=>qo3,V27:()=>To3,V28:()=>Co3,V29:()=>Bo3,V30:()=>xo3,V31:()=>Io3,V32:()=>zo3,V33:()=>Ro3,V34:()=>No3,V35:()=>Fo3,V36:()=>Lo3,V37:()=>Uo3,V38:()=>Vo3,V39:()=>Wo3,V40:()=>Ho3,V41:()=>$o3,V42:()=>Go3,V43:()=>Qo3,V44:()=>Jo3,V45:()=>Ko3,V46:()=>Yo3,V47:()=>Xo3,V48:()=>Zo3,V49:()=>ko3,V50:()=>eu3,V51:()=>tu3,V52:()=>ru3,V53:()=>iu3,V54:()=>nu3,V55:()=>au3,V56:()=>a_});var Eo3=yi(Eo(),1),Mo3=yi(so(),1),Ao3=yi(Za(),1),qo3=yi(Ja(),1),To3=yi(Ua(),1),Co3=yi(Va(),1),Bo3=yi(Wa(),1),xo3=yi(Ia(),1),Io3=yi(xa(),1),zo3=yi(ma(),1),Ro3=yi(Wn(),1),No3=yi(Vn(),1),Fo3=yi(Tn(),1),Lo3=yi(Cn(),1),Uo3=yi(qn(),1),Vo3=yi(Dn(),1),Wo3=yi(ln(),1),Ho3=yi(fn(),1),$o3=yi(sn(),1),Go3=yi(tn(),1),Qo3=yi(en(),1),Jo3=yi(Zi(),1),Ko3=yi($i(),1),Yo3=yi(Li(),1),Xo3=yi(Fi(),1),Zo3=yi(Ri(),1),ko3=yi(xi(),1),eu3=yi(Ai(),1),tu3=yi(Ei(),1),ru3=yi(gi(),1),iu3=yi(Gt(),1),nu3=yi(ay(),1),au3=yi(Uh(),1);var eAP={laterVersion:"v24",earlierVersion:"v23",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V23.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e})};var tAP={laterVersion:"v25",earlierVersion:"v24",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:"0.4.9-1-ge0997b3",[J.JAVA_SDK]:"0.4.9-1-ge0997b3",[J.JAVA_SPRING]:"0.4.9-1-ge0997b3",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V24.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:(e,t)=>{let r=[],i=[],n={};for(let[a,u]of Object.entries(e.services)){let l=[];for(let d of u.endpoints){let s;if(d.sdkRequest!=null&&(s=ou3(d.sdkRequest),s==null)){r.push(d);continue}if(d.response!=null){let o=d.response._visit({fileDownload:c=>he.V24.HttpResponse.fileDownload(c),json:c=>he.V24.HttpResponse.json(c),streaming:c=>he.V24.HttpResponse.streaming(c),text:()=>(i.push(d),he.V24.HttpResponse.json({docs:void 0,responseBodyType:he.V24.TypeReference.unknown()})),_other:()=>{throw new Error("Encountered unknown response type")}});l.push({...d,sdkRequest:s,response:o})}else l.push({...d,sdkRequest:s,response:void 0})}n[a]={...u,endpoints:l}}return i.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support text/plain responses. `),i.length===1&&i[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${i[0].name.originalName} response type will be casted to unknown.`):t.taskContext.logger.warn(`Therefore, endpoints ${i.map(a=>a.name.originalName).join(", ")} response types will be casted to unknown.`)),r.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support bytes requests. `),r.length===1&&r[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${r[0].name.originalName} will be skipped.`):t.taskContext.logger.warn(`Therefore, endpoints ${r.map(a=>a.name.originalName).join(", ")} will be skipped.`)),{...e,services:n}}};function ou3(e){let t=e.shape;if(t.type==="wrapper")return{shape:he.V24.SdkRequestShape.wrapper({...t}),requestParameterName:e.requestParameterName};if(t.value.type==="typeReference")return{shape:he.V24.SdkRequestShape.justRequestBody({...t.value}),requestParameterName:e.requestParameterName}}var iAP={laterVersion:"v26",earlierVersion:"v25",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.5.0-rc2-16-g4177fafd",[J.PYTHON_PYDANTIC]:"0.5.0-rc2-16-g4177fafd",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.5.0-rc2-16-g4177fafd",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V25.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,fu3(r)])),headers:e.headers.map(t=>jJu(t)),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,r.map(i=>uu3(i))])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,su3(r)]))})};function uu3(e){return{...e,headers:e.headers.map(t=>jJu(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function su3(e){return{...e,endpoints:e.endpoints.map(t=>cu3(t)),headers:e.headers.map(t=>jJu(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function cu3(e){return{...e,headers:e.headers.map(t=>jJu(t)),queryParameters:e.queryParameters.map(t=>lu3(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function jJu(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function lu3(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function fu3(e){return{...e,shape:e.shape._visit({union:t=>he.V25.Type.union({...t,baseProperties:t.baseProperties.map(r=>rAP(r))}),object:t=>he.V25.Type.object({...t,properties:t.properties.map(r=>rAP(r))}),enum:t=>he.V25.Type.enum({...t,values:t.values.map(r=>du3(r))}),alias:t=>he.V25.Type.alias(t),undiscriminatedUnion:t=>he.V25.Type.undiscriminatedUnion(t),_other:()=>{throw new Error("Encountered unknown shape")}}),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function rAP(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function du3(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}var nAP={laterVersion:"v27",earlierVersion:"v26",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.6.1-3-g94ee67a",[J.GO_MODEL]:"0.6.1-3-g94ee67a",[J.GO_SDK]:"0.6.1-3-g94ee67a",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V26.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,pu3(r)]))})};function pu3(e){return{...e,endpoints:e.endpoints.map(t=>_u3(t))}}function _u3(e){return{...e,response:e.response!=null?hu3(e.response):void 0}}function hu3(e){if(e.type!=="json")return e;let t=e.value;return t.type==="response"?he.V26.HttpResponse.json(t):he.V26.HttpResponse.json({docs:t.docs,responseBodyType:t.responseBodyType})}var aAP={laterVersion:"v28",earlierVersion:"v27",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.8.1-1-g0f40bf18",[J.TYPESCRIPT_BROWSER_SDK]:"0.8.1-1-g0f40bf18",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.8.1-1-g0f40bf18",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.9.0-2-g6b0be0e",[J.GO_MODEL]:"0.9.0-2-g6b0be0e",[J.GO_SDK]:"0.9.0-2-g6b0be0e",[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V27.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,auth:Hu3(e.auth),headers:SJu(e.headers),types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,Ku3(r)])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,Su3(r)])),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,gu3(r)])),errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,bu3(r)])),pathParameters:wJu(e.pathParameters),variables:yu3(e.variables)})};function yu3(e){return e.map(t=>vu3(t))}function vu3(e){return{...e,type:iN(e.type)}}function bu3(e){return{...e,type:e.type!=null?iN(e.type):void 0}}function gu3(e){return e.map(t=>Ou3(t))}function Ou3(e){return{...e,headers:SJu(e.headers),payload:mu3(e.payload)}}function mu3(e){switch(e.type){case"inlinedPayload":return he.V27.WebhookPayload.inlinedPayload(Pu3(e));case"reference":return he.V27.WebhookPayload.reference({...e,payloadType:iN(e.payloadType)})}}function Pu3(e){return{...e,properties:ju3(e.properties)}}function ju3(e){return e.map(t=>wu3(t))}function wu3(e){return{...e,valueType:iN(e.valueType)}}function Su3(e){return{...e,endpoints:Du3(e.endpoints),headers:SJu(e.headers),pathParameters:wJu(e.pathParameters)}}function Du3(e){return e.map(t=>Eu3(t))}function Eu3(e){return{...e,headers:SJu(e.headers),pathParameters:wJu(e.pathParameters),allPathParameters:wJu(e.allPathParameters),queryParameters:Vu3(e.queryParameters),requestBody:e.requestBody!=null?Iu3(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?Cu3(e.sdkRequest):void 0,response:e.response!=null?Mu3(e.response):void 0}}function Mu3(e){switch(e.type){case"json":return he.V27.HttpResponse.json(Tu3(e.value));case"fileDownload":return he.V27.HttpResponse.fileDownload(e);case"text":return he.V27.HttpResponse.text(e);case"streaming":return he.V27.HttpResponse.streaming(Au3(e));default:Fo(e)}}function Au3(e){return{...e,dataEventType:qu3(e.dataEventType)}}function qu3(e){switch(e.type){case"json":return he.V27.StreamingResponseChunkType.json(iN(e.json));case"text":return he.V27.StreamingResponseChunkType.text();default:Fo(e)}}function Tu3(e){switch(e.type){case"response":return he.V27.JsonResponse.response({...e,responseBodyType:iN(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V27.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:iN(e.responseBodyType),responseProperty:e.responseProperty!=null?cAP(e.responseProperty):void 0});default:Fo(e)}}function Cu3(e){return{...e,shape:Bu3(e.shape)}}function Bu3(e){switch(e.type){case"justRequestBody":return he.V27.SdkRequestShape.justRequestBody(xu3(e.value));case"wrapper":return he.V27.SdkRequestShape.wrapper(e);default:Fo(e)}}function xu3(e){switch(e.type){case"typeReference":return he.V27.SdkRequestBodyType.typeReference(oAP(e));case"bytes":return he.V27.SdkRequestBodyType.bytes(e);default:Fo(e)}}function Iu3(e){switch(e.type){case"inlinedRequestBody":return he.V27.HttpRequestBody.inlinedRequestBody(Fu3(e));case"reference":return he.V27.HttpRequestBody.reference(oAP(e));case"fileUpload":return he.V27.HttpRequestBody.fileUpload(zu3(e));case"bytes":return he.V27.HttpRequestBody.bytes(e);default:Fo(e)}}function zu3(e){return{...e,properties:Ru3(e.properties)}}function Ru3(e){return e.map(t=>Nu3(t))}function Nu3(e){switch(e.type){case"file":return he.V27.FileUploadRequestProperty.file(e);case"bodyProperty":return he.V27.FileUploadRequestProperty.bodyProperty(uAP(e));default:Fo(e)}}function oAP(e){return{...e,requestBodyType:iN(e.requestBodyType)}}function Fu3(e){return{...e,properties:Lu3(e.properties)}}function Lu3(e){return e.map(t=>uAP(t))}function uAP(e){return{...e,valueType:iN(e.valueType)}}function wJu(e){return e.map(t=>Uu3(t))}function Uu3(e){return{...e,valueType:iN(e.valueType)}}function Vu3(e){return e.map(t=>Wu3(t))}function Wu3(e){return{...e,valueType:iN(e.valueType)}}function Hu3(e){return{...e,schemes:$u3(e.schemes)}}function $u3(e){return e.map(t=>Gu3(t))}function Gu3(e){switch(e.type){case"basic":return he.V27.AuthScheme.basic(e);case"bearer":return he.V27.AuthScheme.bearer(e);case"header":return Qu3(e);default:Fo(e)}}function Qu3(e){return he.V27.AuthScheme.header({...e,valueType:iN(e.valueType)})}function SJu(e){return e.map(t=>Ju3(t))}function Ju3(e){return{...e,valueType:iN(e.valueType)}}function Ku3(e){return{...e,shape:Yu3(e.shape)}}function Yu3(e){switch(e.type){case"alias":return he.V27.Type.alias(Xu3(e));case"enum":return he.V27.Type.enum(e);case"object":return he.V27.Type.object(Zu3(e));case"union":return he.V27.Type.union(ku3(e));case"undiscriminatedUnion":return he.V27.Type.undiscriminatedUnion(es3(e));default:Fo(e)}}function Xu3(e){return{aliasOf:iN(e.aliasOf),resolvedType:ns3(e.resolvedType)}}function Zu3(e){return{...e,properties:sAP(e.properties)}}function ku3(e){return{...e,types:ts3(e.types),baseProperties:sAP(e.baseProperties)}}function es3(e){return{members:is3(e.members)}}function sAP(e){return e.map(t=>cAP(t))}function cAP(e){return{...e,valueType:iN(e.valueType)}}function ts3(e){return e.map(t=>({...t,shape:rs3(t.shape)}))}function rs3(e){switch(e.propertiesType){case"samePropertiesAsObject":return he.V27.SingleUnionTypeProperties.samePropertiesAsObject(e);case"singleProperty":return he.V27.SingleUnionTypeProperties.singleProperty({name:e.name,type:iN(e.type)});case"noProperties":return he.V27.SingleUnionTypeProperties.noProperties();default:Fo(e)}}function is3(e){return e.map(t=>({...t,type:iN(t.type)}))}function ns3(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?he.V27.ResolvedTypeReference.primitive(he.V27.PrimitiveType.Boolean):he.V27.ResolvedTypeReference.container(he.V27.ContainerType.literal(he.V27.Literal.string(e.container.literal.string))):he.V27.ResolvedTypeReference.container(lAP(e.container));case"named":return he.V27.ResolvedTypeReference.named(e);case"primitive":return he.V27.ResolvedTypeReference.primitive(e.primitive);case"unknown":return he.V27.ResolvedTypeReference.unknown();default:Fo(e)}}function iN(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?he.V27.TypeReference.primitive(he.V27.PrimitiveType.Boolean):he.V27.TypeReference.container(he.V27.ContainerType.literal(he.V27.Literal.string(e.container.literal.string))):he.V27.TypeReference.container(lAP(e.container));case"named":return he.V27.TypeReference.named(e);case"primitive":return he.V27.TypeReference.primitive(e.primitive);case"unknown":return he.V27.TypeReference.unknown();default:Fo(e)}}function lAP(e){switch(e.type){case"list":return he.V27.ContainerType.list(iN(e.list));case"map":return he.V27.ContainerType.map({keyType:iN(e.keyType),valueType:iN(e.valueType)});case"optional":return he.V27.ContainerType.optional(iN(e.optional));case"set":return he.V27.ContainerType.set(iN(e.set));case"literal":if(e.literal.type==="boolean")throw new Error("Internal error; failed to transform boolean literal between IR versions");return he.V27.ContainerType.literal(he.V27.Literal.string(e.literal.string));default:Fo(e)}}var dAP={laterVersion:"v29",earlierVersion:"v28",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.8.6-1-g3d8d8591",[J.TYPESCRIPT_BROWSER_SDK]:"0.8.6-1-g3d8d8591",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.8.6-1-g3d8d8591",[J.JAVA]:We,[J.JAVA_MODEL]:"0.5.14-1-ge4bcd98",[J.JAVA_SDK]:"0.5.14-1-ge4bcd98",[J.JAVA_SPRING]:"0.5.14-1-ge4bcd98",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V28.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.keys(e.types).map(t=>[t,as3({typeId:t,allTypes:e.types})]))})};function as3({typeId:e,allTypes:t}){let r=fAP({typeId:e,allTypes:t});return{availability:r.availability,docs:r.docs,name:r.name,shape:r.shape,examples:r.examples,referencedTypes:Array.from(r.referencedTypes).map(i=>{let n=fAP({typeId:i,allTypes:t});return{typeId:i,fernFilepath:n.name.fernFilepath,name:n.name.name}})}}function fAP({typeId:e,allTypes:t}){let r=t[e];if(r==null)throw new Error(`Type definition for type id ${e} is undefined`);return r}var pAP={laterVersion:"v30",earlierVersion:"v29",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.6.5-1-g0ef31b7a",[J.PYTHON_PYDANTIC]:"0.6.5-1-g0ef31b7a",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.6.5-1-g0ef31b7a",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V29.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new qhf(e);return{...e,types:t.convertTypes(e.types),services:t.convertServices(e.services)}}},qhf=class{ir;constructor(t){this.ir=t}convertTypes(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,this.convertType(i)]))}convertServices(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,this.convertService(i)]))}convertService(t){return{...t,endpoints:this.convertEndpoints(t.endpoints)}}convertEndpoints(t){return t.map(r=>({...r,examples:this.convertExampleEndpointCalls(r.examples)}))}convertExampleEndpointCalls(t){return t.map(r=>({...r,rootPathParameters:this.convertExamplePathParameters(r.rootPathParameters),servicePathParameters:this.convertExamplePathParameters(r.servicePathParameters),endpointPathParameters:this.convertExamplePathParameters(r.endpointPathParameters),serviceHeaders:this.convertExampleHeaders(r.serviceHeaders),endpointHeaders:this.convertExampleHeaders(r.endpointHeaders),queryParameters:this.convertExampleQueryParameters(r.queryParameters),request:r.request!=null?this.convertExampleRequestBody(r.request):void 0,response:this.convertExampleResponse(r.response)}))}convertExamplePathParameters(t){return t.map(r=>({key:r.name.originalName,value:this.convertExampleTypeReference(r.value)}))}convertExampleHeaders(t){return t.map(r=>({wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}convertExampleQueryParameters(t){return t.map(r=>({wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}convertExampleRequestBody(t){switch(t.type){case"inlinedRequestBody":return he.V29.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))});case"reference":return he.V29.ExampleRequestBody.reference(this.convertExampleTypeReference(t));default:Fo(t)}}convertExampleResponse(t){switch(t.type){case"ok":return he.V29.ExampleResponse.ok({body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});case"error":return he.V29.ExampleResponse.error({...t,body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});default:Fo(t)}}convertType(t){return{...t,examples:this.convertExampleTypes(t.examples)}}convertExampleTypes(t){return t.map(r=>this.convertExampleType(r))}convertExampleType(t){return{...t,shape:this.convertExampleTypeShape(t.shape)}}convertExampleTypeReferences(t){return t.map(r=>this.convertExampleTypeReference(r))}convertExampleTypeReference(t){return{...t,shape:this.convertExampleTypeReferenceShape(t.shape)}}convertExampleTypeReferenceShape(t){switch(t.type){case"primitive":return he.V29.ExampleTypeReferenceShape.primitive(this.convertExamplePrimitive(t.primitive));case"container":return he.V29.ExampleTypeReferenceShape.container(this.convertExampleContainer(t.container));case"named":return he.V29.ExampleTypeReferenceShape.named(this.convertExampleNamedType(t));case"unknown":return he.V29.ExampleTypeReferenceShape.unknown(t);default:Fo(t)}}convertExamplePrimitive(t){switch(t.type){case"integer":return he.V29.ExamplePrimitive.integer(t.integer);case"double":return he.V29.ExamplePrimitive.double(t.double);case"string":return he.V29.ExamplePrimitive.string(t.string.original);case"boolean":return he.V29.ExamplePrimitive.boolean(t.boolean);case"long":return he.V29.ExamplePrimitive.long(t.long);case"datetime":return he.V29.ExamplePrimitive.datetime(t.datetime);case"date":return he.V29.ExamplePrimitive.date(t.date);case"uuid":return he.V29.ExamplePrimitive.uuid(t.uuid);default:Fo(t)}}convertExampleContainer(t){switch(t.type){case"list":return he.V29.ExampleContainer.list(this.convertExampleTypeReferences(t.list));case"set":return he.V29.ExampleContainer.set(this.convertExampleTypeReferences(t.set));case"optional":return he.V29.ExampleContainer.optional(t.optional!=null?this.convertExampleTypeReference(t.optional):void 0);case"map":return he.V29.ExampleContainer.map(this.convertKeyValuePairs(t.map));default:Fo(t)}}convertKeyValuePairs(t){return t.map(r=>({key:this.convertExampleTypeReference(r.key),value:this.convertExampleTypeReference(r.value)}))}convertExampleNamedType(t){return{...t,shape:this.convertExampleTypeShape(t.shape)}}convertExampleTypeShape(t){switch(t.type){case"alias":return he.V29.ExampleTypeShape.alias({value:this.convertExampleTypeReference(t.value)});case"enum":return he.V29.ExampleTypeShape.enum({wireValue:t.value.wireValue});case"object":return he.V29.ExampleTypeShape.object(this.convertExampleObjectType(t));case"union":return he.V29.ExampleTypeShape.union(this.convertExampleUnionType(t));default:Fo(t)}}convertExampleObjectType(t){return{properties:t.properties.map(r=>({...r,wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}}convertExampleUnionType(t){return{wireDiscriminantValue:t.singleUnionType.wireDiscriminantValue.wireValue,properties:this.convertExampleSingleUnionTypeProperties(t.singleUnionType.shape)}}convertExampleSingleUnionTypeProperties(t){switch(t.type){case"samePropertiesAsObject":{let r=this.ir.types[t.typeId]?.name;if(r==null)throw new Error(`Internal error; type ID ${t.typeId} does not exist in the IR`);return he.V29.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:r,shape:this.convertExampleTypeShape(he.V30.ExampleTypeShape.object({properties:t.object.properties}))})}case"singleProperty":return he.V29.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:this.convertExampleTypeReferenceShape(t.shape)});case"noProperties":return he.V29.ExampleSingleUnionTypeProperties.noProperties();default:Fo(t)}}};var _AP={laterVersion:"v31",earlierVersion:"v30",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.8.8",[J.TYPESCRIPT_BROWSER_SDK]:"0.8.8",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.8.8",[J.JAVA]:We,[J.JAVA_MODEL]:"0.7.0-rc0",[J.JAVA_SDK]:"0.7.0-rc0",[J.JAVA_SPRING]:"0.7.0-rc0",[J.PYTHON_FASTAPI]:"0.7.5-1-gb54fb677",[J.PYTHON_PYDANTIC]:"0.7.5-1-gb54fb677",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.7.5-1-gb54fb677",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:ri,[J.RUBY_SDK]:ri,[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V30.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({apiName:e.apiName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:e.auth,headers:e.headers,types:e.types,webhookGroups:e.webhookGroups,errors:e.errors,subpackages:e.subpackages,rootPackage:e.rootPackage,constants:e.constants,environments:e.environments,basePath:e.basePath,pathParameters:e.pathParameters,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,variables:e.variables,serviceTypeReferenceInfo:e.serviceTypeReferenceInfo,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{availability:r.availability,name:r.name,displayName:r.displayName,basePath:r.basePath,endpoints:r.endpoints.map(i=>({id:i.id,docs:i.docs,availability:i.availability,name:i.name,displayName:i.displayName,method:i.method,headers:i.headers,baseUrl:i.baseUrl,path:i.path,fullPath:i.fullPath,pathParameters:i.pathParameters,allPathParameters:i.allPathParameters,queryParameters:i.queryParameters,requestBody:i.requestBody,sdkRequest:i.sdkRequest,response:i.response,errors:i.errors,auth:i.auth,examples:i.examples})),headers:r.headers,pathParameters:r.pathParameters}]))})};var yAP={laterVersion:"v32",earlierVersion:"v31",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.9.4-2-g139cf36",[J.GO_MODEL]:"0.9.4-2-g139cf36",[J.GO_SDK]:"0.9.4-2-g139cf36",[J.RUBY_MODEL]:"0.0.0",[J.RUBY_SDK]:"0.0.0",[J.CSHARP_MODEL]:ri,[J.CSHARP_SDK]:ri,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V31.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:fs3(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(os3)}]))})};function Uin({examples:e,convert:t}){let r=[];for(let i of e){let n=t(i);n!=null&&r.push(n)}return r}function os3(e){return{...e,examples:Uin({examples:e.examples,convert:us3})}}function us3(e){let t;if(e.request!=null&&(t=ss3(e.request),t==null))return;let r=cs3(e.response);if(r!=null)return{...e,rootPathParameters:Uin({examples:e.rootPathParameters,convert:Thf}),endpointPathParameters:Uin({examples:e.endpointPathParameters,convert:Thf}),servicePathParameters:Uin({examples:e.servicePathParameters,convert:Thf}),endpointHeaders:Uin({examples:e.endpointHeaders,convert:hAP}),serviceHeaders:Uin({examples:e.serviceHeaders,convert:hAP}),queryParameters:Uin({examples:e.queryParameters,convert:ls3}),request:t,response:r}}function ss3(e){switch(e.type){case"inlinedRequestBody":{let t=[];for(let r of e.properties){let i=gje(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleRequestBody.inlinedRequestBody({...e,properties:t})}case"reference":{let t=Chf(e.shape);return t==null?void 0:he.V31.ExampleRequestBody.reference({...e,shape:t})}default:Fo(e)}}function cs3(e){switch(e.type){case"ok":{if(e.body==null)return he.V31.ExampleResponse.ok({body:void 0});let t=gje(e.body);return t==null?void 0:he.V31.ExampleResponse.ok({body:t})}case"error":{if(e.body==null)return he.V31.ExampleResponse.error({...e,body:void 0});let t=gje(e.body);return t==null?void 0:he.V31.ExampleResponse.error({...e,body:t})}}}function Thf(e){let t=gje(e.value);if(t!=null)return{...e,value:t}}function hAP(e){let t=gje(e.value);if(t!=null)return{...e,value:t}}function ls3(e){let t=gje(e.value);if(t!=null)return{...e,value:t}}function fs3(e){let t=[];for(let r of e){let i=ds3(r);i!=null&&t.push(i)}return t}function ds3(e){let t=vAP(e.shape);if(t!=null)return{...e,shape:t}}function vAP(e){switch(e.type){case"enum":return he.V31.ExampleTypeShape.enum(e);case"alias":{let t=gje(e.value);return t==null?void 0:he.V31.ExampleTypeShape.alias({value:t})}case"object":{let t=[];for(let r of e.properties){let i=gje(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleTypeShape.object({properties:t})}case"union":{let t=ps3(e.singleUnionType);return t==null?void 0:he.V31.ExampleTypeShape.union({...e,singleUnionType:t})}case"undiscriminatedUnion":return;default:Fo(e)}}function gje(e){let t=Chf(e.shape);if(t!=null)return{shape:t,jsonExample:e.jsonExample}}function ps3(e){let t=_s3(e.shape);if(t!=null)return{...e,shape:t}}function _s3(e){switch(e.type){case"noProperties":return he.V31.ExampleSingleUnionTypeProperties.noProperties();case"singleProperty":{let t=Chf(e.shape);return t==null?void 0:he.V31.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:t})}case"samePropertiesAsObject":{let t=[];for(let r of e.object.properties){let i=gje(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:{properties:t}})}default:Fo(e)}}function Chf(e){switch(e.type){case"container":{let t=hs3(e.container);return t==null?void 0:he.V31.ExampleTypeReferenceShape.container(t)}case"named":{let t=vAP(e.shape);return t==null?void 0:he.V31.ExampleTypeReferenceShape.named({...e,shape:t})}case"primitive":return he.V31.ExampleTypeReferenceShape.primitive(e.primitive);case"unknown":return he.V31.ExampleTypeReferenceShape.unknown(e.unknown);default:Fo(e)}}function hs3(e){switch(e.type){case"list":{let t=[];for(let r of e.list){let i=gje(r);i!=null&&t.push(i)}return he.V31.ExampleContainer.list(t)}case"set":{let t=[];for(let r of e.set){let i=gje(r);i!=null&&t.push(i)}return he.V31.ExampleContainer.set(t)}case"map":{let t=[];for(let r of e.map){let i=gje(r.key),n=gje(r.value);i!=null&&n!=null&&t.push({key:i,value:n})}return he.V31.ExampleContainer.map(t)}case"optional":{if(e.optional==null)return he.V31.ExampleContainer.optional();let t=gje(e.optional);return t==null?he.V31.ExampleContainer.optional():he.V31.ExampleContainer.optional(t)}default:Fo(e)}}var bAP={laterVersion:"v33",earlierVersion:"v32",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.12.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.12.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.13.0-3-g8c56a41",[J.GO_MODEL]:"0.13.0-3-g8c56a41",[J.GO_SDK]:"0.13.0-3-g8c56a41",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:"0.0.0",[J.CSHARP_SDK]:"0.0.0",[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V32.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new Bhf(e);return{...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>t.convertEndpoint(n))}]))}}},Bhf=class{ir;constructor(t){this.ir=t}convertEndpoint(t){return{...t,queryParameters:t.queryParameters.map(r=>this.isTypeReferenceObject(r.valueType)?{...r,valueType:he.V33.TypeReference.container(he.V33.ContainerType.optional(he.V33.TypeReference.primitive("STRING")))}:r),examples:ys3({examples:t.examples,convert:vs3})}}isTypeReferenceObject(t){switch(t.type){case"container":return this.isContainerObject(t.container);case"named":return this.isNamedTypeObject(t);case"primitive":return!1;case"unknown":return!0;default:Fo(t)}}isContainerObject(t){switch(t.type){case"map":case"list":case"set":return!0;case"optional":return this.isTypeReferenceObject(t.optional);case"literal":return!1;default:Fo(t)}}isNamedTypeObject(t){let r=this.ir.types[t.typeId];if(r==null)return!0;switch(r.shape.type){case"alias":return this.isTypeReferenceObject(r.shape.aliasOf);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:Fo(r.shape)}}};function ys3({examples:e,convert:t}){let r=[];for(let i of e){let n=t(i);n!=null&&r.push(n)}return r}function vs3(e){return{...e,queryParameters:e.queryParameters.filter(t=>!xhf(t.value))}}function xhf(e){switch(e.shape.type){case"container":return bs3(e.shape.container);case"named":return gs3(e.shape);case"primitive":return!1;case"unknown":return!0;default:Fo(e.shape)}}function bs3(e){switch(e.type){case"map":case"list":case"set":return!0;case"optional":return e.optional!=null&&xhf(e.optional);default:Fo(e)}}function gs3(e){switch(e.shape.type){case"alias":return xhf(e.shape.value);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:Fo(e.shape)}}var BWn=yi(NPc(),1);var gAP={laterVersion:"v34",earlierVersion:"v33",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.10.4",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V33.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,requestBody:n.requestBody?._visit({inlinedRequestBody:a=>BWn.FernIrV33.HttpRequestBody.inlinedRequestBody(a),reference:a=>BWn.FernIrV33.HttpRequestBody.reference(a),fileUpload:a=>BWn.FernIrV33.HttpRequestBody.fileUpload({...a,properties:a.properties.map(u=>(u.type==="file"&&u.value.type==="fileArray"&&t.taskContext.logger.warn(`${n.method} ${n.fullPath.head} accepts a list of files however the ${t.targetGenerator?.name}@${t.targetGenerator?.version} only supports accepting a single file. File an [issue](https://github.com/fern-api/fern/issues) to add request for file arrays in ${t.targetGenerator?.name}@${t.targetGenerator?.version}!`),u.type==="file"?BWn.FernIrV33.FileUploadRequestProperty.file({...u.value}):u))}),bytes:a=>BWn.FernIrV33.HttpRequestBody.bytes(a),_other:a=>{}})}))}]))})};var OAP={laterVersion:"v35",earlierVersion:"v34",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.18.0",[J.GO_MODEL]:"0.18.0",[J.GO_SDK]:"0.18.0",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V34.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>({docs:i.docs,availability:i.availability,id:i.id,name:i.name,displayName:i.displayName,method:i.method,headers:i.headers,baseUrl:i.baseUrl,path:i.path,fullPath:i.fullPath,pathParameters:i.pathParameters,allPathParameters:i.allPathParameters,queryParameters:i.queryParameters,requestBody:i.requestBody,sdkRequest:i.sdkRequest,response:i.response,errors:i.errors,auth:i.auth,idempotent:i.idempotent,examples:i.examples}))}]))})};var mAP={laterVersion:"v36",earlierVersion:"v35",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.11.6",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V35.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var PAP={laterVersion:"v37",earlierVersion:"v36",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.13.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.13.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:"0.13.0",[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"0.12.0",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V36.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,examples:n.examples.filter(a=>a.exampleType==="userProvided")}))}]))})};var jAP={laterVersion:"v38",earlierVersion:"v37",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.15.0-rc0",[J.TYPESCRIPT_BROWSER_SDK]:"0.15.0-rc0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.12.0-rc0",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.9.0-rc0",[J.PYTHON_PYDANTIC]:"0.9.0-rc0",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"1.2.0-rc0",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V37.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,response:n.response?._visit({fileDownload:a=>he.V37.HttpResponse.fileDownload(a),json:a=>he.V37.HttpResponse.json(a),streaming:a=>a._visit({json:u=>he.V37.HttpResponse.streaming({dataEventType:he.V37.StreamingResponseChunkType.json(u.payload),docs:u.docs,terminator:u.terminator}),sse:()=>{},text:u=>he.V37.HttpResponse.streaming({dataEventType:he.V37.StreamingResponseChunkType.text(),docs:u.docs,terminator:void 0}),_other:()=>{}}),text:a=>he.V37.HttpResponse.text(a),_other:()=>{}})}))}]))})};var wAP={laterVersion:"v39",earlierVersion:"v38",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.9.0-rc1",[J.PYTHON_PYDANTIC]:"0.9.0-rc1",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"1.4.0-rc1",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:"0.7.0-rc0",[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V38.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>Os3(r))}})};function Os3(e){switch(e.type){case"basic":return he.V38.AuthScheme.basic(e);case"bearer":return he.V38.AuthScheme.bearer(e);case"header":return he.V38.AuthScheme.header(e);case"oauth":return he.V38.AuthScheme.bearer({docs:e.docs,token:{originalName:"token",camelCase:{unsafeName:"token",safeName:"token"},pascalCase:{unsafeName:"Token",safeName:"Token"},snakeCase:{unsafeName:"token",safeName:"token"},screamingSnakeCase:{unsafeName:"TOKEN",safeName:"TOKEN"}},tokenEnvVar:void 0});default:Fo(e)}}var SAP={laterVersion:"v40",earlierVersion:"v39",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.20.0",[J.GO_MODEL]:"0.20.0",[J.GO_SDK]:"0.20.0",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V39.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var DAP={laterVersion:"v41",earlierVersion:"v40",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V40.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,errors:Object.fromEntries(Object.entries(e.errors).map(([r,i])=>[r,{name:i.name,discriminantValue:i.discriminantValue,type:i.type,statusCode:i.statusCode,docs:i.docs}]))})};var EAP={laterVersion:"v42",earlierVersion:"v41",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:"0.8.0-rc0",[J.JAVA_SDK]:"0.9.0-rc0",[J.JAVA_SPRING]:"0.8.0-rc0",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V41.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>ms3(r))}})};function ms3(e){switch(e.type){case"basic":return he.V41.AuthScheme.basic(e);case"bearer":return he.V41.AuthScheme.bearer(e);case"header":return he.V41.AuthScheme.header(e);case"oauth":return he.V41.AuthScheme.oauth(Ps3(e));default:Fo(e)}}function Ps3(e){switch(e.configuration.type){case"clientCredentials":return{...e,configuration:he.V41.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:{...e.configuration.tokenEndpoint,endpointReference:e.configuration.tokenEndpoint.endpointReference.endpointId},refreshEndpoint:e.configuration.refreshEndpoint!=null?{...e.configuration.refreshEndpoint,endpointReference:e.configuration.refreshEndpoint?.endpointReference.endpointId}:void 0})};default:Fo(e.configuration.type)}}var MAP={laterVersion:"v43",earlierVersion:"v42",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.17.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.17.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.13.0",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V42.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,response:n.response?.body}))}]))})};var qAP={laterVersion:"v44",earlierVersion:"v43",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V43.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,examples:n.examples.map(a=>js3({example:a})).filter(Qb)}))}]))})};function js3({example:e}){return e._visit({userProvided:t=>he.V43.HttpEndpointExample.userProvided(AAP({example:t})),generated:t=>he.V43.HttpEndpointExample.generated(AAP({example:t})),_other:()=>{}})}function AAP({example:e}){return{...e,response:ws3({example:e.response})}}function ws3({example:e}){switch(e.type){case"ok":return Ss3({example:e.value});case"error":return he.V43.ExampleResponse.error(e);default:Fo(e)}}function Ss3({example:e}){switch(e.type){case"body":return he.V43.ExampleResponse.ok({body:e.value});case"sse":return he.V43.ExampleResponse.ok({body:void 0});case"stream":return he.V43.ExampleResponse.ok({body:void 0});default:Fo(e)}}var TAP={laterVersion:"v45",earlierVersion:"v44",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V44.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V45.types.Type._visit(r.shape,{union:i=>he.V44.types.Type.union({...i,baseProperties:i.baseProperties.map(n=>({...n,valueType:Wq(n.valueType)})),types:i.types.map(n=>Rs3(n))}),enum:he.V44.types.Type.enum,object:i=>he.V44.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:Wq(n.valueType)}))}),alias:i=>he.V44.types.Type.alias({aliasOf:Wq(i.aliasOf),resolvedType:Fs3(i.resolvedType)}),undiscriminatedUnion:i=>he.V44.types.Type.undiscriminatedUnion(Ls3(i)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:Cs3(e.auth),headers:e.headers.map(r=>xWn(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>xWn(r)),types:t,services:rd(e.services,r=>Us3(r)),errors:rd(e.errors,r=>ic3(r)),webhookGroups:rd(e.webhookGroups,r=>As3(r)),websocketChannels:rd(e.websocketChannels,r=>Ds3(r)),pathParameters:e.pathParameters.map(r=>i5a(r)),variables:e.variables.map(r=>Vs3(r))}}};function Ds3(e){return{...e,headers:e.headers.map(t=>xWn(t)),queryParameters:e.queryParameters.map(t=>n5a(t)),pathParameters:e.pathParameters.map(t=>i5a(t)),messages:e.messages.map(t=>Es3(t))}}function Es3(e){return{...e,body:Ms3(e.body)}}function Ms3(e){switch(e.type){case"inlinedBody":return he.V44.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:Wq(t.valueType)}))});case"reference":return he.V44.websocket.WebSocketMessageBody.reference({...e,bodyType:Wq(e.bodyType)})}}function As3(e){return e.map(t=>qs3(t))}function qs3(e){return{...e,headers:e.headers.map(t=>xWn(t)),payload:Ts3(e.payload)}}function Ts3(e){switch(e.type){case"reference":return he.V44.webhooks.WebhookPayload.reference({...e,payloadType:Wq(e.payloadType)});case"inlinedPayload":return he.V44.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:Wq(t.valueType)}))})}}function Cs3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V44.auth.AuthScheme.basic(t);case"bearer":return he.V44.auth.AuthScheme.bearer(t);case"header":return he.V44.auth.AuthScheme.header(Bs3(t));case"oauth":return he.V44.auth.AuthScheme.oauth(xs3(t))}})}}function Bs3(e){return{...e,valueType:Wq(e.valueType)}}function xs3(e){return{...e,configuration:he.V44.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:Is3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?zs3(e.configuration.refreshEndpoint):void 0})}}function Is3(e){return{...e,requestProperties:{clientId:DJu(e.requestProperties.clientId),clientSecret:DJu(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?DJu(e.requestProperties.scopes):void 0},responseProperties:{accessToken:zri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?zri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?zri(e.responseProperties.refreshToken):void 0}}}function zs3(e){return{...e,requestProperties:{refreshToken:DJu(e.requestProperties.refreshToken)},responseProperties:{accessToken:zri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?zri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?zri(e.responseProperties.refreshToken):void 0}}}function xWn(e){return{...e,valueType:Wq(e.valueType)}}function Wq(e){return he.V45.types.TypeReference._visit(e,{container:t=>he.V44.types.TypeReference.container(CAP(t)),primitive:t=>t.v1==="BIG_INTEGER"?he.V44.types.TypeReference.primitive(he.V44.types.PrimitiveType.String):he.V44.types.TypeReference.primitive(t.v1),named:he.V44.types.TypeReference.named,unknown:he.V44.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function CAP(e){return he.V45.types.ContainerType._visit(e,{list:t=>he.V44.types.ContainerType.list(Wq(t)),optional:t=>he.V44.types.ContainerType.optional(Wq(t)),set:t=>he.V44.types.ContainerType.set(Wq(t)),map:({keyType:t,valueType:r})=>he.V44.types.ContainerType.map({keyType:Wq(t),valueType:Wq(r)}),literal:he.V44.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function Rs3(e){return{...e,shape:Ns3(e.shape)}}function Ns3(e){return he.V45.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V44.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V44.types.SingleUnionTypeProperties.singleProperty({...t,type:Wq(t.type)}),noProperties:he.V44.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function Fs3(e){return he.V45.types.ResolvedTypeReference._visit(e,{container:t=>he.V44.types.ResolvedTypeReference.container(CAP(t)),named:he.V44.types.ResolvedTypeReference.named,primitive:t=>t.v1==="BIG_INTEGER"?he.V44.types.ResolvedTypeReference.primitive(he.V44.types.PrimitiveType.String):he.V44.types.ResolvedTypeReference.primitive(t.v1),unknown:he.V44.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function Ls3(e){return{members:e.members.map(t=>({...t,type:Wq(t.type)}))}}function Us3(e){return{...e,pathParameters:e.pathParameters.map(t=>i5a(t)),headers:e.headers.map(t=>xWn(t)),endpoints:e.endpoints.map(t=>Ws3(t))}}function i5a(e){return{...e,valueType:Wq(e.valueType)}}function Vs3(e){return{...e,type:Wq(e.type)}}function Ws3(e){return{...e,pagination:e.pagination!=null?Js3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>i5a(t)),pathParameters:e.pathParameters.map(t=>i5a(t)),sdkRequest:e.sdkRequest!=null?Zs3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?tc3(e.requestBody):void 0,response:e.response!=null?Hs3(e.response):void 0,headers:e.headers.map(t=>xWn(t)),queryParameters:e.queryParameters.map(t=>n5a(t))}}function Hs3(e){return{...e,body:e.body!=null?$s3(e.body):void 0}}function $s3(e){switch(e.type){case"json":return he.V44.http.HttpResponseBody.json(Gs3(e.value));case"fileDownload":return he.V44.http.HttpResponseBody.fileDownload(e);case"text":return he.V44.http.HttpResponseBody.text(e);case"streaming":return he.V44.http.HttpResponseBody.streaming(Qs3(e.value))}}function Gs3(e){switch(e.type){case"response":return he.V44.http.JsonResponse.response({...e,responseBodyType:Wq(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V44.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:Wq(e.responseBodyType),responseProperty:e.responseProperty!=null?Ihf(e.responseProperty):void 0})}}function Qs3(e){switch(e.type){case"json":return he.V44.http.StreamingResponse.json({...e,payload:Wq(e.payload)});case"text":return he.V44.http.StreamingResponse.text(e);case"sse":return he.V44.http.StreamingResponse.sse({...e,payload:Wq(e.payload)})}}function Js3(e){switch(e.type){case"cursor":return he.V44.http.Pagination.cursor(Ks3(e));case"offset":return he.V44.http.Pagination.offset(Ys3(e))}}function Ks3(e){return{...e,page:n5a(e.page),next:zri(e.next),results:zri(e.results)}}function Ys3(e){return{...e,page:n5a(e.page),results:zri(e.results)}}function DJu(e){return{...e,property:Xs3(e.property)}}function Xs3(e){switch(e.type){case"query":return he.V44.RequestPropertyValue.query(n5a(e));case"body":return he.V44.RequestPropertyValue.body(Ihf(e))}}function zri(e){return{...e,property:Ihf(e.property)}}function Ihf(e){return{...e,valueType:Wq(e.valueType)}}function n5a(e){return{...e,valueType:Wq(e.valueType)}}function Zs3(e){return{...e,shape:ks3(e.shape)}}function ks3(e){return he.V45.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V44.http.SdkRequestShape.justRequestBody(ec3(t)),wrapper:he.V44.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function ec3(e){switch(e.type){case"bytes":return he.V44.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V44.http.SdkRequestBodyType.typeReference({...e,requestBodyType:Wq(e.requestBodyType)})}}function tc3(e){return he.V45.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V44.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:Wq(r.valueType)}))}),reference:t=>he.V44.http.HttpRequestBody.reference({...t,requestBodyType:Wq(t.requestBodyType)}),fileUpload:t=>he.V44.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V44.http.FileUploadRequestProperty.bodyProperty({...r,valueType:Wq(r.valueType)});case"file":return he.V44.http.FileUploadRequestProperty.file(rc3(r.value))}})}),bytes:t=>he.V44.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function rc3(e){switch(e.type){case"file":return he.V44.http.FileProperty.file(e);case"fileArray":return he.V44.http.FileProperty.fileArray(e)}}function ic3(e){return{...e,type:e.type!=null?Wq(e.type):void 0}}var xAP={laterVersion:"v46",earlierVersion:"v45",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.21.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.21.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.16.0",[J.JAVA]:We,[J.JAVA_MODEL]:"0.9.0",[J.JAVA_SDK]:"0.10.0",[J.JAVA_SPRING]:"0.9.0",[J.PYTHON_FASTAPI]:"0.10.1",[J.PYTHON_PYDANTIC]:"0.9.1",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"2.9.9",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V45.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:nc3(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>({...i,examples:ac3(i.examples)}))}])),websocketChannels:e.websocketChannels!=null?Object.fromEntries(Object.entries(e.websocketChannels).map(([t,r])=>[t,{...r,examples:oc3(r.examples)}])):void 0,errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,{...r,examples:r.examples.map(i=>({...i,shape:b3(i.shape)}))}]))})};function b3(e){return e.shape._visit({container:t=>({...e,shape:t._visit({list:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.list(r.map(i=>b3(i)))),set:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.set(r.map(i=>b3(i)))),map:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.map(r.map(i=>({key:b3(i.key),value:b3(i.value)})))),optional:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.optional(r!=null?b3(r):void 0)),literal:r=>he.V45.ExampleTypeReferenceShape.primitive(r._visit({string:i=>he.V45.ExamplePrimitive.string(i),integer:i=>he.V45.ExamplePrimitive.integer(i),double:i=>he.V45.ExamplePrimitive.double(i),long:i=>he.V45.ExamplePrimitive.long(i),boolean:i=>he.V45.ExamplePrimitive.boolean(i),datetime:i=>he.V45.ExamplePrimitive.datetime(i),date:i=>he.V45.ExamplePrimitive.date(i),uuid:i=>he.V45.ExamplePrimitive.uuid(i),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}})}),named:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.named({...t,shape:IAP(t.shape)})}),primitive:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.primitive(t._visit({string:r=>he.V45.ExamplePrimitive.string(r),integer:r=>he.V45.ExamplePrimitive.integer(r),double:r=>he.V45.ExamplePrimitive.double(r),long:r=>he.V45.ExamplePrimitive.long(r),boolean:r=>he.V45.ExamplePrimitive.boolean(r),datetime:r=>he.V45.ExamplePrimitive.datetime(r),date:r=>he.V45.ExamplePrimitive.date(r),uuid:r=>he.V45.ExamplePrimitive.uuid(r),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}}))}),unknown:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.unknown(t)}),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}function BAP(e){return{...e,properties:e.properties.map(t=>({...t,value:b3(t.value)}))}}function IAP(e){return e.type==="alias"?he.V45.ExampleTypeShape.alias({value:b3(e.value)}):e.type==="object"?he.V45.ExampleTypeShape.object(BAP(e)):e.type==="union"?he.V45.ExampleTypeShape.union({...e,singleUnionType:{...e.singleUnionType,shape:e.singleUnionType.shape._visit({samePropertiesAsObject:t=>he.V45.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,object:BAP(t.object)}),singleProperty:t=>he.V45.ExampleSingleUnionTypeProperties.singleProperty(b3(t)),noProperties:()=>he.V45.ExampleSingleUnionTypeProperties.noProperties(),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}}):e.type==="undiscriminatedUnion"?he.V45.ExampleTypeShape.undiscriminatedUnion({...e,singleUnionType:b3(e.singleUnionType)}):he.V45.ExampleTypeShape.enum(e)}function nc3(e){return e.map(t=>({...t,shape:IAP(t.shape)}))}function EJu(e){return e.map(t=>({...t,value:b3(t.value)}))}function zhf(e){return e.map(t=>({...t,value:b3(t.value)}))}function zAP(e){return e.map(t=>({...t,value:b3(t.value)}))}function ac3(e){return e.map(t=>{let r={...t,rootPathParameters:EJu(t.rootPathParameters),servicePathParameters:EJu(t.servicePathParameters),endpointPathParameters:EJu(t.endpointPathParameters),serviceHeaders:zhf(t.serviceHeaders),endpointHeaders:zhf(t.endpointHeaders),queryParameters:zAP(t.queryParameters),request:t.request?._visit({inlinedRequestBody:i=>he.V45.ExampleRequestBody.inlinedRequestBody({...i,properties:i.properties.map(n=>({...n,value:b3(n.value)}))}),reference:i=>he.V45.ExampleRequestBody.reference(b3(i)),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}}),response:t.response._visit({ok:i=>he.V45.ExampleResponse.ok(i._visit({body:n=>he.V45.ExampleEndpointSuccessResponse.body(n!=null?b3(n):void 0),stream:n=>he.V45.ExampleEndpointSuccessResponse.stream(n.map(b3)),sse:n=>he.V45.ExampleEndpointSuccessResponse.sse(n.map(a=>({...a,data:b3(a.data)}))),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})),error:i=>he.V45.ExampleResponse.error({...i,body:i.body!=null?b3(i.body):void 0}),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})};return t._visit({userProvided:()=>he.V45.HttpEndpointExample.userProvided(r),generated:()=>he.V45.HttpEndpointExample.generated(r),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})})}function oc3(e){return e.map(t=>({...t,pathParameters:EJu(t.pathParameters),headers:zhf(t.headers),queryParameters:zAP(t.queryParameters),messages:t.messages.map(r=>({...r,body:r.body._visit({inlinedBody:i=>he.V45.ExampleWebSocketMessageBody.inlinedBody({...i,properties:i.properties.map(n=>({...n,value:b3(n.value)}))}),reference:i=>he.V45.ExampleWebSocketMessageBody.reference(b3(i)),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})}))}))}var RAP={laterVersion:"v47",earlierVersion:"v46",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V46.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>{let i=r.endpoints.map(n=>{let{autogeneratedExamples:a,userSpecifiedExamples:u,...l}=n;return{...l,autogeneratedExamples:void 0,userSpecifiedExamples:void 0,examples:[...n.userSpecifiedExamples.map(s=>{if(s.example!=null)return he.V46.HttpEndpointExample.userProvided({...s.example,codeSamples:s.codeSamples})}).filter(Qb),...n.autogeneratedExamples.map(s=>he.V46.HttpEndpointExample.generated({...s.example,codeSamples:void 0}))]}});return[t,{...r,endpoints:i}]}))})};var NAP={laterVersion:"v48",earlierVersion:"v47",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.29.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.29.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.17.0",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V47.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,i])=>{let n=i.endpoints.map(a=>({...a,pagination:a.pagination!=null?sc3(a.pagination):void 0}));return[r,{...i,endpoints:n}]}));return{...e,sdkConfig:{...e.sdkConfig,hasPaginatedEndpoints:uc3(t)},services:t}}};function uc3(e){for(let t of Object.values(e))for(let r of t.endpoints)if(r.pagination!=null)return!0;return!1}function sc3(e){switch(e.type){case"cursor":{let t=cc3(e);return t!=null?he.V47.Pagination.cursor(t):void 0}case"offset":{let t=lc3(e);return t!=null?he.V47.Pagination.offset(t):void 0}default:Fo(e)}}function cc3(e){let t=FAP(e.page);if(t!=null)return{...e,page:t}}function lc3(e){if(e.step!=null)return;let t=FAP(e.page);if(t!=null)return{...e,page:t}}function FAP(e){switch(e.property.type){case"query":return e.property}}var LAP={laterVersion:"v49",earlierVersion:"v48",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:"0.11.0-rc0",[J.PYTHON_PYDANTIC]:"0.10.0-rc0",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:"2.11.0-rc0",[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:ri,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V48.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,i])=>{let n=i.endpoints.flatMap(a=>{let u;return a.response?.body!=null&&(u=a.response.body?._visit({json:d=>he.V48.HttpResponseBody.json({...d}),fileDownload:d=>he.V48.HttpResponseBody.fileDownload({...d}),text:d=>he.V48.HttpResponseBody.text({...d}),streaming:d=>he.V48.HttpResponseBody.streaming({...d}),streamParameter:()=>{},_other:()=>{}}),u==null)?[]:{...a,response:a.response==null?void 0:{statusCode:a.response?.statusCode,body:u}}});return[r,{...i,endpoints:n}]}));return{...e,services:t}}};var UAP={laterVersion:"v50",earlierVersion:"v49",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.34.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.34.0",[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:"0.17.2",[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:"0.0.0",[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V49.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=rd(e.types,r=>({...r,shape:he.V50.types.Type._visit(r.shape,{union:i=>he.V49.types.Type.union({...i,baseProperties:i.baseProperties.map(n=>({...n,valueType:Hq(n.valueType)})),types:i.types.map(n=>Pc3(n))}),enum:he.V49.types.Type.enum,object:i=>he.V49.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:Hq(n.valueType)}))}),alias:i=>he.V49.types.Type.alias({aliasOf:Hq(i.aliasOf),resolvedType:wc3(i.resolvedType)}),undiscriminatedUnion:i=>he.V49.types.Type.undiscriminatedUnion(Sc3(i)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:vc3(e.auth),headers:e.headers.map(r=>IWn(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>IWn(r)),types:t,services:rd(e.services,r=>Dc3(r)),errors:rd(e.errors,r=>Vc3(r)),webhookGroups:rd(e.webhookGroups,r=>_c3(r)),websocketChannels:rd(e.websocketChannels,r=>fc3(r)),pathParameters:e.pathParameters.map(r=>a5a(r)),variables:e.variables.map(r=>Ec3(r))}}};function fc3(e){return{...e,headers:e.headers.map(t=>IWn(t)),queryParameters:e.queryParameters.map(t=>Nhf(t)),pathParameters:e.pathParameters.map(t=>a5a(t)),messages:e.messages.map(t=>dc3(t))}}function dc3(e){return{...e,body:pc3(e.body)}}function pc3(e){switch(e.type){case"inlinedBody":return he.V49.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:Hq(t.valueType)}))});case"reference":return he.V49.websocket.WebSocketMessageBody.reference({...e,bodyType:Hq(e.bodyType)})}}function _c3(e){return e.map(t=>hc3(t))}function hc3(e){return{...e,headers:e.headers.map(t=>IWn(t)),payload:yc3(e.payload)}}function yc3(e){switch(e.type){case"reference":return he.V49.webhooks.WebhookPayload.reference({...e,payloadType:Hq(e.payloadType)});case"inlinedPayload":return he.V49.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:Hq(t.valueType)}))})}}function vc3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V49.auth.AuthScheme.basic(t);case"bearer":return he.V49.auth.AuthScheme.bearer(t);case"header":return he.V49.auth.AuthScheme.header(bc3(t));case"oauth":return he.V49.auth.AuthScheme.oauth(gc3(t))}})}}function bc3(e){return{...e,valueType:Hq(e.valueType)}}function gc3(e){return{...e,configuration:he.V49.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:Oc3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?mc3(e.configuration.refreshEndpoint):void 0})}}function Oc3(e){return{...e,requestProperties:{clientId:q1i(e.requestProperties.clientId),clientSecret:q1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?q1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:Rri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Rri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Rri(e.responseProperties.refreshToken):void 0}}}function mc3(e){return{...e,requestProperties:{refreshToken:q1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:Rri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Rri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Rri(e.responseProperties.refreshToken):void 0}}}function IWn(e){return{...e,valueType:Hq(e.valueType)}}function Hq(e){return he.V50.types.TypeReference._visit(e,{container:t=>he.V49.types.TypeReference.container(VAP(t)),primitive:t=>t.v2?.type==="integer"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.string(t.v2)}):he.V49.types.TypeReference.primitive({v1:t.v1,v2:void 0}),named:he.V49.types.TypeReference.named,unknown:he.V49.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function VAP(e){return he.V50.types.ContainerType._visit(e,{list:t=>he.V49.types.ContainerType.list(Hq(t)),optional:t=>he.V49.types.ContainerType.optional(Hq(t)),set:t=>he.V49.types.ContainerType.set(Hq(t)),map:({keyType:t,valueType:r})=>he.V49.types.ContainerType.map({keyType:Hq(t),valueType:Hq(r)}),literal:he.V49.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function Pc3(e){return{...e,shape:jc3(e.shape)}}function jc3(e){return he.V50.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V49.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V49.types.SingleUnionTypeProperties.singleProperty({...t,type:Hq(t.type)}),noProperties:he.V49.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function wc3(e){return he.V50.types.ResolvedTypeReference._visit(e,{container:t=>he.V49.types.ResolvedTypeReference.container(VAP(t)),named:he.V49.types.ResolvedTypeReference.named,primitive:t=>t.v2?.type==="integer"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.string(t.v2)}):he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:void 0}),unknown:he.V49.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function Sc3(e){return{members:e.members.map(t=>({...t,type:Hq(t.type)}))}}function Dc3(e){return{...e,pathParameters:e.pathParameters.map(t=>a5a(t)),headers:e.headers.map(t=>IWn(t)),endpoints:e.endpoints.map(t=>Mc3(t))}}function a5a(e){return{...e,valueType:Hq(e.valueType)}}function Ec3(e){return{...e,type:Hq(e.type)}}function Mc3(e){return{...e,pagination:e.pagination!=null?Bc3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>a5a(t)),pathParameters:e.pathParameters.map(t=>a5a(t)),sdkRequest:e.sdkRequest!=null?Rc3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Lc3(e.requestBody):void 0,response:e.response!=null?Ac3(e.response):void 0,headers:e.headers.map(t=>IWn(t)),queryParameters:e.queryParameters.map(t=>Nhf(t))}}function Ac3(e){return{...e,body:e.body!=null?qc3(e.body):void 0}}function qc3(e){switch(e.type){case"json":return he.V49.http.HttpResponseBody.json(WAP(e.value));case"fileDownload":return he.V49.http.HttpResponseBody.fileDownload(e);case"text":return he.V49.http.HttpResponseBody.text(e);case"streaming":return he.V49.http.HttpResponseBody.streaming(HAP(e.value));case"streamParameter":return he.V49.http.HttpResponseBody.streamParameter(Cc3(e))}}function WAP(e){switch(e.type){case"response":return he.V49.http.JsonResponse.response({...e,responseBodyType:Hq(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V49.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:Hq(e.responseBodyType),responseProperty:e.responseProperty!=null?Rhf(e.responseProperty):void 0})}}function HAP(e){switch(e.type){case"json":return he.V49.http.StreamingResponse.json({...e,payload:Hq(e.payload)});case"text":return he.V49.http.StreamingResponse.text(e);case"sse":return he.V49.http.StreamingResponse.sse({...e,payload:Hq(e.payload)})}}function Tc3(e){switch(e.type){case"json":return he.V49.http.NonStreamHttpResponseBody.json(WAP(e.value));case"text":return he.V49.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V49.http.NonStreamHttpResponseBody.fileDownload(e)}}function Cc3(e){return{nonStreamResponse:Tc3(e.nonStreamResponse),streamResponse:HAP(e.streamResponse)}}function Bc3(e){switch(e.type){case"cursor":return he.V49.http.Pagination.cursor(xc3(e));case"offset":return he.V49.http.Pagination.offset(Ic3(e))}}function xc3(e){return{...e,page:q1i(e.page),next:Rri(e.next),results:Rri(e.results)}}function Ic3(e){return{...e,page:q1i(e.page),results:Rri(e.results),step:e.step!=null?q1i(e.step):void 0}}function q1i(e){return{...e,property:zc3(e.property)}}function zc3(e){switch(e.type){case"query":return he.V49.RequestPropertyValue.query(Nhf(e));case"body":return he.V49.RequestPropertyValue.body(Rhf(e))}}function Rri(e){return{...e,property:Rhf(e.property)}}function Rhf(e){return{...e,valueType:Hq(e.valueType)}}function Nhf(e){return{...e,valueType:Hq(e.valueType)}}function Rc3(e){return{...e,streamParameter:e.streamParameter!=null?q1i(e.streamParameter):void 0,shape:Nc3(e.shape)}}function Nc3(e){return he.V50.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V49.http.SdkRequestShape.justRequestBody(Fc3(t)),wrapper:he.V49.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Fc3(e){switch(e.type){case"bytes":return he.V49.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V49.http.SdkRequestBodyType.typeReference({...e,requestBodyType:Hq(e.requestBodyType)})}}function Lc3(e){return he.V50.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V49.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:Hq(r.valueType)}))}),reference:t=>he.V49.http.HttpRequestBody.reference({...t,requestBodyType:Hq(t.requestBodyType)}),fileUpload:t=>he.V49.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V49.http.FileUploadRequestProperty.bodyProperty({...r,valueType:Hq(r.valueType)});case"file":return he.V49.http.FileUploadRequestProperty.file(Uc3(r.value))}})}),bytes:t=>he.V49.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Uc3(e){switch(e.type){case"file":return he.V49.http.FileProperty.file(e);case"fileArray":return he.V49.http.FileProperty.fileArray(e)}}function Vc3(e){return{...e,type:e.type!=null?Hq(e.type):void 0}}var QAP={laterVersion:"v51",earlierVersion:"v50",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"0.1.2",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V50.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=rd(e.types,r=>{let i=r.autogeneratedExamples.map(a=>$AP(a)),n=r.userProvidedExamples.map(a=>$AP(a));return{...r,examples:[...i,...n]}});return{...e,types:t,services:rd(e.services,r=>kc3(r)),errors:rd(e.errors,r=>nl3(r)),webhookGroups:rd(e.webhookGroups,r=>Gc3(r)),websocketChannels:rd(e.websocketChannels,r=>Wc3(r))}}};function Wc3(e){return{...e,examples:e.examples.map(t=>Hc3(t))}}function Hc3(e){return{...e,pathParameters:e.pathParameters.map(t=>MJu(t)),headers:e.headers.map(t=>Fhf(t)),queryParameters:e.queryParameters.map(t=>JAP(t)),messages:e.messages.map(t=>({...t,body:$c3(t.body)}))}}function JAP(e){return{...e,value:V4(e.value)}}function Fhf(e){return{...e,value:V4(e.value)}}function MJu(e){return{...e,value:V4(e.value)}}function $c3(e){switch(e.type){case"inlinedBody":return he.V50.ExampleWebSocketMessageBody.inlinedBody(KAP(e));case"reference":return he.V50.ExampleWebSocketMessageBody.reference(V4(e))}}function KAP(e){return{...e,properties:e.properties.map(t=>({...t,value:V4(t.value)}))}}function Gc3(e){return e.map(t=>({...t,examples:t.examples?.map(r=>({...r,payload:V4(r.payload)}))}))}function $AP(e){return{...e,shape:YAP(e.shape)}}function Lhf(e){switch(e.type){case"primitive":return he.V50.ExampleTypeReferenceShape.primitive({...e.primitive});case"container":return he.V50.ExampleTypeReferenceShape.container(Qc3(e));case"unknown":return he.V50.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V50.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:YAP(e.shape)})}}function Qc3(e){switch(e.container.type){case"list":return he.V50.ExampleContainer.list(e.container.list.map(t=>V4(t)));case"set":return he.V50.ExampleContainer.set(e.container.set.map(t=>V4(t)));case"optional":return he.V50.ExampleContainer.optional(e.container.optional!=null?V4(e.container.optional):void 0);case"map":return he.V50.ExampleContainer.map(e.container.map.map(t=>({key:V4(t.key),value:V4(t.value)})));case"literal":return he.V50.ExampleContainer.literal(e.container.literal)}}function V4(e){return{...e,shape:Lhf(e.shape)}}function YAP(e){switch(e.type){case"object":return he.V50.ExampleTypeShape.object({properties:e.properties.map(t=>XAP(t))});case"alias":return he.V50.ExampleTypeShape.alias({value:{...V4(e.value)}});case"enum":return he.V50.ExampleTypeShape.enum(e);case"union":return he.V50.ExampleTypeShape.union(Kc3(e));case"undiscriminatedUnion":return he.V50.ExampleTypeShape.undiscriminatedUnion(Jc3(e))}}function Jc3(e){return{...e,singleUnionType:V4(e.singleUnionType)}}function Kc3(e){return{...e,singleUnionType:Yc3(e.singleUnionType)}}function Yc3(e){return{...e,shape:Xc3(e.shape)}}function Xc3(e){switch(e.type){case"samePropertiesAsObject":return he.V50.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:Zc3(e.object)});case"singleProperty":return he.V50.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Lhf(e.shape)});case"noProperties":return he.V50.ExampleSingleUnionTypeProperties.noProperties()}}function Zc3(e){return{...e,properties:e.properties.map(t=>XAP(t))}}function XAP(e){return{...e,value:{...e.value,shape:Lhf(e.value.shape)}}}function kc3(e){return{...e,endpoints:e.endpoints.map(t=>el3(t))}}function el3(e){return{...e,autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:GAP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?GAP(t.example):void 0}))}}function GAP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>MJu(t)),servicePathParameters:e.servicePathParameters.map(t=>MJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>MJu(t)),serviceHeaders:e.serviceHeaders.map(t=>Fhf(t)),endpointHeaders:e.endpointHeaders.map(t=>Fhf(t)),queryParameters:e.queryParameters.map(t=>JAP(t)),request:e.request!=null?il3(e.request):void 0,response:tl3(e.response)}}function tl3(e){switch(e.type){case"error":return he.V50.ExampleResponse.error({...e,body:e.body!=null?V4(e.body):void 0});case"ok":return he.V50.ExampleResponse.ok(rl3(e))}}function rl3(e){switch(e.value.type){case"body":return he.V50.ExampleEndpointSuccessResponse.body(e.value.value!=null?V4(e.value.value):void 0);case"stream":return he.V50.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>V4(t)));case"sse":return he.V50.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:V4(t.data)})))}}function il3(e){switch(e.type){case"inlinedRequestBody":return he.V50.ExampleRequestBody.inlinedRequestBody(KAP(e));case"reference":return he.V50.ExampleRequestBody.reference(V4(e))}}function nl3(e){return{...e,examples:e.examples.map(t=>({...t,shape:V4(t.shape)}))}}var eqP={laterVersion:"v52",earlierVersion:"v51",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:ri},jsonifyEarlierVersion:e=>m_.V51.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?ol3(e.apiVersion):void 0,auth:_l3(e.auth),headers:e.headers.map(t=>Vin(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>Vin(t)),types:al3(e.types),services:rd(e.services,t=>Sl3(t)),webhookGroups:rd(e.webhookGroups,t=>ll3(t)),websocketChannels:rd(e.websocketChannels,t=>ul3(t)),errors:rd(e.errors,t=>Ul3(t)),pathParameters:e.pathParameters.map(t=>o5a(t)),variables:e.variables.map(t=>Dl3(t))})};function al3(e){return rd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>ZAP(r)),userProvidedExamples:t.userProvidedExamples.map(r=>ZAP(r)),shape:he.V52.types.Type._visit(t.shape,{union:r=>he.V51.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:jE(i.valueType)})),types:r.types.map(i=>ml3(i))}),enum:he.V51.types.Type.enum,object:r=>he.V51.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:jE(i.valueType)}))}),alias:r=>he.V51.types.Type.alias({aliasOf:jE(r.aliasOf),resolvedType:jl3(r.resolvedType)}),undiscriminatedUnion:r=>he.V51.types.Type.undiscriminatedUnion(wl3(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function ol3(e){return he.V51.ApiVersionScheme.header({...e,header:Vin(e.header)})}function ul3(e){return{...e,headers:e.headers.map(t=>Vin(t)),queryParameters:e.queryParameters.map(t=>Whf(t)),pathParameters:e.pathParameters.map(t=>o5a(t)),messages:e.messages.map(t=>sl3(t)),examples:e.examples.map(t=>Vl3(t))}}function sl3(e){return{...e,body:cl3(e.body)}}function cl3(e){switch(e.type){case"inlinedBody":return he.V51.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:jE(t.valueType)}))});case"reference":return he.V51.websocket.WebSocketMessageBody.reference({...e,bodyType:jE(e.bodyType)})}}function ll3(e){return e.map(t=>fl3(t))}function fl3(e){return{...e,headers:e.headers.map(t=>Vin(t)),payload:dl3(e.payload),examples:e.examples!=null?e.examples.map(t=>pl3(t)):void 0}}function dl3(e){switch(e.type){case"reference":return he.V51.webhooks.WebhookPayload.reference({...e,payloadType:jE(e.payloadType)});case"inlinedPayload":return he.V51.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:jE(t.valueType)}))})}}function pl3(e){return{...e,payload:W4(e.payload)}}function _l3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V51.auth.AuthScheme.basic(t);case"bearer":return he.V51.auth.AuthScheme.bearer(t);case"header":return he.V51.auth.AuthScheme.header(hl3(t));case"oauth":return he.V51.auth.AuthScheme.oauth(yl3(t))}})}}function hl3(e){return{...e,valueType:jE(e.valueType)}}function yl3(e){return{...e,configuration:he.V51.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:vl3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?bl3(e.configuration.refreshEndpoint):void 0})}}function vl3(e){return{...e,requestProperties:{clientId:T1i(e.requestProperties.clientId),clientSecret:T1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?T1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:Nri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Nri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Nri(e.responseProperties.refreshToken):void 0}}}function bl3(e){return{...e,requestProperties:{refreshToken:T1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:Nri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Nri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Nri(e.responseProperties.refreshToken):void 0}}}function Vin(e){return{...e,valueType:jE(e.valueType)}}function jE(e){return he.V52.types.TypeReference._visit(e,{container:t=>he.V51.types.TypeReference.container(rqP(t)),primitive:t=>he.V51.types.TypeReference.primitive(tqP(t)),named:he.V51.types.TypeReference.named,unknown:he.V51.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function tqP(e){return{v1:gl3(e.v1),v2:e.v2!=null?Ol3(e.v2):void 0}}function gl3(e){switch(e){case"UINT":return he.V51.types.PrimitiveTypeV1.Integer;case"UINT_64":return he.V51.types.PrimitiveTypeV1.Long}return e}function Ol3(e){switch(e.type){case"integer":return he.V51.types.PrimitiveTypeV2.integer(e);case"double":return he.V51.types.PrimitiveTypeV2.double(e);case"string":return he.V51.types.PrimitiveTypeV2.string(e);case"boolean":return he.V51.types.PrimitiveTypeV2.boolean(e);case"long":return he.V51.types.PrimitiveTypeV2.long(e);case"bigInteger":return he.V51.types.PrimitiveTypeV2.bigInteger(e);case"uint":return;case"uint64":return;default:Fo(e)}}function rqP(e){return he.V52.types.ContainerType._visit(e,{list:t=>he.V51.types.ContainerType.list(jE(t)),optional:t=>he.V51.types.ContainerType.optional(jE(t)),set:t=>he.V51.types.ContainerType.set(jE(t)),map:({keyType:t,valueType:r})=>he.V51.types.ContainerType.map({keyType:jE(t),valueType:jE(r)}),literal:he.V51.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function ml3(e){return{...e,shape:Pl3(e.shape)}}function Pl3(e){return he.V52.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V51.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V51.types.SingleUnionTypeProperties.singleProperty({...t,type:jE(t.type)}),noProperties:he.V51.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function jl3(e){return he.V52.types.ResolvedTypeReference._visit(e,{container:t=>he.V51.types.ResolvedTypeReference.container(rqP(t)),named:he.V51.types.ResolvedTypeReference.named,primitive:t=>he.V51.types.ResolvedTypeReference.primitive(tqP(t)),unknown:he.V51.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function wl3(e){return{members:e.members.map(t=>({...t,type:jE(t.type)}))}}function Sl3(e){return{...e,pathParameters:e.pathParameters.map(t=>o5a(t)),headers:e.headers.map(t=>Vin(t)),endpoints:e.endpoints.map(t=>El3(t))}}function o5a(e){return{...e,valueType:jE(e.valueType)}}function Dl3(e){return{...e,type:jE(e.type)}}function El3(e){return{...e,pagination:e.pagination!=null?Cl3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>o5a(t)),pathParameters:e.pathParameters.map(t=>o5a(t)),sdkRequest:e.sdkRequest!=null?zl3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Fl3(e.requestBody):void 0,response:e.response!=null?Ml3(e.response):void 0,headers:e.headers.map(t=>Vin(t)),queryParameters:e.queryParameters.map(t=>Whf(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:kAP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?kAP(t.example):void 0}))}}function Ml3(e){return{...e,body:e.body!=null?Al3(e.body):void 0}}function Al3(e){switch(e.type){case"json":return he.V51.http.HttpResponseBody.json(iqP(e.value));case"fileDownload":return he.V51.http.HttpResponseBody.fileDownload(e);case"text":return he.V51.http.HttpResponseBody.text(e);case"streaming":return he.V51.http.HttpResponseBody.streaming(nqP(e.value));case"streamParameter":return he.V51.http.HttpResponseBody.streamParameter(Tl3(e))}}function iqP(e){switch(e.type){case"response":return he.V51.http.JsonResponse.response({...e,responseBodyType:jE(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V51.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:jE(e.responseBodyType),responseProperty:e.responseProperty!=null?Vhf(e.responseProperty):void 0})}}function nqP(e){switch(e.type){case"json":return he.V51.http.StreamingResponse.json({...e,payload:jE(e.payload)});case"text":return he.V51.http.StreamingResponse.text(e);case"sse":return he.V51.http.StreamingResponse.sse({...e,payload:jE(e.payload)})}}function ql3(e){switch(e.type){case"json":return he.V51.http.NonStreamHttpResponseBody.json(iqP(e.value));case"text":return he.V51.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V51.http.NonStreamHttpResponseBody.fileDownload(e)}}function Tl3(e){return{nonStreamResponse:ql3(e.nonStreamResponse),streamResponse:nqP(e.streamResponse)}}function Cl3(e){switch(e.type){case"cursor":return he.V51.http.Pagination.cursor(Bl3(e));case"offset":return he.V51.http.Pagination.offset(xl3(e))}}function Bl3(e){return{...e,page:T1i(e.page),next:Nri(e.next),results:Nri(e.results)}}function xl3(e){return{...e,page:T1i(e.page),results:Nri(e.results),step:e.step!=null?T1i(e.step):void 0}}function T1i(e){return{...e,property:Il3(e.property)}}function Il3(e){switch(e.type){case"query":return he.V51.RequestPropertyValue.query(Whf(e));case"body":return he.V51.RequestPropertyValue.body(Vhf(e))}}function Nri(e){return{...e,property:Vhf(e.property)}}function Vhf(e){return{...e,valueType:jE(e.valueType)}}function Whf(e){return{...e,valueType:jE(e.valueType)}}function zl3(e){return{...e,streamParameter:e.streamParameter!=null?T1i(e.streamParameter):void 0,shape:Rl3(e.shape)}}function Rl3(e){return he.V52.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V51.http.SdkRequestShape.justRequestBody(Nl3(t)),wrapper:he.V51.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Nl3(e){switch(e.type){case"bytes":return he.V51.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V51.http.SdkRequestBodyType.typeReference({...e,requestBodyType:jE(e.requestBodyType)})}}function Fl3(e){return he.V52.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V51.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:jE(r.valueType)}))}),reference:t=>he.V51.http.HttpRequestBody.reference({...t,requestBodyType:jE(t.requestBodyType)}),fileUpload:t=>he.V51.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V51.http.FileUploadRequestProperty.bodyProperty({...r,valueType:jE(r.valueType)});case"file":return he.V51.http.FileUploadRequestProperty.file(Ll3(r.value))}})}),bytes:t=>he.V51.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Ll3(e){switch(e.type){case"file":return he.V51.http.FileProperty.file(e);case"fileArray":return he.V51.http.FileProperty.fileArray(e)}}function Ul3(e){return{...e,type:e.type!=null?jE(e.type):void 0,examples:e.examples.map(t=>({...t,shape:W4(t.shape)}))}}function Vl3(e){return{...e,pathParameters:e.pathParameters.map(t=>AJu(t)),headers:e.headers.map(t=>Uhf(t)),queryParameters:e.queryParameters.map(t=>aqP(t)),messages:e.messages.map(t=>({...t,body:Wl3(t.body)}))}}function aqP(e){return{...e,value:W4(e.value)}}function Uhf(e){return{...e,value:W4(e.value)}}function AJu(e){return{...e,value:W4(e.value)}}function Wl3(e){switch(e.type){case"inlinedBody":return he.V51.ExampleWebSocketMessageBody.inlinedBody(oqP(e));case"reference":return he.V51.ExampleWebSocketMessageBody.reference(W4(e))}}function oqP(e){return{...e,properties:e.properties.map(t=>({...t,value:W4(t.value)}))}}function ZAP(e){return{...e,shape:sqP(e.shape)}}function Hhf(e){switch(e.type){case"primitive":return he.V51.ExampleTypeReferenceShape.primitive(Hl3(e));case"container":return he.V51.ExampleTypeReferenceShape.container($l3(e));case"unknown":return he.V51.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V51.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:sqP(e.shape)})}}function uqP(e){switch(e.type){case"integer":return he.V51.ExamplePrimitive.integer(e.integer);case"uint":return he.V51.ExamplePrimitive.integer(e.uint);case"uint64":return he.V51.ExamplePrimitive.integer(e.uint64);case"double":return he.V51.ExamplePrimitive.double(e.double);case"long":return he.V51.ExamplePrimitive.long(e.long);case"boolean":return he.V51.ExamplePrimitive.boolean(e.boolean);case"string":return he.V51.ExamplePrimitive.string(e.string);case"date":return he.V51.ExamplePrimitive.date(e.date);case"datetime":return he.V51.ExamplePrimitive.datetime(e.datetime);case"uuid":return he.V51.ExamplePrimitive.uuid(e.uuid)}}function Hl3(e){return uqP(e.primitive)}function $l3(e){switch(e.container.type){case"list":return he.V51.ExampleContainer.list({list:e.container.list.map(t=>W4(t)),itemType:jE(e.container.itemType)});case"set":return he.V51.ExampleContainer.set({set:e.container.set.map(t=>W4(t)),itemType:jE(e.container.itemType)});case"optional":return he.V51.ExampleContainer.optional({optional:e.container.optional!=null?W4(e.container.optional):void 0,valueType:jE(e.container.valueType)});case"map":return he.V51.ExampleContainer.map({map:e.container.map.map(t=>({key:W4(t.key),value:W4(t.value)})),keyType:jE(e.container.keyType),valueType:jE(e.container.valueType)});case"literal":return he.V51.ExampleContainer.literal({literal:uqP(e.container.literal)})}}function W4(e){return{...e,shape:Hhf(e.shape)}}function sqP(e){switch(e.type){case"object":return he.V51.ExampleTypeShape.object({properties:e.properties.map(t=>cqP(t))});case"alias":return he.V51.ExampleTypeShape.alias({value:{...W4(e.value)}});case"enum":return he.V51.ExampleTypeShape.enum(e);case"union":return he.V51.ExampleTypeShape.union(Ql3(e));case"undiscriminatedUnion":return he.V51.ExampleTypeShape.undiscriminatedUnion(Gl3(e))}}function Gl3(e){return{...e,singleUnionType:W4(e.singleUnionType)}}function Ql3(e){return{...e,singleUnionType:Jl3(e.singleUnionType)}}function Jl3(e){return{...e,shape:Kl3(e.shape)}}function Kl3(e){switch(e.type){case"samePropertiesAsObject":return he.V51.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:Yl3(e.object)});case"singleProperty":return he.V51.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Hhf(e.shape)});case"noProperties":return he.V51.ExampleSingleUnionTypeProperties.noProperties()}}function Yl3(e){return{...e,properties:e.properties.map(t=>cqP(t))}}function cqP(e){return{...e,value:{...e.value,shape:Hhf(e.value.shape)}}}function kAP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>AJu(t)),servicePathParameters:e.servicePathParameters.map(t=>AJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>AJu(t)),serviceHeaders:e.serviceHeaders.map(t=>Uhf(t)),endpointHeaders:e.endpointHeaders.map(t=>Uhf(t)),queryParameters:e.queryParameters.map(t=>aqP(t)),request:e.request!=null?kl3(e.request):void 0,response:Xl3(e.response)}}function Xl3(e){switch(e.type){case"error":return he.V51.ExampleResponse.error({...e,body:e.body!=null?W4(e.body):void 0});case"ok":return he.V51.ExampleResponse.ok(Zl3(e))}}function Zl3(e){switch(e.value.type){case"body":return he.V51.ExampleEndpointSuccessResponse.body(e.value.value!=null?W4(e.value.value):void 0);case"stream":return he.V51.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>W4(t)));case"sse":return he.V51.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:W4(t.data)})))}}function kl3(e){switch(e.type){case"inlinedRequestBody":return he.V51.ExampleRequestBody.inlinedRequestBody(oqP(e));case"reference":return he.V51.ExampleRequestBody.reference(W4(e))}}var dqP={laterVersion:"v53",earlierVersion:"v52",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.38.0-rc0",[J.TYPESCRIPT_BROWSER_SDK]:"0.38.0-rc0",[J.TYPESCRIPT]:"0.38.0-rc0",[J.TYPESCRIPT_SDK]:"0.38.0-rc0",[J.TYPESCRIPT_EXPRESS]:"0.17.3",[J.JAVA]:We,[J.JAVA_MODEL]:"1.3.0",[J.JAVA_SDK]:"2.5.0",[J.JAVA_SPRING]:"1.3.0",[J.PYTHON_FASTAPI]:"1.1.0-rc0",[J.PYTHON_PYDANTIC]:"1.1.0-rc0",[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:"0.1.0",[J.STOPLIGHT]:We,[J.POSTMAN]:"0.2.0",[J.PYTHON_SDK]:"3.3.0-rc0",[J.GO_FIBER]:"0.23.5",[J.GO_MODEL]:"0.23.5",[J.GO_SDK]:"0.28.3",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"0.5.0",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:"0.1.0"},jsonifyEarlierVersion:e=>m_.V52.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?tf3(e.apiVersion):void 0,auth:cf3(e.auth),headers:e.headers.map(t=>Win(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>Win(t)),types:ef3(e.types),services:rd(e.services,t=>Of3(t)),webhookGroups:rd(e.webhookGroups,t=>af3(t)),websocketChannels:rd(e.websocketChannels,t=>rf3(t)),errors:rd(e.errors,t=>zf3(t)),pathParameters:e.pathParameters.map(t=>u5a(t)),variables:e.variables.map(t=>mf3(t))})};function ef3(e){return rd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>lqP(r)),userProvidedExamples:t.userProvidedExamples.map(r=>lqP(r)),shape:he.V53.types.Type._visit(t.shape,{union:r=>he.V52.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:wE(i.valueType)})),types:r.types.map(i=>yf3(i))}),enum:he.V52.types.Type.enum,object:r=>he.V52.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:wE(i.valueType)}))}),alias:r=>he.V52.types.Type.alias({aliasOf:wE(r.aliasOf),resolvedType:bf3(r.resolvedType)}),undiscriminatedUnion:r=>he.V52.types.Type.undiscriminatedUnion(gf3(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function tf3(e){return he.V52.ApiVersionScheme.header({...e,header:Win(e.header)})}function rf3(e){return{...e,headers:e.headers.map(t=>Win(t)),queryParameters:e.queryParameters.map(t=>Qhf(t)),pathParameters:e.pathParameters.map(t=>u5a(t)),messages:e.messages.map(t=>if3(t)),examples:e.examples.map(t=>Rf3(t))}}function if3(e){return{...e,body:nf3(e.body)}}function nf3(e){switch(e.type){case"inlinedBody":return he.V52.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:wE(t.valueType)}))});case"reference":return he.V52.websocket.WebSocketMessageBody.reference({...e,bodyType:wE(e.bodyType)})}}function af3(e){return e.map(t=>of3(t))}function of3(e){return{...e,headers:e.headers.map(t=>Win(t)),payload:uf3(e.payload),examples:e.examples!=null?e.examples.map(t=>sf3(t)):void 0}}function uf3(e){switch(e.type){case"reference":return he.V52.webhooks.WebhookPayload.reference({...e,payloadType:wE(e.payloadType)});case"inlinedPayload":return he.V52.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:wE(t.valueType)}))})}}function sf3(e){return{...e,payload:H4(e.payload)}}function cf3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V52.auth.AuthScheme.basic(t);case"bearer":return he.V52.auth.AuthScheme.bearer(t);case"header":return he.V52.auth.AuthScheme.header(lf3(t));case"oauth":return he.V52.auth.AuthScheme.oauth(ff3(t))}})}}function lf3(e){return{...e,valueType:wE(e.valueType)}}function ff3(e){return{...e,configuration:he.V52.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:df3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?pf3(e.configuration.refreshEndpoint):void 0})}}function df3(e){return{...e,requestProperties:{clientId:C1i(e.requestProperties.clientId),clientSecret:C1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?C1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:Fri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Fri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Fri(e.responseProperties.refreshToken):void 0}}}function pf3(e){return{...e,requestProperties:{refreshToken:C1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:Fri(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Fri(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Fri(e.responseProperties.refreshToken):void 0}}}function Win(e){return{...e,valueType:wE(e.valueType)}}function wE(e){return he.V53.types.TypeReference._visit(e,{container:t=>he.V52.types.TypeReference.container(_qP(t)),primitive:t=>he.V52.types.TypeReference.primitive(pqP(t)),named:he.V52.types.TypeReference.named,unknown:he.V52.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function pqP(e){return{v1:_f3(e.v1),v2:e.v2!=null?hf3(e.v2):void 0}}function _f3(e){switch(e){case"FLOAT":return he.V52.types.PrimitiveTypeV1.Double}return e}function hf3(e){switch(e.type){case"integer":return he.V52.types.PrimitiveTypeV2.integer(e);case"double":return he.V52.types.PrimitiveTypeV2.double(e);case"string":return he.V52.types.PrimitiveTypeV2.string(e);case"boolean":return he.V52.types.PrimitiveTypeV2.boolean(e);case"long":return he.V52.types.PrimitiveTypeV2.long(e);case"bigInteger":return he.V52.types.PrimitiveTypeV2.bigInteger(e);case"uint":return he.V52.types.PrimitiveTypeV2.uint();case"uint64":return he.V52.types.PrimitiveTypeV2.uint64();case"date":return;case"dateTime":return;case"uuid":return;case"base64":return;case"float":return;default:Fo(e)}}function _qP(e){return he.V53.types.ContainerType._visit(e,{list:t=>he.V52.types.ContainerType.list(wE(t)),optional:t=>he.V52.types.ContainerType.optional(wE(t)),set:t=>he.V52.types.ContainerType.set(wE(t)),map:({keyType:t,valueType:r})=>he.V52.types.ContainerType.map({keyType:wE(t),valueType:wE(r)}),literal:he.V52.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function yf3(e){return{...e,shape:vf3(e.shape)}}function vf3(e){return he.V53.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V52.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V52.types.SingleUnionTypeProperties.singleProperty({...t,type:wE(t.type)}),noProperties:he.V52.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function bf3(e){return he.V53.types.ResolvedTypeReference._visit(e,{container:t=>he.V52.types.ResolvedTypeReference.container(_qP(t)),named:he.V52.types.ResolvedTypeReference.named,primitive:t=>he.V52.types.ResolvedTypeReference.primitive(pqP(t)),unknown:he.V52.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function gf3(e){return{members:e.members.map(t=>({...t,type:wE(t.type)}))}}function Of3(e){return{...e,pathParameters:e.pathParameters.map(t=>u5a(t)),headers:e.headers.map(t=>Win(t)),endpoints:e.endpoints.map(t=>Pf3(t))}}function u5a(e){return{...e,valueType:wE(e.valueType)}}function mf3(e){return{...e,type:wE(e.type)}}function Pf3(e){return{...e,pagination:e.pagination!=null?Ef3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>u5a(t)),pathParameters:e.pathParameters.map(t=>u5a(t)),sdkRequest:e.sdkRequest!=null?Tf3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?xf3(e.requestBody):void 0,response:e.response!=null?jf3(e.response):void 0,headers:e.headers.map(t=>Win(t)),queryParameters:e.queryParameters.map(t=>Qhf(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:fqP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?fqP(t.example):void 0}))}}function jf3(e){return{...e,body:e.body!=null?wf3(e.body):void 0}}function wf3(e){switch(e.type){case"json":return he.V52.http.HttpResponseBody.json(hqP(e.value));case"fileDownload":return he.V52.http.HttpResponseBody.fileDownload(e);case"text":return he.V52.http.HttpResponseBody.text(e);case"streaming":return he.V52.http.HttpResponseBody.streaming(yqP(e.value));case"streamParameter":return he.V52.http.HttpResponseBody.streamParameter(Df3(e))}}function hqP(e){switch(e.type){case"response":return he.V52.http.JsonResponse.response({...e,responseBodyType:wE(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V52.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:wE(e.responseBodyType),responseProperty:e.responseProperty!=null?Ghf(e.responseProperty):void 0})}}function yqP(e){switch(e.type){case"json":return he.V52.http.StreamingResponse.json({...e,payload:wE(e.payload)});case"text":return he.V52.http.StreamingResponse.text(e);case"sse":return he.V52.http.StreamingResponse.sse({...e,payload:wE(e.payload)})}}function Sf3(e){switch(e.type){case"json":return he.V52.http.NonStreamHttpResponseBody.json(hqP(e.value));case"text":return he.V52.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V52.http.NonStreamHttpResponseBody.fileDownload(e)}}function Df3(e){return{nonStreamResponse:Sf3(e.nonStreamResponse),streamResponse:yqP(e.streamResponse)}}function Ef3(e){switch(e.type){case"cursor":return he.V52.http.Pagination.cursor(Mf3(e));case"offset":return he.V52.http.Pagination.offset(Af3(e))}}function Mf3(e){return{...e,page:C1i(e.page),next:Fri(e.next),results:Fri(e.results)}}function Af3(e){return{...e,page:C1i(e.page),results:Fri(e.results),step:e.step!=null?C1i(e.step):void 0}}function C1i(e){return{...e,property:qf3(e.property)}}function qf3(e){switch(e.type){case"query":return he.V52.RequestPropertyValue.query(Qhf(e));case"body":return he.V52.RequestPropertyValue.body(Ghf(e))}}function Fri(e){return{...e,property:Ghf(e.property)}}function Ghf(e){return{...e,valueType:wE(e.valueType)}}function Qhf(e){return{...e,valueType:wE(e.valueType)}}function Tf3(e){return{...e,streamParameter:e.streamParameter!=null?C1i(e.streamParameter):void 0,shape:Cf3(e.shape)}}function Cf3(e){return he.V53.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V52.http.SdkRequestShape.justRequestBody(Bf3(t)),wrapper:he.V52.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Bf3(e){switch(e.type){case"bytes":return he.V52.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V52.http.SdkRequestBodyType.typeReference({...e,requestBodyType:wE(e.requestBodyType)})}}function xf3(e){return he.V53.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V52.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:wE(r.valueType)}))}),reference:t=>he.V52.http.HttpRequestBody.reference({...t,requestBodyType:wE(t.requestBodyType)}),fileUpload:t=>he.V52.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V52.http.FileUploadRequestProperty.bodyProperty({...r,valueType:wE(r.valueType)});case"file":return he.V52.http.FileUploadRequestProperty.file(If3(r.value))}})}),bytes:t=>he.V52.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function If3(e){switch(e.type){case"file":return he.V52.http.FileProperty.file(e);case"fileArray":return he.V52.http.FileProperty.fileArray(e)}}function zf3(e){return{...e,type:e.type!=null?wE(e.type):void 0,examples:e.examples.map(t=>({...t,shape:H4(t.shape)}))}}function Rf3(e){return{...e,pathParameters:e.pathParameters.map(t=>qJu(t)),headers:e.headers.map(t=>$hf(t)),queryParameters:e.queryParameters.map(t=>vqP(t)),messages:e.messages.map(t=>({...t,body:Nf3(t.body)}))}}function vqP(e){return{...e,value:H4(e.value)}}function $hf(e){return{...e,value:H4(e.value)}}function qJu(e){return{...e,value:H4(e.value)}}function Nf3(e){switch(e.type){case"inlinedBody":return he.V52.ExampleWebSocketMessageBody.inlinedBody(bqP(e));case"reference":return he.V52.ExampleWebSocketMessageBody.reference(H4(e))}}function bqP(e){return{...e,properties:e.properties.map(t=>({...t,value:H4(t.value)}))}}function lqP(e){return{...e,shape:OqP(e.shape)}}function Jhf(e){switch(e.type){case"primitive":return he.V52.ExampleTypeReferenceShape.primitive(Ff3(e));case"container":return he.V52.ExampleTypeReferenceShape.container(Lf3(e));case"unknown":return he.V52.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V52.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:OqP(e.shape)})}}function gqP(e){switch(e.type){case"integer":return he.V52.ExamplePrimitive.integer(e.integer);case"uint":return he.V52.ExamplePrimitive.integer(e.uint);case"uint64":return he.V52.ExamplePrimitive.integer(e.uint64);case"float":return he.V52.ExamplePrimitive.double(e.float);case"double":return he.V52.ExamplePrimitive.double(e.double);case"long":return he.V52.ExamplePrimitive.long(e.long);case"boolean":return he.V52.ExamplePrimitive.boolean(e.boolean);case"string":return he.V52.ExamplePrimitive.string(e.string);case"date":return he.V52.ExamplePrimitive.date(e.date);case"datetime":return he.V52.ExamplePrimitive.datetime(e.datetime);case"uuid":return he.V52.ExamplePrimitive.uuid(e.uuid);case"base64":return he.V52.ExamplePrimitive.string({original:e.base64});case"bigInteger":return he.V52.ExamplePrimitive.string({original:e.bigInteger})}}function Ff3(e){return gqP(e.primitive)}function Lf3(e){switch(e.container.type){case"list":return he.V52.ExampleContainer.list({list:e.container.list.map(t=>H4(t)),itemType:wE(e.container.itemType)});case"set":return he.V52.ExampleContainer.set({set:e.container.set.map(t=>H4(t)),itemType:wE(e.container.itemType)});case"optional":return he.V52.ExampleContainer.optional({optional:e.container.optional!=null?H4(e.container.optional):void 0,valueType:wE(e.container.valueType)});case"map":return he.V52.ExampleContainer.map({map:e.container.map.map(t=>({key:H4(t.key),value:H4(t.value)})),keyType:wE(e.container.keyType),valueType:wE(e.container.valueType)});case"literal":return he.V52.ExampleContainer.literal({literal:gqP(e.container.literal)})}}function H4(e){return{...e,shape:Jhf(e.shape)}}function OqP(e){switch(e.type){case"object":return he.V52.ExampleTypeShape.object({properties:e.properties.map(t=>mqP(t))});case"alias":return he.V52.ExampleTypeShape.alias({value:{...H4(e.value)}});case"enum":return he.V52.ExampleTypeShape.enum(e);case"union":return he.V52.ExampleTypeShape.union(Vf3(e));case"undiscriminatedUnion":return he.V52.ExampleTypeShape.undiscriminatedUnion(Uf3(e))}}function Uf3(e){return{...e,singleUnionType:H4(e.singleUnionType)}}function Vf3(e){return{...e,singleUnionType:Wf3(e.singleUnionType)}}function Wf3(e){return{...e,shape:Hf3(e.shape)}}function Hf3(e){switch(e.type){case"samePropertiesAsObject":return he.V52.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:$f3(e.object)});case"singleProperty":return he.V52.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Jhf(e.shape)});case"noProperties":return he.V52.ExampleSingleUnionTypeProperties.noProperties()}}function $f3(e){return{...e,properties:e.properties.map(t=>mqP(t))}}function mqP(e){return{...e,value:{...e.value,shape:Jhf(e.value.shape)}}}function fqP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>qJu(t)),servicePathParameters:e.servicePathParameters.map(t=>qJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>qJu(t)),serviceHeaders:e.serviceHeaders.map(t=>$hf(t)),endpointHeaders:e.endpointHeaders.map(t=>$hf(t)),queryParameters:e.queryParameters.map(t=>vqP(t)),request:e.request!=null?Jf3(e.request):void 0,response:Gf3(e.response)}}function Gf3(e){switch(e.type){case"error":return he.V52.ExampleResponse.error({...e,body:e.body!=null?H4(e.body):void 0});case"ok":return he.V52.ExampleResponse.ok(Qf3(e))}}function Qf3(e){switch(e.value.type){case"body":return he.V52.ExampleEndpointSuccessResponse.body(e.value.value!=null?H4(e.value.value):void 0);case"stream":return he.V52.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>H4(t)));case"sse":return he.V52.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:H4(t.data)})))}}function Jf3(e){switch(e.type){case"inlinedRequestBody":return he.V52.ExampleRequestBody.inlinedRequestBody(bqP(e));case"reference":return he.V52.ExampleRequestBody.reference(H4(e))}}var PqP={laterVersion:"v54",earlierVersion:"v53",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:We,[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:We},jsonifyEarlierVersion:e=>m_.V53.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:rd(e.services,t=>({...t,endpoints:t.endpoints.map(r=>({...r,response:Kf3(r.response)}))}))})};function Kf3(e){if(e!=null)return{statusCode:e.statusCode,body:e.body?.type==="bytes"?he.V53.HttpResponseBody.fileDownload({docs:void 0}):e.body}}var SqP={laterVersion:"v55",earlierVersion:"v54",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.47.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.47.0",[J.TYPESCRIPT]:"0.47.0",[J.TYPESCRIPT_SDK]:"0.47.0",[J.TYPESCRIPT_EXPRESS]:"0.17.7",[J.JAVA]:We,[J.JAVA_MODEL]:"1.7.0",[J.JAVA_SDK]:"2.16.0",[J.JAVA_SPRING]:"1.5.0",[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"1.10.1",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:"0.3.2"},jsonifyEarlierVersion:e=>m_.V54.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?Xf3(e.apiVersion):void 0,auth:ad3(e.auth),headers:e.headers.map(t=>Hin(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>Hin(t)),types:Yf3(e.types),services:rd(e.services,t=>_d3(t)),webhookGroups:rd(e.webhookGroups,t=>td3(t)),websocketChannels:rd(e.websocketChannels,t=>Zf3(t)),errors:rd(e.errors,t=>qd3(t)),pathParameters:e.pathParameters.map(t=>s5a(t)),variables:e.variables.map(t=>hd3(t)),dynamic:e.dynamic!=null?Wd3(e.dynamic):void 0})};function Yf3(e){return rd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>jqP(r)),userProvidedExamples:t.userProvidedExamples.map(r=>jqP(r)),shape:he.V55.types.Type._visit(t.shape,{union:r=>he.V54.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:qP(i.valueType)})),types:r.types.map(i=>ld3(i))}),enum:he.V54.types.Type.enum,object:r=>he.V54.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:qP(i.valueType)})),extendedProperties:r.extendedProperties?.map(i=>({...i,valueType:qP(i.valueType)}))}),alias:r=>he.V54.types.Type.alias({aliasOf:qP(r.aliasOf),resolvedType:dd3(r.resolvedType)}),undiscriminatedUnion:r=>he.V54.types.Type.undiscriminatedUnion(pd3(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function Xf3(e){return he.V54.ApiVersionScheme.header({...e,header:Hin(e.header)})}function Zf3(e){return{...e,headers:e.headers.map(t=>Hin(t)),queryParameters:e.queryParameters.map(t=>Xhf(t)),pathParameters:e.pathParameters.map(t=>s5a(t)),messages:e.messages.map(t=>kf3(t)),examples:e.examples.map(t=>Td3(t))}}function kf3(e){return{...e,body:ed3(e.body)}}function ed3(e){switch(e.type){case"inlinedBody":return he.V54.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:qP(t.valueType)}))});case"reference":return he.V54.websocket.WebSocketMessageBody.reference({...e,bodyType:qP(e.bodyType)})}}function td3(e){return e.map(t=>rd3(t))}function rd3(e){return{...e,headers:e.headers.map(t=>Hin(t)),payload:id3(e.payload),examples:e.examples!=null?e.examples.map(t=>nd3(t)):void 0}}function id3(e){switch(e.type){case"reference":return he.V54.webhooks.WebhookPayload.reference({...e,payloadType:qP(e.payloadType)});case"inlinedPayload":return he.V54.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:qP(t.valueType)}))})}}function nd3(e){return{...e,payload:q6(e.payload)}}function ad3(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V54.auth.AuthScheme.basic(t);case"bearer":return he.V54.auth.AuthScheme.bearer(t);case"header":return he.V54.auth.AuthScheme.header(od3(t));case"oauth":return he.V54.auth.AuthScheme.oauth(ud3(t))}})}}function od3(e){return{...e,valueType:qP(e.valueType)}}function ud3(e){return{...e,configuration:he.V54.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:sd3(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?cd3(e.configuration.refreshEndpoint):void 0})}}function sd3(e){return{...e,requestProperties:{clientId:B1i(e.requestProperties.clientId),clientSecret:B1i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?B1i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:RVr(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?RVr(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?RVr(e.responseProperties.refreshToken):void 0}}}function cd3(e){return{...e,requestProperties:{refreshToken:B1i(e.requestProperties.refreshToken)},responseProperties:{accessToken:RVr(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?RVr(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?RVr(e.responseProperties.refreshToken):void 0}}}function Hin(e){return{...e,valueType:qP(e.valueType)}}function qP(e){return e.type==="container"&&e.container.type==="nullable"?rp3(e.container.nullable):e.type==="container"&&e.container.type==="optional"?tp3(e.container.optional):he.V55.types.TypeReference._visit(e,{container:t=>he.V54.types.TypeReference.container(EqP(t)),primitive:t=>he.V54.types.TypeReference.primitive(DqP(t)),named:he.V54.types.TypeReference.named,unknown:he.V54.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function DqP(e){return{v1:e.v1,v2:e.v2!=null?e.v2:void 0}}function EqP(e){return he.V55.types.ContainerType._visit(e,{list:t=>he.V54.types.ContainerType.list(qP(t)),optional:t=>he.V54.types.ContainerType.optional(qP(t)),nullable:t=>he.V54.types.ContainerType.optional(qP(t)),set:t=>he.V54.types.ContainerType.set(qP(t)),map:({keyType:t,valueType:r})=>he.V54.types.ContainerType.map({keyType:qP(t),valueType:qP(r)}),literal:he.V54.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function ld3(e){return{...e,shape:fd3(e.shape)}}function fd3(e){return he.V55.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V54.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V54.types.SingleUnionTypeProperties.singleProperty({...t,type:qP(t.type)}),noProperties:he.V54.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function dd3(e){return he.V55.types.ResolvedTypeReference._visit(e,{container:t=>he.V54.types.ResolvedTypeReference.container(EqP(t)),named:he.V54.types.ResolvedTypeReference.named,primitive:t=>he.V54.types.ResolvedTypeReference.primitive(DqP(t)),unknown:he.V54.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function pd3(e){return{members:e.members.map(t=>({...t,type:qP(t.type)}))}}function _d3(e){return{...e,pathParameters:e.pathParameters.map(t=>s5a(t)),headers:e.headers.map(t=>Hin(t)),endpoints:e.endpoints.map(t=>yd3(t))}}function s5a(e){return{...e,valueType:qP(e.valueType)}}function hd3(e){return{...e,type:qP(e.type)}}function yd3(e){return{...e,pagination:e.pagination!=null?md3(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>s5a(t)),pathParameters:e.pathParameters.map(t=>s5a(t)),sdkRequest:e.sdkRequest!=null?Sd3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Md3(e.requestBody):void 0,response:e.response!=null?vd3(e.response):void 0,headers:e.headers.map(t=>Hin(t)),queryParameters:e.queryParameters.map(t=>Xhf(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:wqP(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?wqP(t.example):void 0}))}}function vd3(e){return{...e,body:e.body!=null?bd3(e.body):void 0}}function bd3(e){switch(e.type){case"json":return he.V54.http.HttpResponseBody.json(MqP(e.value));case"fileDownload":return he.V54.http.HttpResponseBody.fileDownload(e);case"bytes":return he.V54.http.HttpResponseBody.bytes(e);case"text":return he.V54.http.HttpResponseBody.text(e);case"streaming":return he.V54.http.HttpResponseBody.streaming(AqP(e.value));case"streamParameter":return he.V54.http.HttpResponseBody.streamParameter(Od3(e));default:Fo(e)}}function MqP(e){switch(e.type){case"response":return he.V54.http.JsonResponse.response({...e,responseBodyType:qP(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V54.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:qP(e.responseBodyType),responseProperty:e.responseProperty!=null?Yhf(e.responseProperty):void 0})}}function AqP(e){switch(e.type){case"json":return he.V54.http.StreamingResponse.json({...e,payload:qP(e.payload)});case"text":return he.V54.http.StreamingResponse.text(e);case"sse":return he.V54.http.StreamingResponse.sse({...e,payload:qP(e.payload)})}}function gd3(e){switch(e.type){case"json":return he.V54.http.NonStreamHttpResponseBody.json(MqP(e.value));case"bytes":return he.V54.http.NonStreamHttpResponseBody.bytes(e);case"text":return he.V54.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V54.http.NonStreamHttpResponseBody.fileDownload(e);default:Fo(e)}}function Od3(e){return{nonStreamResponse:gd3(e.nonStreamResponse),streamResponse:AqP(e.streamResponse)}}function md3(e){switch(e.type){case"cursor":return he.V54.http.Pagination.cursor(Pd3(e));case"offset":return he.V54.http.Pagination.offset(jd3(e))}}function Pd3(e){return{...e,page:B1i(e.page),next:RVr(e.next),results:RVr(e.results)}}function jd3(e){return{...e,page:B1i(e.page),results:RVr(e.results),step:e.step!=null?B1i(e.step):void 0,hasNextPage:e.hasNextPage!=null?RVr(e.hasNextPage):void 0}}function B1i(e){return{...e,property:wd3(e.property)}}function wd3(e){switch(e.type){case"query":return he.V54.RequestPropertyValue.query(Xhf(e));case"body":return he.V54.RequestPropertyValue.body(Yhf(e))}}function RVr(e){return{...e,property:Yhf(e.property)}}function Yhf(e){return{...e,valueType:qP(e.valueType)}}function Xhf(e){return{...e,valueType:qP(e.valueType)}}function Sd3(e){return{...e,streamParameter:e.streamParameter!=null?B1i(e.streamParameter):void 0,shape:Dd3(e.shape)}}function Dd3(e){return he.V55.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V54.http.SdkRequestShape.justRequestBody(Ed3(t)),wrapper:he.V54.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Ed3(e){switch(e.type){case"bytes":return he.V54.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V54.http.SdkRequestBodyType.typeReference({...e,requestBodyType:qP(e.requestBodyType)})}}function Md3(e){return he.V55.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V54.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:qP(r.valueType)})),extendedProperties:t.extendedProperties?.map(r=>({...r,valueType:qP(r.valueType)}))}),reference:t=>he.V54.http.HttpRequestBody.reference({...t,requestBodyType:qP(t.requestBodyType)}),fileUpload:t=>he.V54.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V54.http.FileUploadRequestProperty.bodyProperty({...r,valueType:qP(r.valueType)});case"file":return he.V54.http.FileUploadRequestProperty.file(Ad3(r.value))}})}),bytes:t=>he.V54.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Ad3(e){switch(e.type){case"file":return he.V54.http.FileProperty.file(e);case"fileArray":return he.V54.http.FileProperty.fileArray(e)}}function qd3(e){return{...e,type:e.type!=null?qP(e.type):void 0,examples:e.examples.map(t=>({...t,shape:q6(t.shape)}))}}function Td3(e){return{...e,pathParameters:e.pathParameters.map(t=>TJu(t)),headers:e.headers.map(t=>Khf(t)),queryParameters:e.queryParameters.map(t=>qqP(t)),messages:e.messages.map(t=>({...t,body:Cd3(t.body)}))}}function qqP(e){return{...e,value:q6(e.value)}}function Khf(e){return{...e,value:q6(e.value)}}function TJu(e){return{...e,value:q6(e.value)}}function Cd3(e){switch(e.type){case"inlinedBody":return he.V54.ExampleWebSocketMessageBody.inlinedBody(TqP(e));case"reference":return he.V54.ExampleWebSocketMessageBody.reference(q6(e))}}function TqP(e){return{...e,properties:e.properties.map(t=>({...t,value:q6(t.value)}))}}function jqP(e){return{...e,shape:CqP(e.shape)}}function Zhf(e){switch(e.type){case"primitive":return he.V54.ExampleTypeReferenceShape.primitive(Bd3(e));case"container":return he.V54.ExampleTypeReferenceShape.container(xd3(e));case"unknown":return he.V54.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V54.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:CqP(e.shape)})}}function Bd3(e){return e.primitive}function xd3(e){switch(e.container.type){case"list":return he.V54.ExampleContainer.list({list:e.container.list.map(t=>q6(t)),itemType:qP(e.container.itemType)});case"set":return he.V54.ExampleContainer.set({set:e.container.set.map(t=>q6(t)),itemType:qP(e.container.itemType)});case"optional":return he.V54.ExampleContainer.optional({optional:e.container.optional!=null?q6(e.container.optional):void 0,valueType:qP(e.container.valueType)});case"nullable":return he.V54.ExampleContainer.optional({optional:e.container.nullable!=null?q6(e.container.nullable):void 0,valueType:qP(e.container.valueType)});case"map":return he.V54.ExampleContainer.map({map:e.container.map.map(t=>({key:q6(t.key),value:q6(t.value)})),keyType:qP(e.container.keyType),valueType:qP(e.container.valueType)});case"literal":return he.V54.ExampleContainer.literal({literal:e.container.literal})}}function q6(e){return{...e,shape:Zhf(e.shape)}}function CqP(e){switch(e.type){case"object":return he.V54.ExampleTypeShape.object({properties:e.properties.map(t=>BqP(t))});case"alias":return he.V54.ExampleTypeShape.alias({value:{...q6(e.value)}});case"enum":return he.V54.ExampleTypeShape.enum(e);case"union":return he.V54.ExampleTypeShape.union(zd3(e));case"undiscriminatedUnion":return he.V54.ExampleTypeShape.undiscriminatedUnion(Id3(e))}}function Id3(e){return{...e,singleUnionType:q6(e.singleUnionType)}}function zd3(e){return{...e,singleUnionType:Rd3(e.singleUnionType)}}function Rd3(e){return{...e,shape:Nd3(e.shape)}}function Nd3(e){switch(e.type){case"samePropertiesAsObject":return he.V54.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:Fd3(e.object)});case"singleProperty":return he.V54.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Zhf(e.shape)});case"noProperties":return he.V54.ExampleSingleUnionTypeProperties.noProperties()}}function Fd3(e){return{...e,properties:e.properties.map(t=>BqP(t))}}function BqP(e){return{...e,value:{...e.value,shape:Zhf(e.value.shape)}}}function wqP(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>TJu(t)),servicePathParameters:e.servicePathParameters.map(t=>TJu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>TJu(t)),serviceHeaders:e.serviceHeaders.map(t=>Khf(t)),endpointHeaders:e.endpointHeaders.map(t=>Khf(t)),queryParameters:e.queryParameters.map(t=>qqP(t)),request:e.request!=null?Vd3(e.request):void 0,response:Ld3(e.response)}}function Ld3(e){switch(e.type){case"error":return he.V54.ExampleResponse.error({...e,body:e.body!=null?q6(e.body):void 0});case"ok":return he.V54.ExampleResponse.ok(Ud3(e))}}function Ud3(e){switch(e.value.type){case"body":return he.V54.ExampleEndpointSuccessResponse.body(e.value.value!=null?q6(e.value.value):void 0);case"stream":return he.V54.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>q6(t)));case"sse":return he.V54.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:q6(t.data)})))}}function Vd3(e){switch(e.type){case"inlinedRequestBody":return he.V54.ExampleRequestBody.inlinedRequestBody(TqP(e));case"reference":return he.V54.ExampleRequestBody.reference(q6(e))}}function Wd3(e){return{...e,types:rd(e.types,t=>Hd3(t)),endpoints:rd(e.endpoints,t=>$d3(t)),headers:e.headers?.map(t=>g6t(t))}}function Hd3(e){switch(e.type){case"alias":return he.V54.dynamic.NamedType.alias({...e,typeReference:NAe(e.typeReference)});case"enum":return he.V54.dynamic.NamedType.enum(e);case"object":return he.V54.dynamic.NamedType.object({...e,properties:e.properties.map(t=>g6t(t))});case"discriminatedUnion":return he.V54.dynamic.NamedType.discriminatedUnion({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,Qd3(r)]))});case"undiscriminatedUnion":return he.V54.dynamic.NamedType.undiscriminatedUnion({...e,types:e.types.map(t=>NAe(t))});default:Fo(e)}}function $d3(e){return{...e,auth:e.auth!=null?Gd3(e.auth):void 0,request:Jd3(e.request)}}function Gd3(e){switch(e.type){case"basic":return he.V54.dynamic.Auth.basic(e);case"bearer":return he.V54.dynamic.Auth.bearer(e);case"header":return he.V54.dynamic.Auth.header({header:g6t(e.header)})}}function NAe(e){switch(e.type){case"list":return he.V54.dynamic.TypeReference.list(NAe(e.value));case"optional":return np3(e.value);case"nullable":return ip3(e.value);case"map":return he.V54.dynamic.TypeReference.map({...e,key:NAe(e.key),value:NAe(e.value)});case"literal":return he.V54.dynamic.TypeReference.literal(e.value);case"named":return he.V54.dynamic.TypeReference.named(e.value);case"primitive":return he.V54.dynamic.TypeReference.primitive(e.value);case"set":return he.V54.dynamic.TypeReference.set(NAe(e.value));case"unknown":return he.V54.dynamic.TypeReference.unknown();default:Fo(e)}}function Qd3(e){switch(e.type){case"samePropertiesAsObject":return he.V54.dynamic.SingleDiscriminatedUnionType.samePropertiesAsObject({...e,properties:e.properties.map(t=>g6t(t))});case"singleProperty":return he.V54.dynamic.SingleDiscriminatedUnionType.singleProperty({...e,typeReference:NAe(e.typeReference),properties:e.properties?.map(t=>g6t(t))});case"noProperties":return he.V54.dynamic.SingleDiscriminatedUnionType.noProperties({...e,properties:e.properties?.map(t=>g6t(t))});default:Fo(e)}}function g6t(e){return{...e,typeReference:NAe(e.typeReference)}}function Jd3(e){switch(e.type){case"body":return he.V54.dynamic.Request.body(Kd3(e));case"inlined":return he.V54.dynamic.Request.inlined(Yd3(e));default:Fo(e)}}function Kd3(e){return{pathParameters:e.pathParameters?.map(t=>g6t(t)),body:e.body!=null?xqP(e.body):void 0}}function Yd3(e){return{...e,pathParameters:e.pathParameters?.map(t=>g6t(t)),queryParameters:e.queryParameters?.map(t=>g6t(t)),headers:e.headers?.map(t=>g6t(t)),body:e.body!=null?Xd3(e.body):void 0}}function Xd3(e){switch(e.type){case"properties":return he.V54.dynamic.InlinedRequestBody.properties(e.value.map(t=>g6t(t)));case"referenced":return he.V54.dynamic.InlinedRequestBody.referenced(Zd3(e));case"fileUpload":return he.V54.dynamic.InlinedRequestBody.fileUpload(kd3(e));default:Fo(e)}}function Zd3(e){return{...e,bodyType:xqP(e.bodyType)}}function xqP(e){switch(e.type){case"bytes":return he.V54.dynamic.ReferencedRequestBodyType.bytes();case"typeReference":return he.V54.dynamic.ReferencedRequestBodyType.typeReference(NAe(e.value));default:Fo(e)}}function kd3(e){return{properties:e.properties.map(t=>ep3(t))}}function ep3(e){switch(e.type){case"file":return he.V54.dynamic.FileUploadRequestBodyProperty.file(e);case"fileArray":return he.V54.dynamic.FileUploadRequestBodyProperty.fileArray(e);case"bodyProperty":return he.V54.dynamic.FileUploadRequestBodyProperty.bodyProperty(g6t(e));default:Fo(e)}}function tp3(e){return e.type==="container"&&e.container.type==="nullable"?he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(qP(e.container.nullable))):he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(qP(e)))}function rp3(e){return e.type==="container"&&e.container.type==="optional"?qP(e):he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(qP(e)))}function ip3(e){return e.type==="optional"?NAe(e):he.V54.dynamic.TypeReference.optional(NAe(e))}function np3(e){return e.type==="nullable"?he.V54.dynamic.TypeReference.optional(NAe(e.value)):he.V54.dynamic.TypeReference.optional(NAe(e))}var IqP={laterVersion:"v56",earlierVersion:"v55",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:We,[J.TYPESCRIPT_BROWSER_SDK]:We,[J.TYPESCRIPT]:We,[J.TYPESCRIPT_SDK]:We,[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:We,[J.GO_MODEL]:We,[J.GO_SDK]:We,[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:"0.0.2",[J.CSHARP_SDK]:"1.12.0-rc0",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:We},jsonifyEarlierVersion:e=>m_.V55.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:rd(e.services,t=>ap3(t))})};function ap3(e){return{...e,endpoints:e.endpoints.map(t=>op3(t))}}function op3(e){return{...e,pagination:up3(e.pagination)}}function up3(e){if(e!=null)switch(e.type){case"cursor":return he.V55.http.Pagination.cursor({next:e.next,page:e.page,results:e.results});case"offset":return he.V55.http.Pagination.offset({hasNextPage:e.hasNextPage,page:e.page,results:e.results,step:e.step});case"custom":return;default:Fo(e)}}var zqP={laterVersion:"v57",earlierVersion:"v56",firstGeneratorVersionToConsumeNewIR:{[J.TYPESCRIPT_NODE_SDK]:"0.49.0",[J.TYPESCRIPT_BROWSER_SDK]:"0.49.0",[J.TYPESCRIPT]:"0.49.0",[J.TYPESCRIPT_SDK]:"0.49.0",[J.TYPESCRIPT_EXPRESS]:We,[J.JAVA]:We,[J.JAVA_MODEL]:We,[J.JAVA_SDK]:We,[J.JAVA_SPRING]:We,[J.PYTHON_FASTAPI]:We,[J.PYTHON_PYDANTIC]:We,[J.OPENAPI_PYTHON_CLIENT]:We,[J.OPENAPI]:We,[J.STOPLIGHT]:We,[J.POSTMAN]:We,[J.PYTHON_SDK]:We,[J.GO_FIBER]:"0.23.6",[J.GO_MODEL]:"0.23.6",[J.GO_SDK]:"0.37.0",[J.RUBY_MODEL]:We,[J.RUBY_SDK]:We,[J.CSHARP_MODEL]:We,[J.CSHARP_SDK]:"1.12.0-rc11",[J.SWIFT_MODEL]:We,[J.SWIFT_SDK]:ri,[J.PHP_MODEL]:ri,[J.PHP_SDK]:"0.14.1"},jsonifyEarlierVersion:e=>m_.V56.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,dynamic:e.dynamic!=null?sp3(e.dynamic):void 0})};function sp3(e){return{...e,endpoints:cp3(e.endpoints)}}function cp3(e){return rd(e,t=>lp3(t))}function lp3(e){return{...e,auth:e.auth!=null?pp3(e.auth):void 0,examples:e.examples!=null?fp3(e.examples):void 0}}function fp3(e){return e.map(t=>dp3(t))}function dp3(e){return{...e,auth:e.auth!=null?_p3(e.auth):void 0}}function pp3(e){switch(e.type){case"basic":return he.V56.dynamic.Auth.basic(e);case"bearer":return he.V56.dynamic.Auth.bearer(e);case"header":return he.V56.dynamic.Auth.header(e);case"oauth":return;default:Fo(e)}}function _p3(e){switch(e.type){case"basic":return he.V56.dynamic.AuthValues.basic(e);case"bearer":return he.V56.dynamic.AuthValues.bearer(e);case"header":return he.V56.dynamic.AuthValues.header(e);case"oauth":return;default:Fo(e)}}function c5a(){return yp3}var CJu=class{migrations;constructor(t){this.migrations=t}withMigration(t){return new khf([...this.migrations,t])}},khf=class extends CJu{build(){return new eyf(this.migrations)}},eyf=class{migrations;constructor(t){this.migrations=t}migrateForGenerator({intermediateRepresentation:t,context:r,targetGenerator:i}){return this.migrate({intermediateRepresentation:t,shouldMigrate:n=>this.shouldRunMigration({migration:n,targetGenerator:i}),context:r,targetGenerator:i})}migrateThroughMigration({migration:t,intermediateRepresentation:r,context:i,targetGenerator:n}){return this.migrateThroughVersion({version:t.earlierVersion,intermediateRepresentation:r,context:i,targetGenerator:n})}migrateThroughVersion({version:t,intermediateRepresentation:r,context:i,targetGenerator:n}){let a=!1;if(this.migrations[0]?.laterVersion===t)return{ir:r,jsonify:()=>Promise.resolve().then(()=>a_.IntermediateRepresentation.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}))};let l=this.migrate({intermediateRepresentation:r,shouldMigrate:d=>{let s=d.earlierVersion===t;return a||=s,s||!a},context:i,targetGenerator:n});return a||i.failAndThrow(`IR ${t} does not exist`),l}migrate({intermediateRepresentation:t,shouldMigrate:r,context:i,targetGenerator:n}){let a=t,u=async()=>await a_.IntermediateRepresentation.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"});for(let l of this.migrations){if(!r(l))break;i.logger.debug(`Migrating IR from ${l.laterVersion} to ${l.earlierVersion}`),a=l.migrateBackwards(a,{taskContext:i,targetGenerator:n}),u=()=>Promise.resolve().then(()=>l.jsonifyEarlierVersion(a))}return{ir:a,jsonify:u}}shouldRunMigration({migration:t,targetGenerator:r}){let i=t.firstGeneratorVersionToConsumeNewIR[r.name];if(i==null)throw new Error(`Cannot migrate intermediate representation. Unrecognized generator: ${r.name}. If leveraging a custom generator, ensure you are specifying "ir-version" within the generator configuration.`);switch(i){case We:return!0;case ri:throw new Error(`Cannot migrate intermediate representation. Generator was created after intermediate representation ${t.laterVersion}.`)}return Pie(i,r.version)}getIRVersionForGenerator({targetGenerator:t}){let r=this.migrations[0]?.laterVersion;for(let i of this.migrations)if(this.shouldRunMigration({migration:i,targetGenerator:t}))r=i.earlierVersion;else break;return r}},hp3={Builder:new CJu([])},yp3=hp3.Builder.withMigration(zqP).withMigration(IqP).withMigration(SqP).withMigration(PqP).withMigration(dqP).withMigration(eqP).withMigration(QAP).withMigration(UAP).withMigration(LAP).withMigration(NAP).withMigration(RAP).withMigration(xAP).withMigration(TAP).withMigration(qAP).withMigration(MAP).withMigration(EAP).withMigration(DAP).withMigration(SAP).withMigration(wAP).withMigration(jAP).withMigration(PAP).withMigration(mAP).withMigration(OAP).withMigration(gAP).withMigration(bAP).withMigration(yAP).withMigration(_AP).withMigration(pAP).withMigration(dAP).withMigration(aAP).withMigration(nAP).withMigration(iAP).withMigration(tAP).withMigration(eAP).withMigration(blg).withMigration(hlg).withMigration(_lg).withMigration(flg).withMigration(clg).withMigration(ulg).withMigration(olg).withMigration(alg).withMigration(rlg).withMigration(kcg).withMigration(Zcg).withMigration(Xcg).withMigration(Kcg).withMigration(Jcg).withMigration(Qcg).withMigration(Wcg).withMigration(Lcg).withMigration(Fcg).withMigration(Ncg).withMigration(wcg).withMigration(mcg).withMigration(Rb_).build();function l5a({intermediateRepresentation:e,context:t,targetGenerator:r}){return c5a().migrateForGenerator({intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function tyf({intermediateRepresentation:e,context:t,targetGenerator:r,irVersion:i}){return c5a().migrateThroughVersion({version:i,intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function f5a({intermediateRepresentation:e,context:t,version:r}){return c5a().migrateThroughVersion({version:r,intermediateRepresentation:e,context:t}).jsonify()}async function NqP({project:e,irFilepath:t,cliContext:r,generationLanguage:i,audiences:n,version:a,keywords:u,smartCasing:l,readme:d,directFromOpenapi:s}){await Promise.all(e.apiWorkspaces.map(async o=>{await r.runTaskForWorkspace(o,async c=>{r.logger.info(`Generating IR for workspace ${o.workspaceName??"api"}`);let b=await vp3({workspace:o,context:c,generationLanguage:i,keywords:u,smartCasing:l,disableExamples:!1,audiences:n,version:a,readme:d,directFromOpenapi:s}),g=RqP.default.resolve(t);await xGr(Wl.of(g),b),c.logger.info(`Wrote IR to ${g}`)})}))}async function vp3({workspace:e,context:t,generationLanguage:r,audiences:i,keywords:n,smartCasing:a,disableExamples:u,version:l,readme:d,directFromOpenapi:s}){let o;if(s&&e instanceof B7)o=await e.getIntermediateRepresentation({context:t});else{let c=await e.toFernWorkspace({context:t});o=await tMn({workspace:c,context:t,generationLanguage:r,audiences:i,keywords:n,smartCasing:a,disableExamples:u,readme:d,includeDynamicExamples:!1})}return l==null?a_.IntermediateRepresentation.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}):f5a({intermediateRepresentation:o,version:l,context:t})}var FqP=require("fs/promises"),LqP=yi(require("path"),1);async function UqP({project:e,outputFilepath:t,cliContext:r}){await Promise.all(e.apiWorkspaces.map(async i=>{await r.runTaskForWorkspace(i,async n=>{let a=await _ba(i,n),u=LqP.default.resolve(t);await(0,FqP.writeFile)(u,await RGr(a,{pretty:!0})),n.logger.info(`Wrote FDR API definition to ${u}`)})}))}var VqP=require("fs/promises"),WqP=yi(require("path"),1);async function HqP({project:e,irFilepath:t,cliContext:r,sdkLanguage:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await r.runTaskForWorkspace(n,async a=>{if(n instanceof wpi){a.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(n instanceof B7))return;let u=new U5t(n.absoluteFilePath),l=await qze({context:a,specs:n.specs}),d=YRi({context:a,documents:await u.loadDocuments({context:a,specs:l})}),s=WqP.default.resolve(t),o=await uv.OpenApiIntermediateRepresentation.jsonOrThrow(d,{skipValidation:!0});await(0,VqP.writeFile)(s,await RGr(o,{pretty:!0})),a.logger.info(`Wrote IR to ${s}`)})}))}var BJu=require("fs/promises");async function GqP({project:e,includeModels:t,cliContext:r}){await Promise.all(e.apiWorkspaces.map(async i=>{await r.runTaskForWorkspace(i,async n=>{i instanceof B7?await gp3({workspace:i,context:n,includeModels:t}):n.logger.warn("Skipping fern workspace definition generation")})}))}async function bp3(e,t){let r=null;try{let i=(await(0,BJu.readFile)(e,"utf8")).toString();try{r=JSON.parse(i)}catch{r=Kd.load(i,{json:!0})}}catch{return t.failAndThrow(`Failed to read OpenAPI overrides from file ${e}`)}return r}async function gp3({workspace:e,includeModels:t,context:r}){let i=new U5t(e.absoluteFilePath),n=await qze({context:r,specs:e.specs});for(let a of n){let u=YRi({context:r,documents:await i.loadDocuments({context:r,specs:[a]})}),l={};a.absoluteFilepathToOverrides!==void 0&&(l=await bp3(a.absoluteFilepathToOverrides,r));let d="path"in l?l.path:{};for(let c of u.endpoints){let b=i_a(c);c.path in d||(d[c.path]={});let g=d[c.path];if(g!=null&&g[c.method]==null){let O=b.file.split("/").map(w=>w.replace(".yml","")).filter(w=>w!=="__package__"),m={};O.length>0&&(m["x-fern-sdk-group-name"]=O),m["x-fern-sdk-method-name"]=b.endpointId,g[c.method.toLowerCase()]=m}else l==null&&r.logger.warn(`Endpoint ${c.path} ${c.method} is defined multiple times`)}let s="path"in l?l.path:{};if(t){$qP(s,u.groupedSchemas.rootSchemas);for(let[c,b]of Object.entries(u.groupedSchemas.namespacedSchemas))$qP(s,b)}let o={schemas:s};await(0,BJu.writeFile)(Xu(_p(a.absoluteFilepath),Xa.of("openapi-overrides.yml")),Kd.dump({paths:d,components:o}))}}function $qP(e,t){for(let[r,i]of Object.entries(t)){if(r in e)continue;let n={};n["x-fern-type-name"]="nameOverride"in i?i.nameOverride??r:r,e[r]=n}}var xJu="api",QqP="group";var JqP=".preview",KqP="approved-output-directories",YqP=".fern";var rTP=require("fs/promises");var ZqP=require("fs/promises");var XqP=require("os");function d5a(){return Xu(Wl.of((0,XqP.homedir)()),Xa.of(YqP),Xa.of(KqP))}async function kqP(){let e=d5a();if(!await Cf(e))return[];let r=await(0,ZqP.readFile)(e,{encoding:"utf-8"});return JSON.parse(r)}var IJu=require("fs/promises"),eTP=yi(require("path"),1);async function tTP(e){await(0,IJu.mkdir)(eTP.default.dirname(d5a()),{recursive:!0}),await(0,IJu.writeFile)(d5a(),JSON.stringify(e,null,2))}async function iTP(e,t,r){if(!e||sys()||r)return{shouldProceed:!0};let i=await kqP();return i?.includes(e)?{shouldProceed:!0}:await Cf(e)?(await(0,rTP.readdir)(e)).length===0?{shouldProceed:!0}:await t.confirmPrompt(`Directory ${e} contains existing files that may be overwritten. Continue?`,!1)?(await tTP([...i??[],e]),{shouldProceed:!0}):{shouldProceed:!1}:{shouldProceed:!0}}var wRP=yi(Lg(),1),i2t=yi(ORP(),1),GAe=yi($q(),1);var K1i=yi(require("path"),1),onn="/fern",unn=K1i.default.join(onn,"output"),Ovf=K1i.default.join(onn,"config.json"),iYu=K1i.default.join(onn,"ir.json"),B5a=K1i.default.join(onn,"snippet.json"),x5a=K1i.default.join(onn,"snippet-templates.json"),K3V=K1i.default.join(onn,"generators"),mRP=K1i.default.join(onn,"sources");var xO3="0.0.1";function PRP(e){return e!=null?wRP.GithubPublishInfo._visit(e,{npm:t=>i2t.FernGeneratorExec.GithubPublishInfo.npm({registryUrl:t.registryUrl,packageName:t.packageName,tokenEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.token??"")}),maven:t=>i2t.FernGeneratorExec.GithubPublishInfo.maven({registryUrl:t.registryUrl,coordinate:t.coordinate,usernameEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.password??""),signature:t.signature!=null?{keyIdEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.signature.keyId??""),passwordEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.signature.password??""),secretKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.signature.secretKey??"")}:void 0}),pypi:t=>i2t.FernGeneratorExec.GithubPublishInfo.pypi({registryUrl:t.registryUrl,packageName:t.packageName,usernameEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.credentials?.password??"")}),rubygems:t=>i2t.FernGeneratorExec.GithubPublishInfo.rubygems({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.apiKey??"")}),postman:t=>i2t.FernGeneratorExec.GithubPublishInfo.postman({apiKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.apiKey??""),workspaceIdEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.workspaceId??"")}),nuget:t=>i2t.FernGeneratorExec.GithubPublishInfo.nuget({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,GAe.EnvironmentVariable)(t.apiKey??"")}),_other:()=>{}}):void 0}function SRP({generatorInvocation:e,customConfig:t,workspaceName:r,organization:i,outputVersion:n=xO3,absolutePathToSnippet:a,absolutePathToSnippetTemplates:u,writeUnitTests:l,generateOauthClients:d,generatePaginatedClients:s}){let o=[],c=e.outputMode._visit({publish:b=>({...jRP(n,b),publishingMetadata:e.publishMetadata}),publishV2:b=>({...jRP(n,b),publishingMetadata:e.publishMetadata}),downloadFiles:()=>({mode:i2t.FernGeneratorExec.OutputMode.downloadFiles(),path:unn,publishingMetadata:e.publishMetadata}),github:b=>{let g={mode:i2t.FernGeneratorExec.OutputMode.github({repoUrl:`https://github.com/${b.owner}/${b.repo}`,version:n,publishInfo:PRP(b.publishInfo),installationToken:void 0}),path:unn,publishingMetadata:e.publishMetadata};return a!==void 0&&(o.push(`${a}:${B5a}`),g.snippetFilepath=B5a),u!==void 0&&(o.push(`${u}:${x5a}`),g.snippetTemplateFilepath=x5a),g},githubV2:b=>{let g=b._visit({commitAndRelease:m=>`https://github.com/${m.owner}/${m.repo}`,push:m=>`https://github.com/${m.owner}/${m.repo}`,pullRequest:m=>`https://github.com/${m.owner}/${m.repo}`,_other:()=>{throw new Error("Encountered unknown github mode")}}),O={mode:i2t.FernGeneratorExec.OutputMode.github({repoUrl:g,version:n,publishInfo:PRP(b.publishInfo)}),path:unn,publishingMetadata:e.publishMetadata};return a!==void 0&&(o.push(`${a}:${B5a}`),O.snippetFilepath=B5a),u!==void 0&&(o.push(`${u}:${x5a}`),O.snippetTemplateFilepath=x5a),O},_other:()=>{throw new Error("Output type did not match any of the types supported by Fern")}});return{binds:o,config:{irFilepath:iYu,output:c,publish:void 0,customConfig:t,workspaceName:r,organization:i,environment:i2t.FernGeneratorExec.GeneratorEnvironment.local(),dryRun:!1,whitelabel:!1,writeUnitTests:l,generateOauthClients:d,generatePaginatedClients:s}}}function jRP(e,t){let r;return"registryOverrides"in t?r=t.registryOverrides.maven??t.registryOverrides.npm:r!=null&&(r=t._visit({mavenOverride:i=>i,npmOverride:i=>i,pypiOverride:i=>i,rubyGemsOverride:i=>i,postman:i=>i,nugetOverride:i=>i,_other:()=>{}})),{mode:i2t.FernGeneratorExec.OutputMode.publish({registries:{maven:{group:"",password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??""},npm:{registryUrl:r?.registryUrl??"",scope:"",token:r?.token??""}},publishTarget:void 0,registriesV2:{maven:{password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??"",coordinate:r?.coordinate??"",signature:r?.signature},npm:{registryUrl:r?.registryUrl??"",token:r?.token??"",packageName:r?.packageName??""},pypi:{packageName:r?.coordinate??"",password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??"",pypiMetadata:r?.pypiMetadata},rubygems:{registryUrl:r?.registryUrl??"",apiKey:r?.apiKey??"",packageName:r?.packageName??""},nuget:{registryUrl:r?.registryUrl??"",apiKey:r?.apiKey??"",packageName:r?.packageName??""}},version:e}),path:unn}}async function DRP({workspace:e,audiences:t,generatorInvocation:r,context:i,irVersionOverride:n,version:a,packageName:u,sourceConfig:l,includeOptionalRequestPropertyExamples:d}){let s=C2({workspace:e,audiences:t,generationLanguage:r.language,keywords:r.keywords,smartCasing:r.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:d,disabled:r.disableExamples},readme:r.readme,version:a,packageName:u,context:i,sourceResolver:new q2(i,e),includeDynamicExamples:!0});l!=null&&(s.sourceConfig=l),i.logger.debug("Generated IR");let o=n!=null?await f5a({intermediateRepresentation:s,context:i,version:n}):await l5a({intermediateRepresentation:s,context:i,targetGenerator:{name:r.name,version:r.version}});return{latest:s,migrated:o}}var TRP=require("fs/promises"),bHn=yi(Lte(),1);var ERP=require("fs/promises"),MRP=yi(Lte(),1);async function mvf({logger:e,imageName:t,args:r=[],binds:i=[],writeLogsToFile:n=!0,removeAfterCompletion:a=!1}){let u=()=>IO3({logger:e,imageName:t,args:r,binds:i,removeAfterCompletion:a,writeLogsToFile:n});try{await u()}catch(l){if(l instanceof Error&&l.message.includes("No such image"))await zO3(t),await u();else throw l}}async function IO3({logger:e,imageName:t,args:r,binds:i,removeAfterCompletion:n,writeLogsToFile:a}){let u=["run","--user","root",...i.flatMap(c=>["-v",c]),n?"--rm":"",t,...r].filter(Boolean),{stdout:l,stderr:d,exitCode:s}=await SG(e,"docker",u,{reject:!1,all:!0,doNotPipeOutput:!0}),o=l+d;if(a){let c=await MRP.default.file();await(0,ERP.writeFile)(c.path,o),e.info(`Generator logs here: ${c.path}`)}if(s!==0)throw new Error(`Docker exited with code ${s}.
1997
1997
  ${l}
1998
1998
  ${d}`)}async function zO3(e){await SG(void 0,"docker",["pull",e],{all:!0,doNotPipeOutput:!0})}var CRP=yi(Vf(),1);var ARP=yi(r6o(),1),Ije=require("fs/promises"),qRP=yi(Lte(),1);var nYu=class{context;absolutePathToTmpOutputDirectory;absolutePathToTmpSnippetJSON;absolutePathToTmpSnippetTemplatesJSON;absolutePathToLocalSnippetTemplateJSON;absolutePathToLocalOutput;absolutePathToLocalSnippetJSON;constructor({context:t,absolutePathToTmpOutputDirectory:r,absolutePathToTmpSnippetJSON:i,absolutePathToLocalSnippetTemplateJSON:n,absolutePathToLocalOutput:a,absolutePathToLocalSnippetJSON:u,absolutePathToTmpSnippetTemplatesJSON:l}){this.context=t,this.absolutePathToLocalOutput=a,this.absolutePathToTmpOutputDirectory=r,this.absolutePathToTmpSnippetJSON=i,this.absolutePathToLocalSnippetJSON=u,this.absolutePathToLocalSnippetTemplateJSON=n,this.absolutePathToTmpSnippetTemplatesJSON=l}async copyGeneratedFiles(){await this.isFernIgnorePresent()?await this.copyGeneratedFilesWithFernIgnore():await this.copyGeneratedFilesNoFernIgnore(),this.absolutePathToTmpSnippetJSON!=null&&this.absolutePathToLocalSnippetJSON!=null&&await Cf(this.absolutePathToTmpSnippetJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetJSON}),this.absolutePathToTmpSnippetTemplatesJSON!=null&&this.absolutePathToLocalSnippetTemplateJSON!=null&&await Cf(this.absolutePathToTmpSnippetTemplatesJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetTemplatesJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetTemplateJSON})}async isFernIgnorePresent(){let t=Wl.of(Xu(this.absolutePathToLocalOutput,Xa.of(QYa)));return await Cf(t)}async copyGeneratedFilesWithFernIgnore(){let t=Wl.of((await qRP.default.dir({})).path),r=Wl.of(Xu(this.absolutePathToLocalOutput,Xa.of(QYa))),i=await NO3({absolutePathToFernignore:r});await(0,Ije.cp)(this.absolutePathToLocalOutput,t,{recursive:!0}),await this.runGitCommand(["init"],t),await this.runGitCommand(["add","."],t),(await this.runGitCommand(["config","--list"],t)).includes("user.name")||(await this.runGitCommand(["config","user.name","fern-api"],t),await this.runGitCommand(["config","user.email","info@buildwithfern.com"],t)),await this.runGitCommand(["commit","--allow-empty","-m",'"init"'],t),await this.runGitCommand(["rm","-rf","."],t),await this.copyGeneratedFilesToDirectory(t),await this.runGitCommand(["reset","--",...i],t),await this.runGitCommand(["restore","."],t),await(0,Ije.rmdir)(this.absolutePathToLocalOutput,{recursive:!0}),await(0,Ije.cp)(t,this.absolutePathToLocalOutput,{recursive:!0})}async copyGeneratedFilesNoFernIgnore(){this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`),await(0,Ije.rm)(this.absolutePathToLocalOutput,{force:!0,recursive:!0}),await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput)}async copyGeneratedFilesToDirectory(t){let[r,...i]=await(0,Ije.readdir)(this.absolutePathToTmpOutputDirectory);if(r!=null)if(this.context.logger.debug(`Copying generated files to ${t}`),r.endsWith(".zip")){await(0,ARP.default)(Xu(this.absolutePathToTmpOutputDirectory,Xa.of(r)),t);for(let n of i)await(0,Ije.cp)(Xu(this.absolutePathToTmpOutputDirectory,Xa.of(n)),Xu(t,Xa.of(n)),{recursive:!0})}else await(0,Ije.cp)(this.absolutePathToTmpOutputDirectory,t,{recursive:!0})}async copySnippetJSON({absolutePathToTmpSnippetJSON:t,absolutePathToLocalSnippetJSON:r}){this.context.logger.debug(`Copying generated snippets to ${r}`),await(0,Ije.cp)(t,r)}async runGitCommand(t,r){return(await SG(this.context.logger,"git",t,{cwd:r,doNotPipeOutput:!0})).stdout}},RO3=/\r?\n/;async function NO3({absolutePathToFernignore:e}){let t=(await(0,Ije.readFile)(e)).toString();return[QYa,...t.trim().split(RO3).filter(r=>!r.startsWith("#")&&r.length>0)]}async function BRP({organization:e,workspace:t,generatorInvocation:r,absolutePathToLocalOutput:i,absolutePathToLocalSnippetJSON:n,absolutePathToLocalSnippetTemplateJSON:a,absolutePathToFernConfig:u,audiences:l,workspaceTempDir:d,keepDocker:s,context:o,irVersionOverride:c,outputVersionOverride:b,writeUnitTests:g,generateOauthClients:O,generatePaginatedClients:m,includeOptionalRequestPropertyExamples:w}){let{latest:E,migrated:A}=await DRP({workspace:t,audiences:l,generatorInvocation:r,context:o,irVersionOverride:c,packageName:Jb.getPackageName({generatorInvocation:r}),version:b,sourceConfig:UO3(t),includeOptionalRequestPropertyExamples:w}),q=await FO3({workspaceTempDir:d,context:o,ir:A});o.logger.debug("Wrote IR to: "+q);let D=await bHn.default.file({tmpdir:d.path}),C=Wl.of(D.path);o.logger.debug("Will write config.json to: "+C);let R=await bHn.default.dir({tmpdir:d.path}),$=Wl.of(R.path);o.logger.debug("Will write output to: "+$);let I;if(n!=null){let K=await bHn.default.file({tmpdir:d.path});I=Wl.of(K.path),o.logger.debug("Will write snippet.json to: "+I)}let U;if(a!=null){let K=await bHn.default.file({tmpdir:d.path});U=Wl.of(K.path),o.logger.debug("Will write snippet-templates.json to: "+U)}let{generatorConfig:H}=await LO3({absolutePathToOutput:$,absolutePathToSnippet:I,absolutePathToSnippetTemplates:U,absolutePathToIr:q,absolutePathToWriteConfigJson:C,workspaceName:t.definition.rootApiFile.contents.name,organization:e,outputVersion:b,keepDocker:s,generatorInvocation:r,context:o,writeUnitTests:g,generateOauthClients:O,generatePaginatedClients:m,sources:t.getSources()});return await new nYu({context:o,absolutePathToLocalOutput:i,absolutePathToTmpOutputDirectory:$,absolutePathToLocalSnippetJSON:n,absolutePathToLocalSnippetTemplateJSON:a,absolutePathToTmpSnippetJSON:I,absolutePathToTmpSnippetTemplatesJSON:U}).copyGeneratedFiles(),{absolutePathToIr:q,absolutePathToConfigJson:C,ir:E,generatorConfig:H}}async function FO3({ir:e,workspaceTempDir:t,context:r}){r.logger.debug("Migrated IR");let i=await bHn.default.file({tmpdir:t.path}),n=Wl.of(i.path);return await xGr(n,e,{pretty:!1}),r.logger.debug(`Wrote IR to ${n}`),n}async function LO3({workspaceName:e,organization:t,outputVersion:r,absolutePathToOutput:i,absolutePathToSnippet:n,absolutePathToSnippetTemplates:a,absolutePathToIr:u,absolutePathToWriteConfigJson:l,keepDocker:d,context:s,generatorInvocation:o,writeUnitTests:c,generateOauthClients:b,generatePaginatedClients:g,sources:O}){let{name:m,version:w,config:E}=o,A=`${m}:${w}`,q=[`${l}:${Ovf}:ro`,`${u}:${iYu}:ro`,`${i}:${unn}`];for(let I of O)q.push(`${I.absoluteFilePath}:${xRP(I)}:ro`);let{config:D,binds:C}=SRP({generatorInvocation:o,customConfig:E,workspaceName:e,outputVersion:r,organization:t,absolutePathToSnippet:n,absolutePathToSnippetTemplates:a,writeUnitTests:c,generateOauthClients:b,generatePaginatedClients:g});q.push(...C);let R=await CRP.GeneratorConfig.json(D);if(!R.ok)throw new Error(`Failed to parse config.json into ${l}`);if(await(0,TRP.writeFile)(l,JSON.stringify(R.value,void 0,4)),!await oys(l,5e3))throw new Error(`Failed to create ${l}`);return await mvf({logger:s.logger,imageName:A,args:[Ovf],binds:q,removeAfterCompletion:!d}),{generatorConfig:D}}function UO3(e){return{sources:e.getSources().map(t=>t.type==="protobuf"?Sre.proto({id:t.id,protoRootUrl:`file:///${xRP(t)}`}):Sre.openapi())}}function xRP(e){return`${mRP}/${e.id}`}var Pvf=yi(require("os"),1),IRP=yi(require("path"),1),zRP=yi(Lte(),1);async function jvf({projectConfig:e,workspace:t,generatorGroup:r,keepDocker:i,context:n}){let a=await VO3();(await Promise.all(r.generators.map(async l=>n.runInteractiveTask({name:l.name},async d=>{if(l.absolutePathToLocalOutput==null)d.failWithoutThrowing("Cannot generate because output location is not local-file-system");else{let s=await t.toFernWorkspace({context:n},x1n(l));await BRP({organization:e.organization,absolutePathToFernConfig:e._absolutePath,workspace:s,generatorInvocation:l,absolutePathToLocalOutput:l.absolutePathToLocalOutput,absolutePathToLocalSnippetJSON:void 0,absolutePathToLocalSnippetTemplateJSON:void 0,audiences:r.audiences,workspaceTempDir:a,keepDocker:i,context:d,irVersionOverride:l.irVersionOverride,outputVersionOverride:void 0,writeUnitTests:!1,generateOauthClients:!1,generatePaginatedClients:!1}),d.logger.info(Js.green("Wrote files to "+l.absolutePathToLocalOutput))}})))).some(l=>!l)&&n.failAndThrow()}async function VO3(){return zRP.default.dir({tmpdir:Pvf.default.platform()==="darwin"?IRP.default.join("/private",Pvf.default.tmpdir()):void 0,prefix:"fern"})}var fYu=yi(JBi(),1);var RRP=require("fs"),aYu=require("fs/promises"),NRP=require("stream/promises");async function FRP({snippetsS3PreSignedReadUrl:e,absolutePathToLocalSnippetJSON:t,context:r}){try{await WO3({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(Js.green(`Downloaded to ${t}`))}catch{r.logger.debug(Js.yellow("Failed to download snippet.json from output."))}}async function WO3({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await xR.get(e,{responseType:"stream"});await Cf(t)&&await(0,aYu.rm)(t,{recursive:!0}),await(0,aYu.mkdir)(_p(t),{recursive:!0}),await(0,NRP.pipeline)(r.data,(0,RRP.createWriteStream)(t))}var Dvf=yi(fre(),1);var WRP=yi(r6o(),1),HRP=require("fs"),sYu=require("fs/promises"),Svf=yi(require("path"),1),$RP=require("stream/promises");var oYu=yi(VRP(),1);function Gri(e,t,{target:r="stdout",...i}={}){return oYu.default[r]?$wn.link(e,t):i.fallback===!1?e:typeof i.fallback=="function"?i.fallback(e,t):`${e} (\u200B${t}\u200B)`}Gri.isSupported=oYu.default.stdout;Gri.stderr=(e,t,r={})=>Gri(e,t,{target:"stderr",...r});Gri.stderr.isSupported=oYu.default.stderr;var GRP=yi(Lte(),1);var uYu=class{context;generatorInvocation;absolutePathToPreview;lengthOfLastLogs=0;constructor({interactiveTaskContext:t,generatorInvocation:r,absolutePathToPreview:i}){this.context=t,this.generatorInvocation=r,this.absolutePathToPreview=i}async processUpdate(t){t==null&&this.context.failAndThrow("Task is missing on job status");let r=t.packages.map(n=>n.coordinate._visit({npm:a=>`${a.name}@${a.version}`,maven:a=>`${a.group}:${a.artifact}:${a.version}`,pypi:a=>`${a.name} ${a.version}`,ruby:a=>`${a.name}:${a.version}`,nuget:a=>`${a.name} ${a.version}`,_other:()=>"<unknown package>"}));this.absolutePathToPreview==null&&this.context.setSubtitle(r.length>0?r.map(n=>`\u25E6 ${n}`).join(`
1999
1999
  `):void 0);for(let n of t.logs.slice(this.lengthOfLastLogs))this.context.logger.log(QO3(n.level),n.message);this.lengthOfLastLogs=t.logs.length;let i=n=>{this.context.logger.debug(`Generated files. ${Gri("View here",n,{fallback:(a,u)=>`${a}: ${u}`})}`)};return await t.status._visit({notStarted:Jo,running:Jo,failed:({message:n,s3PreSignedReadUrl:a})=>{a!=null&&i(a),this.context.failAndThrow(n)},finished:async n=>{if(n.s3PreSignedReadUrlV2!=null){i(n.s3PreSignedReadUrlV2);let a=this.getAbsolutePathToLocalOutput();a!=null&&await $O3({s3PreSignedReadUrl:n.s3PreSignedReadUrlV2,absolutePathToLocalOutput:a,context:this.context})}if(this.absolutePathToPreview==null)for(let a of r)this.context.logger.info(`Published ${a}`);this.#e=!0,this.#t=n.createdSnippets!=null?n.createdSnippets:!1,this.#r=n.snippetsS3PreSignedReadUrl},_other:()=>{this.context.logger.warn("Received unknown update type: "+t.status.type)}}),this.#e?{createdSnippets:this.#t,snippetsS3PreSignedReadUrl:this.#r}:void 0}getAbsolutePathToLocalOutput(){return this.absolutePathToPreview!=null?Xu(this.absolutePathToPreview,Xa.of(Svf.default.basename(this.generatorInvocation.name))):this.generatorInvocation.absolutePathToLocalOutput}#e=!1;get isFinished(){return this.#e}#t=!1;get createdSnippets(){return this.#t}#r=void 0;get snippetsS3PreSignedReadUrl(){return this.#r}};async function $O3({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t,context:r}){try{await GO3({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(Js.green(`Downloaded to ${t}`))}catch(i){r.failAndThrow("Failed to download files",i)}}async function GO3({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await xR.get(e,{responseType:"stream"}),i=await GRP.default.dir({prefix:"fern",unsafeCleanup:!0}),n=Svf.default.join(i.path,"output.zip");await(0,$RP.pipeline)(r.data,(0,HRP.createWriteStream)(n)),await Cf(t)&&await(0,sYu.rm)(t,{recursive:!0}),await(0,sYu.mkdir)(t,{recursive:!0}),await(0,WRP.default)(n,t)}function QO3(e){switch(e){case"DEBUG":return V0.Debug;case"INFO":return V0.Info;case"WARN":return V0.Warn;case"ERROR":return V0.Error;default:return V0.Info}}var lYu=require("fs/promises"),QRP=yi(Lte(),1);var JO3="proto.zip",cYu=class{sourceTypes;context;sources;constructor(t,r){this.context=t,this.sources=Object.fromEntries(r.map(i=>[i.id,i])),this.sourceTypes=new Set(Object.values(this.sources).map(i=>i.type))}async uploadSources(t){for(let[r,i]of Object.entries(t)){let n=this.getSourceOrThrow(r);await this.uploadSource(n,i.uploadUrl)}return this.convertFdrSourceUploadsToSourceConfig(t)}async uploadSource(t,r){let i=await this.getUploadCommand(t),n=await(0,lYu.readFile)(i.absoluteFilePath),a=await fetch(r,{method:"PUT",body:n,headers:{"Content-Type":"application/octet-stream"}});await i.cleanup(),a.ok||this.context.failAndThrow(`Failed to upload source file: ${t.absoluteFilePath}. Status: ${a.status}, ${a.statusText}`)}async getUploadCommand(t){if(t.type==="protobuf"){let r=await this.zipSource(t.absoluteFilePath);return{absoluteFilePath:r,cleanup:async()=>{this.context.logger.debug(`Removing ${r}`),await(0,lYu.unlink)(r)}}}return{absoluteFilePath:t.absoluteFilePath,cleanup:async()=>{}}}async zipSource(t){let r=await QRP.default.dir(),i=Xu(Wl.of(r.path),Xa.of(JO3));return this.context.logger.debug(`Zipping source ${t} into ${i}`),await SG(this.context.logger,"zip",["-r",i,"."],{cwd:t,doNotPipeOutput:!0}),i}convertFdrSourceUploadsToSourceConfig(t){let r=[];for(let[i,n]of Object.entries(t))switch(this.getSourceOrThrow(i).type){case"protobuf":r.push(Sre.proto({id:i,protoRootUrl:n.downloadUrl}));continue;case"openapi":r.push(Sre.openapi());continue;case"asyncapi":continue}return{sources:r}}getSourceOrThrow(t){let r=this.sources[t];return r==null&&this.context.failAndThrow(`Internal error; server responded with source id "${t}" which does not exist in the workspace.`),r}};var JRP=yi(ora(),1),zje=require("fs/promises");var KRP=require("path"),YRP=yi(jRo(),1),XRP=yi(Lte(),1);var OHn=yi(JBi(),1);async function ZRP({projectConfig:e,workspace:t,organization:r,intermediateRepresentation:i,generatorInvocation:n,version:a,context:u,shouldLogS3Url:l,token:d,whitelabel:s,irVersionOverride:o,absolutePathToPreview:c}){let b=await KO3({projectConfig:e,workspace:t,organization:r,generatorInvocation:n,version:a,context:u,shouldLogS3Url:l,token:d,whitelabel:s,absolutePathToPreview:c});return await YO3({intermediateRepresentation:i,job:b,context:u,generatorInvocation:n,irVersionOverride:o}),b}async function KO3({projectConfig:e,workspace:t,organization:r,generatorInvocation:i,version:n,context:a,shouldLogS3Url:u,token:l,whitelabel:d,absolutePathToPreview:s}){let o=BQr({token:l.value}),c={id:i.name,version:i.version,outputMode:i.outputMode,customConfig:i.config,publishMetadata:i.publishMetadata},b;if(i.outputMode.type.startsWith("github"))try{let O=await XRP.default.dir(),m=Wl.of(O.path);a.logger.debug(`Writing mock fern definition to ${m}`);let w=Xu(m,Xa.of(hU)),E=Xu(w,Xa.of(R8));await(0,zje.mkdir)(E,{recursive:!0});let A=Xu(E,Xa.of(Q3));await(0,zje.writeFile)(A,Kd.dump(t.definition.rootApiFile.contents)),await kRP({absolutePathToDefinitionDirectory:E,definition:t.definition});let q=Xu(w,Xa.of(Rte));await(0,zje.writeFile)(q,JSON.stringify(e.rawConfig,void 0,2));try{let R=t.getSources();for(let $ of R){let I=await(0,zje.readFile)($.absoluteFilePath),U=(0,KRP.relative)(t.absoluteFilePath,$.absoluteFilePath),H=Xu(w,Xa.of(U));await(0,zje.mkdir)(_p(H),{recursive:!0}),await(0,zje.writeFile)(H,new Uint8Array(I))}}catch(R){a.logger.debug(`Failed to write source files to disk, continuing: ${R}`)}let D=Xu(m,Xa.of("definition.tgz"));await(0,YRP.create)({file:D,cwd:w},["."]),a.logger.debug("Getting upload URL for Fern definition.");let C=await o.remoteGen.getDefinitionUploadUrl({apiName:t.definition.rootApiFile.contents.name,organizationName:r,version:n});C.ok?(a.logger.debug("Uploading definition..."),await xR.put(C.body.s3Url,await(0,zje.readFile)(D)),b={definitionS3DownloadUrl:C.body.s3Url,outputPath:".mock",cliVersion:e.version}):C.error.content.reason==="status-code"?a.logger.debug(`Failed with status-code to get upload URL with status code ${C.error.content.statusCode}, continuing: ${C.error.content.body}`):C.error.content.reason==="non-json"?a.logger.debug(`Failed with non-json to get upload URL with status code ${C.error.content.statusCode}, continuing: ${C.error.content.rawBody}`):C.error.content.reason==="unknown"&&a.logger.debug(`Failed to get upload URL as unknown error occurred continuing: ${C.error.content.errorMessage}`)}catch(O){a.logger.debug(`Failed to upload definition to S3, continuing: ${O}`)}let g=await o.remoteGen.createJobV3({apiName:t.definition.rootApiFile.contents.name,version:n,organizationName:r,generators:[c],uploadToS3:ZO3({outputMode:i.outputMode,generatorInvocation:i,absolutePathToPreview:s,shouldLogS3Url:u}),whitelabel:d,fernDefinitionMetadata:b,preview:s!=null});return g.ok?g.body:XO3(g.error)._visit({illegalApiNameError:()=>a.failAndThrow("API name is invalid: "+t.definition.rootApiFile.contents.name),illegalApiVersionError:()=>a.failAndThrow("API version is invalid: "+n),cannotPublishToNpmScope:({validScope:O,invalidScope:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),cannotPublishToMavenGroup:({validGroup:O,invalidGroup:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),cannotPublishPypiPackage:({validPrefix:O,invalidPackageName:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),generatorsDoNotExistError:O=>a.failAndThrow("Generators do not exist: "+O.nonExistentGenerators.map(m=>`${m.id}@${m.version}`).join(", ")),insufficientPermissions:()=>a.failAndThrow("Insufficient permissions."),orgNotConfiguredForWhitelabel:()=>a.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com."),_other:O=>a.failAndThrow("Failed to create job",O)})}async function kRP({absolutePathToDefinitionDirectory:e,definition:t}){for(let[r,i]of Object.entries(t.namedDefinitionFiles)){let n=Xu(e,Xa.of(r));await(0,zje.mkdir)(_p(n),{recursive:!0}),await(0,zje.writeFile)(n,Kd.dump(i.contents))}for(let[r,i]of Object.entries(t.packageMarkers))if(i.contents.export==null){let n=Xu(e,Xa.of(r));await(0,zje.mkdir)(_p(n),{recursive:!0}),await(0,zje.writeFile)(n,Kd.dump(i.contents))}for(let[r,i]of Object.entries(t.importedDefinitions))await kRP({absolutePathToDefinitionDirectory:Xu(e,Xa.of(r)),definition:i.definition})}async function YO3({intermediateRepresentation:e,generatorInvocation:t,job:r,context:i,irVersionOverride:n}){let a=n==null?await l5a({intermediateRepresentation:e,context:i,targetGenerator:{name:t.name,version:t.version}}):await tyf({intermediateRepresentation:e,context:i,irVersion:n,targetGenerator:{name:t.name,version:t.version}}),u=new JRP.default,l=await RGr(a,{onWrite:s=>{i.logger.debug("Wrote IR to disk: "+s)}});u.append("file",l);let d=Fv(Ijs(),`/api/remote-gen/jobs/${r.jobId}/start`);try{await xR.post(d,u,{headers:u.getHeaders(),maxBodyLength:1/0})}catch(s){let o=s instanceof hup?s.response?.data:s;i.logger.debug(`POST ${d} failed with ${JSON.stringify(s)}`),i.failAndThrow("Failed to start job",o)}}function XO3(e){if(e?.reason==="status-code"){let t=e.body;switch(t?._error){case"IllegalApiNameError":return OHn.FernFiddle.remoteGen.createJobV3.Error.illegalApiNameError();case"GeneratorsDoNotExistError":return OHn.FernFiddle.remoteGen.createJobV3.Error.generatorsDoNotExistError(t.body);case"CannotPublishToNpmScope":return OHn.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToNpmScope(t.body);case"CannotPublishToMavenScope":return OHn.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToMavenGroup(t.body);case"InsufficientPermissions":return OHn.FernFiddle.remoteGen.createJobV3.Error.insufficientPermissions(t.body)}}return e}function ZO3({outputMode:e,generatorInvocation:t,absolutePathToPreview:r,shouldLogS3Url:i}){return e.type==="downloadFiles"||t.absolutePathToLocalSnippets!=null||r!=null||i}function eNP({apiName:e,organization:t,generatorInvocation:r}){let i=kO3(r);if(i!=null)return{apiName:e,organization:t,customConfig:r.config,outputConfig:i}}function kO3(e){let t=e.outputMode;switch(t.type){case"downloadFiles":return ys.GeneratorOutputConfig.local();case"publishV2":return em3({publish:t.publishV2,version:e.version});case"githubV2":return tm3({github:t.githubV2,language:e.language,version:e.version});case"publish":case"github":return;default:Fo(t)}}function em3({publish:e,version:t}){switch(e.type){case"npmOverride":{let r=e.npmOverride;return r==null?void 0:ys.GeneratorOutputConfig.publish(ys.PublishInfo.npm({version:t,packageName:r.packageName,repoUrl:void 0}))}case"mavenOverride":{let r=e.mavenOverride;return r==null?void 0:ys.GeneratorOutputConfig.publish(ys.PublishInfo.maven({version:t,coordinate:r.coordinate,repoUrl:void 0}))}case"pypiOverride":{let r=e.pypiOverride;return r==null?void 0:ys.GeneratorOutputConfig.publish(ys.PublishInfo.pypi({version:t,packageName:r.coordinate,repoUrl:void 0}))}case"rubyGemsOverride":{let r=e.rubyGemsOverride;return r==null?void 0:ys.GeneratorOutputConfig.publish(ys.PublishInfo.rubygems({version:t,packageName:r.packageName,repoUrl:void 0}))}case"nugetOverride":{let r=e.nugetOverride;return r==null?void 0:ys.GeneratorOutputConfig.publish(ys.PublishInfo.nuget({version:t,packageName:r.packageName,repoUrl:void 0}))}case"postman":return;default:Fo(e)}}function tm3({github:e,version:t,language:r}){let i=rm3({owner:e.owner,repo:e.repo});if(r===Jb.GenerationLanguage.GO)return ys.GeneratorOutputConfig.publish(ys.PublishInfo.go({version:t,repoUrl:i}));let n=e.publishInfo;if(n!=null)switch(n.type){case"maven":return ys.GeneratorOutputConfig.publish(ys.PublishInfo.maven({version:t,coordinate:n.coordinate,repoUrl:i}));case"npm":return ys.GeneratorOutputConfig.publish(ys.PublishInfo.npm({version:t,packageName:n.packageName,repoUrl:i}));case"pypi":return ys.GeneratorOutputConfig.publish(ys.PublishInfo.pypi({version:t,packageName:n.packageName,repoUrl:i}));case"rubygems":return ys.GeneratorOutputConfig.publish(ys.PublishInfo.rubygems({version:t,packageName:n.packageName,repoUrl:i}));case"nuget":return ys.GeneratorOutputConfig.publish(ys.PublishInfo.nuget({version:t,packageName:n.packageName,repoUrl:i}));case"postman":return;default:Fo(n)}}function rm3({owner:e,repo:t}){return`https://github.com/${e}/${t}`}var tNP=BQr();var im3=3;function rNP({job:e,taskId:t,taskHandler:r,context:i}){let n=0,a=async()=>{let u=await tNP.remoteGen.getJobStatus(e.jobId);if(u.ok)return u.body[t];i.logger.debug("Failed to get job status.",JSON.stringify(u.error.content))};return new Promise((u,l)=>{d();async function d(){try{let s=await a();if(s==null)n++,n===im3&&i.failAndThrow(`Failed to get job status after ${n} attempts.`),setTimeout(d,2e3+1e3*n);else{n=0;let o=await r.processUpdate(s);r.isFinished?u(o):setTimeout(d,2e3)}}catch(s){l(s)}}})}async function iNP({projectConfig:e,organization:t,workspace:r,interactiveTaskContext:i,generatorInvocation:n,version:a,audiences:u,shouldLogS3Url:l,token:d,whitelabel:s,irVersionOverride:o,absolutePathToPreview:c,readme:b}){let g=kBi({token:d.value}),O=Jb.getPackageName({generatorInvocation:n}),m=c!=null,w=ee=>z_n(ee,{onError:fe=>i.failAndThrow(fe)},{substituteAsEmpty:m}),E=w(n),A=eNP({apiName:r.definition.rootApiFile.contents.name,organization:t,generatorInvocation:E}),q=C2({workspace:r,generationLanguage:n.language,keywords:n.keywords,smartCasing:n.smartCasing,exampleGeneration:{disabled:n.disableExamples,skipAutogenerationIfManualExamplesExist:!0},audiences:u,readme:b,packageName:O,version:a??await am3({fdr:g,packageName:O,generatorInvocation:n}),context:i,sourceResolver:new q2(i,r),dynamicGeneratorConfig:A}),D=r.getSources(),C=iDe({ir:q,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0}}),R=await g.api.v1.register.registerApiDefinition({orgId:Dvf.FernRegistry.OrgId(t),apiId:Dvf.FernRegistry.ApiId(q.apiName.originalName),definition:C,sources:D.length>0?om3(D):void 0}),$,I;R.ok&&($=R.body.apiDefinitionId,I=R.body.sources);let U=new cYu(i,D);if(I==null&&U.sourceTypes.has("protobuf")&&(R.ok||i.failAndThrow(`Failed to register API definition: ${JSON.stringify(R.error.content)}`),i.failAndThrow("Did not successfully upload Protobuf source files.")),I!=null){i.logger.debug("Uploading source files ...");let ee=await U.uploadSources(I);i.logger.debug("Setting IR source configuration ..."),q.sourceConfig=ee}let H=await ZRP({projectConfig:e,workspace:r,organization:t,generatorInvocation:E,context:i,version:a,intermediateRepresentation:{...q,fdrApiDefinitionId:$,publishConfig:nm3({generatorInvocation:E})},shouldLogS3Url:l,token:d,whitelabel:s!=null?w(s):void 0,irVersionOverride:o,absolutePathToPreview:c});i.logger.debug(`Job ID: ${H.jobId}`);let k=H.taskIds[0];if(k==null){i.failAndThrow("Did not receive a task ID.");return}i.logger.debug(`Task ID: ${k}`);let K=new uYu({job:H,taskId:k,generatorInvocation:n,interactiveTaskContext:i,absolutePathToPreview:c});return await rNP({job:H,taskHandler:K,taskId:k,context:i})}function nm3({generatorInvocation:e}){return e.outputMode._visit({downloadFiles:()=>{},github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:t=>t._visit({mavenOverride:()=>{},pypiOverride:()=>{},nugetOverride:()=>{},npmOverride:()=>{},rubyGemsOverride:()=>{},postman:r=>{let i;return e.raw?.output?.location==="postman"&&(i=e.raw.output?.["collection-id"]),uc.PublishingConfig.direct({target:uc.PublishTarget.postman({apiKey:r.apiKey,workspaceId:r.workspaceId,collectionId:i})})},_other:()=>{}}),_other:()=>{}})}async function am3({fdr:e,packageName:t,generatorInvocation:r}){if(r.language==null)return;let i;switch(r.language){case"csharp":i="Csharp";break;case"go":i="Go";break;case"java":i="Java";break;case"python":i="Python";break;case"ruby":i="Ruby";break;case"typescript":i="TypeScript";break;default:return}if(t==null)return;let n=await e.sdks.versions.computeSemanticVersion({githubRepository:r.outputMode.type==="githubV2"?`${r.outputMode.githubV2.owner}/${r.outputMode.githubV2.repo}`:void 0,language:i,package:t});if(n.ok)return n.body.version}function om3(e){return Object.fromEntries(Object.values(e).map(t=>[t.id,{type:t.type==="protobuf"?"proto":t.type}]))}async function Evf({projectConfig:e,organization:t,workspace:r,context:i,generatorGroup:n,version:a,shouldLogS3Url:u,token:l,whitelabel:d,absolutePathToPreview:s,mode:o}){if(n.generators.length===0)return i.logger.warn("No generators specified."),null;let c=[],b=[];return c.push(...n.generators.map(O=>i.runInteractiveTask({name:O.name},async m=>{let w=await r.toFernWorkspace({context:i},x1n(O)),E=await iNP({projectConfig:e,organization:t,workspace:w,interactiveTaskContext:m,generatorInvocation:{...O,outputMode:O.outputMode._visit({downloadFiles:()=>O.outputMode,github:A=>fYu.FernFiddle.OutputMode.github({...A,makePr:o==="pull-request"}),githubV2:A=>o==="pull-request"?fYu.FernFiddle.OutputMode.githubV2(fYu.FernFiddle.GithubOutputModeV2.pullRequest(A)):O.outputMode,publish:()=>O.outputMode,publishV2:()=>O.outputMode,_other:()=>O.outputMode})},version:a,audiences:n.audiences,shouldLogS3Url:u,token:l,whitelabel:d,readme:O.readme,irVersionOverride:O.irVersionOverride,absolutePathToPreview:s});E!=null&&E.createdSnippets&&(b.push(O),O.absolutePathToLocalSnippets!=null&&E.snippetsS3PreSignedReadUrl!=null&&await FRP({snippetsS3PreSignedReadUrl:E.snippetsS3PreSignedReadUrl,absolutePathToLocalSnippetJSON:O.absolutePathToLocalSnippets,context:m}))}))),(await Promise.all(c)).some(O=>!O)&&i.failAndThrow(),{snippetsProducedBy:b}}var QNP=require("fs/promises");var Gvf=yi(y_n(),1);var n2t=yi(fre(),1);var LNP=yi(FNP(),1);var UNP=require("util");var NP3=(0,UNP.promisify)(LNP.default);async function VNP(e,t,r){let i=Ura(e,t),n=[];for(let a of i){let u=await Promise.all(a.map(async l=>{try{let d=await NP3(l);return d==null||d.height==null||d.width==null?void 0:{filePath:l,width:d.width,height:d.height,blurDataUrl:void 0}}catch(d){r.logger.error(`Failed to measure image size for ${l}. ${d?.message}`);return}}));n.push(...u.filter(Qb))}return new Map(n.map(a=>[a.filePath,a]))}var FP3=10,WNP=10;async function JNP({token:e,organization:t,docsWorkspace:r,domain:i,customDomains:n,fernWorkspaces:a,ossWorkspaces:u,context:l,preview:d,editThisPage:s,isPrivate:o=!1}){let c=kBi({token:e.value}),b=o?{type:"private",authType:"sso"}:{type:"public"},g,O=n[0]??i,m=LP3(i),E=await new o9t(i,r,u,a,l,s,async q=>{let D=new Map(q.map(H=>[H.absoluteFilePath,H])),R=q.map(H=>({...H,mediaType:Gvf.lookup(H.absoluteFilePath)})).filter(H=>H.mediaType!==!1).filter(H=>JB.parse(H.mediaType)?.isImage()??!1).map(H=>H.absoluteFilePath),$=await VNP(R,FP3,l),I=[];[...$.values()].forEach(H=>{let k=D.get(H.filePath);if(k==null)return;let K={filePath:n2t.FernRegistry.docs.v1.write.FilePath(Nka(k.relativeFilePath)),width:H.width,height:H.height,blurDataUrl:H.blurDataUrl,alt:void 0};I.push(K)});let U=q.filter(({absoluteFilePath:H})=>!$.has(H)).map(({relativeFilePath:H})=>Nka(H));if(d){let H=await c.docs.v2.write.startDocsPreviewRegister({orgId:n2t.FernRegistry.OrgId(t),authConfig:o?{type:"private",authType:"sso"}:{type:"public"},filepaths:U.map(k=>n2t.FernRegistry.docs.v1.write.FilePath(k)),images:I,basePath:m});return H.ok?(O=H.body.previewUrl,g=H.body.docsRegistrationId,await HNP(H.body.uploadUrls,r.absoluteFilePath,l,WNP),$NP(H.body.uploadUrls,r.absoluteFilePath)):await GNP(H.error,l)}else{let H=await c.docs.v2.write.startDocsRegister({domain:i,customDomains:n,authConfig:b,apiId:n2t.FernRegistry.ApiId(""),orgId:n2t.FernRegistry.OrgId(t),filepaths:U.map(k=>n2t.FernRegistry.docs.v1.write.FilePath(k)),images:I});return H.ok?(g=H.body.docsRegistrationId,await HNP(H.body.uploadUrls,r.absoluteFilePath,l,WNP),$NP(H.body.uploadUrls,r.absoluteFilePath)):GNP(H.error,l)}},async({ir:q,snippetsConfig:D,playgroundConfig:C,apiName:R})=>{let $=iDe({ir:q,snippetsConfig:D,playgroundConfig:C}),I=await c.api.v1.register.registerApiDefinition({orgId:n2t.FernRegistry.OrgId(t),apiId:n2t.FernRegistry.ApiId(q.apiName.originalName),definition:$,definitionV2:void 0});if(I.ok)return l.logger.debug(`Registered API Definition ${I.body.apiDefinitionId}`),I.body.apiDefinitionId;switch(I.error.error){case"UnauthorizedError":case"UserNotInOrgError":return l.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return R!=null?l.failAndThrow(`Failed to publish docs because API definition (${R}) could not be uploaded. Please contact support@buildwithfern.com