fern-api 0.119.1 → 0.120.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +9 -9
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -2437,7 +2437,7 @@ ${Egy.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&vgf(th
|
|
|
2437
2437
|
`+lua.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?lua.default.cyan(Rgy(t,this.opt.mask)):lua.default.italic(lua.default.dim("[hidden]")):this.opt.mask?Rgy(t,this.opt.mask):lua.default.italic(lua.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var KEu=Hi(Ase(),1);var R0y=Hi(Zgf(),1),HEu=require("child_process"),cZa=require("fs"),GEu=Hi(require("path"),1),N0y=Hi(require("os"),1),F0y=require("crypto"),N0f=Hi(T0y(),1);var UEu=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var EKo=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var VEu=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var WEu=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function JEu(e="",t,r){let n=new F0f(e,r);n.runAsync((i,a)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function q0y(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function I0C(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var F0f=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=I0C(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??N0y.default.tmpdir(),r=(0,F0y.randomUUID)(),n=q0y(this.fileOptions.prefix),i=q0y(this.fileOptions.postfix),a=`${n}${r}${i}`,o=GEu.default.resolve(t,a),c=GEu.default.resolve(t)+GEu.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let f={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(f.mode=this.fileOptions.mode),(0,cZa.writeFileSync)(this.tempFile,this.text,f)}catch(t){throw new UEu(t)}}readTemporaryFile(){try{let t=(0,cZa.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,R0y.detect)(t)??"utf8";N0f.default.encodingExists(r)||(r="utf8"),this.text=N0f.default.decode(t,r)}}catch(t){throw new VEu(t)}}removeTemporaryFile(){try{(0,cZa.unlinkSync)(this.tempFile)}catch(t){throw new WEu(t)}}launchEditor(){try{let t=(0,HEu.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new EKo(t)}}launchEditorAsync(t){try{(0,HEu.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new EKo(r)}}};var x0y=Hi(Rrt(),1);var SKo=class extends Pse{_run(t){this.done=t,this.editorResult=new x0y.Subject;let r=Hve(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?KEu.default.dim("Received"):KEu.default.dim("Press <enter> to launch your preferred editor."),t&&(r=KEu.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),JEu(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 V0y=require("stream");var L0y=Hi(require("readline"),1),U0y=Hi(Q0y(),1),_ua=class{constructor(t){this.rl||=L0y.default.createInterface(B0C(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 B0C(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new U0y.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var DKo=class extends _ua{constructor(t={}){super(t),this.log=new V0y.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return fKo(this.rl,this.bottomBar.split(`
|
|
2438
2438
|
`).length),this}updateBottomBar(t){return fKo(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+`
|
|
2439
2439
|
`}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&&yEu(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var J4=Hi(Rrt(),1),H0y=Hi(BJo(),1);var $Eu=Hi(Rrt(),1),W0y=Hi(BJo(),1),YEu=function(e,t,r){return typeof e[t]!="function"?(0,$Eu.of)(e):(0,$Eu.from)((0,W0y.default)(e[t])(r).then(n=>(e[t]=n,e)))};var G0y={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,a,o)=>{i==="__proto__"||i==="constructor"||(a===o.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((o,c)=>o!=null?o[c]:o,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},lZa=class extends _ua{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,J4.from)(t):(0,J4.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,J4.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,J4.from)([t]),this.process=n.pipe((0,J4.concatMap)(this.processQuestion.bind(this)),(0,J4.publish)()),this.process.connect(),this.process.pipe((0,J4.reduce)((i,a)=>(G0y.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,J4.defer)(()=>(0,J4.of)(t).pipe((0,J4.concatMap)(this.setDefaultType.bind(this)),(0,J4.concatMap)(this.filterIfRunnable.bind(this)),(0,J4.concatMap)(()=>YEu(t,"message",this.answers)),(0,J4.concatMap)(()=>YEu(t,"default",this.answers)),(0,J4.concatMap)(()=>YEu(t,"choices",this.answers)),(0,J4.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,J4.defer)(()=>(0,J4.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,J4.defer)(()=>(0,J4.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&G0y.get(this.answers,t.name)!==void 0)return J4.EMPTY;if(t.when===!1)return J4.EMPTY;if(typeof t.when!="function")return(0,J4.of)(t);let{answers:r}=this;return(0,J4.defer)(()=>(0,J4.from)((0,H0y.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,J4.filter)(n=>n!=null)))}};function J0y(e){let t=function(r,n){let i;try{i=new lZa(t.prompts,e)}catch(o){return Promise.reject(o)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",pKo),this.registerPrompt("input",cua),this.registerPrompt("number",_Ko),this.registerPrompt("confirm",hKo),this.registerPrompt("rawlist",yKo),this.registerPrompt("expand",vKo),this.registerPrompt("checkbox",bKo),this.registerPrompt("password",gKo),this.registerPrompt("editor",SKo)},t.restoreDefaultPrompts(),t}var z0f=J0y();function q0C(e,t){z0f.registerPrompt(e,t)}function R0C(){z0f.restoreDefaultPrompts()}var N0C={prompt:z0f,ui:{BottomBar:DKo,Prompt:lZa},createPromptModule:J0y,registerPrompt:q0C,restoreDefaultPrompts:R0C,Separator:axe},XEu=N0C;var PZa=require("path"),EOy=require("fs"),SOy=require("readline"),Xmy="posthog-node";function cAC(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"]}={}){return a=>{if(!(i==="*"||i.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[vSu.POSTHOG_ID_TAG];if(c===void 0)return a;let f=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${c}`,f).toString();a.tags["PostHog Person URL"]=u;let s=a.exception?.values||[],l=s.map(O=>({...O,stacktrace:O.stacktrace?{...O.stacktrace,type:"raw",frames:(O.stacktrace.frames||[]).map(P=>({...P,platform:"node:javascript"}))}:void 0})),m={$exception_message:s[0]?.value||a.message,$exception_type:s[0]?.type,$exception_personURL:u,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:s[0]?.value||a.message,$sentry_exception_type:s[0]?.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:m}),a}}var vSu=class{constructor(t,r,n,i){this.name=Xmy,this.name=Xmy,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(cAC(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};vSu.POSTHOG_ID_TAG="posthog_distinct_id";var dSu="0123456789abcdef",bSu=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,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let 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|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,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 n=new Uint8Array(16);for(let i=0;i<16;i+=4){let a=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=a>>>24,n[i+1]=a>>>16,n[i+2]=a>>>8,n[i+3]=a}return new e(n)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=dSu.charAt(this.bytes[r]>>>4),t+=dSu.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+=dSu.charAt(this.bytes[r]>>>4),t+=dSu.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 n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},Pmf=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??lAC()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return bSu.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,bSu.ofInner(t)}},lAC=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),Zmy,wmf=()=>fAC().toString(),fAC=()=>(Zmy||(Zmy=new Pmf)).generate();function dAC(e,t){let r=!1;return Object.assign(n=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function pAC(e,t){global.process.on("uncaughtException",dAC(e,t))}function _AC(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var pSu,kmy,_Su;function hAC(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return _Su&&r.length===kmy||(kmy=r.length,_Su=r.reduce((n,i)=>{pSu||(pSu={});let a=pSu[i];if(a)n[a[0]]=a[1];else{let o=e(i);for(let c=o.length-1;c>=0;c--){let u=o[c]?.filename,s=t[i];if(u&&s){n[u]=s,pSu[i]=[u,s];break}}}return n},{})),_Su}function yAC(e){return typeof Event<"u"&&DOy(e,Event)}function vAC(e){return COy(e,"Object")}function Bmf(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return DOy(e,Error)}}function DOy(e,t){try{return e instanceof t}catch{return!1}}function bAC(e){return COy(e,"ErrorEvent")}function COy(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function gAC(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},o=IOy(a,r,n);return{$exception_list:await Promise.all(o.map(async u=>{let s=await EAC(e,t,u);return s.value=s.value||"",s.type=s.type||"Error",s.mechanism=a,s}))}}function IOy(e,t,r){let n=mAC(e,t,r);return n.cause?[n,...IOy(e,n.cause,r)]:[n]}function mAC(e,t,r){if(Bmf(t))return t;if(e.synthetic=!0,vAC(t)){let i=OAC(t);if(i)return i;let a=AAC(t),o=r?.syntheticException||new Error(a);return o.message=a,o}let n=r?.syntheticException||new Error(t);return n.message=`${t}`,n}function OAC(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(Bmf(r))return r}}function AAC(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message '${e.message}'`),n}else if("message"in e&&typeof e.message=="string")return e.message;let t=wAC(e);if(bAC(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=PAC(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function PAC(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function wAC(e,t=40){let r=Object.keys(jAC(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return eOy(n,t);for(let i=r.length;i>0;i--){let a=r.slice(0,i).join(", ");if(!(a.length>t))return i===r.length?a:eOy(a,t)}return""}function eOy(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function jAC(e){return Bmf(e)?{message:e.message,name:e.name,stack:e.stack,...tOy(e)}:yAC(e)?{type:e.type,target:rOy(e.target),currentTarget:rOy(e.currentTarget),...tOy(e)}:e}function tOy(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function rOy(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function EAC(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=SAC(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function SAC(e,t){return DAC(e(t.stack||"",1),e)}function DAC(e,t){let r=hAC(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var CAC=2e3,mZa=class e{static async captureException(t,r,n,i,a){let o={...a};i||(o.$process_person_profile=!1);let c=await gAC(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||wmf(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(pAC(this.onException.bind(this),this.onFatalError.bind(this)),_AC(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(CAC)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function IAC(e=process.argv[1]?(0,PZa.dirname)(process.argv[1]):process.cwd(),t=PZa.sep==="\\"){let r=t?nOy(e):e;return n=>{if(!n)return;let i=t?nOy(n):n,{dir:a,base:o,ext:c}=PZa.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let f=decodeURIComponent(o);a||(a=".");let u=a.lastIndexOf("/node_modules");if(u>-1)return`${a.slice(u+14).replace(/\//g,".")}:${f}`;if(a.startsWith(r)){let s=a.slice(r.length+1).replace(/\//g,".");return s?`${s}:${f}`:f}return f}}function nOy(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var gSu=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}},ySu=new gSu(25),MOy=new gSu(20),Tmf=7,MAC=1e3,BAC=1e4;async function TAC(e){let t={};for(let i=e.length-1;i>=0;i--){let a=e[i],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||FAC(o)||xAC(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(MOy.get(i))continue;let a=t[i];if(!a)continue;a.sort((f,u)=>f-u);let o=QAC(a);if(o.every(f=>zAC(i,f)))continue;let c=LAC(ySu,i,{});n.push(qAC(i,o,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&RAC(e,ySu),ySu.reduce(),e}function qAC(e,t,r){return new Promise(n=>{let i=(0,EOy.createReadStream)(e),a=(0,SOy.createInterface)({input:i});function o(){i.destroy(),n()}let c=0,f=0,u=t[f];if(u===void 0){o();return}let s=u[0],l=u[1];function m(){MOy.set(e,1),a.close(),a.removeAllListeners(),o()}i.on("error",m),a.on("error",m),a.on("close",o),a.on("line",O=>{if(c++,!(c<s)&&(r[c]=UAC(O,0),c>=l)){if(f===t.length-1){a.close(),a.removeAllListeners();return}f++;let P=t[f];if(P===void 0){a.close(),a.removeAllListeners();return}s=P[0],l=P[1]}})})}function RAC(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;NAC(r.lineno,r,n)}}function NAC(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=BOy(e);i<e;i++){let a=r[i];if(a===void 0){iOy(t);return}t.pre_context.push(a)}if(r[e]===void 0){iOy(t);return}t.context_line=r[e];let n=TOy(e);t.post_context=[];for(let i=e+1;i<=n;i++){let a=r[i];if(a===void 0)break;t.post_context.push(a)}}function iOy(e){delete e.pre_context,delete e.context_line,delete e.post_context}function FAC(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function xAC(e){return e.lineno!==void 0&&e.lineno>BAC||e.colno!==void 0&&e.colno>MAC}function zAC(e,t){let r=ySu.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function QAC(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=aOy(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let a=e[t+1];if(typeof a!="number")break;a<=n[1]?n[1]=a+Tmf:(i.push(n),n=aOy(a)),t++}return i}function aOy(e){return[BOy(e),TOy(e)]}function BOy(e){return Math.max(1,e-Tmf)}function TOy(e){return e+Tmf}function LAC(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function UAC(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,n);return a>n-5&&(a=n),a===n&&(i=Math.max(a-140,0)),r=r.slice(i,a),i>0&&(r=`...${r}`),a<n&&(r+="..."),r}var VAC="4.18.0",lxe;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.DecideEndpointWasHit="decide_endpoint_was_hit",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config"})(lxe||(lxe={}));var oOy;(function(e){e.Left="left",e.Right="right",e.Center="center"})(oOy||(oOy={}));var sOy;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(sOy||(sOy={}));var uOy;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(uOy||(uOy={}));var cOy;(function(e){e.Html="html",e.Text="text"})(cOy||(cOy={}));var lOy;(function(e){e.Number="number",e.Emoji="emoji"})(lOy||(lOy={}));var fOy;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(fOy||(fOy={}));var dOy;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(dOy||(dOy={}));var pOy;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(pOy||(pOy={}));var _Oy;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(_Oy||(_Oy={}));var WAC=e=>{if("flags"in e){let t=HAC(e.flags),r=JAC(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,qOy(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,GAC(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function GAC(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var HAC=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,qmf(r)]).filter(([,t])=>t!==void 0)),JAC=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?qOy(n):void 0]}))},qmf=e=>e===void 0?void 0:e.variant??e.enabled,qOy=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},KAC=1,$AC=new Set(["61be3dd8","96f6df5f","8cfdba9b","bf027177","e59430a8","7fa5500b","569798e9","04809ff7","0ebc61a5","32de7f98","3beeb69a","12d34ad9","733853ec","0645bb64","5dcbee21","b1f95fa3","2189e408","82b460c2","3a8cc979","29ef8843","2cdbf767","38084b54","50f9f8de","41d0df91","5c236689","c11aedd3","ada46672","f4331ee1","42fed62a","c957462c","d62f705a","e0162666","01b3e5cf","441cef7f","bb9cafee","8f348eb0","b2553f3a","97469d7d","39f21a76","03706dcc","27d50569","307584a7","6433e92e","150c7fbb","49f57f22","3772f65b","01eb8256","3c9e9234","f853c7f7","c0ac4b67","cd609d40","10ca9b1a","8a87f11b","8e8e5216","1f6b63b3","db7943dd","79b7164c","07f78e33","2d21b6fd","952db5ee","a7d3b43f","1924dd9c","84e1b8f6","dff631b6","c5aa8a79","fa133a95","498a4508","24748755","98f3d658","21bbda67","7dbfed69","be3ec24c","fc80b8e2","75cc0998"]),YAC="utf8";function XAC(e,t){if(!e||typeof e!="string"||ZAC(e))throw new Error(t)}function ZAC(e){return e.trim().length===0}function kAC(e){return e?.replace(/\/+$/,"")}async function ePC(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function hOy(){return new Date().getTime()}function Omf(){return new Date().toISOString()}function mSu(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function tPC(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function rPC(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return(t>>>0).toString(16).padStart(8,"0")}function nPC(e,t=0,r){let n=rPC(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function yOy(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var xKo=String.fromCharCode,vOy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",hSu={};function iPC(e,t){if(!hSu[e]){hSu[e]={};for(let r=0;r<e.length;r++)hSu[e][e.charAt(r)]=r}return hSu[e][t]}var bZa={compressToBase64:function(e){if(e==null)return"";let t=bZa._compress(e,6,function(r){return vOy.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:bZa._decompress(e.length,32,function(t){return iPC(vOy,e.charAt(t))})},compress:function(e){return bZa._compress(e,16,function(t){return xKo(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],o,c,f="",u="",s="",l=2,m=3,O=2,P=0,C=0,M;for(M=0;M<e.length;M+=1)if(f=e.charAt(M),Object.prototype.hasOwnProperty.call(n,f)||(n[f]=m++,i[f]=!0),u=s+f,Object.prototype.hasOwnProperty.call(n,u))s=u;else{if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<O;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<O;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[s]}else for(c=n[s],o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,O),O++),n[u]=m++,s=String(f)}if(s!==""){if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<O;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<O;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[s]}else for(c=n[s],o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,O),O++)}for(c=2,o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;for(;;)if(P=P<<1,C==t-1){a.push(r(P));break}else C++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:bZa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let n=[],i=[],a={val:r(0),position:t,index:1},o=4,c=4,f=3,u="",s,l,m,O,P,C,M;for(s=0;s<3;s+=1)n[s]=s;for(m=0,P=Math.pow(2,2),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;switch(m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;M=xKo(m);break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;M=xKo(m);break;case 2:return""}for(n[3]=M,l=M,i.push(M);;){if(a.index>e)return"";for(m=0,P=Math.pow(2,f),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;switch(M=m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;n[c++]=xKo(m),M=c-1,o--;break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;n[c++]=xKo(m),M=c-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,f),f++),n[M])u=n[M];else if(M===c)u=l+l.charAt(0);else return null;i.push(u),n[c++]=l+u.charAt(0),o--,l=u,o==0&&(o=Math.pow(2,f),f++)}}},jmf=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}},OZa=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},zKo=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function bOy(e){if(e instanceof OZa){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function Amf(e){return typeof e=="object"&&(e instanceof OZa||e instanceof zKo)}function gOy(e){return typeof e=="object"&&e instanceof OZa&&e.status===413}var Emf;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(Emf||(Emf={}));var Smf=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new jmf,this._isInitialized=!1,XAC(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=kAC(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.preloadFeatureFlags=r?.preloadFeatureFlags??!0,this.defaultOptIn=r?.defaultOptIn??!0,this.disableSurveys=r?.disableSurveys??!1,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:Amf},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r?.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}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(lxe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(lxe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(lxe.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>console.log("PostHog Debug",n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=wmf();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",a,i)})}async captureStatelessImmediate(t,r,n,i){let a=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",a,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",a,i)})}async aliasStatelessImmediate(t,r,n,i){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,i)}groupIdentifyStateless(t,r,n,i,a,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...o||{}}});this.enqueue("capture",c,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",i)),this._events.emit("error",i)})}async getDecide(t,r={},n={},i={},a={}){await this._initPromise;let c=nPC(this.apiKey,KAC,$AC)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,f={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,f,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(u=>u.json()).then(u=>WAC(u)).catch(u=>{this._events.emit("error",u)})}async getFeatureFlagStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,n,i,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let f=qmf(c.response);return f===void 0&&(f=!1),{response:f,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,n,i,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,n,i,a,o,[t]);if(!c)return;let f=c[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,n,i,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let f=await this.getDecide(t,r,n,i,c);if(f!==void 0)return f.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),f.quotaLimited?.includes(Emf.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:f?.requestId}):f}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return i&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(i))),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(lxe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(lxe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(lxe.Props,this.props)})}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i=this.prepareMessage(t,r,n),a=this.getPersistedProperty(lxe.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:i}),this.setPersistedProperty(lxe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=mSu(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized||await this._initPromise,this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i={api_key:this.apiKey,batch:[this.prepareMessage(t,r,n)],sent_at:Omf()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${hOy()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,c=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(bZa.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(f){this._events.emit("error",f)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:Omf(),uuid:n?.uuid?n.uuid:wmf()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await bOy(t)})}async flush(){let t=yOy([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),yOy([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(lxe.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),a=i.map(m=>m.message),o=()=>{let O=(this.getPersistedProperty(lxe.Queue)||[]).slice(i.length);this.setPersistedProperty(lxe.Queue,O),t=O},c={api_key:this.apiKey,batch:a,sent_at:Omf()};this.historicalMigration&&(c.historical_migration=!0);let f=JSON.stringify(c),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${hOy()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,s=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(bZa.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f},l={retryCheck:m=>gOy(m)?!1:Amf(m)};try{await this.fetchWithRetry(u,s,l)}catch(m){if(gOy(m)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this.logMsgIfDebug(()=>console.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`));continue}throw m instanceof zKo||o(),this._events.emit("error",m),m}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){var a;(a=AbortSignal).timeout??(a.timeout=function(u){let s=new AbortController;return setTimeout(()=>s.abort(),u),s.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,YAC)}catch{c=new TextEncoder().encode(o).length}return await ePC(async()=>{let f=null;try{f=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(s){throw new zKo(s)}if(!(r.mode==="no-cors")&&(f.status<200||f.status>=400))throw new OZa(f,c);return f},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(lxe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!Amf(i))throw i;await bOy(i)}};return Promise.race([new Promise((i,a)=>{mSu(()=>{this.logMsgIfDebug(()=>console.error("Timed out while shutting down PostHog")),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}async shutdown(t=3e4){return this.shutdownPromise?this.logMsgIfDebug(()=>console.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup")):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}},Dmf=tPC();if(!Dmf){let e=Ymy();Dmf=async(t,r)=>{let n=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:n.status,text:async()=>n.data,json:async()=>n.data}}}var ROy=Dmf,OSu=class{constructor(t){this.factory=t}async getValue(){return this.value!==void 0?this.value:(this.initializationPromise===void 0&&(this.initializationPromise=(async()=>{try{let t=await this.factory();return this.value=t,t}finally{this.initializationPromise=void 0}})()),this.initializationPromise)}isInitialized(){return this.value!==void 0}async waitForInitialization(){this.isInitialized()||await this.getValue()}},NOy=new OSu(async()=>{try{return await import("crypto")}catch{return}});async function aPC(){return await NOy.getValue()}var oPC=new OSu(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await NOy.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function sPC(){return await oPC.getValue()}async function uPC(e){let t=await aPC();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await sPC();if(r){let n=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}throw new Error("No crypto implementation available. Tried Node Crypto API and Web SubtleCrypto API")}var cPC=60*1e3,lPC=1152921504606847e3,fPC=["is_not"],gZa=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},wse=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Cmf=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=a,this.poller=void 0,this.fetch=c.fetch||ROy,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let f of this.featureFlags)if(t===f.key){c=f;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,n,i,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(f){f instanceof wse?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let n;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),n==null)return null;try{return JSON.parse(n)}catch{return n}}}async getAllFlagsAndPayloads(t,r={},n={},i={}){await this.loadFeatureFlags();let a={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async f=>{try{let u=await this.computeFlagLocally(f,t,r,n,i);a[f.key]=u;let s=await this.computeFeatureFlagPayloadLocally(f.key,u);s&&(o[f.key]=s)}catch(u){u instanceof wse||u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${u}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,n={},i={},a={}){if(t.ensure_experience_continuity)throw new wse("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let f=this.groupTypeMapping[String(c)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new wse("Flag has unknown group type index");if(!(f in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=a[f];return await this.matchFeatureFlagProperties(t,n[f],u)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],o=!1,c,f=[...a].sort((u,s)=>{let l=!!u.variant,m=!!s.variant;return l&&m?0:l?-1:m?1:0});for(let u of f)try{if(await this.isConditionMatch(t,r,u,n)){let s=u.variant,l=i.multivariate?.variants||[];s&&l.some(m=>m.key===s)?c=s:c=await this.getMatchingVariant(t,r)||!0;break}}catch(s){if(s instanceof wse)o=!0;else throw s}if(c!==void 0)return c;if(o)throw new wse("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i){let a=n.rollout_percentage,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let f=c.type,u=!1;if(f==="cohort"?u=xOy(c,i,this.cohorts,this.debugMode):u=FOy(c,i,o),!u)return!1}if(a==null)return!0}return!(a!=null&&await mOy(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await mOy(t.key,r,"variant"),i=this.variantLookupTable(t).find(a=>n>=a.valueMin&&n<a.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{i=n+c.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:c.key}),n=i}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(cPC,this.pollingInterval*2**this.backOffCount):this.pollingInterval}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.getPollingInterval());try{let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 401:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new gZa(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new gZa(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new gZa(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r)){this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));return}this.featureFlags=r.flags??[],this.featureFlagsByKey=this.featureFlags.reduce((n,i)=>(n[i.key]=i,n),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||{},this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof gZa&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET"){return{method:t,headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=mSu(()=>{i.abort()},this.timeout),r.signal=i.signal}try{return await this.fetch(t,r)}finally{clearTimeout(n)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,n=this.getPersonalApiKeyRequestOptions(),i=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;i=mSu(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function mOy(e,t,r=""){let n=await uPC(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/lPC}function FOy(e,t,r){let n=e.key,i=e.value,a=e.operator||"exact";if(n in t){if(a==="is_not_set")throw new wse("Operator is_not_set is not supported")}else throw new wse(`Property ${n} not found in propertyValues`);let o=t[n];if(o==null&&!fPC.includes(a))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${a} operator`),!1;function c(u,s){return Array.isArray(u)?u.map(l=>String(l).toLowerCase()).includes(String(s).toLowerCase()):String(u).toLowerCase()===String(s).toLowerCase()}function f(u,s,l){if(l==="gt")return u>s;if(l==="gte")return u>=s;if(l==="lt")return u<s;if(l==="lte")return u<=s;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(i,o);case"is_not":return!c(i,o);case"is_set":return n in t;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return OOy(String(i))&&String(o).match(String(i))!==null;case"not_regex":return OOy(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u!=null&&o!=null?typeof o=="string"?f(o,String(i),a):f(o,u,a):f(String(o),String(i),a)}case"is_date_after":case"is_date_before":{let u=dPC(String(i));if(u==null&&(u=AOy(i)),u==null)throw new wse(`Invalid date: ${i}`);let s=AOy(o);return["is_date_before"].includes(a)?s<u:s>u}default:throw new wse(`Unknown operator: ${a}`)}}function xOy(e,t,r,n=!1){let i=String(e.value);if(!(i in r))throw new wse("can't match cohort without a given cohort property value");let a=r[i];return zOy(a,t,r,n)}function zOy(e,t,r,n=!1){if(!e)return!0;let i=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let f=zOy(c,t,r,n);if(i==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof wse)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new wse("Can't match cohort without a given cohort property value");return i==="AND"}else{for(let c of a)try{let f;c.type==="cohort"?f=xOy(c,t,r,n):f=FOy(c,t);let u=c.negation||!1;if(i==="AND"){if(!f&&!u||f&&u)return!1}else if(f&&!u||!f&&u)return!0}catch(f){if(f instanceof wse)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new wse("can't match cohort without a given cohort property value");return i==="AND"}}function OOy(e){try{return new RegExp(e),!0}catch{return!1}}function AOy(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 wse(`${e} is in an invalid date format`)}else throw new wse(`The date provided ${e} must be a string, number, or date object`)}function dPC(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let a=r.groups.interval;if(a=="h")n.setUTCHours(n.getUTCHours()-i);else if(a=="d")n.setUTCDate(n.getUTCDate()-i);else if(a=="w")n.setUTCDate(n.getUTCDate()-i*7);else if(a=="m")n.setUTCMonth(n.getUTCMonth()-i);else if(a=="y")n.setUTCFullYear(n.getUTCFullYear()-i);else return null;return n}else return null}var Imf=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},pPC=100,POy=30*1e3,_PC=50*1e3,Mmf=class extends Smf{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Imf,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,pPC):POy,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');this.featureFlagsPoller=new Cmf({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:n=>{this._events.emit("error",n)},onLoad:n=>{this._events.emit("localEvaluationFlagsLoaded",n)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new mZa(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||_PC}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):ROy(t,r)}getLibraryVersion(){return VAC}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=O=>{super.captureStateless(r,n,O,{timestamp:c,disableGeoip:f,uuid:u})},l=async(O,P,C)=>(await super.getFeatureFlagsStateless(O,P,void 0,void 0,C)).flags,m=Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let O={};for(let[P,C]of Object.entries(a||{}))O[P]=String(C);return await this.getAllFlags(r,{groups:O,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(O=>{let P={};if(O)for(let[M,T]of Object.entries(O))P[`$feature/${M}`]=T;let C=Object.keys(O||{}).filter(M=>O?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(O=>{s({...O,...i,$groups:a})});this.addPendingPromise(m)}async captureImmediate(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=O=>super.captureStatelessImmediate(r,n,O,{timestamp:c,disableGeoip:f,uuid:u}),l=async(O,P,C)=>(await super.getFeatureFlagsStateless(O,P,void 0,void 0,C)).flags;await Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let O={};for(let[P,C]of Object.entries(a||{}))O[P]=String(C);return await this.getAllFlags(r,{groups:O,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(O=>{let P={};if(O)for(let[M,T]of Object.entries(O))P[`$feature/${M}`]=T;let C=Object.keys(O||{}).filter(M=>O?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(O=>{s({...O,...i,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:i},{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:i},{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=POy){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(n),i(),r(a>0)})})}async getFeatureFlag(t,r,n){let{groups:i,disableGeoip:a}=n||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:f,groupProperties:u}=n||{},s=this.addLocalPersonAndGroupProperties(r,i,f,u);f=s.allPersonProperties,u=s.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,f,u),m=l!==void 0,O,P;if(!m&&!o){let M=await super.getFeatureFlagDetailStateless(t,r,i,f,u,a);if(M===void 0)return;P=M.response,l=qmf(P),O=M?.requestId}let C=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:P?.metadata?.id,$feature_flag_version:P?.metadata?.version,$feature_flag_reason:P?.reason?.description??P?.reason?.code,locally_evaluated:m,[`$feature/${t}`]:l,$feature_flag_request_id:O},groups:i,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,n,i){let{groups:a,disableGeoip:o}=i||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:f,personProperties:u,groupProperties:s}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,u,s);u=l.allPersonProperties,s=l.allGroupProperties;let m;return this.featureFlagsPoller!==void 0&&(n||(n=await this.getFeatureFlag(t,r,{...i,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),n&&(m=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,n))),c==null&&(c=!1),f==null&&(f=!0),c==null&&(c=!1),!(m!==void 0)&&!c&&(m=await super.getFeatureFlagPayloadStateless(t,r,a,u,s,o)),m}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i}=r||{},{onlyEvaluateLocally:a,personProperties:o,groupProperties:c}=r||{},f=this.addLocalPersonAndGroupProperties(t,n,o,c);o=f.allPersonProperties,c=f.allGroupProperties,a==null&&(a=!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,o,c),s={},l={},m=!0;if(u&&(s=u.response,l=u.payloads,m=u.fallbackToDecide),m&&!a){let O=await super.getFeatureFlagsAndPayloadsStateless(t,n,o,c,i);s={...s,...O.flags||{}},l={...l,...O.payloads||{}}}return{featureFlags:s,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:a}){super.groupIdentifyStateless(t,r,n,{disableGeoip:a},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,n,i){let a={distinct_id:t,...n||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...i?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,n){let i=new Error("PostHog syntheticException");mZa.captureException(this,t,{syntheticException:i},r,n)}},wOy=/\(error: (.*)\)/,QOy=50,LOy="?";function hPC(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,o,c,f,u;if(i[1]){c=i[1];let m=c.lastIndexOf(".");if(c[m-1]==="."&&m--,m>0){a=c.slice(0,m),o=c.slice(m+1);let O=a.indexOf(".Module");O>0&&(c=c.slice(O+1),a=a.slice(0,O))}f=void 0}o&&(f=a,u=o),o==="<anonymous>"&&(u=void 0,c=void 0),c===void 0&&(u=u||LOy,c=f?`${f}.${u}`:u);let s=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return s?.match(/\/[A-Z]:/)&&(s=s.slice(1)),!s&&i[5]&&!l&&(s=i[5]),{filename:s?decodeURI(s):void 0,module:e?e(s):void 0,function:c,lineno:jOy(i[3]),colno:jOy(i[4]),in_app:yPC(s||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function yPC(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function jOy(e){return parseInt(e||"",10)||void 0}function vPC(e){return[90,hPC(e)]}function bPC(e){let r=[vPC(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],o=n.split(`
|
|
2440
|
-
`);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=wOy.test(f)?f.replace(wOy,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=QOy)break}}return gPC(a)}}function gPC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,QOy).map(r=>({...r,filename:r.filename||mPC(t).filename,function:r.function||LOy}))}function mPC(e){return e[e.length-1]||{}}mZa.stackParser=bPC(IAC());mZa.frameModifiers=[TAC];var AZa=class extends Mmf{getLibraryId(){return"posthog-node"}};var ASu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new AZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.119.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var QKo=class{async sendEvent(){}async identify(){}async flush(){}};var wZa=require("fs/promises"),GOy=require("os"),HOy=require("path");var UOy=Hi(require("crypto")),wSu=new Uint8Array(256),PSu=wSu.length;function Rmf(){return PSu>wSu.length-16&&(UOy.default.randomFillSync(wSu),PSu=0),wSu.slice(PSu,PSu+=16)}var Kve=[];for(let e=0;e<256;++e)Kve.push((e+256).toString(16).slice(1));function VOy(e,t=0){return Kve[e[t+0]]+Kve[e[t+1]]+Kve[e[t+2]]+Kve[e[t+3]]+"-"+Kve[e[t+4]]+Kve[e[t+5]]+"-"+Kve[e[t+6]]+Kve[e[t+7]]+"-"+Kve[e[t+8]]+Kve[e[t+9]]+"-"+Kve[e[t+10]]+Kve[e[t+11]]+Kve[e[t+12]]+Kve[e[t+13]]+Kve[e[t+14]]+Kve[e[t+15]]}var WOy=Hi(require("crypto")),Nmf={randomUUID:WOy.default.randomUUID};function OPC(e,t,r){if(Nmf.randomUUID&&!t&&!e)return Nmf.randomUUID();e=e||{};let n=e.random||(e.rng||Rmf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return VOy(n)}var Frt=OPC;var APC="id",PPC=".fern",LKo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new AZa(r),this.userId=t==null?void 0:n_f(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.119.1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ql(F_.of((0,GOy.homedir)()),eu.of(PPC),eu.of(APC));await Vv(t)||(await(0,wZa.mkdir)((0,HOy.dirname)(t),{recursive:!0}),await(0,wZa.writeFile)(t,Frt())),this.persistedDistinctId=(await(0,wZa.readFile)(t)).toString()}return this.persistedDistinctId}};var Fmf;async function jZa(){return Fmf==null&&(Fmf=await wPC()),Fmf}async function wPC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new QKo;let r=await LOu();return r!=null?new LKo({token:r,posthogApiKey:e}):await DYa()!=null?new ASu({posthogApiKey:e}):new LKo({token:void 0,posthogApiKey:e})}catch{return new QKo}}function UKo(e,t){return function(){return e.apply(t,arguments)}}var{toString:jPC}=Object.prototype,{getPrototypeOf:zmf}=Object,{iterator:ESu,toStringTag:KOy}=Symbol,SSu=(e=>t=>{let r=jPC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),YTr=e=>(e=e.toLowerCase(),t=>SSu(t)===e),DSu=e=>t=>typeof t===e,{isArray:SZa}=Array,EZa=DSu("undefined");function VKo(e){return e!==null&&!EZa(e)&&e.constructor!==null&&!EZa(e.constructor)&&fxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var $Oy=YTr("ArrayBuffer");function EPC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$Oy(e.buffer),t}var SPC=DSu("string"),fxe=DSu("function"),YOy=DSu("number"),WKo=e=>e!==null&&typeof e=="object",DPC=e=>e===!0||e===!1,jSu=e=>{if(SSu(e)!=="object")return!1;let t=zmf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(KOy in e)&&!(ESu in e)},CPC=e=>{if(!WKo(e)||VKo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},IPC=YTr("Date"),MPC=YTr("File"),BPC=YTr("Blob"),TPC=YTr("FileList"),qPC=e=>WKo(e)&&fxe(e.pipe),RPC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fxe(e.append)&&((t=SSu(e))==="formdata"||t==="object"&&fxe(e.toString)&&e.toString()==="[object FormData]"))},NPC=YTr("URLSearchParams"),[FPC,xPC,zPC,QPC]=["ReadableStream","Request","Response","Headers"].map(YTr),LPC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function GKo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),SZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(VKo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function XOy(e,t){if(VKo(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var mua=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ZOy=e=>!EZa(e)&&e!==mua;function xmf(){let{caseless:e,skipUndefined:t}=ZOy(this)&&this||{},r={},n=(i,a)=>{let o=e&&XOy(r,a)||a;jSu(r[o])&&jSu(i)?r[o]=xmf(r[o],i):jSu(i)?r[o]=xmf({},i):SZa(i)?r[o]=i.slice():(!t||!EZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&GKo(arguments[i],n);return r}var UPC=(e,t,r,{allOwnKeys:n}={})=>(GKo(t,(i,a)=>{r&&fxe(i)?e[a]=UKo(i,r):e[a]=i},{allOwnKeys:n}),e),VPC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),WPC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},GPC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&zmf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},HPC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},JPC=e=>{if(!e)return null;if(SZa(e))return e;let t=e.length;if(!YOy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},KPC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&zmf(Uint8Array)),$PC=(e,t)=>{let n=(e&&e[ESu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},YPC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},XPC=YTr("HTMLFormElement"),ZPC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),JOy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),kPC=YTr("RegExp"),kOy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};GKo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},ewC=e=>{kOy(e,(t,r)=>{if(fxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(fxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},twC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return SZa(e)?n(e):n(String(e).split(t)),r},rwC=()=>{},nwC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function iwC(e){return!!(e&&fxe(e.append)&&e[KOy]==="FormData"&&e[ESu])}var awC=e=>{let t=new Array(10),r=(n,i)=>{if(WKo(n)){if(t.indexOf(n)>=0)return;if(VKo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=SZa(n)?[]:{};return GKo(n,(o,c)=>{let f=r(o,i+1);!EZa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},owC=YTr("AsyncFunction"),swC=e=>e&&(WKo(e)||fxe(e))&&fxe(e.then)&&fxe(e.catch),eAy=((e,t)=>e?setImmediate:t?((r,n)=>(mua.addEventListener("message",({source:i,data:a})=>{i===mua&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),mua.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fxe(mua.postMessage)),uwC=typeof queueMicrotask<"u"?queueMicrotask.bind(mua):typeof process<"u"&&process.nextTick||eAy,cwC=e=>e!=null&&fxe(e[ESu]),Zf={isArray:SZa,isArrayBuffer:$Oy,isBuffer:VKo,isFormData:RPC,isArrayBufferView:EPC,isString:SPC,isNumber:YOy,isBoolean:DPC,isObject:WKo,isPlainObject:jSu,isEmptyObject:CPC,isReadableStream:FPC,isRequest:xPC,isResponse:zPC,isHeaders:QPC,isUndefined:EZa,isDate:IPC,isFile:MPC,isBlob:BPC,isRegExp:kPC,isFunction:fxe,isStream:qPC,isURLSearchParams:NPC,isTypedArray:KPC,isFileList:TPC,forEach:GKo,merge:xmf,extend:UPC,trim:LPC,stripBOM:VPC,inherits:WPC,toFlatObject:GPC,kindOf:SSu,kindOfTest:YTr,endsWith:HPC,toArray:JPC,forEachEntry:$PC,matchAll:YPC,isHTMLForm:XPC,hasOwnProperty:JOy,hasOwnProp:JOy,reduceDescriptors:kOy,freezeMethods:ewC,toObjectSet:twC,toCamelCase:ZPC,noop:rwC,toFiniteNumber:nwC,findKey:XOy,global:mua,isContextDefined:ZOy,isSpecCompliantForm:iwC,toJSONObject:awC,isAsyncFn:owC,isThenable:swC,setImmediate:eAy,asap:uwC,isIterable:cwC};function DZa(e,t,r,n,i){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),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Zf.inherits(DZa,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:Zf.toJSONObject(this.config),code:this.code,status:this.status}}});var tAy=DZa.prototype,rAy={};["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=>{rAy[e]={value:e}});Object.defineProperties(DZa,rAy);Object.defineProperty(tAy,"isAxiosError",{value:!0});DZa.from=(e,t,r,n,i,a)=>{let o=Object.create(tAy);Zf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return DZa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var zm=DZa;var nAy=Hi(isa(),1),CSu=nAy.default;function Qmf(e){return Zf.isPlainObject(e)||Zf.isArray(e)}function aAy(e){return Zf.endsWith(e,"[]")?e.slice(0,-2):e}function iAy(e,t,r){return e?e.concat(t).map(function(i,a){return i=aAy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function lwC(e){return Zf.isArray(e)&&!e.some(Qmf)}var fwC=Zf.toFlatObject(Zf,{},null,function(t){return/^is[A-Z]/.test(t)});function dwC(e,t,r){if(!Zf.isObject(e))throw new TypeError("target must be an object");t=t||new(CSu||FormData),r=Zf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Zf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Zf.isSpecCompliantForm(t);if(!Zf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Zf.isDate(P))return P.toISOString();if(Zf.isBoolean(P))return P.toString();if(!f&&Zf.isBlob(P))throw new zm("Blob is not supported. Use a Buffer instead.");return Zf.isArrayBuffer(P)||Zf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Zf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Zf.isArray(P)&&lwC(P)||(Zf.isFileList(P)||Zf.endsWith(C,"[]"))&&(T=Zf.toArray(P)))return C=aAy(C),T.forEach(function(U,q){!(Zf.isUndefined(U)||U===null)&&t.append(o===!0?iAy([C],q,a):o===null?C:C+"[]",u(U))}),!1}return Qmf(P)?!0:(t.append(iAy(M,C,a),u(P)),!1)}let l=[],m=Object.assign(fwC,{defaultVisitor:s,convertValue:u,isVisitable:Qmf});function O(P,C){if(!Zf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Zf.forEach(P,function(T,z){(!(Zf.isUndefined(T)||T===null)&&i.call(t,T,Zf.isString(z)?z.trim():z,C,m))===!0&&O(T,C?C.concat(z):[z])}),l.pop()}}if(!Zf.isObject(e))throw new TypeError("data must be an object");return O(e),t}var y4i=dwC;function oAy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function sAy(e,t){this._pairs=[],e&&y4i(e,this,t)}var uAy=sAy.prototype;uAy.append=function(t,r){this._pairs.push([t,r])};uAy.toString=function(t){let r=t?function(n){return t.call(this,n,oAy)}:oAy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var cAy=sAy;function pwC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Oua(e,t,r){if(!t)return e;let n=r&&r.encode||pwC;Zf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Zf.isURLSearchParams(t)?t.toString():new cAy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Lmf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Zf.forEach(this.handlers,function(n){n!==null&&t(n)})}},Umf=Lmf;var CZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var pAy=Hi(require("crypto"),1);var lAy=Hi(require("url"),1),fAy=lAy.default.URLSearchParams;var Vmf="abcdefghijklmnopqrstuvwxyz",dAy="0123456789",_Ay={DIGIT:dAy,ALPHA:Vmf,ALPHA_DIGIT:Vmf+Vmf.toUpperCase()+dAy},_wC=(e=16,t=_Ay.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);pAy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},hAy={isNode:!0,classes:{URLSearchParams:fAy,FormData:CSu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:_Ay,generateString:_wC,protocols:["http","https","file","data"]};var Hmf={};yf(Hmf,{hasBrowserEnv:()=>Gmf,hasStandardBrowserEnv:()=>hwC,hasStandardBrowserWebWorkerEnv:()=>ywC,navigator:()=>Wmf,origin:()=>vwC});var Gmf=typeof window<"u"&&typeof document<"u",Wmf=typeof navigator=="object"&&navigator||void 0,hwC=Gmf&&(!Wmf||["ReactNative","NativeScript","NS"].indexOf(Wmf.product)<0),ywC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vwC=Gmf&&window.location.href||"http://localhost";var J8={...Hmf,...hAy};function Jmf(e,t){return y4i(e,new J8.classes.URLSearchParams,{visitor:function(r,n,i,a){return J8.isNode&&Zf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function bwC(e){return Zf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gwC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function mwC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Zf.isArray(i)?i.length:o,f?(Zf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Zf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Zf.isArray(i[o])&&(i[o]=gwC(i[o])),!c)}if(Zf.isFormData(e)&&Zf.isFunction(e.entries)){let r={};return Zf.forEachEntry(e,(n,i)=>{t(bwC(n),i,r,0)}),r}return null}var ISu=mwC;function OwC(e,t,r){if(Zf.isString(e))try{return(t||JSON.parse)(e),Zf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Kmf={transitional:CZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Zf.isObject(t);if(a&&Zf.isHTMLForm(t)&&(t=new FormData(t)),Zf.isFormData(t))return i?JSON.stringify(ISu(t)):t;if(Zf.isArrayBuffer(t)||Zf.isBuffer(t)||Zf.isStream(t)||Zf.isFile(t)||Zf.isBlob(t)||Zf.isReadableStream(t))return t;if(Zf.isArrayBufferView(t))return t.buffer;if(Zf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Jmf(t,this.formSerializer).toString();if((c=Zf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return y4i(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),OwC(t)):t}],transformResponse:[function(t){let r=this.transitional||Kmf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Zf.isResponse(t)||Zf.isReadableStream(t))return t;if(t&&Zf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?zm.from(c,zm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:J8.classes.FormData,Blob:J8.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Zf.forEach(["delete","get","head","post","put","patch"],e=>{Kmf.headers[e]={}});var IZa=Kmf;var AwC=Zf.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"]),yAy=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2440
|
+
`);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=wOy.test(f)?f.replace(wOy,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=QOy)break}}return gPC(a)}}function gPC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,QOy).map(r=>({...r,filename:r.filename||mPC(t).filename,function:r.function||LOy}))}function mPC(e){return e[e.length-1]||{}}mZa.stackParser=bPC(IAC());mZa.frameModifiers=[TAC];var AZa=class extends Mmf{getLibraryId(){return"posthog-node"}};var ASu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new AZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.120.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var QKo=class{async sendEvent(){}async identify(){}async flush(){}};var wZa=require("fs/promises"),GOy=require("os"),HOy=require("path");var UOy=Hi(require("crypto")),wSu=new Uint8Array(256),PSu=wSu.length;function Rmf(){return PSu>wSu.length-16&&(UOy.default.randomFillSync(wSu),PSu=0),wSu.slice(PSu,PSu+=16)}var Kve=[];for(let e=0;e<256;++e)Kve.push((e+256).toString(16).slice(1));function VOy(e,t=0){return Kve[e[t+0]]+Kve[e[t+1]]+Kve[e[t+2]]+Kve[e[t+3]]+"-"+Kve[e[t+4]]+Kve[e[t+5]]+"-"+Kve[e[t+6]]+Kve[e[t+7]]+"-"+Kve[e[t+8]]+Kve[e[t+9]]+"-"+Kve[e[t+10]]+Kve[e[t+11]]+Kve[e[t+12]]+Kve[e[t+13]]+Kve[e[t+14]]+Kve[e[t+15]]}var WOy=Hi(require("crypto")),Nmf={randomUUID:WOy.default.randomUUID};function OPC(e,t,r){if(Nmf.randomUUID&&!t&&!e)return Nmf.randomUUID();e=e||{};let n=e.random||(e.rng||Rmf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return VOy(n)}var Frt=OPC;var APC="id",PPC=".fern",LKo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new AZa(r),this.userId=t==null?void 0:n_f(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.120.1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ql(F_.of((0,GOy.homedir)()),eu.of(PPC),eu.of(APC));await Vv(t)||(await(0,wZa.mkdir)((0,HOy.dirname)(t),{recursive:!0}),await(0,wZa.writeFile)(t,Frt())),this.persistedDistinctId=(await(0,wZa.readFile)(t)).toString()}return this.persistedDistinctId}};var Fmf;async function jZa(){return Fmf==null&&(Fmf=await wPC()),Fmf}async function wPC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new QKo;let r=await LOu();return r!=null?new LKo({token:r,posthogApiKey:e}):await DYa()!=null?new ASu({posthogApiKey:e}):new LKo({token:void 0,posthogApiKey:e})}catch{return new QKo}}function UKo(e,t){return function(){return e.apply(t,arguments)}}var{toString:jPC}=Object.prototype,{getPrototypeOf:zmf}=Object,{iterator:ESu,toStringTag:KOy}=Symbol,SSu=(e=>t=>{let r=jPC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),YTr=e=>(e=e.toLowerCase(),t=>SSu(t)===e),DSu=e=>t=>typeof t===e,{isArray:SZa}=Array,EZa=DSu("undefined");function VKo(e){return e!==null&&!EZa(e)&&e.constructor!==null&&!EZa(e.constructor)&&fxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var $Oy=YTr("ArrayBuffer");function EPC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$Oy(e.buffer),t}var SPC=DSu("string"),fxe=DSu("function"),YOy=DSu("number"),WKo=e=>e!==null&&typeof e=="object",DPC=e=>e===!0||e===!1,jSu=e=>{if(SSu(e)!=="object")return!1;let t=zmf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(KOy in e)&&!(ESu in e)},CPC=e=>{if(!WKo(e)||VKo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},IPC=YTr("Date"),MPC=YTr("File"),BPC=YTr("Blob"),TPC=YTr("FileList"),qPC=e=>WKo(e)&&fxe(e.pipe),RPC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fxe(e.append)&&((t=SSu(e))==="formdata"||t==="object"&&fxe(e.toString)&&e.toString()==="[object FormData]"))},NPC=YTr("URLSearchParams"),[FPC,xPC,zPC,QPC]=["ReadableStream","Request","Response","Headers"].map(YTr),LPC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function GKo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),SZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(VKo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function XOy(e,t){if(VKo(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var mua=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ZOy=e=>!EZa(e)&&e!==mua;function xmf(){let{caseless:e,skipUndefined:t}=ZOy(this)&&this||{},r={},n=(i,a)=>{let o=e&&XOy(r,a)||a;jSu(r[o])&&jSu(i)?r[o]=xmf(r[o],i):jSu(i)?r[o]=xmf({},i):SZa(i)?r[o]=i.slice():(!t||!EZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&GKo(arguments[i],n);return r}var UPC=(e,t,r,{allOwnKeys:n}={})=>(GKo(t,(i,a)=>{r&&fxe(i)?e[a]=UKo(i,r):e[a]=i},{allOwnKeys:n}),e),VPC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),WPC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},GPC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&zmf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},HPC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},JPC=e=>{if(!e)return null;if(SZa(e))return e;let t=e.length;if(!YOy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},KPC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&zmf(Uint8Array)),$PC=(e,t)=>{let n=(e&&e[ESu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},YPC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},XPC=YTr("HTMLFormElement"),ZPC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),JOy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),kPC=YTr("RegExp"),kOy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};GKo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},ewC=e=>{kOy(e,(t,r)=>{if(fxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(fxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},twC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return SZa(e)?n(e):n(String(e).split(t)),r},rwC=()=>{},nwC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function iwC(e){return!!(e&&fxe(e.append)&&e[KOy]==="FormData"&&e[ESu])}var awC=e=>{let t=new Array(10),r=(n,i)=>{if(WKo(n)){if(t.indexOf(n)>=0)return;if(VKo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=SZa(n)?[]:{};return GKo(n,(o,c)=>{let f=r(o,i+1);!EZa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},owC=YTr("AsyncFunction"),swC=e=>e&&(WKo(e)||fxe(e))&&fxe(e.then)&&fxe(e.catch),eAy=((e,t)=>e?setImmediate:t?((r,n)=>(mua.addEventListener("message",({source:i,data:a})=>{i===mua&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),mua.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fxe(mua.postMessage)),uwC=typeof queueMicrotask<"u"?queueMicrotask.bind(mua):typeof process<"u"&&process.nextTick||eAy,cwC=e=>e!=null&&fxe(e[ESu]),Zf={isArray:SZa,isArrayBuffer:$Oy,isBuffer:VKo,isFormData:RPC,isArrayBufferView:EPC,isString:SPC,isNumber:YOy,isBoolean:DPC,isObject:WKo,isPlainObject:jSu,isEmptyObject:CPC,isReadableStream:FPC,isRequest:xPC,isResponse:zPC,isHeaders:QPC,isUndefined:EZa,isDate:IPC,isFile:MPC,isBlob:BPC,isRegExp:kPC,isFunction:fxe,isStream:qPC,isURLSearchParams:NPC,isTypedArray:KPC,isFileList:TPC,forEach:GKo,merge:xmf,extend:UPC,trim:LPC,stripBOM:VPC,inherits:WPC,toFlatObject:GPC,kindOf:SSu,kindOfTest:YTr,endsWith:HPC,toArray:JPC,forEachEntry:$PC,matchAll:YPC,isHTMLForm:XPC,hasOwnProperty:JOy,hasOwnProp:JOy,reduceDescriptors:kOy,freezeMethods:ewC,toObjectSet:twC,toCamelCase:ZPC,noop:rwC,toFiniteNumber:nwC,findKey:XOy,global:mua,isContextDefined:ZOy,isSpecCompliantForm:iwC,toJSONObject:awC,isAsyncFn:owC,isThenable:swC,setImmediate:eAy,asap:uwC,isIterable:cwC};function DZa(e,t,r,n,i){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),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Zf.inherits(DZa,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:Zf.toJSONObject(this.config),code:this.code,status:this.status}}});var tAy=DZa.prototype,rAy={};["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=>{rAy[e]={value:e}});Object.defineProperties(DZa,rAy);Object.defineProperty(tAy,"isAxiosError",{value:!0});DZa.from=(e,t,r,n,i,a)=>{let o=Object.create(tAy);Zf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return DZa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var zm=DZa;var nAy=Hi(isa(),1),CSu=nAy.default;function Qmf(e){return Zf.isPlainObject(e)||Zf.isArray(e)}function aAy(e){return Zf.endsWith(e,"[]")?e.slice(0,-2):e}function iAy(e,t,r){return e?e.concat(t).map(function(i,a){return i=aAy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function lwC(e){return Zf.isArray(e)&&!e.some(Qmf)}var fwC=Zf.toFlatObject(Zf,{},null,function(t){return/^is[A-Z]/.test(t)});function dwC(e,t,r){if(!Zf.isObject(e))throw new TypeError("target must be an object");t=t||new(CSu||FormData),r=Zf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Zf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Zf.isSpecCompliantForm(t);if(!Zf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Zf.isDate(P))return P.toISOString();if(Zf.isBoolean(P))return P.toString();if(!f&&Zf.isBlob(P))throw new zm("Blob is not supported. Use a Buffer instead.");return Zf.isArrayBuffer(P)||Zf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Zf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Zf.isArray(P)&&lwC(P)||(Zf.isFileList(P)||Zf.endsWith(C,"[]"))&&(T=Zf.toArray(P)))return C=aAy(C),T.forEach(function(U,q){!(Zf.isUndefined(U)||U===null)&&t.append(o===!0?iAy([C],q,a):o===null?C:C+"[]",u(U))}),!1}return Qmf(P)?!0:(t.append(iAy(M,C,a),u(P)),!1)}let l=[],m=Object.assign(fwC,{defaultVisitor:s,convertValue:u,isVisitable:Qmf});function O(P,C){if(!Zf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Zf.forEach(P,function(T,z){(!(Zf.isUndefined(T)||T===null)&&i.call(t,T,Zf.isString(z)?z.trim():z,C,m))===!0&&O(T,C?C.concat(z):[z])}),l.pop()}}if(!Zf.isObject(e))throw new TypeError("data must be an object");return O(e),t}var y4i=dwC;function oAy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function sAy(e,t){this._pairs=[],e&&y4i(e,this,t)}var uAy=sAy.prototype;uAy.append=function(t,r){this._pairs.push([t,r])};uAy.toString=function(t){let r=t?function(n){return t.call(this,n,oAy)}:oAy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var cAy=sAy;function pwC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Oua(e,t,r){if(!t)return e;let n=r&&r.encode||pwC;Zf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Zf.isURLSearchParams(t)?t.toString():new cAy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Lmf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Zf.forEach(this.handlers,function(n){n!==null&&t(n)})}},Umf=Lmf;var CZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var pAy=Hi(require("crypto"),1);var lAy=Hi(require("url"),1),fAy=lAy.default.URLSearchParams;var Vmf="abcdefghijklmnopqrstuvwxyz",dAy="0123456789",_Ay={DIGIT:dAy,ALPHA:Vmf,ALPHA_DIGIT:Vmf+Vmf.toUpperCase()+dAy},_wC=(e=16,t=_Ay.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);pAy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},hAy={isNode:!0,classes:{URLSearchParams:fAy,FormData:CSu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:_Ay,generateString:_wC,protocols:["http","https","file","data"]};var Hmf={};yf(Hmf,{hasBrowserEnv:()=>Gmf,hasStandardBrowserEnv:()=>hwC,hasStandardBrowserWebWorkerEnv:()=>ywC,navigator:()=>Wmf,origin:()=>vwC});var Gmf=typeof window<"u"&&typeof document<"u",Wmf=typeof navigator=="object"&&navigator||void 0,hwC=Gmf&&(!Wmf||["ReactNative","NativeScript","NS"].indexOf(Wmf.product)<0),ywC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vwC=Gmf&&window.location.href||"http://localhost";var J8={...Hmf,...hAy};function Jmf(e,t){return y4i(e,new J8.classes.URLSearchParams,{visitor:function(r,n,i,a){return J8.isNode&&Zf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function bwC(e){return Zf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gwC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function mwC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Zf.isArray(i)?i.length:o,f?(Zf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Zf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Zf.isArray(i[o])&&(i[o]=gwC(i[o])),!c)}if(Zf.isFormData(e)&&Zf.isFunction(e.entries)){let r={};return Zf.forEachEntry(e,(n,i)=>{t(bwC(n),i,r,0)}),r}return null}var ISu=mwC;function OwC(e,t,r){if(Zf.isString(e))try{return(t||JSON.parse)(e),Zf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Kmf={transitional:CZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Zf.isObject(t);if(a&&Zf.isHTMLForm(t)&&(t=new FormData(t)),Zf.isFormData(t))return i?JSON.stringify(ISu(t)):t;if(Zf.isArrayBuffer(t)||Zf.isBuffer(t)||Zf.isStream(t)||Zf.isFile(t)||Zf.isBlob(t)||Zf.isReadableStream(t))return t;if(Zf.isArrayBufferView(t))return t.buffer;if(Zf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Jmf(t,this.formSerializer).toString();if((c=Zf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return y4i(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),OwC(t)):t}],transformResponse:[function(t){let r=this.transitional||Kmf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Zf.isResponse(t)||Zf.isReadableStream(t))return t;if(t&&Zf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?zm.from(c,zm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:J8.classes.FormData,Blob:J8.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Zf.forEach(["delete","get","head","post","put","patch"],e=>{Kmf.headers[e]={}});var IZa=Kmf;var AwC=Zf.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"]),yAy=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2441
2441
|
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&AwC[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var vAy=Symbol("internals");function HKo(e){return e&&String(e).trim().toLowerCase()}function MSu(e){return e===!1||e==null?e:Zf.isArray(e)?e.map(MSu):String(e)}function PwC(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var wwC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function $mf(e,t,r,n,i){if(Zf.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Zf.isString(t)){if(Zf.isString(n))return t.indexOf(n)!==-1;if(Zf.isRegExp(n))return n.test(t)}}function jwC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function EwC(e,t){let r=Zf.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,a,o){return this[n].call(this,t,i,a,o)},configurable:!0})})}var MZa=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,f,u){let s=HKo(f);if(!s)throw new Error("header name must be a non-empty string");let l=Zf.findKey(i,s);(!l||i[l]===void 0||u===!0||u===void 0&&i[l]!==!1)&&(i[l||f]=MSu(c))}let o=(c,f)=>Zf.forEach(c,(u,s)=>a(u,s,f));if(Zf.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(Zf.isString(t)&&(t=t.trim())&&!wwC(t))o(yAy(t),r);else if(Zf.isObject(t)&&Zf.isIterable(t)){let c={},f,u;for(let s of t){if(!Zf.isArray(s))throw TypeError("Object iterator must return a key-value pair");c[u=s[0]]=(f=c[u])?Zf.isArray(f)?[...f,s[1]]:[f,s[1]]:s[1]}o(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=HKo(t),t){let n=Zf.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return PwC(i);if(Zf.isFunction(r))return r.call(this,i,n);if(Zf.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=HKo(t),t){let n=Zf.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||$mf(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(o){if(o=HKo(o),o){let c=Zf.findKey(n,o);c&&(!r||$mf(n,n[c],c,r))&&(delete n[c],i=!0)}}return Zf.isArray(t)?t.forEach(a):a(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let a=r[n];(!t||$mf(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Zf.forEach(this,(i,a)=>{let o=Zf.findKey(n,a);if(o){r[o]=MSu(i),delete r[a];return}let c=t?jwC(a):String(a).trim();c!==a&&delete r[a],r[c]=MSu(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Zf.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Zf.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
2442
2442
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[vAy]=this[vAy]={accessors:{}}).accessors,i=this.prototype;function a(o){let c=HKo(o);n[c]||(EwC(i,o),n[c]=!0)}return Zf.isArray(t)?t.forEach(a):a(t),this}};MZa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Zf.reduceDescriptors(MZa.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Zf.freezeMethods(MZa);var g$=MZa;function JKo(e,t){let r=this||IZa,n=t||r,i=g$.from(n.headers),a=n.data;return Zf.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function KKo(e){return!!(e&&e.__CANCEL__)}function bAy(e,t,r){zm.call(this,e??"canceled",zm.ERR_CANCELED,t,r),this.name="CanceledError"}Zf.inherits(bAy,zm,{__CANCEL__:!0});var xrt=bAy;function wUr(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new zm("Request failed with status code "+r.status,[zm.ERR_BAD_REQUEST,zm.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Ymf(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Xmf(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Aua(e,t,r){let n=!Ymf(t);return e&&(n||r==!1)?Xmf(e,t):t}var qAy=Hi(ZEu(),1),RAy=Hi(require("http"),1),NAy=Hi(require("https"),1),FAy=Hi(require("util"),1),xAy=Hi(Z0f(),1),CAi=Hi(require("zlib"),1);var Pua="1.12.2";function $Ko(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var SwC=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Zmf(e,t,r){let n=r&&r.Blob||J8.classes.Blob,i=$Ko(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=SwC.exec(e);if(!a)throw new zm("Invalid URL",zm.ERR_INVALID_URL);let o=a[1],c=a[2],f=a[3],u=Buffer.from(decodeURIComponent(f),c?"base64":"utf8");if(t){if(!n)throw new zm("Blob is not supported",zm.ERR_NOT_SUPPORT);return new n([u],{type:o})}return u}throw new zm("Unsupported protocol "+i,zm.ERR_NOT_SUPPORT)}var jua=Hi(require("stream"),1);var gAy=Hi(require("stream"),1);var kmf=Symbol("internals"),eOf=class extends gAy.default.Transform{constructor(t){t=Zf.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Zf.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[kmf]={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",n=>{n==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[kmf];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[kmf],a=i.maxRate,o=this.readableHighWaterMark,c=i.timeWindow,f=1e3/c,u=a/f,s=i.minChunkSize!==!1?Math.max(i.minChunkSize,u*.01):0,l=(O,P)=>{let C=Buffer.byteLength(O);i.bytesSeen+=C,i.bytes+=C,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(O)?process.nextTick(P):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(P)}},m=(O,P)=>{let C=Buffer.byteLength(O),M=null,T=o,z,U=0;if(a){let q=Date.now();(!i.ts||(U=q-i.ts)>=c)&&(i.ts=q,z=u-i.bytes,i.bytes=z<0?-z:0,U=0),z=u-i.bytes}if(a){if(z<=0)return setTimeout(()=>{P(null,O)},c-U);z<T&&(T=z)}T&&C>T&&C-T>s&&(M=O.subarray(T),O=O.subarray(0,T)),l(O,M?()=>{process.nextTick(P,null,M)}:P)};m(t,function O(P,C){if(P)return n(P);C?m(C,O):n(null)})}},tOf=eOf;var zAy=require("events");var OAy=Hi(require("util"),1),AAy=require("stream");var{asyncIterator:mAy}=Symbol,DwC=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[mAy]?yield*e[mAy]():yield e},BSu=DwC;var CwC=J8.ALPHABET.ALPHA_DIGIT+"-_",YKo=typeof TextEncoder=="function"?new TextEncoder:new OAy.default.TextEncoder,wua=`\r
|
|
2443
2443
|
`,IwC=YKo.encode(wua),MwC=2,rOf=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Zf.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${wua}`;i?r=YKo.encode(String(r).replace(/\r?\n|\r\n?/g,wua)):a+=`Content-Type: ${r.type||"application/octet-stream"}${wua}`,this.headers=YKo.encode(a+wua),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+MwC,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Zf.isTypedArray(t)?yield t:yield*BSu(t),yield IwC}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},BwC=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+J8.generateString(i,CwC)}=r||{};if(!Zf.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=YKo.encode("--"+a+wua),c=YKo.encode("--"+a+"--"+wua),f=c.byteLength,u=Array.from(e.entries()).map(([l,m])=>{let O=new rOf(l,m);return f+=O.size,O});f+=o.byteLength*u.length,f=Zf.toFiniteNumber(f);let s={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(s["Content-Length"]=f),t&&t(s),AAy.Readable.from((async function*(){for(let l of u)yield o,yield*l.encode();yield c})())},PAy=BwC;var wAy=Hi(require("stream"),1),nOf=class extends wAy.default.Transform{__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},jAy=nOf;var TwC=(e,t)=>Zf.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(a){n(a)}},n)}:e,EAy=TwC;function qwC(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,o;return t=t!==void 0?t:1e3,function(f){let u=Date.now(),s=n[a];o||(o=u),r[i]=f,n[i]=u;let l=a,m=0;for(;l!==i;)m+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),u-o<t)return;let O=s&&u-s;return O?Math.round(m*1e3/O):void 0}}var SAy=qwC;function RwC(e,t){let r=0,n=1e3/t,i,a,o=(u,s=Date.now())=>{r=s,i=null,a&&(clearTimeout(a),a=null),e(...u)};return[(...u)=>{let s=Date.now(),l=s-r;l>=n?o(u,s):(i=u,a||(a=setTimeout(()=>{a=null,o(i)},n-l)))},()=>i&&o(i)]}var DAy=RwC;var DAi=(e,t,r=3)=>{let n=0,i=SAy(50,250);return DAy(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,f=o-n,u=i(f),s=o<=c;n=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&s?(c-o)/u:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},BZa=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},TZa=e=>(...t)=>Zf.asap(()=>e(...t));function iOf(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let a=n.length,o=n.length;for(let m=0;m<o;m++)if(n.charCodeAt(m)===37&&m+2<o){let O=n.charCodeAt(m+1),P=n.charCodeAt(m+2);(O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102)&&(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(a-=2,m+=2)}let c=0,f=o-1,u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);f>=0&&(n.charCodeAt(f)===61?(c++,f--):u(f)&&(c++,f-=3)),c===1&&f>=0&&(n.charCodeAt(f)===61||u(f))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var CAy={flush:CAi.default.constants.Z_SYNC_FLUSH,finishFlush:CAi.default.constants.Z_SYNC_FLUSH},NwC={flush:CAi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:CAi.default.constants.BROTLI_OPERATION_FLUSH},IAy=Zf.isFunction(CAi.default.createBrotliDecompress),{http:FwC,https:xwC}=xAy.default,zwC=/https:?/,MAy=J8.protocols.map(e=>e+":"),BAy=(e,[t,r])=>(e.on("end",r).on("error",r),t);function QwC(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function QAy(e,t,r){let n=t;if(!n&&n!==!1){let i=qAy.default.getProxyForUrl(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let a=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(a){QAy(a,t,a.href)}}var LwC=typeof process<"u"&&Zf.kindOf(process)==="process",UwC=e=>new Promise((t,r)=>{let n,i,a=(f,u)=>{i||(i=!0,n&&n(f,u))},o=f=>{a(f),t(f)},c=f=>{a(f,!0),r(f)};e(o,c,f=>n=f).catch(c)}),VwC=({address:e,family:t})=>{if(!Zf.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},TAy=(e,t)=>VwC(Zf.isObject(e)?e:{address:e,family:t}),LAy=LwC&&function(t){return UwC(async function(n,i,a){let{data:o,lookup:c,family:f}=t,{responseType:u,responseEncoding:s}=t,l=t.method.toUpperCase(),m,O=!1,P;if(c){let Se=EAy(c,Ot=>Zf.isArray(Ot)?Ot:[Ot]);c=(Ot,mt,Qe)=>{Se(Ot,mt,(Be,er,pt)=>{if(Be)return Qe(Be);let Ar=Zf.isArray(er)?er.map(Xt=>TAy(Xt)):[TAy(er,pt)];mt.all?Qe(Be,Ar):Qe(Be,Ar[0].address,Ar[0].family)})}}let C=new zAy.EventEmitter,M=()=>{t.cancelToken&&t.cancelToken.unsubscribe(T),t.signal&&t.signal.removeEventListener("abort",T),C.removeAllListeners()};a((Se,Ot)=>{m=!0,Ot&&(O=!0,M())});function T(Se){C.emit("abort",!Se||Se.type?new xrt(null,t,P):Se)}C.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(T),t.signal&&(t.signal.aborted?T():t.signal.addEventListener("abort",T)));let z=Aua(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(z,J8.hasBrowserEnv?J8.origin:void 0),q=U.protocol||MAy[0];if(q==="data:"){if(t.maxContentLength>-1){let Ot=String(t.url||z||"");if(iOf(Ot)>t.maxContentLength)return i(new zm("maxContentLength size of "+t.maxContentLength+" exceeded",zm.ERR_BAD_RESPONSE,t))}let Se;if(l!=="GET")return wUr(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=Zmf(t.url,u==="blob",{Blob:t.env&&t.env.Blob})}catch(Ot){throw zm.from(Ot,zm.ERR_BAD_REQUEST,t)}return u==="text"?(Se=Se.toString(s),(!s||s==="utf8")&&(Se=Zf.stripBOM(Se))):u==="stream"&&(Se=jua.default.Readable.from(Se)),wUr(n,i,{data:Se,status:200,statusText:"OK",headers:new g$,config:t})}if(MAy.indexOf(q)===-1)return i(new zm("Unsupported protocol "+q,zm.ERR_BAD_REQUEST,t));let V=g$.from(t.headers).normalize();V.set("User-Agent","axios/"+Pua,!1);let{onUploadProgress:$,onDownloadProgress:re}=t,Y=t.maxRate,k,ne;if(Zf.isSpecCompliantForm(o)){let Se=V.getContentType(/boundary=([-_\w\d]{10,70})/i);o=PAy(o,Ot=>{V.set(Ot)},{tag:`axios-${Pua}-boundary`,boundary:Se&&Se[1]||void 0})}else if(Zf.isFormData(o)&&Zf.isFunction(o.getHeaders)){if(V.set(o.getHeaders()),!V.hasContentLength())try{let Se=await FAy.default.promisify(o.getLength).call(o);Number.isFinite(Se)&&Se>=0&&V.setContentLength(Se)}catch{}}else if(Zf.isBlob(o)||Zf.isFile(o))o.size&&V.setContentType(o.type||"application/octet-stream"),V.setContentLength(o.size||0),o=jua.default.Readable.from(BSu(o));else if(o&&!Zf.isStream(o)){if(!Buffer.isBuffer(o))if(Zf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(Zf.isString(o))o=Buffer.from(o,"utf-8");else return i(new zm("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",zm.ERR_BAD_REQUEST,t));if(V.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new zm("Request body larger than maxBodyLength limit",zm.ERR_BAD_REQUEST,t))}let Oe=Zf.toFiniteNumber(V.getContentLength());Zf.isArray(Y)?(k=Y[0],ne=Y[1]):k=ne=Y,o&&($||k)&&(Zf.isStream(o)||(o=jua.default.Readable.from(o,{objectMode:!1})),o=jua.default.pipeline([o,new tOf({maxRate:Zf.toFiniteNumber(k)})],Zf.noop),$&&o.on("progress",BAy(o,BZa(Oe,DAi(TZa($),!1,3)))));let ye;if(t.auth){let Se=t.auth.username||"",Ot=t.auth.password||"";ye=Se+":"+Ot}if(!ye&&U.username){let Se=U.username,Ot=U.password;ye=Se+":"+Ot}ye&&V.delete("authorization");let ge;try{ge=Oua(U.pathname+U.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Se){let Ot=new Error(Se.message);return Ot.config=t,Ot.url=t.url,Ot.exists=!0,i(Ot)}V.set("Accept-Encoding","gzip, compress, deflate"+(IAy?", br":""),!1);let pe={path:ge,method:l,headers:V.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:ye,protocol:q,family:f,beforeRedirect:QwC,beforeRedirects:{}};!Zf.isUndefined(c)&&(pe.lookup=c),t.socketPath?pe.socketPath=t.socketPath:(pe.hostname=U.hostname.startsWith("[")?U.hostname.slice(1,-1):U.hostname,pe.port=U.port,QAy(pe,t.proxy,q+"//"+U.hostname+(U.port?":"+U.port:"")+pe.path));let Ce,je=zwC.test(pe.protocol);if(pe.agent=je?t.httpsAgent:t.httpAgent,t.transport?Ce=t.transport:t.maxRedirects===0?Ce=je?NAy.default:RAy.default:(t.maxRedirects&&(pe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(pe.beforeRedirects.config=t.beforeRedirect),Ce=je?xwC:FwC),t.maxBodyLength>-1?pe.maxBodyLength=t.maxBodyLength:pe.maxBodyLength=1/0,t.insecureHTTPParser&&(pe.insecureHTTPParser=t.insecureHTTPParser),P=Ce.request(pe,function(Ot){if(P.destroyed)return;let mt=[Ot],Qe=+Ot.headers["content-length"];if(re||ne){let Xt=new tOf({maxRate:Zf.toFiniteNumber(ne)});re&&Xt.on("progress",BAy(Xt,BZa(Qe,DAi(TZa(re),!0,3)))),mt.push(Xt)}let Be=Ot,er=Ot.req||P;if(t.decompress!==!1&&Ot.headers["content-encoding"])switch((l==="HEAD"||Ot.statusCode===204)&&delete Ot.headers["content-encoding"],(Ot.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":mt.push(CAi.default.createUnzip(CAy)),delete Ot.headers["content-encoding"];break;case"deflate":mt.push(new jAy),mt.push(CAi.default.createUnzip(CAy)),delete Ot.headers["content-encoding"];break;case"br":IAy&&(mt.push(CAi.default.createBrotliDecompress(NwC)),delete Ot.headers["content-encoding"])}Be=mt.length>1?jua.default.pipeline(mt,Zf.noop):mt[0];let pt=jua.default.finished(Be,()=>{pt(),M()}),Ar={status:Ot.statusCode,statusText:Ot.statusMessage,headers:new g$(Ot.headers),config:t,request:er};if(u==="stream")Ar.data=Be,wUr(n,i,Ar);else{let Xt=[],Ye=0;Be.on("data",function(tr){Xt.push(tr),Ye+=tr.length,t.maxContentLength>-1&&Ye>t.maxContentLength&&(O=!0,Be.destroy(),i(new zm("maxContentLength size of "+t.maxContentLength+" exceeded",zm.ERR_BAD_RESPONSE,t,er)))}),Be.on("aborted",function(){if(O)return;let tr=new zm("stream has been aborted",zm.ERR_BAD_RESPONSE,t,er);Be.destroy(tr),i(tr)}),Be.on("error",function(tr){P.destroyed||i(zm.from(tr,null,t,er))}),Be.on("end",function(){try{let tr=Xt.length===1?Xt[0]:Buffer.concat(Xt);u!=="arraybuffer"&&(tr=tr.toString(s),(!s||s==="utf8")&&(tr=Zf.stripBOM(tr))),Ar.data=tr}catch(tr){return i(zm.from(tr,null,t,Ar.request,Ar))}wUr(n,i,Ar)})}C.once("abort",Xt=>{Be.destroyed||(Be.emit("error",Xt),Be.destroy())})}),C.once("abort",Se=>{i(Se),P.destroy(Se)}),P.on("error",function(Ot){i(zm.from(Ot,null,t,P))}),P.on("socket",function(Ot){Ot.setKeepAlive(!0,1e3*60)}),t.timeout){let Se=parseInt(t.timeout,10);if(Number.isNaN(Se)){i(new zm("error trying to parse `config.timeout` to int",zm.ERR_BAD_OPTION_VALUE,t,P));return}P.setTimeout(Se,function(){if(m)return;let mt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Qe=t.transitional||CZa;t.timeoutErrorMessage&&(mt=t.timeoutErrorMessage),i(new zm(mt,Qe.clarifyTimeoutError?zm.ETIMEDOUT:zm.ECONNABORTED,t,P)),T()})}if(Zf.isStream(o)){let Se=!1,Ot=!1;o.on("end",()=>{Se=!0}),o.once("error",mt=>{Ot=!0,P.destroy(mt)}),o.on("close",()=>{!Se&&!Ot&&T(new xrt("Request stream has been aborted",t,P))}),o.pipe(P)}else P.end(o)})};var UAy=J8.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,J8.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(J8.origin),J8.navigator&&/(msie|trident)/i.test(J8.navigator.userAgent)):()=>!0;var VAy=J8.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let o=[e+"="+encodeURIComponent(t)];Zf.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Zf.isString(n)&&o.push("path="+n),Zf.isString(i)&&o.push("domain="+i),a===!0&&o.push("secure"),document.cookie=o.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 WAy=e=>e instanceof g$?{...e}:e;function XTr(e,t){t=t||{};let r={};function n(u,s,l,m){return Zf.isPlainObject(u)&&Zf.isPlainObject(s)?Zf.merge.call({caseless:m},u,s):Zf.isPlainObject(s)?Zf.merge({},s):Zf.isArray(s)?s.slice():s}function i(u,s,l,m){if(Zf.isUndefined(s)){if(!Zf.isUndefined(u))return n(void 0,u,l,m)}else return n(u,s,l,m)}function a(u,s){if(!Zf.isUndefined(s))return n(void 0,s)}function o(u,s){if(Zf.isUndefined(s)){if(!Zf.isUndefined(u))return n(void 0,u)}else return n(void 0,s)}function c(u,s,l){if(l in t)return n(u,s);if(l in e)return n(void 0,u)}let f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,s,l)=>i(WAy(u),WAy(s),l,!0)};return Zf.forEach(Object.keys({...e,...t}),function(s){let l=f[s]||i,m=l(e[s],t[s],s);Zf.isUndefined(m)&&l!==c||(r[s]=m)}),r}var TSu=e=>{let t=XTr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=g$.from(o),t.url=Oua(Aua(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Zf.isFormData(r)){if(J8.hasStandardBrowserEnv||J8.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Zf.isFunction(r.getHeaders)){let f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([s,l])=>{u.includes(s.toLowerCase())&&o.set(s,l)})}}if(J8.hasStandardBrowserEnv&&(n&&Zf.isFunction(n)&&(n=n(t)),n||n!==!1&&UAy(t.url))){let f=i&&a&&VAy.read(a);f&&o.set(i,f)}return t};var WwC=typeof XMLHttpRequest<"u",GAy=WwC&&function(e){return new Promise(function(r,n){let i=TSu(e),a=i.data,o=g$.from(i.headers).normalize(),{responseType:c,onUploadProgress:f,onDownloadProgress:u}=i,s,l,m,O,P;function C(){O&&O(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let M=new XMLHttpRequest;M.open(i.method.toUpperCase(),i.url,!0),M.timeout=i.timeout;function T(){if(!M)return;let U=g$.from("getAllResponseHeaders"in M&&M.getAllResponseHeaders()),V={data:!c||c==="text"||c==="json"?M.responseText:M.response,status:M.status,statusText:M.statusText,headers:U,config:e,request:M};wUr(function(re){r(re),C()},function(re){n(re),C()},V),M=null}"onloadend"in M?M.onloadend=T:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(T)},M.onabort=function(){M&&(n(new zm("Request aborted",zm.ECONNABORTED,e,M)),M=null)},M.onerror=function(q){let V=q&&q.message?q.message:"Network Error",$=new zm(V,zm.ERR_NETWORK,e,M);$.event=q||null,n($),M=null},M.ontimeout=function(){let q=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",V=i.transitional||CZa;i.timeoutErrorMessage&&(q=i.timeoutErrorMessage),n(new zm(q,V.clarifyTimeoutError?zm.ETIMEDOUT:zm.ECONNABORTED,e,M)),M=null},a===void 0&&o.setContentType(null),"setRequestHeader"in M&&Zf.forEach(o.toJSON(),function(q,V){M.setRequestHeader(V,q)}),Zf.isUndefined(i.withCredentials)||(M.withCredentials=!!i.withCredentials),c&&c!=="json"&&(M.responseType=i.responseType),u&&([m,P]=DAi(u,!0),M.addEventListener("progress",m)),f&&M.upload&&([l,O]=DAi(f),M.upload.addEventListener("progress",l),M.upload.addEventListener("loadend",O)),(i.cancelToken||i.signal)&&(s=U=>{M&&(n(!U||U.type?new xrt(null,e,M):U),M.abort(),M=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));let z=$Ko(i.url);if(z&&J8.protocols.indexOf(z)===-1){n(new zm("Unsupported protocol "+z+":",zm.ERR_BAD_REQUEST,e));return}M.send(a||null)})};var GwC=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(u){if(!i){i=!0,c();let s=u instanceof Error?u:this.reason;n.abort(s instanceof zm?s:new xrt(s instanceof Error?s.message:s))}},o=t&&setTimeout(()=>{o=null,a(new zm(`timeout ${t} of ms exceeded`,zm.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),e=null)};e.forEach(u=>u.addEventListener("abort",a));let{signal:f}=n;return f.unsubscribe=()=>Zf.asap(c),f}},HAy=GwC;var HwC=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},JwC=async function*(e,t){for await(let r of KwC(e))yield*HwC(r,t)},KwC=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},aOf=(e,t,r,n)=>{let i=JwC(e,t),a=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{let{done:u,value:s}=await i.next();if(u){c(),f.close();return}let l=s.byteLength;if(r){let m=a+=l;r(m)}f.enqueue(new Uint8Array(s))}catch(u){throw c(u),u}},cancel(f){return c(f),i.return()}},{highWaterMark:2})};var JAy=64*1024,{isFunction:qSu}=Zf,$wC=(({Request:e,Response:t})=>({Request:e,Response:t}))(Zf.global),{ReadableStream:KAy,TextEncoder:$Ay}=Zf.global,YAy=(e,...t)=>{try{return!!e(...t)}catch{return!1}},YwC=e=>{e=Zf.merge.call({skipUndefined:!0},$wC,e);let{fetch:t,Request:r,Response:n}=e,i=t?qSu(t):typeof fetch=="function",a=qSu(r),o=qSu(n);if(!i)return!1;let c=i&&qSu(KAy),f=i&&(typeof $Ay=="function"?(P=>C=>P.encode(C))(new $Ay):async P=>new Uint8Array(await new r(P).arrayBuffer())),u=a&&c&&YAy(()=>{let P=!1,C=new r(J8.origin,{body:new KAy,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!C}),s=o&&c&&YAy(()=>Zf.isReadableStream(new n("").body)),l={stream:s&&(P=>P.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!l[P]&&(l[P]=(C,M)=>{let T=C&&C[P];if(T)return T.call(C);throw new zm(`Response type '${P}' is not supported`,zm.ERR_NOT_SUPPORT,M)})});let m=async P=>{if(P==null)return 0;if(Zf.isBlob(P))return P.size;if(Zf.isSpecCompliantForm(P))return(await new r(J8.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(Zf.isArrayBufferView(P)||Zf.isArrayBuffer(P))return P.byteLength;if(Zf.isURLSearchParams(P)&&(P=P+""),Zf.isString(P))return(await f(P)).byteLength},O=async(P,C)=>{let M=Zf.toFiniteNumber(P.getContentLength());return M??m(C)};return async P=>{let{url:C,method:M,data:T,signal:z,cancelToken:U,timeout:q,onDownloadProgress:V,onUploadProgress:$,responseType:re,headers:Y,withCredentials:k="same-origin",fetchOptions:ne}=TSu(P),Oe=t||fetch;re=re?(re+"").toLowerCase():"text";let ye=HAy([z,U&&U.toAbortSignal()],q),ge=null,pe=ye&&ye.unsubscribe&&(()=>{ye.unsubscribe()}),Ce;try{if($&&u&&M!=="get"&&M!=="head"&&(Ce=await O(Y,T))!==0){let Be=new r(C,{method:"POST",body:T,duplex:"half"}),er;if(Zf.isFormData(T)&&(er=Be.headers.get("content-type"))&&Y.setContentType(er),Be.body){let[pt,Ar]=BZa(Ce,DAi(TZa($)));T=aOf(Be.body,JAy,pt,Ar)}}Zf.isString(k)||(k=k?"include":"omit");let je=a&&"credentials"in r.prototype,Se={...ne,signal:ye,method:M.toUpperCase(),headers:Y.normalize().toJSON(),body:T,duplex:"half",credentials:je?k:void 0};ge=a&&new r(C,Se);let Ot=await(a?Oe(ge,ne):Oe(C,Se)),mt=s&&(re==="stream"||re==="response");if(s&&(V||mt&&pe)){let Be={};["status","statusText","headers"].forEach(Xt=>{Be[Xt]=Ot[Xt]});let er=Zf.toFiniteNumber(Ot.headers.get("content-length")),[pt,Ar]=V&&BZa(er,DAi(TZa(V),!0))||[];Ot=new n(aOf(Ot.body,JAy,pt,()=>{Ar&&Ar(),pe&&pe()}),Be)}re=re||"text";let Qe=await l[Zf.findKey(l,re)||"text"](Ot,P);return!mt&&pe&&pe(),await new Promise((Be,er)=>{wUr(Be,er,{data:Qe,headers:g$.from(Ot.headers),status:Ot.status,statusText:Ot.statusText,config:P,request:ge})})}catch(je){throw pe&&pe(),je&&je.name==="TypeError"&&/Load failed|fetch/i.test(je.message)?Object.assign(new zm("Network Error",zm.ERR_NETWORK,P,ge),{cause:je.cause||je}):zm.from(je,je&&je.code,P,ge)}}},XwC=new Map,oOf=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],o=a.length,c=o,f,u,s=XwC;for(;c--;)f=a[c],u=s.get(f),u===void 0&&s.set(f,u=c?new Map:YwC(t)),s=u;return u},gnU=oOf();var sOf={http:LAy,xhr:GAy,fetch:{get:oOf}};Zf.forEach(sOf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var XAy=e=>`- ${e}`,kwC=e=>Zf.isFunction(e)||e===null||e===!1,RSu={getAdapter:(e,t)=>{e=Zf.isArray(e)?e:[e];let{length:r}=e,n,i,a={};for(let o=0;o<r;o++){n=e[o];let c;if(i=n,!kwC(n)&&(i=sOf[(c=String(n)).toLowerCase()],i===void 0))throw new zm(`Unknown adapter '${c}'`);if(i&&(Zf.isFunction(i)||(i=i.get(t))))break;a[c||"#"+o]=i}if(!i){let o=Object.entries(a).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
|
|
@@ -2678,7 +2678,7 @@ ${q}${z}${V}${dro}`});function kNu({message:e,error:t,logger:r,logLevel:n=sE.Err
|
|
|
2678
2678
|
Run ${Mf.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
2679
2679
|
Run ${Mf.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),RZa(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function pRf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!lUy(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,f)=>c.generatorName.localeCompare(f.generatorName)||c.currentVersion.localeCompare(f.currentVersion));for(let c of o)i+=`
|
|
2680
2680
|
${await viI(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+Mf.dim(c.currentVersion)+Mf.reset(" \u2192 ")+Mf.green(c.latestVersion);return i+=`
|
|
2681
|
-
`,n?RZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function viI(e){let r=await new cUy.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 biI({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=t3i(s.name,l),O=await bTr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});O!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=t3i(u.name,s),m=await bTr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await CTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function pUy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Sxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function nFu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await biI({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...pUy(u,f,t.logger));else o.push(...pUy(c.versions,void 0,t.logger))}return o}var RZo=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var yro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var _Rf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)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(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),_Uy=typeof globalThis.AbortController=="function",hUy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",yUy=typeof globalThis.ReadableStream=="function",vUy=typeof globalThis.FormData=="function",iFu=["get","post","put","patch","head","delete"],giI=()=>{};giI();var bUy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},aFu=2147483647,gUy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,oFu=Symbol("stop"),mUy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},OUy={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 miI=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=gUy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},AUy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},PUy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(AUy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},wUy=(e,t,r)=>{if(!e.body)return e;let n=miI(r??e.body);return new Request(e,{duplex:"half",body:AUy(e.body,n,t)})};var vro=e=>e!==null&&typeof e=="object";var NZo=(...e)=>{for(let t of e)if((!vro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return vRf({},...e)},hRf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function sFu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:vRf(e[r]??[],t[r]??[])}var yRf=(e={},t={})=>({beforeRequest:sFu(e,t,"beforeRequest"),beforeRetry:sFu(e,t,"beforeRetry"),afterResponse:sFu(e,t,"afterResponse"),beforeError:sFu(e,t,"beforeError")}),vRf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(vro(i)){for(let[a,o]of Object.entries(i))vro(o)&&a in t&&(o=vRf(t[a],o)),t={...t,[a]:o};vro(i.hooks)&&(n=yRf(n,i.hooks),t.hooks=n),vro(i.headers)&&(r=hRf(r,i.headers),t.headers=r)}return t};var EUy=e=>iFu.includes(e)?e.toUpperCase():e,OiI=["get","put","head","delete","options","trace"],AiI=[408,413,429,500,502,503,504],PiI=[413,429,503],jUy={limit:2,methods:OiI,statusCodes:AiI,afterStatusCodes:PiI,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},SUy=(e={})=>{if(typeof e=="number")return{...jUy,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{...jUy,...e}};async function bRf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new yro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function gRf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var DUy=(e,t)=>{let r={};for(let n in t)!(n in OUy)&&!(n in mUy)&&!(n in e)&&(r[n]=t[n]);return r},CUy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var FZo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>aFu)throw new RangeError(`The \`timeout\` option cannot be greater than ${aFu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new RZo(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yUy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return PUy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),n.request.bodyUsed||f.push(n.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(bUy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:hRf(this._input.headers,r.headers),hooks:yRf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:EUy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:SUy(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(_Uy&&hUy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(_Rf&&(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),CUy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(vUy&&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)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!_Rf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=wUy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof yro)throw t;if(t instanceof RZo){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=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(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i: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 n=Math.min(this._calculateRetryDelay(r),aFu);if(this._retryCount<1)throw r;await gRf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===oFu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=DUy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):bRf(this._originalRequest,t,this.abortController,this._options)}};var mRf=e=>{let t=(r,n)=>FZo.create(r,NZo(e,n));for(let r of iFu)t[r]=(n,i)=>FZo.create(n,NZo(e,i,{method:r}));return t.create=r=>mRf(NZo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),mRf(NZo(e,r))),t.stop=oFu,t},wiI=mRf(),IUy=wiI;var kUy=Hi(ZUy(),1);function jRf(e){let t=(0,kUy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var JVy=Hi(HVy(),1),KVy=Hi(pTu(),1),xRf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},zRf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function QRf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??jRf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,JVy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await IUy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new xRf(e):l}if(t.allVersions)return u;let s=new zRf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[O,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[O];if(!l){let O=Object.keys(u.versions);if(r=KVy.default.maxSatisfying(O,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function Tla(e,t){let{version:r}=await QRf(e.toLowerCase(),t);return r}async function z7i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Tla(e.packageName,{version:t?"prerelease":"latest"})}var $Vy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],gFu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=sE.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new rFu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.119.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Mf.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new jne}failWithoutThrowing(t,r){this.didSucceed=!1,kNu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await jZa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await fUy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2681
|
+
`,n?RZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function viI(e){let r=await new cUy.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 biI({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=t3i(s.name,l),O=await bTr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});O!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=t3i(u.name,s),m=await bTr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await CTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function pUy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Sxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function nFu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await biI({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...pUy(u,f,t.logger));else o.push(...pUy(c.versions,void 0,t.logger))}return o}var RZo=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var yro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var _Rf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)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(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),_Uy=typeof globalThis.AbortController=="function",hUy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",yUy=typeof globalThis.ReadableStream=="function",vUy=typeof globalThis.FormData=="function",iFu=["get","post","put","patch","head","delete"],giI=()=>{};giI();var bUy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},aFu=2147483647,gUy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,oFu=Symbol("stop"),mUy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},OUy={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 miI=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=gUy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},AUy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},PUy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(AUy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},wUy=(e,t,r)=>{if(!e.body)return e;let n=miI(r??e.body);return new Request(e,{duplex:"half",body:AUy(e.body,n,t)})};var vro=e=>e!==null&&typeof e=="object";var NZo=(...e)=>{for(let t of e)if((!vro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return vRf({},...e)},hRf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function sFu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:vRf(e[r]??[],t[r]??[])}var yRf=(e={},t={})=>({beforeRequest:sFu(e,t,"beforeRequest"),beforeRetry:sFu(e,t,"beforeRetry"),afterResponse:sFu(e,t,"afterResponse"),beforeError:sFu(e,t,"beforeError")}),vRf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(vro(i)){for(let[a,o]of Object.entries(i))vro(o)&&a in t&&(o=vRf(t[a],o)),t={...t,[a]:o};vro(i.hooks)&&(n=yRf(n,i.hooks),t.hooks=n),vro(i.headers)&&(r=hRf(r,i.headers),t.headers=r)}return t};var EUy=e=>iFu.includes(e)?e.toUpperCase():e,OiI=["get","put","head","delete","options","trace"],AiI=[408,413,429,500,502,503,504],PiI=[413,429,503],jUy={limit:2,methods:OiI,statusCodes:AiI,afterStatusCodes:PiI,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},SUy=(e={})=>{if(typeof e=="number")return{...jUy,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{...jUy,...e}};async function bRf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new yro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function gRf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var DUy=(e,t)=>{let r={};for(let n in t)!(n in OUy)&&!(n in mUy)&&!(n in e)&&(r[n]=t[n]);return r},CUy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var FZo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>aFu)throw new RangeError(`The \`timeout\` option cannot be greater than ${aFu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new RZo(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yUy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return PUy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),n.request.bodyUsed||f.push(n.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(bUy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:hRf(this._input.headers,r.headers),hooks:yRf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:EUy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:SUy(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(_Uy&&hUy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(_Rf&&(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),CUy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(vUy&&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)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!_Rf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=wUy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof yro)throw t;if(t instanceof RZo){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=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(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i: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 n=Math.min(this._calculateRetryDelay(r),aFu);if(this._retryCount<1)throw r;await gRf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===oFu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=DUy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):bRf(this._originalRequest,t,this.abortController,this._options)}};var mRf=e=>{let t=(r,n)=>FZo.create(r,NZo(e,n));for(let r of iFu)t[r]=(n,i)=>FZo.create(n,NZo(e,i,{method:r}));return t.create=r=>mRf(NZo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),mRf(NZo(e,r))),t.stop=oFu,t},wiI=mRf(),IUy=wiI;var kUy=Hi(ZUy(),1);function jRf(e){let t=(0,kUy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var JVy=Hi(HVy(),1),KVy=Hi(pTu(),1),xRf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},zRf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function QRf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??jRf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,JVy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await IUy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new xRf(e):l}if(t.allVersions)return u;let s=new zRf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[O,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[O];if(!l){let O=Object.keys(u.versions);if(r=KVy.default.maxSatisfying(O,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function Tla(e,t){let{version:r}=await QRf(e.toLowerCase(),t);return r}async function z7i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Tla(e.packageName,{version:t?"prerelease":"latest"})}var $Vy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],gFu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=sE.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new rFu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.120.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Mf.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new jne}failWithoutThrowing(t,r){this.didSucceed=!1,kNu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await jZa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await fUy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2682
2682
|
`)||(r+=`
|
|
2683
2683
|
`),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=pJl(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new CZo(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw a.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,a),new jne}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await jZa()).sendEvent(t)}logger=G6r((t,...r)=>this.log(t,...r));stderr=G6r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=YVy(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?YVy(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=$Vy[this.numTasks++%$Vy.length],o=Mf.hex(a)(i);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===gV.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}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>Axi.indexOf(i.level)>=Axi.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===sE.Debug,stderr:r})}_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 z7i({cliEnvironment:this.environment,includePreReleases:t}),n=Sxe(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await nFu({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await rRf({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:Mf.yellow("?"),style:{answer:i=>Mf.cyan(i),message:i=>Mf.bold(i),highlight:i=>Mf.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`
|
|
2684
2684
|
Cancelled by user.`),new jne):n}}async getInput(t){return await Zqf({message:t.message,default:t.default})}};function YVy(e){return`[${e}]:`}var mqr=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:n,absoluteFilePath:i,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=n,this.absoluteFilePath=i,this.changelog=a}};function mFu(e,t,r,n){if(typeof r!="function")throw new Error("method for before hook must be a function");return n||(n={}),Array.isArray(t)?t.reverse().reduce((i,a)=>mFu.bind(null,e,a,i,n),r)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((i,a)=>a.hook.bind(null,i,n),r)():r(n))}function XVy(e,t,r,n){let i=n;e.registry[r]||(e.registry[r]=[]),t==="before"&&(n=(a,o)=>Promise.resolve().then(i.bind(null,o)).then(a.bind(null,o))),t==="after"&&(n=(a,o)=>{let c;return Promise.resolve().then(a.bind(null,o)).then(f=>(c=f,i(c,o))).then(()=>c)}),t==="error"&&(n=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(c=>i(c,o))),e.registry[r].push({hook:n,orig:i})}function ZVy(e,t,r){if(!e.registry[t])return;let n=e.registry[t].map(i=>i.orig).indexOf(r);n!==-1&&e.registry[t].splice(n,1)}var kVy=Function.bind,eWy=kVy.bind(kVy);function tWy(e,t,r){let n=eWy(ZVy,null).apply(null,r?[t,r]:[t]);e.api={remove:n},e.remove=n,["before","error","after","wrap"].forEach(i=>{let a=r?[t,i,r]:[t,i];e[i]=e.api[i]=eWy(XVy,null).apply(null,a)})}function IaI(){let e=Symbol("Singular"),t={registry:{}},r=mFu.bind(null,t,e);return tWy(r,t,e),r}function MaI(){let e={registry:{}},t=mFu.bind(null,e);return tWy(t,e),t}var rWy={Singular:IaI,Collection:MaI};var BaI="0.0.0-development",TaI=`octokit-endpoint.js/${BaI} ${Nfe()}`,qaI={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":TaI},mediaType:{format:""}};function RaI(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function NaI(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function aWy(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{NaI(t[n])?n in e?r[n]=aWy(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}function nWy(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function URf(e,t,r){if(typeof t=="string"){let[i,a]=t.split(" ");r=Object.assign(a?{method:i,url:a}:{url:i},r)}else r=Object.assign({},t);r.headers=RaI(r.headers),nWy(r),nWy(r.headers);let n=aWy(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(n.mediaType.previews=e.mediaType.previews.filter(i=>!n.mediaType.previews.includes(i)).concat(n.mediaType.previews)),n.mediaType.previews=(n.mediaType.previews||[]).map(i=>i.replace(/-preview/,""))),n}function FaI(e,t){let r=/\?/.test(e)?"&":"?",n=Object.keys(t);return n.length===0?e:e+r+n.map(i=>i==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${i}=${encodeURIComponent(t[i])}`).join("&")}var xaI=/\{[^{}}]+\}/g;function zaI(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function QaI(e){let t=e.match(xaI);return t?t.map(zaI).reduce((r,n)=>r.concat(n),[]):[]}function iWy(e,t){let r={__proto__:null};for(let n of Object.keys(e))t.indexOf(n)===-1&&(r[n]=e[n]);return r}function oWy(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function jro(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function VZo(e,t,r){return t=e==="+"||e==="#"?oWy(t):jro(t),r?jro(r)+"="+t:t}function wro(e){return e!=null}function LRf(e){return e===";"||e==="&"||e==="?"}function LaI(e,t,r,n){var i=e[r],a=[];if(wro(i)&&i!=="")if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")i=i.toString(),n&&n!=="*"&&(i=i.substring(0,parseInt(n,10))),a.push(VZo(t,i,LRf(t)?r:""));else if(n==="*")Array.isArray(i)?i.filter(wro).forEach(function(o){a.push(VZo(t,o,LRf(t)?r:""))}):Object.keys(i).forEach(function(o){wro(i[o])&&a.push(VZo(t,i[o],o))});else{let o=[];Array.isArray(i)?i.filter(wro).forEach(function(c){o.push(VZo(t,c))}):Object.keys(i).forEach(function(c){wro(i[c])&&(o.push(jro(c)),o.push(VZo(t,i[c].toString())))}),LRf(t)?a.push(jro(r)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?wro(i)&&a.push(jro(r)):i===""&&(t==="&"||t==="?")?a.push(jro(r)+"="):i===""&&a.push("");return a}function UaI(e){return{expand:VaI.bind(null,e)}}function VaI(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(n,i,a){if(i){let c="",f=[];if(r.indexOf(i.charAt(0))!==-1&&(c=i.charAt(0),i=i.substr(1)),i.split(/,/g).forEach(function(u){var s=/([^:\*]*)(?::(\d+)|(\*))?/.exec(u);f.push(LaI(t,c,s[1],s[2]||s[3]))}),c&&c!=="+"){var o=",";return c==="?"?o="&":c!=="#"&&(o=c),(f.length!==0?c:"")+f.join(o)}else return f.join(",")}else return oWy(a)}),e==="/"?e:e.replace(/\/$/,"")}function sWy(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),n=Object.assign({},e.headers),i,a=iWy(e,["method","baseUrl","url","headers","request","mediaType"]),o=QaI(r);r=UaI(r).expand(a),/^http/.test(r)||(r=e.baseUrl+r);let c=Object.keys(e).filter(s=>o.includes(s)).concat("baseUrl"),f=iWy(a,c);if(!/application\/octet-stream/i.test(n.accept)&&(e.mediaType.format&&(n.accept=n.accept.split(/,/).map(s=>s.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let s=n.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];n.accept=s.concat(e.mediaType.previews).map(l=>{let m=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${l}-preview${m}`}).join(",")}return["GET","HEAD"].includes(t)?r=FaI(r,f):"data"in f?i=f.data:Object.keys(f).length&&(i=f),!n["content-type"]&&typeof i<"u"&&(n["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof i>"u"&&(i=""),Object.assign({method:t,url:r,headers:n},typeof i<"u"?{body:i}:null,e.request?{request:e.request}:null)}function WaI(e,t,r){return sWy(URf(e,t,r))}function uWy(e,t){let r=URf(e,t),n=WaI.bind(null,r);return Object.assign(n,{DEFAULTS:r,defaults:uWy.bind(null,r),merge:URf.bind(null,r),parse:sWy})}var cWy=uWy(null,qaI);var hWy=Hi(pWy(),1);var Oqr=class extends Error{name;status;request;response;constructor(t,r,n){super(t),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0),"response"in n&&(this.response=n.response);let i=Object.assign({},n.request);n.request.headers.authorization&&(i.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),i.url=i.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=i}};var GaI="10.0.6",HaI={headers:{"user-agent":`octokit-request.js/${GaI} ${Nfe()}`}};function JaI(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}async function _Wy(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,n=e.request?.parseSuccessResponseBody!==!1,i=JaI(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([l,m])=>[l,String(m)])),o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(l){let m="Unknown Error";if(l instanceof Error){if(l.name==="AbortError")throw l.status=500,l;m=l.message,l.name==="TypeError"&&"cause"in l&&(l.cause instanceof Error?m=l.cause.message:typeof l.cause=="string"&&(m=l.cause))}let O=new Oqr(m,500,{request:e});throw O.cause=l,O}let c=o.status,f=o.url,u={};for(let[l,m]of o.headers)u[l]=m;let s={url:f,status:c,headers:u,data:""};if("deprecation"in u){let l=u.link&&u.link.match(/<([^<>]+)>; rel="deprecation"/),m=l&&l.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${u.sunset}${m?`. See ${m}`:""}`)}if(c===204||c===205)return s;if(e.method==="HEAD"){if(c<400)return s;throw new Oqr(o.statusText,c,{response:s,request:e})}if(c===304)throw s.data=await VRf(o),new Oqr("Not modified",c,{response:s,request:e});if(c>=400)throw s.data=await VRf(o),new Oqr($aI(s.data),c,{response:s,request:e});return s.data=n?await VRf(o):o.body,s}async function VRf(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(()=>"");let r=(0,hWy.safeParse)(t);if(KaI(r)){let n="";try{return n=await e.text(),JSON.parse(n)}catch{return n}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(()=>""):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function KaI(e){return e.type==="application/json"||e.type==="application/scim+json"}function $aI(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){let t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(r=>JSON.stringify(r)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function WRf(e,t){let r=e.defaults(t);return Object.assign(function(i,a){let o=r.merge(i,a);if(!o.request||!o.request.hook)return _Wy(r.parse(o));let c=(f,u)=>_Wy(r.parse(r.merge(f,u)));return Object.assign(c,{endpoint:r,defaults:WRf.bind(null,r)}),o.request.hook(c,o)},{endpoint:r,defaults:WRf.bind(null,r)})}var H7=WRf(cWy,HaI);var YaI="0.0.0-development";function XaI(e){return`Request failed due to following response errors:
|
|
@@ -2695,12 +2695,12 @@ Cancelled by user.`),new jne):n}}async getInput(t){return await Zqf({message:t.m
|
|
|
2695
2695
|
})
|
|
2696
2696
|
`);let u={},s=new n.Events(u);return u.on("secondary-limit",f.onSecondaryRateLimit),u.on("rate-limit",f.onRateLimit),u.on("error",l=>e.log.warn("Error in throttling-plugin limit handler",l)),f.retryLimiter.on("failed",async function(l,m){let[O,P,C]=m.args,{pathname:M}=new URL(C.url,"http://github.test");if(!(M.startsWith("/graphql")&&l.status!==401||l.status===403||l.status===429))return;let z=~~P.retryCount;P.retryCount=z,C.request.retryCount=z;let{wantRetry:U,retryAfter:q=0}=await(async function(){if(/\bsecondary rate\b/i.test(l.message)){let V=Number(l.response.headers["retry-after"])||O.fallbackSecondaryRateRetryAfter;return{wantRetry:await s.trigger("secondary-limit",V,C,e,z),retryAfter:V}}if(l.response.headers!=null&&l.response.headers["x-ratelimit-remaining"]==="0"||(l.response.data?.errors??[]).some(V=>V.type==="RATE_LIMITED")){let V=new Date(~~l.response.headers["x-ratelimit-reset"]*1e3).getTime(),$=Math.max(Math.ceil((V-Date.now())/1e3)+1,0);return{wantRetry:await s.trigger("rate-limit",$,C,e,z),retryAfter:$}}return{}})();if(U)return P.retryCount++,q*O.retryAfterBaseValue}),e.hook.wrap("request",DoI.bind(null,f)),{}}jFu.VERSION=SoI;jFu.triggersNotification=RWy;function NWy(e){let t=e.clientType||"oauth-app",r=e.baseUrl||"https://github.com",n={clientType:t,allowSignup:e.allowSignup!==!1,clientId:e.clientId,login:e.login||null,redirectUrl:e.redirectUrl||null,state:e.state||Math.random().toString(36).substr(2),url:""};if(t==="oauth-app"){let i="scopes"in e?e.scopes:[];n.scopes=typeof i=="string"?i.split(/[,\s]+/).filter(Boolean):i}return n.url=qoI(`${r}/login/oauth/authorize`,n),n}function qoI(e,t){let r={allowSignup:"allow_signup",clientId:"client_id",login:"login",redirectUrl:"redirect_uri",scopes:"scope",state:"state"},n=e;return Object.keys(r).filter(i=>t[i]!==null).filter(i=>i!=="scopes"?!0:t.clientType==="github-app"?!1:!Array.isArray(t[i])||t[i].length>0).map(i=>[r[i],`${t[i]}`]).forEach(([i,a],o)=>{n+=o===0?"?":"&",n+=`${i}=${encodeURIComponent(a)}`}),n}function QWy(e){let t=e.endpoint.DEFAULTS;return/^https:\/\/(api\.)?github\.com$/.test(t.baseUrl)?"https://github.com":t.baseUrl.replace("/api/v3","")}async function EFu(e,t,r){let n={baseUrl:QWy(e),headers:{accept:"application/json"},...r},i=await e(t,n);if("error"in i.data){let a=new Oqr(`${i.data.error_description} (${i.data.error}, ${i.data.error_uri})`,400,{request:e.endpoint.merge(t,n)});throw a.response=i,a}return i}function LWy({request:e=H7,...t}){let r=QWy(e);return NWy({...t,baseUrl:r})}async function UWy(e){let t=e.request||H7,r=await EFu(t,"POST /login/oauth/access_token",{client_id:e.clientId,client_secret:e.clientSecret,code:e.code,redirect_uri:e.redirectUrl}),n={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.data.access_token,scopes:r.data.scope.split(/\s+/).filter(Boolean)};if(e.clientType==="github-app"){if("refresh_token"in r.data){let i=new Date(r.headers.date).getTime();n.refreshToken=r.data.refresh_token,n.expiresAt=FWy(i,r.data.expires_in),n.refreshTokenExpiresAt=FWy(i,r.data.refresh_token_expires_in)}delete n.scopes}return{...r,authentication:n}}function FWy(e,t){return new Date(e+t*1e3).toISOString()}async function VWy(e){let t=e.request||H7,r={client_id:e.clientId};return"scopes"in e&&Array.isArray(e.scopes)&&(r.scope=e.scopes.join(" ")),EFu(t,"POST /login/device/code",r)}async function rNf(e){let t=e.request||H7,r=await EFu(t,"POST /login/oauth/access_token",{client_id:e.clientId,device_code:e.code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),n={clientType:e.clientType,clientId:e.clientId,token:r.data.access_token,scopes:r.data.scope.split(/\s+/).filter(Boolean)};if("clientSecret"in e&&(n.clientSecret=e.clientSecret),e.clientType==="github-app"){if("refresh_token"in r.data){let i=new Date(r.headers.date).getTime();n.refreshToken=r.data.refresh_token,n.expiresAt=xWy(i,r.data.expires_in),n.refreshTokenExpiresAt=xWy(i,r.data.refresh_token_expires_in)}delete n.scopes}return{...r,authentication:n}}function xWy(e,t){return new Date(e+t*1e3).toISOString()}async function SFu(e){let r=await(e.request||H7)("POST /applications/{client_id}/token",{headers:{authorization:`basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`},client_id:e.clientId,access_token:e.token}),n={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.token,scopes:r.data.scopes};return r.data.expires_at&&(n.expiresAt=r.data.expires_at),e.clientType==="github-app"&&delete n.scopes,{...r,authentication:n}}async function DFu(e){let t=e.request||H7,r=await EFu(t,"POST /login/oauth/access_token",{client_id:e.clientId,client_secret:e.clientSecret,grant_type:"refresh_token",refresh_token:e.refreshToken}),n=new Date(r.headers.date).getTime(),i={clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,token:r.data.access_token,refreshToken:r.data.refresh_token,expiresAt:zWy(n,r.data.expires_in),refreshTokenExpiresAt:zWy(n,r.data.refresh_token_expires_in)};return{...r,authentication:i}}function zWy(e,t){return new Date(e+t*1e3).toISOString()}async function WWy(e){let{request:t,clientType:r,clientId:n,clientSecret:i,token:a,...o}=e,f=await(e.request||H7)("POST /applications/{client_id}/token/scoped",{headers:{authorization:`basic ${btoa(`${n}:${i}`)}`},client_id:n,access_token:a,...o}),u=Object.assign({clientType:r,clientId:n,clientSecret:i,token:f.data.token},f.data.expires_at?{expiresAt:f.data.expires_at}:{});return{...f,authentication:u}}async function HZo(e){let t=e.request||H7,r=btoa(`${e.clientId}:${e.clientSecret}`),n=await t("PATCH /applications/{client_id}/token",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token}),i={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:n.data.token,scopes:n.data.scopes};return n.data.expires_at&&(i.expiresAt=n.data.expires_at),e.clientType==="github-app"&&delete i.scopes,{...n,authentication:i}}async function JZo(e){let t=e.request||H7,r=btoa(`${e.clientId}:${e.clientSecret}`);return t("DELETE /applications/{client_id}/token",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token})}async function KZo(e){let t=e.request||H7,r=btoa(`${e.clientId}:${e.clientSecret}`);return t("DELETE /applications/{client_id}/grant",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token})}async function HWy(e,t){let r=RoI(e,t.auth);if(r)return r;let{data:n}=await VWy({clientType:e.clientType,clientId:e.clientId,request:t.request||e.request,scopes:t.auth.scopes||e.scopes});await e.onVerification(n);let i=await nNf(t.request||e.request,e.clientId,e.clientType,n);return e.authentication=i,i}function RoI(e,t){if(t.refresh===!0||!e.authentication)return!1;if(e.clientType==="github-app")return e.authentication;let r=e.authentication,n=("scopes"in t&&t.scopes||e.scopes).join(" "),i=r.scopes.join(" ");return n===i?r:!1}async function GWy(e){await new Promise(t=>setTimeout(t,e*1e3))}async function nNf(e,t,r,n){try{let i={clientId:t,request:e,code:n.device_code},{authentication:a}=r==="oauth-app"?await rNf({...i,clientType:"oauth-app"}):await rNf({...i,clientType:"github-app"});return{type:"token",tokenType:"oauth",...a}}catch(i){if(!i.response)throw i;let a=i.response.data.error;if(a==="authorization_pending")return await GWy(n.interval),nNf(e,t,r,n);if(a==="slow_down")return await GWy(n.interval+7),nNf(e,t,r,n);throw i}}async function NoI(e,t){return HWy(e,{auth:t})}async function FoI(e,t,r,n){let i=t.endpoint.merge(r,n);if(/\/login\/(oauth\/access_token|device\/code)$/.test(i.url))return t(i);let{token:a}=await HWy(e,{request:t,auth:{type:"oauth"}});return i.headers.authorization=`token ${a}`,t(i)}var xoI="0.0.0-development";function JWy(e){let t=e.request||H7.defaults({headers:{"user-agent":`octokit-auth-oauth-device.js/${xoI} ${Nfe()}`}}),{request:r=t,...n}=e,i=e.clientType==="github-app"?{...n,clientType:"github-app",request:r}:{...n,clientType:"oauth-app",request:r,scopes:e.scopes||[]};if(!e.clientId)throw new Error('[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)');if(!e.onVerification)throw new Error('[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)');return Object.assign(NoI.bind(null,i),{hook:FoI.bind(null,i)})}var $Wy="0.0.0-development";async function KWy(e){if("code"in e.strategyOptions){let{authentication:t}=await UWy({clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,onTokenCreated:e.onTokenCreated,...e.strategyOptions,request:e.request});return{type:"token",tokenType:"oauth",...t}}if("onVerification"in e.strategyOptions){let r=await JWy({clientType:e.clientType,clientId:e.clientId,onTokenCreated:e.onTokenCreated,...e.strategyOptions,request:e.request})({type:"oauth"});return{clientSecret:e.clientSecret,...r}}if("token"in e.strategyOptions)return{type:"token",tokenType:"oauth",clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,onTokenCreated:e.onTokenCreated,...e.strategyOptions};throw new Error("[@octokit/auth-oauth-user] Invalid strategy options")}async function iNf(e,t={}){if(e.authentication||(e.authentication=e.clientType==="oauth-app"?await KWy(e):await KWy(e)),e.authentication.invalid)throw new Error("[@octokit/auth-oauth-user] Token is invalid");let r=e.authentication;if("expiresAt"in r&&(t.type==="refresh"||new Date(r.expiresAt)<new Date)){let{authentication:n}=await DFu({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:r.refreshToken,request:e.request});e.authentication={tokenType:"oauth",type:"token",...n}}if(t.type==="refresh"){if(e.clientType==="oauth-app")throw new Error("[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens");if(!r.hasOwnProperty("expiresAt"))throw new Error("[@octokit/auth-oauth-user] Refresh token missing");await e.onTokenCreated?.(e.authentication,{type:t.type})}if(t.type==="check"||t.type==="reset"){let n=t.type==="check"?SFu:HZo;try{let{authentication:i}=await n({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.authentication.token,request:e.request});return e.authentication={tokenType:"oauth",type:"token",...i},t.type==="reset"&&await e.onTokenCreated?.(e.authentication,{type:t.type}),e.authentication}catch(i){throw i.status===404&&(i.message="[@octokit/auth-oauth-user] Token is invalid",e.authentication.invalid=!0),i}}if(t.type==="delete"||t.type==="deleteAuthorization"){let n=t.type==="delete"?JZo:KZo;try{await n({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.authentication.token,request:e.request})}catch(i){if(i.status!==404)throw i}return e.authentication.invalid=!0,e.authentication}return e.authentication}var zoI=/\/applications\/[^/]+\/(token|grant)s?/;function $Zo(e){return e&&zoI.test(e)}async function QoI(e,t,r,n={}){let i=t.endpoint.merge(r,n);if(/\/login\/(oauth\/access_token|device\/code)$/.test(i.url))return t(i);if($Zo(i.url)){let o=btoa(`${e.clientId}:${e.clientSecret}`);return i.headers.authorization=`basic ${o}`,t(i)}let{token:a}=e.clientType==="oauth-app"?await iNf({...e,request:t}):await iNf({...e,request:t});return i.headers.authorization="token "+a,t(i)}function APe({clientId:e,clientSecret:t,clientType:r="oauth-app",request:n=H7.defaults({headers:{"user-agent":`octokit-auth-oauth-app.js/${$Wy} ${Nfe()}`}}),onTokenCreated:i,...a}){let o=Object.assign({clientType:r,clientId:e,clientSecret:t,onTokenCreated:i,strategyOptions:a,request:n});return Object.assign(iNf.bind(null,o),{hook:QoI.bind(null,o)})}APe.VERSION=$Wy;async function LoI(e,t){if(t.type==="oauth-app")return{type:"oauth-app",clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,headers:{authorization:`basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`}};if("factory"in t){let{type:i,...a}={...t,...e};return t.factory(a)}let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.request,...t};return(e.clientType==="oauth-app"?await APe({...r,clientType:e.clientType}):await APe({...r,clientType:e.clientType}))()}async function UoI(e,t,r,n){let i=t.endpoint.merge(r,n);if(/\/login\/(oauth\/access_token|device\/code)$/.test(i.url))return t(i);if(e.clientType==="github-app"&&!$Zo(i.url))throw new Error(`[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${i.method} ${i.url}" is not supported.`);let a=btoa(`${e.clientId}:${e.clientSecret}`);i.headers.authorization=`basic ${a}`;try{return await t(i)}catch(o){throw o.status!==401||(o.message=`[@octokit/auth-oauth-app] "${i.method} ${i.url}" does not support clientId/clientSecret basic authentication.`),o}}var VoI="0.0.0-development";function CFu(e){let t=Object.assign({request:H7.defaults({headers:{"user-agent":`octokit-auth-oauth-app.js/${VoI} ${Nfe()}`}}),clientType:"oauth-app"},e);return Object.assign(LoI.bind(null,t),{hook:UoI.bind(null,t)})}async function MFu({appId:e,privateKey:t,timeDifference:r,createJwt:n}){try{if(n){let{jwt:o,expiresAt:c}=await n(e,r);return{type:"app",token:o,appId:e,expiresAt:c}}let i={id:e,privateKey:t};r&&Object.assign(i,{now:Math.floor(Date.now()/1e3)+r});let a=await plf(i);return{type:"app",token:a.token,appId:a.appId,expiresAt:new Date(a.expiration*1e3).toISOString()}}catch(i){throw t==="-----BEGIN RSA PRIVATE KEY-----"?new Error("The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'"):i}}function GoI(){return new S0u(15e3,1e3*60*59)}async function HoI(e,t){let r=aNf(t),n=await e.get(r);if(!n)return;let[i,a,o,c,f,u]=n.split("|"),s=t.permissions||f.split(/,/).reduce((l,m)=>(/!$/.test(m)?l[m.slice(0,-1)]="write":l[m]="read",l),{});return{token:i,createdAt:a,expiresAt:o,permissions:s,repositoryIds:t.repositoryIds,repositoryNames:t.repositoryNames,singleFileName:u,repositorySelection:c}}async function JoI(e,t,r){let n=aNf(t),i=t.permissions?"":Object.keys(r.permissions).map(o=>`${o}${r.permissions[o]==="write"?"!":""}`).join(","),a=[r.token,r.createdAt,r.expiresAt,r.repositorySelection,i,r.singleFileName].join("|");await e.set(n,a)}function aNf({installationId:e,permissions:t={},repositoryIds:r=[],repositoryNames:n=[]}){let i=Object.keys(t).sort().map(c=>t[c]==="read"?c:`${c}!`).join(","),a=r.sort().join(","),o=n.join(",");return[e,a,o,i].filter(Boolean).join("|")}function YWy({installationId:e,token:t,createdAt:r,expiresAt:n,repositorySelection:i,permissions:a,repositoryIds:o,repositoryNames:c,singleFileName:f}){return Object.assign({type:"token",tokenType:"installation",token:t,installationId:e,permissions:a,createdAt:r,expiresAt:n,repositorySelection:i},o?{repositoryIds:o}:null,c?{repositoryNames:c}:null,f?{singleFileName:f}:null)}async function XWy(e,t,r){let n=Number(t.installationId||e.installationId);if(!n)throw new Error("[@octokit/auth-app] installationId option is required for installation authentication.");if(t.factory){let{type:a,factory:o,oauthApp:c,...f}={...e,...t};return o(f)}let i=r||e.request;return KoI(e,{...t,installationId:n},i)}var IFu=new Map;function KoI(e,t,r){let n=aNf(t);if(IFu.has(n))return IFu.get(n);let i=$oI(e,t,r).finally(()=>IFu.delete(n));return IFu.set(n,i),i}async function $oI(e,t,r){if(!t.refresh){let z=await HoI(e.cache,t);if(z){let{token:U,createdAt:q,expiresAt:V,permissions:$,repositoryIds:re,repositoryNames:Y,singleFileName:k,repositorySelection:ne}=z;return YWy({installationId:t.installationId,token:U,createdAt:q,expiresAt:V,permissions:$,repositorySelection:ne,repositoryIds:re,repositoryNames:Y,singleFileName:k})}}let n=await MFu(e),i={installation_id:t.installationId,mediaType:{previews:["machine-man"]},headers:{authorization:`bearer ${n.token}`}};t.repositoryIds&&Object.assign(i,{repository_ids:t.repositoryIds}),t.repositoryNames&&Object.assign(i,{repositories:t.repositoryNames}),t.permissions&&Object.assign(i,{permissions:t.permissions});let{data:{token:a,expires_at:o,repositories:c,permissions:f,repository_selection:u,single_file:s}}=await r("POST /app/installations/{installation_id}/access_tokens",i),l=f||{},m=u||"all",O=c?c.map(z=>z.id):void 0,P=c?c.map(z=>z.name):void 0,C=new Date().toISOString(),M={token:a,createdAt:C,expiresAt:o,repositorySelection:m,permissions:l,repositoryIds:O,repositoryNames:P};s&&Object.assign(i,{singleFileName:s}),await JoI(e.cache,t,M);let T={installationId:t.installationId,token:a,createdAt:C,expiresAt:o,repositorySelection:m,permissions:l,repositoryIds:O,repositoryNames:P};return s&&Object.assign(T,{singleFileName:s}),YWy(T)}async function YoI(e,t){switch(t.type){case"app":return MFu(e);case"oauth-app":return e.oauthApp({type:"oauth-app"});case"installation":return XWy(e,{...t,type:"installation"});case"oauth-user":return e.oauthApp(t);default:throw new Error(`Invalid auth type: ${t.type}`)}}var XoI=["/app","/app/hook/config","/app/hook/deliveries","/app/hook/deliveries/{delivery_id}","/app/hook/deliveries/{delivery_id}/attempts","/app/installations","/app/installations/{installation_id}","/app/installations/{installation_id}/access_tokens","/app/installations/{installation_id}/suspended","/app/installation-requests","/marketplace_listing/accounts/{account_id}","/marketplace_listing/plan","/marketplace_listing/plans","/marketplace_listing/plans/{plan_id}/accounts","/marketplace_listing/stubbed/accounts/{account_id}","/marketplace_listing/stubbed/plan","/marketplace_listing/stubbed/plans","/marketplace_listing/stubbed/plans/{plan_id}/accounts","/orgs/{org}/installation","/repos/{owner}/{repo}/installation","/users/{username}/installation"];function ZoI(e){let r=`^(?:${e.map(n=>n.split("/").map(i=>i.startsWith("{")?"(?:.+?)":i).join("/")).map(n=>`(?:${n})`).join("|")})$`;return new RegExp(r,"i")}var koI=ZoI(XoI);function esI(e){return!!e&&koI.test(e.split("?")[0])}var tsI=5*1e3;function rsI(e){return!(e.message.match(/'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/)||e.message.match(/'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/))}async function nsI(e,t,r,n){let i=t.endpoint.merge(r,n),a=i.url;if(/\/login\/oauth\/access_token$/.test(a))return t(i);if(esI(a.replace(t.endpoint.DEFAULTS.baseUrl,""))){let{token:f}=await MFu(e);i.headers.authorization=`bearer ${f}`;let u;try{u=await t(i)}catch(s){if(rsI(s)||typeof s.response.headers.date>"u")throw s;let l=Math.floor((Date.parse(s.response.headers.date)-Date.parse(new Date().toString()))/1e3);e.log.warn(s.message),e.log.warn(`[@octokit/auth-app] GitHub API time and system time are different by ${l} seconds. Retrying request with the difference accounted for.`);let{token:m}=await MFu({...e,timeDifference:l});return i.headers.authorization=`bearer ${m}`,t(i)}return u}if($Zo(a)){let f=await e.oauthApp({type:"oauth-app"});return i.headers.authorization=f.headers.authorization,t(i)}let{token:o,createdAt:c}=await XWy(e,{},t.defaults({baseUrl:i.baseUrl}));return i.headers.authorization=`token ${o}`,ZWy(e,t,i,c)}async function ZWy(e,t,r,n,i=0){let a=+new Date-+new Date(n);try{return await t(r)}catch(o){if(o.status!==401)throw o;if(a>=tsI)throw i>0&&(o.message=`After ${i} retries within ${a/1e3}s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`),o;++i;let c=i*1e3;return e.log.warn(`[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${i}, wait: ${c/1e3}s)`),await new Promise(f=>setTimeout(f,c)),ZWy(e,t,r,n,i)}}var isI="8.1.2";function Ero(e){if(!e.appId)throw new Error("[@octokit/auth-app] appId option is required");if(!e.privateKey&&!e.createJwt)throw new Error("[@octokit/auth-app] privateKey option is required");if(e.privateKey&&e.createJwt)throw new Error("[@octokit/auth-app] privateKey and createJwt options are mutually exclusive");if("installationId"in e&&!e.installationId)throw new Error("[@octokit/auth-app] installationId is set to a falsy value");let t=e.log||{};typeof t.warn!="function"&&(t.warn=console.warn.bind(console));let r=e.request||H7.defaults({headers:{"user-agent":`octokit-auth-app.js/${isI} ${Nfe()}`}}),n=Object.assign({request:r,cache:GoI()},e,e.installationId?{installationId:Number(e.installationId)}:{},{log:t,oauthApp:CFu({clientType:"github-app",clientId:e.clientId||"",clientSecret:e.clientSecret||"",request:r})});return Object.assign(YoI.bind(null,n),{hook:nsI.bind(null,n)})}async function asI(e){return{type:"unauthenticated",reason:e}}function osI(e){return e.status!==403||!e.response?!1:e.response.headers["x-ratelimit-remaining"]==="0"}var ssI=/\babuse\b/i;function usI(e){return e.status!==403?!1:ssI.test(e.message)}async function csI(e,t,r,n){let i=t.endpoint.merge(r,n);return t(i).catch(a=>{throw a.status===404?(a.message=`Not found. May be due to lack of authentication. Reason: ${e}`,a):osI(a)?(a.message=`API rate limit exceeded. This maybe caused by the lack of authentication. Reason: ${e}`,a):usI(a)?(a.message=`You have triggered an abuse detection mechanism. This maybe caused by the lack of authentication. Reason: ${e}`,a):a.status===401?(a.message=`Unauthorized. "${i.method} ${i.url}" failed most likely due to lack of authentication. Reason: ${e}`,a):(a.status>=400&&a.status<500&&(a.message=a.message.replace(/\.?$/,`. May be caused by lack of authentication (${e}).`)),a)})}var xla=function(t){if(!t||!t.reason)throw new Error("[@octokit/auth-unauthenticated] No reason passed to createUnauthenticatedAuth");return Object.assign(asI.bind(null,t.reason),{hook:csI.bind(null,t.reason)})};var kWy="8.0.3";function eGy(e,t,r){if(Array.isArray(t)){for(let n of t)eGy(e,n,r);return}e.eventHandlers[t]||(e.eventHandlers[t]=[]),e.eventHandlers[t].push(r)}var lsI=Q7i.defaults({userAgent:`octokit-oauth-app.js/${kWy} ${Nfe()}`});async function EPi(e,t){let{name:r,action:n}=t;if(e.eventHandlers[`${r}.${n}`])for(let i of e.eventHandlers[`${r}.${n}`])await i(t);if(e.eventHandlers[r])for(let i of e.eventHandlers[r])await i(t)}async function fsI(e,t){return e.octokit.auth({type:"oauth-user",...t,async factory(r){let n=new e.Octokit({authStrategy:APe,auth:r}),i=await n.auth({type:"get"});return await EPi(e,{name:"token",action:"created",token:i.token,scopes:i.scopes,authentication:i,octokit:n}),n}})}function dsI(e,t){let r={clientId:e.clientId,request:e.octokit.request,...t,allowSignup:e.allowSignup??t.allowSignup,redirectUrl:t.redirectUrl??e.redirectUrl,scopes:t.scopes??e.defaultScopes};return LWy({clientType:e.clientType,...r})}async function psI(e,t){let r=await e.octokit.auth({type:"oauth-user",...t});return await EPi(e,{name:"token",action:"created",token:r.token,scopes:r.scopes,authentication:r,octokit:new e.Octokit({authStrategy:APe,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.token,scopes:r.scopes,refreshToken:r.refreshToken,expiresAt:r.expiresAt,refreshTokenExpiresAt:r.refreshTokenExpiresAt}})}),{authentication:r}}async function _sI(e,t){let r=await SFu({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t});return Object.assign(r.authentication,{type:"token",tokenType:"oauth"}),r}async function hsI(e,t){let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};if(e.clientType==="oauth-app"){let a=await HZo({clientType:"oauth-app",...r}),o=Object.assign(a.authentication,{type:"token",tokenType:"oauth"});return await EPi(e,{name:"token",action:"reset",token:a.authentication.token,scopes:a.authentication.scopes||void 0,authentication:o,octokit:new e.Octokit({authStrategy:APe,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:a.authentication.token,scopes:a.authentication.scopes}})}),{...a,authentication:o}}let n=await HZo({clientType:"github-app",...r}),i=Object.assign(n.authentication,{type:"token",tokenType:"oauth"});return await EPi(e,{name:"token",action:"reset",token:n.authentication.token,authentication:i,octokit:new e.Octokit({authStrategy:APe,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:n.authentication.token}})}),{...n,authentication:i}}async function ysI(e,t){if(e.clientType==="oauth-app")throw new Error("[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps");let r=await DFu({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,refreshToken:t.refreshToken}),n=Object.assign(r.authentication,{type:"token",tokenType:"oauth"});return await EPi(e,{name:"token",action:"refreshed",token:r.authentication.token,authentication:n,octokit:new e.Octokit({authStrategy:APe,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.authentication.token}})}),{...r,authentication:n}}async function vsI(e,t){if(e.clientType==="oauth-app")throw new Error("[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps");let r=await WWy({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t}),n=Object.assign(r.authentication,{type:"token",tokenType:"oauth"});return await EPi(e,{name:"token",action:"scoped",token:r.authentication.token,authentication:n,octokit:new e.Octokit({authStrategy:APe,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.authentication.token}})}),{...r,authentication:n}}async function bsI(e,t){let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t},n=e.clientType==="oauth-app"?await JZo({clientType:"oauth-app",...r}):await JZo({clientType:"github-app",...r});return await EPi(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:xla,auth:{reason:'Handling "token.deleted" event. The access for the token has been revoked.'}})}),n}async function gsI(e,t){let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t},n=e.clientType==="oauth-app"?await KZo({clientType:"oauth-app",...r}):await KZo({clientType:"github-app",...r});return await EPi(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:xla,auth:{reason:'Handling "token.deleted" event. The access for the token has been revoked.'}})}),await EPi(e,{name:"authorization",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:xla,auth:{reason:'Handling "authorization.deleted" event. The access for the app has been revoked.'}})}),n}var BFu=class{static VERSION=kWy;static defaults(e){return class extends this{constructor(...r){super({...e,...r[0]})}}}constructor(e){let t=e.Octokit||lsI;this.type=e.clientType||"oauth-app";let r=new t({authStrategy:CFu,auth:{clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret}}),n={clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret,defaultScopes:e.defaultScopes||[],allowSignup:e.allowSignup,baseUrl:e.baseUrl,redirectUrl:e.redirectUrl,log:e.log,Octokit:t,octokit:r,eventHandlers:{}};this.on=eGy.bind(null,n),this.octokit=r,this.getUserOctokit=fsI.bind(null,n),this.getWebFlowAuthorizationUrl=dsI.bind(null,n),this.createToken=psI.bind(null,n),this.checkToken=_sI.bind(null,n),this.resetToken=hsI.bind(null,n),this.refreshToken=ysI.bind(null,n),this.scopeToken=vsI.bind(null,n),this.deleteToken=bsI.bind(null,n),this.deleteAuthorization=gsI.bind(null,n)}type;on;octokit;getUserOctokit;getWebFlowAuthorizationUrl;createToken;checkToken;resetToken;refreshToken;scopeToken;deleteToken;deleteAuthorization};var tGy=require("crypto"),nGy=require("crypto"),oNf=require("buffer"),rGy="6.0.0";async function TFu(e,t){if(!e||!t)throw new TypeError("[@octokit/webhooks-methods] secret & payload required for sign()");if(typeof t!="string")throw new TypeError("[@octokit/webhooks-methods] payload must be a string");let r="sha256";return`${r}=${(0,tGy.createHmac)(r,e).update(t).digest("hex")}`}TFu.VERSION=rGy;async function YZo(e,t,r){if(!e||!t||!r)throw new TypeError("[@octokit/webhooks-methods] secret, eventPayload & signature required");if(typeof t!="string")throw new TypeError("[@octokit/webhooks-methods] eventPayload must be a string");let n=oNf.Buffer.from(r),i=oNf.Buffer.from(await TFu(e,t));return n.length!==i.length?!1:(0,nGy.timingSafeEqual)(n,i)}YZo.VERSION=rGy;async function iGy(e,t,r,n){if(await YZo(e,t,r))return!0;if(n!==void 0)for(let a of n){let o=await YZo(a,t,r);if(o)return o}return!1}var sGy=(e={})=>(typeof e.debug!="function"&&(e.debug=()=>{}),typeof e.info!="function"&&(e.info=()=>{}),typeof e.warn!="function"&&(e.warn=console.warn.bind(console)),typeof e.error!="function"&&(e.error=console.error.bind(console)),e),msI=["branch_protection_configuration","branch_protection_configuration.disabled","branch_protection_configuration.enabled","branch_protection_rule","branch_protection_rule.created","branch_protection_rule.deleted","branch_protection_rule.edited","check_run","check_run.completed","check_run.created","check_run.requested_action","check_run.rerequested","check_suite","check_suite.completed","check_suite.requested","check_suite.rerequested","code_scanning_alert","code_scanning_alert.appeared_in_branch","code_scanning_alert.closed_by_user","code_scanning_alert.created","code_scanning_alert.fixed","code_scanning_alert.reopened","code_scanning_alert.reopened_by_user","commit_comment","commit_comment.created","create","custom_property","custom_property.created","custom_property.deleted","custom_property.promote_to_enterprise","custom_property.updated","custom_property_values","custom_property_values.updated","delete","dependabot_alert","dependabot_alert.auto_dismissed","dependabot_alert.auto_reopened","dependabot_alert.created","dependabot_alert.dismissed","dependabot_alert.fixed","dependabot_alert.reintroduced","dependabot_alert.reopened","deploy_key","deploy_key.created","deploy_key.deleted","deployment","deployment.created","deployment_protection_rule","deployment_protection_rule.requested","deployment_review","deployment_review.approved","deployment_review.rejected","deployment_review.requested","deployment_status","deployment_status.created","discussion","discussion.answered","discussion.category_changed","discussion.closed","discussion.created","discussion.deleted","discussion.edited","discussion.labeled","discussion.locked","discussion.pinned","discussion.reopened","discussion.transferred","discussion.unanswered","discussion.unlabeled","discussion.unlocked","discussion.unpinned","discussion_comment","discussion_comment.created","discussion_comment.deleted","discussion_comment.edited","fork","github_app_authorization","github_app_authorization.revoked","gollum","installation","installation.created","installation.deleted","installation.new_permissions_accepted","installation.suspend","installation.unsuspend","installation_repositories","installation_repositories.added","installation_repositories.removed","installation_target","installation_target.renamed","issue_comment","issue_comment.created","issue_comment.deleted","issue_comment.edited","issues","issues.assigned","issues.closed","issues.deleted","issues.demilestoned","issues.edited","issues.labeled","issues.locked","issues.milestoned","issues.opened","issues.pinned","issues.reopened","issues.transferred","issues.typed","issues.unassigned","issues.unlabeled","issues.unlocked","issues.unpinned","issues.untyped","label","label.created","label.deleted","label.edited","marketplace_purchase","marketplace_purchase.cancelled","marketplace_purchase.changed","marketplace_purchase.pending_change","marketplace_purchase.pending_change_cancelled","marketplace_purchase.purchased","member","member.added","member.edited","member.removed","membership","membership.added","membership.removed","merge_group","merge_group.checks_requested","merge_group.destroyed","meta","meta.deleted","milestone","milestone.closed","milestone.created","milestone.deleted","milestone.edited","milestone.opened","org_block","org_block.blocked","org_block.unblocked","organization","organization.deleted","organization.member_added","organization.member_invited","organization.member_removed","organization.renamed","package","package.published","package.updated","page_build","personal_access_token_request","personal_access_token_request.approved","personal_access_token_request.cancelled","personal_access_token_request.created","personal_access_token_request.denied","ping","project","project.closed","project.created","project.deleted","project.edited","project.reopened","project_card","project_card.converted","project_card.created","project_card.deleted","project_card.edited","project_card.moved","project_column","project_column.created","project_column.deleted","project_column.edited","project_column.moved","projects_v2","projects_v2.closed","projects_v2.created","projects_v2.deleted","projects_v2.edited","projects_v2.reopened","projects_v2_item","projects_v2_item.archived","projects_v2_item.converted","projects_v2_item.created","projects_v2_item.deleted","projects_v2_item.edited","projects_v2_item.reordered","projects_v2_item.restored","projects_v2_status_update","projects_v2_status_update.created","projects_v2_status_update.deleted","projects_v2_status_update.edited","public","pull_request","pull_request.assigned","pull_request.auto_merge_disabled","pull_request.auto_merge_enabled","pull_request.closed","pull_request.converted_to_draft","pull_request.demilestoned","pull_request.dequeued","pull_request.edited","pull_request.enqueued","pull_request.labeled","pull_request.locked","pull_request.milestoned","pull_request.opened","pull_request.ready_for_review","pull_request.reopened","pull_request.review_request_removed","pull_request.review_requested","pull_request.synchronize","pull_request.unassigned","pull_request.unlabeled","pull_request.unlocked","pull_request_review","pull_request_review.dismissed","pull_request_review.edited","pull_request_review.submitted","pull_request_review_comment","pull_request_review_comment.created","pull_request_review_comment.deleted","pull_request_review_comment.edited","pull_request_review_thread","pull_request_review_thread.resolved","pull_request_review_thread.unresolved","push","registry_package","registry_package.published","registry_package.updated","release","release.created","release.deleted","release.edited","release.prereleased","release.published","release.released","release.unpublished","repository","repository.archived","repository.created","repository.deleted","repository.edited","repository.privatized","repository.publicized","repository.renamed","repository.transferred","repository.unarchived","repository_advisory","repository_advisory.published","repository_advisory.reported","repository_dispatch","repository_dispatch.sample.collected","repository_import","repository_ruleset","repository_ruleset.created","repository_ruleset.deleted","repository_ruleset.edited","repository_vulnerability_alert","repository_vulnerability_alert.create","repository_vulnerability_alert.dismiss","repository_vulnerability_alert.reopen","repository_vulnerability_alert.resolve","secret_scanning_alert","secret_scanning_alert.created","secret_scanning_alert.publicly_leaked","secret_scanning_alert.reopened","secret_scanning_alert.resolved","secret_scanning_alert.validated","secret_scanning_alert_location","secret_scanning_alert_location.created","secret_scanning_scan","secret_scanning_scan.completed","security_advisory","security_advisory.published","security_advisory.updated","security_advisory.withdrawn","security_and_analysis","sponsorship","sponsorship.cancelled","sponsorship.created","sponsorship.edited","sponsorship.pending_cancellation","sponsorship.pending_tier_change","sponsorship.tier_changed","star","star.created","star.deleted","status","sub_issues","sub_issues.parent_issue_added","sub_issues.parent_issue_removed","sub_issues.sub_issue_added","sub_issues.sub_issue_removed","team","team.added_to_repository","team.created","team.deleted","team.edited","team.removed_from_repository","team_add","watch","watch.started","workflow_dispatch","workflow_job","workflow_job.completed","workflow_job.in_progress","workflow_job.queued","workflow_job.waiting","workflow_run","workflow_run.completed","workflow_run.in_progress","workflow_run.requested"];function OsI(e,t={}){if(typeof e!="string")throw new TypeError("eventName must be of type string");if(e==="*")throw new TypeError('Using the "*" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onAny() method instead');if(e==="error")throw new TypeError('Using the "error" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onError() method instead');if(t.onUnknownEventName!=="ignore"&&!msI.includes(e)){if(t.onUnknownEventName!=="warn")throw new TypeError(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`);(t.log||console).warn(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`)}}function sNf(e,t,r){e.hooks[t]||(e.hooks[t]=[]),e.hooks[t].push(r)}function uGy(e,t,r){if(Array.isArray(t)){t.forEach(n=>uGy(e,n,r));return}OsI(t,{onUnknownEventName:"warn",log:e.log}),sNf(e,t,r)}function AsI(e,t){sNf(e,"*",t)}function PsI(e,t){sNf(e,"error",t)}function aGy(e,t){let r;try{r=e(t)}catch(n){console.log('FATAL: Error occurred in "error" event handler'),console.log(n)}r&&r.catch&&r.catch(n=>{console.log('FATAL: Error occurred in "error" event handler'),console.log(n)})}function wsI(e,t,r){let n=[e.hooks[r],e.hooks["*"]];return t&&n.unshift(e.hooks[`${r}.${t}`]),[].concat(...n.filter(Boolean))}function jsI(e,t){let r=e.hooks.error||[];if(t instanceof Error){let o=Object.assign(new AggregateError([t],t.message),{event:t});return r.forEach(c=>aGy(c,o)),Promise.reject(o)}if(!t||!t.name){let o=new Error("Event name not passed");throw new AggregateError([o],o.message)}if(!t.payload){let o=new Error("Event name not passed");throw new AggregateError([o],o.message)}let n=wsI(e,"action"in t.payload?t.payload.action:null,t.name);if(n.length===0)return Promise.resolve();let i=[],a=n.map(o=>{let c=Promise.resolve(t);return e.transform&&(c=c.then(e.transform)),c.then(f=>o(f)).catch(f=>i.push(Object.assign(f,{event:t})))});return Promise.all(a).then(()=>{if(i.length===0)return;let o=new AggregateError(i,i.map(c=>c.message).join(`
|
|
2697
2697
|
`));throw Object.assign(o,{event:t}),r.forEach(c=>aGy(c,o)),o})}function cGy(e,t,r){if(Array.isArray(t)){t.forEach(n=>cGy(e,n,r));return}if(e.hooks[t]){for(let n=e.hooks[t].length-1;n>=0;n--)if(e.hooks[t][n]===r){e.hooks[t].splice(n,1);return}}}function EsI(e){let t={hooks:{},log:sGy(e&&e.log)};return e&&e.transform&&(t.transform=e.transform),{on:uGy.bind(null,t),onAny:AsI.bind(null,t),onError:PsI.bind(null,t),removeListener:cGy.bind(null,t),receive:jsI.bind(null,t)}}async function SsI(e,t){if(!await iGy(e.secret,t.payload,t.signature,e.additionalSecrets).catch(()=>!1)){let i=new Error("[@octokit/webhooks] signature does not match event payload and secret");return i.event=t,i.status=400,e.eventHandler.receive(i)}let n;try{n=JSON.parse(t.payload)}catch(i){throw i.message="Invalid JSON",i.status=400,new AggregateError([i],i.message)}return e.eventHandler.receive({id:t.id,name:t.name,payload:n})}var oGy=new TextDecoder("utf-8",{fatal:!1}),hiV=oGy.decode.bind(oGy);var lGy=class{sign;verify;on;onAny;onError;removeListener;receive;verifyAndReceive;constructor(e){if(!e||!e.secret)throw new Error("[@octokit/webhooks] options.secret required");let t={eventHandler:EsI(e),secret:e.secret,additionalSecrets:e.additionalSecrets,hooks:{},log:sGy(e.log)};this.sign=TFu.bind(null,e.secret),this.verify=YZo.bind(null,e.secret),this.on=t.eventHandler.on,this.onAny=t.eventHandler.onAny,this.onError=t.eventHandler.onError,this.removeListener=t.eventHandler.removeListener,this.receive=t.eventHandler.receive,this.verifyAndReceive=SsI.bind(null,t)}};var DsI="16.1.2";function CsI(e,t){return new lGy({secret:t.secret,transform:async r=>{if(!("installation"in r.payload)||typeof r.payload.installation!="object"){let a=new e.constructor({authStrategy:xla,auth:{reason:'"installation" key missing in webhook event payload'}});return{...r,octokit:a}}let n=r.payload.installation.id,i=await e.auth({type:"installation",installationId:n,factory(a){return new a.octokit.constructor({...a.octokitOptions,authStrategy:Ero,auth:{...a,installationId:n}})}});return i.hook.before("request",a=>{a.headers["x-github-delivery"]=r.id}),{...r,octokit:i}}})}async function fGy(e,t){return e.octokit.auth({type:"installation",installationId:t,factory(r){let n={...r.octokitOptions,authStrategy:Ero,auth:{...r,installationId:t}};return new r.octokit.constructor(n)}})}function IsI(e){return Object.assign(MsI.bind(null,e),{iterator:dGy.bind(null,e)})}async function MsI(e,t){let r=dGy(e)[Symbol.asyncIterator](),n=await r.next();for(;!n.done;)await t(n.value),n=await r.next()}function dGy(e){return{async*[Symbol.asyncIterator](){let t=wFu.iterator(e.octokit,"GET /app/installations");for await(let{data:r}of t)for(let n of r)yield{octokit:await fGy(e,n.id),installation:n}}}}function BsI(e){return Object.assign(TsI.bind(null,e),{iterator:pGy.bind(null,e)})}async function TsI(e,t,r){let n=pGy(e,r?t:void 0)[Symbol.asyncIterator](),i=await n.next();for(;!i.done;)r?await r(i.value):await t(i.value),i=await n.next()}function qsI(e,t){return{async*[Symbol.asyncIterator](){yield{octokit:await e.getInstallationOctokit(t)}}}}function pGy(e,t){return{async*[Symbol.asyncIterator](){let r=t?qsI(e,t.installationId):e.eachInstallation.iterator();for await(let{octokit:n}of r){let i=wFu.iterator(n,"GET /installation/repositories");for await(let{data:a}of i)for(let o of a)yield{octokit:n,repository:o}}}}}function RsI(e){let t;return async function(n={}){t||(t=NsI(e));let i=await t,a=new URL(i);return n.target_id!==void 0&&(a.pathname+="/permissions",a.searchParams.append("target_id",n.target_id.toFixed())),n.state!==void 0&&a.searchParams.append("state",n.state),a.href}}async function NsI(e){let{data:t}=await e.octokit.request("GET /app");if(!t)throw new Error("[@octokit/app] unable to fetch metadata for app");return`${t.html_url}/installations/new`}var _Gy=class{static VERSION=DsI;static defaults(e){return class extends this{constructor(...r){super({...e,...r[0]})}}}octokit;webhooks;oauth;getInstallationOctokit;eachInstallation;eachRepository;getInstallationUrl;log;constructor(e){let t=e.Octokit||Q7i,r=Object.assign({appId:e.appId,privateKey:e.privateKey},e.oauth?{clientId:e.oauth.clientId,clientSecret:e.oauth.clientSecret}:{}),n={authStrategy:Ero,auth:r};"log"in e&&typeof e.log<"u"&&(n.log=e.log),this.octokit=new t(n),this.log=Object.assign({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console)},e.log),e.webhooks?this.webhooks=CsI(this.octokit,e.webhooks):Object.defineProperty(this,"webhooks",{get(){throw new Error("[@octokit/app] webhooks option not set")}}),e.oauth?this.oauth=new BFu({...e.oauth,clientType:"github-app",Octokit:t}):Object.defineProperty(this,"oauth",{get(){throw new Error("[@octokit/app] oauth.clientId / oauth.clientSecret options are not set")}}),this.getInstallationOctokit=fGy.bind(null,this),this.eachInstallation=IsI(this),this.eachRepository=BsI(this),this.getInstallationUrl=RsI(this)}};var FsI="0.0.0-development",qFu=Q7i.plugin(kRf,$Rf,CWy,eNf,jFu).defaults({userAgent:`octokit.js/${FsI}`,throttle:{onRateLimit:xsI,onSecondaryRateLimit:zsI}});function xsI(e,t,r){if(r.log.warn(`Request quota exhausted for request ${t.method} ${t.url}`),t.request.retryCount===0)return r.log.info(`Retrying after ${e} seconds!`),!0}function zsI(e,t,r){if(r.log.warn(`SecondaryRateLimit detected for request ${t.method} ${t.url}`),t.request.retryCount===0)return r.log.info(`Retrying after ${e} seconds!`),!0}var xiV=_Gy.defaults({Octokit:qFu}),ziV=BFu.defaults({Octokit:qFu});var hGy=Hi(pTu(),1);async function uNf({packageName:e,generatorInvocation:t}){if(t.language==null||e==null)return;let r=await QsI({packageName:e,language:t.language,githubRepository:GsI(t)});return r==null?void 0:hGy.default.inc(r,"patch")??void 0}async function QsI({packageName:e,language:t,githubRepository:r}){let n;switch(t){case"typescript":n=await LsI(e);break;case"python":n=await UsI(e);break;case"csharp":case"go":case"java":case"ruby":case"php":case"swift":break}return n!=null||r!=null&&(n=await VsI(r)),n}async function LsI(e){try{return await Tla(e)}catch{return}}async function UsI(e){try{let t=await fetch(`https://pypi.org/pypi/${e}/json`);return t.ok?(await t.json()).info.version:void 0}catch{return}}async function VsI(e){try{let{owner:t,repo:r}=WsI(e);return(await new qFu().rest.repos.listTags({owner:t,repo:r,per_page:1})).data?.[0]?.name}catch{return}}function WsI(e){let[t,r]=e.split("/");if(t==null||r==null)throw new Error(`Invalid github repository: ${e}`);return{owner:t,repo:r}}function GsI(e){if(e.outputMode.type==="githubV2")return`${e.outputMode.githubV2.owner}/${e.outputMode.githubV2.repo}`}var fnt=class extends mqr{definition;sources;type="fern";constructor({definition:t,sources:r,...n}){super(n),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var dnt={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:lm.RemoveDiscriminantsFromSchemas.Always};function XZo({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??dnt.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??dnt.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??dnt.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??dnt.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??dnt.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??dnt.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??dnt.inlinePathParameters,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??dnt.useBytesForBinaryResponse,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??dnt.respectForwardCompatibleEnums,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??dnt.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??dnt.coerceOptionalSchemasToNullable,groupEnvironmentsByHost:t?.groupEnvironmentsByHost??e?.groupEnvironmentsByHost??dnt.groupEnvironmentsByHost,removeDiscriminantsFromSchemas:t?.removeDiscriminantsFromSchemas??e?.removeDiscriminantsFromSchemas??dnt.removeDiscriminantsFromSchemas}}var PPe={openapi:e=>({...e,type:"openapi",_visit:function(t){return PPe._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return PPe._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 Sro={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Sro._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var sde={basic:e=>({...e,type:"basic",_visit:function(t){return sde._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return sde._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return sde._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return sde._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return sde._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 NS={primitive:e=>({value:e,type:"primitive",_visit:function(t){return NS._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return NS._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return NS._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return NS._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return NS._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return NS._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return NS._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return NS._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return NS._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var zO={int:e=>({value:e,type:"int",_visit:function(t){return zO._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return zO._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return zO._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return zO._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return zO._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return zO._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return zO._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return zO._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return zO._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return zO._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return zO._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 L7i={boolean:e=>({value:e,type:"boolean",_visit:function(t){return L7i._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return L7i._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 U7i={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return U7i._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return U7i._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 RFu={};yf(RFu,{Availability:()=>ude,CustomCodeSample:()=>bVr,EndpointExample:()=>mht,EndpointResponseExample:()=>Oht,HttpMethod:()=>lde,LiteralSchemaValue:()=>NV,MultipartRequestPropertyEncoding:()=>fNf,MultipartSchema:()=>gVr,OneOfSchema:()=>mVr,Pagination:()=>pnt,PrimitiveSchemaValue:()=>zq,Request:()=>Aqr,Response:()=>kve,RetriesConfiguration:()=>ZZo,Schema:()=>_1,SupportedSdkLanguage:()=>cde,WebhookHttpMethod:()=>lNf,WebsocketMessageOrigin:()=>cNf});var cNf={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case cNf.Client:return t.client();case cNf.Server:return t.server();default:return t._other()}}};var lNf={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case lNf.Get:return t.get();case lNf.Post:return t.post();default:return t._other()}}};var ude={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case ude.GenerallyAvailable:return t.generallyAvailable();case ude.Beta:return t.beta();case ude.Deprecated:return t.deprecated();default:return t._other()}}};var ZZo={disabled:e=>({value:e,type:"disabled",_visit:function(t){return ZZo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"disabled":return t.disabled(e.value);default:return t._other(e)}}};var pnt={cursor:e=>({...e,type:"cursor",_visit:function(t){return pnt._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return pnt._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return pnt._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 bVr={language:e=>({...e,type:"language",_visit:function(t){return bVr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return bVr._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 cde={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 cde.Curl:return t.curl();case cde.Python:return t.python();case cde.Javascript:return t.javascript();case cde.Typescript:return t.typescript();case cde.Go:return t.go();case cde.Ruby:return t.ruby();case cde.Csharp:return t.csharp();case cde.Java:return t.java();case cde.Js:return t.js();case cde.Node:return t.node();case cde.Ts:return t.ts();case cde.Nodets:return t.nodets();case cde.Golang:return t.golang();case cde.Dotnet:return t.dotnet();case cde.Jvm:return t.jvm();default:return t._other()}}};var mht={unknown:e=>({value:e,type:"unknown",_visit:function(t){return mht._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return mht._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 Oht={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return Oht._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return Oht._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 lde={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case lde.Get:return t.get();case lde.Post:return t.post();case lde.Put:return t.put();case lde.Patch:return t.patch();case lde.Delete:return t.delete();case lde.Head:return t.head();case lde.Options:return t.options();case lde.Trace:return t.trace();default:return t._other()}}};var Aqr={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Aqr._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Aqr._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Aqr._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return Aqr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var fNf={Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case fNf.Json:return t.json();case fNf.Form:return t.form();default:return t._other()}}};var gVr={file:e=>({...e,type:"file",_visit:function(t){return gVr._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return gVr._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 kve={file:e=>({...e,type:"file",_visit:function(t){return kve._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return kve._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return kve._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return kve._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return kve._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return kve._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return kve._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var _1={primitive:e=>({...e,type:"primitive",_visit:function(t){return _1._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return _1._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return _1._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return _1._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return _1._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return _1._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return _1._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return _1._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return _1._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return _1._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return _1._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 zq={int:e=>({...e,type:"int",_visit:function(t){return zq._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return zq._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return zq._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return zq._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return zq._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return zq._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return zq._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return zq._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return zq._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return zq._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return zq._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 NV={boolean:e=>({value:e,type:"boolean",_visit:function(t){return NV._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return NV._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 mVr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return mVr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return mVr._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 jCe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return jCe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return jCe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return jCe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return jCe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var YL={file:e=>({...e,type:"file",_visit:function(t){return YL._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return YL._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return YL._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return YL._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return YL._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return YL._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return YL._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var jh={primitive:e=>({...e,type:"primitive",_visit:function(t){return jh._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return jh._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return jh._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return jh._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return jh._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return jh._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return jh._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return jh._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return jh._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return jh._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return jh._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 _nt={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return _nt._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return _nt._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 k0={int:e=>({...e,type:"int",_visit:function(t){return k0._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return k0._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return k0._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return k0._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return k0._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return k0._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return k0._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return k0._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return k0._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return k0._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return k0._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 Jj={};yf(Jj,{AllOfPropertyConflict:()=>kro,ArraySchema:()=>Zxu,ArraySchemaWithExample:()=>C3u,Availability:()=>GFu,Base64WithExample:()=>w3u,BasicSecurityScheme:()=>JFu,BearerSecurityScheme:()=>KFu,BooleanSchema:()=>Hxu,BooleanWithExample:()=>j3u,BytesResponse:()=>Vro,CasingOverrides:()=>XFu,CommonProperty:()=>o3u,CommonPropertyWithExample:()=>x3u,CursorPagination:()=>Cxu,CustomCodeSample:()=>Sxu,CustomCodeSampleLanguage:()=>wxu,CustomCodeSampleSdk:()=>Exu,CustomPagination:()=>Mxu,DateWithExample:()=>P3u,DatetimeWithExample:()=>A3u,DiscriminatedOneOfSchema:()=>i3u,DiscriminatedOneOfSchemaWithExample:()=>N3u,DoubleSchema:()=>Wxu,DoubleWithExample:()=>m3u,Encoding:()=>WFu,Endpoint:()=>Bxu,EndpointExample:()=>Jro,EndpointResponseExample:()=>Pxu,EndpointSdkName:()=>PVr,EndpointSecurity:()=>Rro,EndpointWithExample:()=>GGy,EnumSchema:()=>Bro,EnumSchemaWithExample:()=>S3u,EnumValue:()=>G7i,ErrorExample:()=>bxu,FernExample:()=>mxu,FileResponse:()=>Lro,FileSchema:()=>lxu,FloatWithExample:()=>g3u,FormUrlEncodedRequest:()=>hxu,FullEndpointExample:()=>Dxu,FullExample:()=>TQ,FullObjectExample:()=>axu,FullOneOfExample:()=>sxu,GlobalHeader:()=>Kxu,Header:()=>J7i,HeaderExample:()=>Hro,HeaderSecurityScheme:()=>$Fu,HeaderWithExample:()=>Y7i,HttpEndpointServer:()=>Wro,HttpError:()=>gxu,HttpErrorWithExample:()=>_3u,HttpMethod:()=>Nro,IdempotencyHeader:()=>$xu,Int64WithExample:()=>y3u,IntSchema:()=>Uxu,IntWithExample:()=>h3u,JsonRequest:()=>_xu,JsonRequestWithExample:()=>l3u,JsonResponse:()=>Uro,JsonResponseWithExample:()=>rno,KeyValuePair:()=>oxu,LiteralExample:()=>nxu,LiteralSchema:()=>Zro,LiteralSchemaValue:()=>Yxu,LongSchema:()=>Vxu,MapSchema:()=>kxu,MapSchemaWithExample:()=>I3u,MultipartRequest:()=>Qro,MultipartRequestProperty:()=>pxu,MultipartRequestPropertyEncoding:()=>dxu,MultipartSchema:()=>fxu,NamedFullExample:()=>Pht,Namespace:()=>ZFu,NamespaceId:()=>rxu,NullExample:()=>ixu,NullableSchema:()=>t3u,NullableSchemaWithExample:()=>B3u,OauthSecurityScheme:()=>exu,ObjectProperty:()=>n3u,ObjectPropertyConflictInfo:()=>eno,ObjectPropertyWithExample:()=>R3u,ObjectSchema:()=>Xxu,ObjectSchemaWithExample:()=>T3u,OctetStreamRequest:()=>zro,OffsetPagination:()=>Ixu,OneOfSchema:()=>r3u,OneOfSchemaWithExample:()=>q3u,OpenApiIntermediateRepresentation:()=>VGy,OpenApiSource:()=>QFu,OptionalSchema:()=>e3u,OptionalSchemaWithExample:()=>M3u,Pagination:()=>Kro,ParseFormUrlEncodedRequest:()=>f3u,ParseMultipartRequest:()=>c3u,ParseOctetStreamRequest:()=>u3u,PathParameter:()=>Fro,PathParameterExample:()=>Oxu,PathParameterWithExample:()=>s3u,PrimitiveExample:()=>qro,PrimitiveSchema:()=>$7i,PrimitiveSchemaValue:()=>Jxu,PrimitiveSchemaValueWithExample:()=>E3u,PrimitiveSchemaWithExample:()=>nno,PropertyKey:()=>Tro,ProtobufEncoding:()=>VFu,ProtobufSource:()=>LFu,QueryParameter:()=>xro,QueryParameterExample:()=>Gro,QueryParameterWithExample:()=>tno,QuerySecurityScheme:()=>YFu,ReferencedSchema:()=>wVr,Request:()=>yxu,RequestWithExample:()=>d3u,Response:()=>vxu,ResponseWithExample:()=>p3u,RetriesConfiguration:()=>$ro,Schema:()=>VI,SchemaId:()=>ECe,SchemaWithExample:()=>$4,Schemas:()=>Lxu,SdkGroup:()=>kFu,SdkGroupInfo:()=>uxu,SdkGroupName:()=>H7i,SecurityScheme:()=>txu,SecuritySchemeId:()=>Mro,Server:()=>rko,Source:()=>UFu,StatusCode:()=>OVr,StreamingResponseExample:()=>Axu,StringSchema:()=>Gxu,StringSchemaWithExample:()=>O3u,SupportedSdkLanguage:()=>jxu,Tag:()=>HFu,TagId:()=>SCe,Tags:()=>cxu,TextResponse:()=>K7i,Uint64WithExample:()=>b3u,UintWithExample:()=>v3u,UnDiscriminatedOneOfSchema:()=>a3u,UnDiscriminatedOneOfSchemaWithExample:()=>F3u,UnknownSchemaWithExample:()=>D3u,Webhook:()=>Txu,WebhookExampleCall:()=>Xro,WebhookHttpMethod:()=>Yro,WebhookWithExample:()=>HGy,WebsocketChannel:()=>Qxu,WebsocketHandshake:()=>qxu,WebsocketHandshakeWithExample:()=>WGy,WebsocketMessageExample:()=>xxu,WebsocketMessageOrigin:()=>Rxu,WebsocketMessageSchema:()=>Nxu,WebsocketServer:()=>Fxu,WebsocketSessionExample:()=>zxu,WithAvailability:()=>ow,WithDescription:()=>Ov,WithEncoding:()=>Cxe,WithInline:()=>K4,WithName:()=>jD,WithNamespace:()=>FS,WithSdkGroupName:()=>QM,WithSdkMethodName:()=>AVr,WithSource:()=>jP,WithStatusCode:()=>Aht,WithTitle:()=>zM,commons:()=>yNf,example:()=>vNf,finalIr:()=>bNf,parseIr:()=>gNf});var yNf={};yf(yNf,{BasicSecurityScheme:()=>JFu,BearerSecurityScheme:()=>KFu,Encoding:()=>WFu,HeaderSecurityScheme:()=>$Fu,Namespace:()=>ZFu,NamespaceId:()=>rxu,OauthSecurityScheme:()=>exu,OpenApiSource:()=>QFu,ProtobufEncoding:()=>VFu,ProtobufSource:()=>LFu,QuerySecurityScheme:()=>YFu,SchemaId:()=>ECe,SdkGroup:()=>kFu,SdkGroupName:()=>H7i,SecurityScheme:()=>txu,SecuritySchemeId:()=>Mro,Server:()=>rko,Source:()=>UFu,StatusCode:()=>OVr,Tag:()=>HFu,TagId:()=>SCe,WithAvailability:()=>ow,WithDescription:()=>Ov,WithEncoding:()=>Cxe,WithInline:()=>K4,WithName:()=>jD,WithNamespace:()=>FS,WithSdkGroupName:()=>QM,WithSdkMethodName:()=>AVr,WithSource:()=>jP,WithStatusCode:()=>Aht,WithTitle:()=>zM});var Gr={};yf(Gr,{JsonError:()=>Dro,ParseError:()=>Cro,any:()=>IGy,bigint:()=>vGy,boolean:()=>MGy,booleanLiteral:()=>CGy,date:()=>bGy,discriminant:()=>QGy,enum_:()=>FFu,getObjectLikeUtils:()=>Pqr,getObjectUtils:()=>zla,getSchemaUtils:()=>BQ,isProperty:()=>W7i,lazy:()=>gGy,lazyObject:()=>EGy,list:()=>zFu,number:()=>BGy,object:()=>xFu,objectWithoutOptionalProperties:()=>jGy,optional:()=>dNf,property:()=>OGy,record:()=>NGy,set:()=>FGy,string:()=>TGy,stringLiteral:()=>DGy,transform:()=>pNf,undiscriminatedUnion:()=>zGy,union:()=>UGy,unknown:()=>qGy,withParsedProperties:()=>hNf});var Qq={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 Z8(e,t){return`Expected ${t}. Received ${HsI(e)}.`}function HsI(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 fde(e){return{...e,json:yGy(e.json),parse:yGy(e.parse)}}function yGy(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
2698
|
-
`)),{ok:!0,value:t}):n}}function NFu(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Dro=class e extends Error{errors;constructor(t){super(t.map(NFu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var Cro=class e extends Error{errors;constructor(t){super(t.map(NFu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function BQ(e){return{optional:()=>dNf(e),transform:t=>pNf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new Cro(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Dro(n.errors)}}}function dNf(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Qq.OPTIONAL};return{...t,...BQ(t)}}function pNf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...BQ(r)}}function vGy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Z8(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:Z8(t,"bigint")}]},getType:()=>Qq.BIGINT};return{...fde(e),...BQ(e)}}var JsI=/^([+-]?\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 bGy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Z8(t,"string")}]}:JsI.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Z8(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Z8(t,"Date object")}]},getType:()=>Qq.DATE};return{...fde(e),...BQ(e)}}function wPe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...fde(r),...BQ(r)}}}function FFu(e){let t=new Set(e);return wPe(Qq.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:Z8(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:Z8(n,"enum")}]}:{ok:!0,value:n})()}function gGy(e){let t=_Nf(e);return{...t,...BQ(t)}}function _Nf(e){return{parse:(t,r)=>Iro(e).parse(t,r),json:(t,r)=>Iro(e).json(t,r),getType:()=>Iro(e).getType()}}function Iro(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function kZo(e){return Object.entries(e)}function eko(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function V7i(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 tko(e){return Object.keys(e)}function mGy(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function Pqr(e){return{withParsedProperties:t=>hNf(e,t)}}function hNf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!V7i(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Z8(n,"object")}]};let a=new Set(Object.keys(t)),o=eko(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...BQ(r),...Pqr(r)}}function OGy(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function W7i(e){return e.isProperty}function xFu(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>W7i(n)?n.rawKey:r),_getParsedProperties:()=>tko(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of kZo(e)){let f=W7i(c)?c.rawKey:o,u=W7i(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,wGy(u)&&a.push(f)}return AGy({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of kZo(e)){let c=W7i(o)?o.valueSchema:o;wGy(c)&&i.push(a)}return AGy({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return W7i(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>Qq.OBJECT};return{...fde(t),...BQ(t),...Pqr(t),...zla(t)}}function AGy({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!V7i(e))return{ok:!1,errors:[{path:a,message:Z8(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function zla(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>PGy({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>PGy({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>Qq.OBJECT};return{...r,...BQ(r),...Pqr(r),...zla(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>Qq.OBJECT};return{...t,...BQ(t),...Pqr(t),...zla(t)}}}}function PGy({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=mGy(tko(t),u=>i.has(u)),c=r(eko(t,o)),f=n(eko(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function wGy(e){return!KsI(e)}function KsI(e){switch(e.getType()){case Qq.ANY:case Qq.UNKNOWN:case Qq.OPTIONAL:return!0;default:return!1}}function jGy(e){return xFu(e)}function EGy(e){let t={..._Nf(e),_getRawProperties:()=>Iro(e)._getRawProperties(),_getParsedProperties:()=>Iro(e)._getParsedProperties()};return{...t,...BQ(t),...Pqr(t),...zla(t)}}function zFu(e){let t={parse:(r,n)=>SGy(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>SGy(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>Qq.LIST};return{...fde(t),...BQ(t)}}function SGy(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:Z8(e,"list"),path:[]}]}}function DGy(e){return wPe(Qq.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Z8(r,`"${e}"`)}]})()}function CGy(e){return wPe(Qq.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Z8(r,`${e.toString()}`)}]})()}var IGy=wPe(Qq.ANY,e=>({ok:!0,value:e}));var MGy=wPe(Qq.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Z8(e,"boolean")}]});var BGy=wPe(Qq.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Z8(e,"number")}]});var TGy=wPe(Qq.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Z8(e,"string")}]});var qGy=wPe(Qq.UNKNOWN,e=>({ok:!0,value:e}));function NGy(e,t){let r={parse:(n,i)=>RGy({value:n,isKeyNumeric:e.getType()===Qq.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>RGy({value:n,isKeyNumeric:e.getType()===Qq.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Qq.RECORD};return{...fde(r),...BQ(r)}}function RGy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return V7i(e)?kZo(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,u=o;if(t){let O=o.length>0?Number(o):NaN;isNaN(O)||(u=O)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:Z8(e,"object")}]}}function FGy(e){let t=zFu(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Z8(n,"Set")}]},getType:()=>Qq.SET};return{...fde(r),...BQ(r)}}function zGy(e){let t={parse:(r,n)=>xGy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>xGy((i,a)=>i.json(r,a),e,n),getType:()=>Qq.UNDISCRIMINATED_UNION};return{...fde(t),...BQ(t)}}function xGy(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function QGy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function UGy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=FFu(tko(t)),a={parse:(o,c)=>LGy({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>LGy({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>Qq.UNION};return{...fde(a),...BQ(a),...Pqr(a)}}function LGy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!V7i(e))return{ok:!1,errors:[{path:c,message:Z8(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var zM=Gr.objectWithoutOptionalProperties({title:Gr.string().optional()});var QFu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var LFu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var UFu=Gr.union("type",{openapi:QFu,protobuf:LFu}).transform({transform:e=>{switch(e.type){case"openapi":return PPe.openapi(e);case"protobuf":return PPe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var jP=Gr.objectWithoutOptionalProperties({source:UFu.optional()});var VFu=Gr.objectWithoutOptionalProperties({typeName:Gr.string()});var WFu=Gr.union("type",{protobuf:VFu}).transform({transform:e=>{switch(e.type){case"protobuf":return Sro.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Cxe=Gr.objectWithoutOptionalProperties({encoding:WFu.optional()});var Ov=Gr.objectWithoutOptionalProperties({description:Gr.string().optional()});var GFu=Gr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var ow=Gr.objectWithoutOptionalProperties({availability:GFu.optional()});var OVr=Gr.number();var Aht=Gr.objectWithoutOptionalProperties({statusCode:OVr.optional()});var jD=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string()});var K4=Gr.objectWithoutOptionalProperties({inline:Gr.boolean().optional()});var ECe=Gr.string();var SCe=Gr.string();var HFu=Gr.objectWithoutOptionalProperties({id:SCe}).extend(Ov);var Mro=Gr.string();var JFu=Gr.objectWithoutOptionalProperties({usernameVariableName:Gr.string().optional(),usernameEnvVar:Gr.string().optional(),passwordVariableName:Gr.string().optional(),passwordEnvVar:Gr.string().optional()});var KFu=Gr.objectWithoutOptionalProperties({tokenVariableName:Gr.string().optional(),tokenEnvVar:Gr.string().optional()});var $Fu=Gr.objectWithoutOptionalProperties({headerName:Gr.string(),prefix:Gr.string().optional(),headerVariableName:Gr.string().optional(),headerEnvVar:Gr.string().optional()});var YFu=Gr.objectWithoutOptionalProperties({queryParameterName:Gr.string()});var XFu=Gr.objectWithoutOptionalProperties({snake:Gr.string().optional(),camel:Gr.string().optional(),screamingSnake:Gr.string().optional(),pascal:Gr.string().optional()});var G7i=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string(),value:Gr.string(),casing:XFu.optional()}).extend(Ov).extend(ow);var ZFu=Gr.objectWithoutOptionalProperties({type:Gr.stringLiteral("namespace"),name:Gr.string()});var kFu=Gr.undiscriminatedUnion([Gr.string(),ZFu]);var H7i=Gr.list(kFu);var QM=Gr.objectWithoutOptionalProperties({groupName:H7i.optional()});var FS=Gr.objectWithoutOptionalProperties({namespace:Gr.string().optional()});var Bro=Gr.objectWithoutOptionalProperties({default:G7i.optional(),values:Gr.list(G7i)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var exu=Gr.objectWithoutOptionalProperties({scopesEnum:Bro.optional()});var txu=Gr.union("type",{basic:JFu,bearer:KFu,header:$Fu,query:YFu,oauth:exu}).transform({transform:e=>{switch(e.type){case"basic":return sde.basic(e);case"bearer":return sde.bearer(e);case"header":return sde.header(e);case"query":return sde.query(e);case"oauth":return sde.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var rko=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string(),audiences:Gr.list(Gr.string()).optional()}).extend(Ov);var rxu=Gr.string();var AVr=Gr.objectWithoutOptionalProperties({sdkMethodName:Gr.string().optional()});var vNf={};yf(vNf,{FullExample:()=>TQ,FullObjectExample:()=>axu,FullOneOfExample:()=>sxu,KeyValuePair:()=>oxu,LiteralExample:()=>nxu,NullExample:()=>ixu,PrimitiveExample:()=>qro,PropertyKey:()=>Tro});var Tro=Gr.string();var qro=Gr.union("type",{int:Gr.object({value:Gr.number()}),int64:Gr.object({value:Gr.number()}),uint:Gr.object({value:Gr.number()}),uint64:Gr.object({value:Gr.number()}),float:Gr.object({value:Gr.number()}),double:Gr.object({value:Gr.number()}),string:Gr.object({value:Gr.string()}),datetime:Gr.object({value:Gr.string()}),date:Gr.object({value:Gr.string()}),base64:Gr.object({value:Gr.string()}),boolean:Gr.object({value:Gr.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return zO.int(e.value);case"int64":return zO.int64(e.value);case"uint":return zO.uint(e.value);case"uint64":return zO.uint64(e.value);case"float":return zO.float(e.value);case"double":return zO.double(e.value);case"string":return zO.string(e.value);case"datetime":return zO.datetime(e.value);case"date":return zO.date(e.value);case"base64":return zO.base64(e.value);case"boolean":return zO.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var nxu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return L7i.boolean(e.value);case"string":return L7i.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var ixu=Gr.objectWithoutOptionalProperties({});var TQ=Gr.union("type",{primitive:Gr.object({value:qro}),object:Gr.lazyObject(()=>axu),array:Gr.object({value:Gr.list(Gr.lazy(()=>TQ))}),map:Gr.object({value:Gr.list(Gr.lazyObject(()=>oxu))}),enum:Gr.object({value:Gr.string()}),literal:Gr.object({value:nxu}),oneOf:Gr.object({value:Gr.lazy(()=>sxu)}),null:ixu,unknown:Gr.object({value:Gr.lazy(()=>TQ)})}).transform({transform:e=>{switch(e.type){case"primitive":return NS.primitive(e.value);case"object":return NS.object(e);case"array":return NS.array(e.value);case"map":return NS.map(e.value);case"enum":return NS.enum(e.value);case"literal":return NS.literal(e.value);case"oneOf":return NS.oneOf(e.value);case"null":return NS.null(e);case"unknown":return NS.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var axu=Gr.objectWithoutOptionalProperties({properties:Gr.record(Tro,Gr.lazy(()=>TQ))});var oxu=Gr.objectWithoutOptionalProperties({key:qro,value:Gr.lazy(()=>TQ)});var sxu=Gr.union("type",{discriminated:Gr.object({value:Gr.record(Tro,Gr.lazy(()=>TQ))}),undiscriminated:Gr.object({value:Gr.lazy(()=>TQ)})}).transform({transform:e=>{switch(e.type){case"discriminated":return U7i.discriminated(e.value);case"undiscriminated":return U7i.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var bNf={};yf(bNf,{AllOfPropertyConflict:()=>kro,ArraySchema:()=>Zxu,Availability:()=>GFu,BooleanSchema:()=>Hxu,BytesResponse:()=>Vro,CasingOverrides:()=>XFu,CommonProperty:()=>o3u,CursorPagination:()=>Cxu,CustomCodeSample:()=>Sxu,CustomCodeSampleLanguage:()=>wxu,CustomCodeSampleSdk:()=>Exu,CustomPagination:()=>Mxu,DiscriminatedOneOfSchema:()=>i3u,DoubleSchema:()=>Wxu,Endpoint:()=>Bxu,EndpointExample:()=>Jro,EndpointResponseExample:()=>Pxu,EndpointSdkName:()=>PVr,EndpointSecurity:()=>Rro,EnumSchema:()=>Bro,EnumValue:()=>G7i,ErrorExample:()=>bxu,FernExample:()=>mxu,FileResponse:()=>Lro,FileSchema:()=>lxu,FormUrlEncodedRequest:()=>hxu,FullEndpointExample:()=>Dxu,GlobalHeader:()=>Kxu,Header:()=>J7i,HeaderExample:()=>Hro,HttpEndpointServer:()=>Wro,HttpError:()=>gxu,HttpMethod:()=>Nro,IdempotencyHeader:()=>$xu,IntSchema:()=>Uxu,JsonRequest:()=>_xu,JsonResponse:()=>Uro,LiteralSchema:()=>Zro,LiteralSchemaValue:()=>Yxu,LongSchema:()=>Vxu,MapSchema:()=>kxu,MultipartRequest:()=>Qro,MultipartRequestProperty:()=>pxu,MultipartRequestPropertyEncoding:()=>dxu,MultipartSchema:()=>fxu,NullableSchema:()=>t3u,ObjectProperty:()=>n3u,ObjectPropertyConflictInfo:()=>eno,ObjectSchema:()=>Xxu,OctetStreamRequest:()=>zro,OffsetPagination:()=>Ixu,OneOfSchema:()=>r3u,OpenApiIntermediateRepresentation:()=>VGy,OptionalSchema:()=>e3u,Pagination:()=>Kro,PathParameter:()=>Fro,PathParameterExample:()=>Oxu,PrimitiveSchema:()=>$7i,PrimitiveSchemaValue:()=>Jxu,QueryParameter:()=>xro,QueryParameterExample:()=>Gro,ReferencedSchema:()=>wVr,Request:()=>yxu,Response:()=>vxu,RetriesConfiguration:()=>$ro,Schema:()=>VI,Schemas:()=>Lxu,SdkGroupInfo:()=>uxu,StreamingResponseExample:()=>Axu,StringSchema:()=>Gxu,SupportedSdkLanguage:()=>jxu,Tags:()=>cxu,TextResponse:()=>K7i,UnDiscriminatedOneOfSchema:()=>a3u,Webhook:()=>Txu,WebhookExampleCall:()=>Xro,WebhookHttpMethod:()=>Yro,WebsocketChannel:()=>Qxu,WebsocketHandshake:()=>qxu,WebsocketMessageExample:()=>xxu,WebsocketMessageOrigin:()=>Rxu,WebsocketMessageSchema:()=>Nxu,WebsocketServer:()=>Fxu,WebsocketSessionExample:()=>zxu});var uxu=Gr.objectWithoutOptionalProperties({summary:Gr.string().optional(),description:Gr.string().optional()});var cxu=Gr.objectWithoutOptionalProperties({tagsById:Gr.record(SCe,HFu),orderedTagIds:Gr.list(SCe).optional()});var Rro=Gr.list(Gr.record(Mro,Gr.list(Gr.string())));var Nro=Gr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var Fro=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>VI),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var xro=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>VI),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var J7i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>VI),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var PVr=Gr.objectWithoutOptionalProperties({groupName:H7i,methodName:Gr.string()});var zro=Gr.objectWithoutOptionalProperties({contentType:Gr.string().optional()}).extend(Ov).extend(jP);var lxu=Gr.objectWithoutOptionalProperties({isOptional:Gr.boolean(),isArray:Gr.boolean()}).extend(Ov);var fxu=Gr.union("type",{file:lxu,json:Gr.object({value:Gr.lazy(()=>VI)})}).transform({transform:e=>{switch(e.type){case"file":return gVr.file(e);case"json":return gVr.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var dxu=Gr.enum_(["json","form"]);var pxu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:fxu,contentType:Gr.string().optional(),exploded:Gr.boolean().optional(),encoding:dxu.optional()}).extend(Ov);var Qro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),properties:Gr.list(pxu)}).extend(Ov).extend(jP);var _xu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP);var hxu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP);var yxu=Gr.union("type",{octetStream:zro,multipart:Qro,json:_xu,formUrlEncoded:hxu}).transform({transform:e=>{switch(e.type){case"octetStream":return Aqr.octetStream(e);case"multipart":return Aqr.multipart(e);case"json":return Aqr.json(e);case"formUrlEncoded":return Aqr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var Lro=Gr.objectWithoutOptionalProperties({}).extend(Ov).extend(jP).extend(Aht);var Uro=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI),responseProperty:Gr.string().optional()}).extend(Ov).extend(jP).extend(Aht);var K7i=Gr.objectWithoutOptionalProperties({}).extend(Ov).extend(jP).extend(Aht);var Vro=Gr.objectWithoutOptionalProperties({}).extend(Ov).extend(jP).extend(Aht);var vxu=Gr.union("type",{file:Lro,json:Uro,text:K7i,bytes:Vro,streamingSse:Uro,streamingText:K7i,streamingJson:Uro}).transform({transform:e=>{switch(e.type){case"file":return kve.file(e);case"json":return kve.json(e);case"text":return kve.text(e);case"bytes":return kve.bytes(e);case"streamingSse":return kve.streamingSse(e);case"streamingText":return kve.streamingText(e);case"streamingJson":return kve.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var bxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),description:Gr.string().optional(),example:Gr.lazy(()=>TQ)});var gxu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI).optional(),examples:Gr.list(bxu).optional()}).extend(Ov).extend(jD).extend(jP);var Wro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string().optional(),audiences:Gr.list(Gr.string()).optional()});var mxu=Gr.unknown();var Oxu=Gr.objectWithoutOptionalProperties({name:Gr.string(),parameterNameOverride:Gr.string().optional(),value:Gr.lazy(()=>TQ)});var Gro=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>TQ)});var Hro=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>TQ)});var Axu=Gr.objectWithoutOptionalProperties({sse:Gr.boolean(),events:Gr.list(Gr.lazy(()=>TQ))});var Pxu=Gr.union("type",{withStreaming:Axu,withoutStreaming:Gr.object({value:Gr.lazy(()=>TQ)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return Oht.withStreaming(e);case"withoutStreaming":return Oht.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var wxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),language:Gr.string(),code:Gr.string(),install:Gr.string().optional()}).extend(Ov);var jxu=Gr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var Exu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),sdk:jxu,code:Gr.string()}).extend(Ov);var Sxu=Gr.union("type",{language:wxu,sdk:Exu}).transform({transform:e=>{switch(e.type){case"language":return bVr.language(e);case"sdk":return bVr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var Dxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),pathParameters:Gr.list(Oxu).optional(),queryParameters:Gr.list(Gro).optional(),headers:Gr.list(Hro).optional(),request:Gr.lazy(()=>TQ).optional(),response:Pxu.optional(),codeSamples:Gr.list(Sxu)}).extend(Ov);var Jro=Gr.union("type",{unknown:Gr.object({value:mxu}),full:Dxu}).transform({transform:e=>{switch(e.type){case"unknown":return mht.unknown(e.value);case"full":return mht.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var Cxu=Gr.objectWithoutOptionalProperties({cursor:Gr.string(),nextCursor:Gr.property("next_cursor",Gr.string()),results:Gr.string()});var Ixu=Gr.objectWithoutOptionalProperties({offset:Gr.string(),results:Gr.string(),step:Gr.string().optional(),hasNextPage:Gr.string().optional()});var Mxu=Gr.objectWithoutOptionalProperties({results:Gr.string()});var Kro=Gr.union("type",{cursor:Cxu,offset:Ixu,custom:Mxu}).transform({transform:e=>{switch(e.type){case"cursor":return pnt.cursor(e);case"offset":return pnt.offset(e);case"custom":return pnt.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var $ro=Gr.union("type",{disabled:Gr.object({value:Gr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return ZZo.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Bxu=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:Rro,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:Nro,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(SCe),pathParameters:Gr.list(Fro),queryParameters:Gr.list(xro),headers:Gr.list(J7i),sdkName:PVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:yxu.optional(),response:vxu.optional(),errors:Gr.record(OVr,gxu),servers:Gr.list(Wro),examples:Gr.list(Jro),pagination:Kro.optional(),retries:$ro.optional()}).extend(Ov).extend(ow).extend(jP).extend(FS);var Yro=Gr.enum_(["GET","POST"]);var Xro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),payload:Gr.lazy(()=>TQ)}).extend(Ov);var Txu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:PVr.optional(),method:Yro,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(SCe),headers:Gr.list(J7i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>VI),examples:Gr.list(Xro)}).extend(Ov).extend(jP).extend(FS);var qxu=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(xro),headers:Gr.list(J7i),pathParameters:Gr.list(Fro)});var Rxu=Gr.enum_(["client","server"]);var Nxu=Gr.objectWithoutOptionalProperties({name:Gr.string(),origin:Rxu,body:Gr.lazy(()=>VI)});var Fxu=Gr.objectWithoutOptionalProperties({name:Gr.string(),url:Gr.string()});var xxu=Gr.objectWithoutOptionalProperties({messageType:Gr.string(),payload:Gr.lazy(()=>TQ)}).extend(Ov);var zxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),queryParameters:Gr.list(Gro).optional(),headers:Gr.list(Hro).optional(),messages:Gr.list(xxu)}).extend(Ov);var Qxu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),path:Gr.string(),groupName:H7i,summary:Gr.string().optional(),handshake:qxu,messages:Gr.list(Nxu),servers:Gr.list(Fxu),examples:Gr.list(zxu)}).extend(Ov).extend(jP);var Lxu=Gr.objectWithoutOptionalProperties({rootSchemas:Gr.record(ECe,Gr.lazy(()=>VI)),namespacedSchemas:Gr.record(rxu,Gr.record(ECe,Gr.lazy(()=>VI)))});var Uxu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var Vxu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional()});var Wxu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var Gxu=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional()});var Hxu=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional()});var Jxu=Gr.union("type",{int:Uxu,int64:Vxu,uint:Gr.object({}),uint64:Gr.object({}),float:Gr.object({}),double:Wxu,string:Gxu,datetime:Gr.object({}),date:Gr.object({}),base64:Gr.object({}),boolean:Hxu}).transform({transform:e=>{switch(e.type){case"int":return zq.int(e);case"int64":return zq.int64(e);case"uint":return zq.uint();case"uint64":return zq.uint64();case"float":return zq.float();case"double":return zq.double(e);case"string":return zq.string(e);case"datetime":return zq.datetime();case"date":return zq.date();case"base64":return zq.base64();case"boolean":return zq.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var $7i=Gr.objectWithoutOptionalProperties({schema:Jxu}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var Kxu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),optional:Gr.boolean().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>VI).optional()});var $xu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>VI).optional()});var VGy=Gr.objectWithoutOptionalProperties({apiVersion:Gr.unknown().optional(),title:Gr.string().optional(),description:Gr.string().optional(),basePath:Gr.string().optional(),servers:Gr.list(rko),websocketServers:Gr.list(rko),groups:Gr.record(Gr.string(),uxu),tags:cxu,hasEndpointsMarkedInternal:Gr.boolean(),endpoints:Gr.list(Bxu),webhooks:Gr.list(Txu),channels:Gr.record(Gr.string(),Qxu),groupedSchemas:Lxu,variables:Gr.record(Gr.string(),$7i),nonRequestReferencedSchemas:Gr.set(ECe),securitySchemes:Gr.record(Mro,txu),globalHeaders:Gr.list(Kxu).optional(),idempotencyHeaders:Gr.list($xu).optional()});var wVr=Gr.objectWithoutOptionalProperties({schema:ECe}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM);var Yxu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return NV.boolean(e.value);case"string":return NV.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Zro=Gr.objectWithoutOptionalProperties({value:Yxu}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var VI=Gr.union("type",{primitive:$7i,object:Gr.lazyObject(()=>Xxu),array:Gr.lazyObject(()=>Zxu),map:Gr.lazyObject(()=>kxu),optional:Gr.lazyObject(()=>e3u),enum:Bro,reference:wVr,literal:Zro,oneOf:Gr.object({value:Gr.lazy(()=>r3u)}),nullable:Gr.lazyObject(()=>t3u),unknown:jD}).transform({transform:e=>{switch(e.type){case"primitive":return _1.primitive(e);case"object":return _1.object(e);case"array":return _1.array(e);case"map":return _1.map(e);case"optional":return _1.optional(e);case"enum":return _1.enum(e);case"reference":return _1.reference(e);case"literal":return _1.literal(e);case"oneOf":return _1.oneOf(e.value);case"nullable":return _1.nullable(e);case"unknown":return _1.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var kro=Gr.objectWithoutOptionalProperties({propertyKey:Gr.string(),allOfSchemaIds:Gr.list(ECe),conflictingTypeSignatures:Gr.boolean()});var Xxu=Gr.objectWithoutOptionalProperties({allOf:Gr.list(wVr),properties:Gr.list(Gr.lazyObject(()=>n3u)),allOfPropertyConflicts:Gr.list(kro),additionalProperties:Gr.boolean()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var eno=Gr.objectWithoutOptionalProperties({differentSchema:Gr.boolean()});var n3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>VI),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),conflict:Gr.record(ECe,eno),generatedName:Gr.string(),nameOverride:Gr.string().optional(),audiences:Gr.list(Gr.string())}).extend(ow);var Zxu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var kxu=Gr.objectWithoutOptionalProperties({key:$7i,value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(zM).extend(K4);var e3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var t3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var r3u=Gr.union("type",{discriminated:Gr.lazyObject(()=>i3u),undiscriminated:Gr.lazyObject(()=>a3u)}).transform({transform:e=>{switch(e.type){case"discriminated":return mVr.discriminated(e);case"undiscriminated":return mVr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var i3u=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>o3u)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>VI))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var o3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>VI)});var a3u=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>VI))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var gNf={};yf(gNf,{ArraySchemaWithExample:()=>C3u,Base64WithExample:()=>w3u,BooleanWithExample:()=>j3u,CommonPropertyWithExample:()=>x3u,DateWithExample:()=>P3u,DatetimeWithExample:()=>A3u,DiscriminatedOneOfSchemaWithExample:()=>N3u,DoubleWithExample:()=>m3u,EndpointWithExample:()=>GGy,EnumSchemaWithExample:()=>S3u,FloatWithExample:()=>g3u,HeaderWithExample:()=>Y7i,HttpErrorWithExample:()=>_3u,Int64WithExample:()=>y3u,IntWithExample:()=>h3u,JsonRequestWithExample:()=>l3u,JsonResponseWithExample:()=>rno,MapSchemaWithExample:()=>I3u,NamedFullExample:()=>Pht,NullableSchemaWithExample:()=>B3u,ObjectPropertyWithExample:()=>R3u,ObjectSchemaWithExample:()=>T3u,OneOfSchemaWithExample:()=>q3u,OptionalSchemaWithExample:()=>M3u,ParseFormUrlEncodedRequest:()=>f3u,ParseMultipartRequest:()=>c3u,ParseOctetStreamRequest:()=>u3u,PathParameterWithExample:()=>s3u,PrimitiveSchemaValueWithExample:()=>E3u,PrimitiveSchemaWithExample:()=>nno,QueryParameterWithExample:()=>tno,RequestWithExample:()=>d3u,ResponseWithExample:()=>p3u,SchemaWithExample:()=>$4,StringSchemaWithExample:()=>O3u,Uint64WithExample:()=>b3u,UintWithExample:()=>v3u,UnDiscriminatedOneOfSchemaWithExample:()=>F3u,UnknownSchemaWithExample:()=>D3u,WebhookWithExample:()=>HGy,WebsocketHandshakeWithExample:()=>WGy});var Pht=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),value:Gr.unknown()}).extend(Ov);var tno=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>$4),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var Y7i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>$4),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var WGy=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(tno),headers:Gr.list(Y7i)});var s3u=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>$4),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var u3u=Gr.objectWithoutOptionalProperties({}).extend(zro).extend(AVr);var c3u=Gr.objectWithoutOptionalProperties({}).extend(Qro).extend(AVr);var l3u=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>$4),contentType:Gr.string().optional(),fullExamples:Gr.list(Pht).optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP).extend(AVr);var f3u=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>$4),contentType:Gr.string().optional(),fullExamples:Gr.list(Pht).optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP).extend(AVr);var d3u=Gr.union("type",{octetStream:u3u,multipart:c3u,json:l3u,formUrlEncoded:f3u}).transform({transform:e=>{switch(e.type){case"octetStream":return jCe.octetStream(e);case"multipart":return jCe.multipart(e);case"json":return jCe.json(e);case"formUrlEncoded":return jCe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var rno=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>$4),responseProperty:Gr.string().optional(),fullExamples:Gr.list(Pht).optional()}).extend(Ov).extend(jP).extend(Aht);var p3u=Gr.union("type",{file:Lro,json:rno,text:K7i,bytes:Vro,streamingSse:rno,streamingText:K7i,streamingJson:rno}).transform({transform:e=>{switch(e.type){case"file":return YL.file(e);case"json":return YL.json(e);case"text":return YL.text(e);case"bytes":return YL.bytes(e);case"streamingSse":return YL.streamingSse(e);case"streamingText":return YL.streamingText(e);case"streamingJson":return YL.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var _3u=Gr.objectWithoutOptionalProperties({statusCode:OVr,schema:Gr.lazy(()=>$4),fullExamples:Gr.list(Pht).optional()}).extend(Ov).extend(jD).extend(jP);var GGy=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:Rro,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:Nro,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(SCe),pathParameters:Gr.list(s3u),queryParameters:Gr.list(tno),headers:Gr.list(Y7i),sdkName:PVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:d3u.optional(),response:p3u.optional(),errors:Gr.record(OVr,_3u),servers:Gr.list(Wro),examples:Gr.list(Jro),pagination:Kro.optional(),retries:$ro.optional()}).extend(Ov).extend(ow).extend(jP).extend(FS);var HGy=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:PVr.optional(),method:Yro,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(SCe),headers:Gr.list(Y7i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>$4),examples:Gr.list(Xro)}).extend(Ov).extend(jP).extend(FS);var h3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var y3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var v3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var b3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var g3u=Gr.objectWithoutOptionalProperties({example:Gr.number().optional()});var m3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var O3u=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional(),example:Gr.string().optional()});var A3u=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var P3u=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var w3u=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var j3u=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional(),example:Gr.boolean().optional()});var E3u=Gr.union("type",{int:h3u,int64:y3u,uint:v3u,uint64:b3u,float:g3u,double:m3u,string:O3u,datetime:A3u,date:P3u,base64:w3u,boolean:j3u}).transform({transform:e=>{switch(e.type){case"int":return k0.int(e);case"int64":return k0.int64(e);case"uint":return k0.uint(e);case"uint64":return k0.uint64(e);case"float":return k0.float(e);case"double":return k0.double(e);case"string":return k0.string(e);case"datetime":return k0.datetime(e);case"date":return k0.date(e);case"base64":return k0.base64(e);case"boolean":return k0.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var nno=Gr.objectWithoutOptionalProperties({schema:E3u}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var S3u=Gr.objectWithoutOptionalProperties({default:G7i.optional(),values:Gr.list(G7i),example:Gr.string().optional()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var D3u=Gr.objectWithoutOptionalProperties({example:Gr.unknown()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var $4=Gr.union("type",{primitive:nno,object:Gr.lazyObject(()=>T3u),array:Gr.lazyObject(()=>C3u),map:Gr.lazyObject(()=>I3u),optional:Gr.lazyObject(()=>M3u),enum:S3u,reference:wVr,literal:Zro,oneOf:Gr.object({value:Gr.lazy(()=>q3u)}),nullable:Gr.lazyObject(()=>B3u),unknown:D3u}).transform({transform:e=>{switch(e.type){case"primitive":return jh.primitive(e);case"object":return jh.object(e);case"array":return jh.array(e);case"map":return jh.map(e);case"optional":return jh.optional(e);case"enum":return jh.enum(e);case"reference":return jh.reference(e);case"literal":return jh.literal(e);case"oneOf":return jh.oneOf(e.value);case"nullable":return jh.nullable(e);case"unknown":return jh.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var C3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>$4),example:Gr.list(Gr.unknown()).optional()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var I3u=Gr.objectWithoutOptionalProperties({key:nno,value:Gr.lazy(()=>$4),example:Gr.unknown().optional()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(zM).extend(K4);var M3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>$4)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var B3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>$4)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var T3u=Gr.objectWithoutOptionalProperties({allOf:Gr.list(wVr),properties:Gr.list(Gr.lazyObject(()=>R3u)),allOfPropertyConflicts:Gr.list(kro),fullExamples:Gr.list(Pht).optional(),additionalProperties:Gr.boolean()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var R3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>$4),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),audiences:Gr.list(Gr.string()),conflict:Gr.record(ECe,eno),nameOverride:Gr.string().optional(),generatedName:Gr.string()}).extend(ow);var q3u=Gr.union("type",{discriminated:Gr.lazyObject(()=>N3u),undiscriminated:Gr.lazyObject(()=>F3u)}).transform({transform:e=>{switch(e.type){case"discriminated":return _nt.discriminated(e);case"undiscriminated":return _nt.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var N3u=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>x3u)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>$4))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var x3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>$4)});var F3u=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>$4))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var JGy=/^(\d+)/,ino=/^[a-zA-Z][a-zA-Z0-9_]*$/,KGy={"<":"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 Qla(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let o=Math.floor(e/10),c=e%10;return c===0?n[o]:`${n[o]}_${t[c]}`}if(e<1e3){let o=Math.floor(e/100),c=e%100;return c===0?`${t[o]}_hundred`:`${t[o]}_hundred_${Qla(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${Qla(a)}`}function nko(e){let t=e.match(JGy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=Qla(i);return n.length>0?`${a}_${n}`:a}}}function ano(e){let t=nko(e),r=KGy[e];return t!=null?aU($A(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":aU($A(e)))}function Ixe(e,t){return e.type==="primitive"&&t.type==="primitive"?$Gy(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?$sI(e.values,t.values):e.type==="array"&&t.type==="array"?Ixe(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"?Ixe(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?YsI(e.value,t.value):e.type==="object"&&t.type==="object"?XsI(e,t):e.type==="map"&&t.type==="map"?$Gy(e.key.schema,t.key.schema)&&Ixe(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function $Gy(e,t){return e.type===t.type}function $sI(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return sse(r,n)}function YsI(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:Ixe(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:Ixe(r,i)}):!1}function XsI(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let a=r[n];return a==null?!1:Ixe(a,i.schema)})}function QJ(e){switch(e){case ude.Deprecated:return"deprecated";case ude.Beta:return"pre-release";case ude.GenerallyAvailable:return"generally-available";default:return}}function ZsI(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function YGy(e){let t=e?ZsI(e):void 0;if(t==null||t.length===0)return ria;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push($A(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push($A(i.name)):r.push(i.name,ria);break}default:Zu(i.type)}else Zu(i);return r.join("/")}function X7i(e){return Cw.of(`${YGy(e)}.yml`)}function mNf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?ria:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,YGy(r))}function XGy({sdkName:e,namespaceOverride:t}){return Cw.of(`${mNf({sdkName:e,namespaceOverride:t})}.yml`)}function ZGy({location:e,namespaceOverride:t}){return t!=null?QX(Cw.of(t),e):e}function z3u(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Zu(e.type)}}function ono(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:Zu(e)}}function Y4(e){return typeof e=="string"?e:e.type}function sno(e){if(typeof e!="string")return e.docs}function iko(e){if(typeof e!="string")return e.default}function ONf(e){if(typeof e!="string")return e.validation}function eHy(e){let t=Y4(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?kGy(e):{...e,type:kGy(e.type)}}function kGy(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function Lla(e){return Y4(e).startsWith("optional<")?e:typeof e=="string"?tHy(e):{...e,type:tHy(e.type)}}function tHy(e){return e.startsWith("optional<")?e:`optional<${e}>`}var ksI=-2147483648,euI=2147483647,tuI=-17976931348623157e292,ruI=17976931348623157e292;function mC({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:a}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return Q3u(e);case"array":return wNf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return jNf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return PNf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return SNf();case"optional":return L3u({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return ENf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return fuI({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,DNf(e);case"object":return duI({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return puI({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:Zu(e)}}function Q3u(e){switch(e.schema.type){case"string":return auI({description:e.description,schema:e.schema});case"int":return ouI({description:e.description,schema:e.schema});case"float":return suI({description:e.description,schema:e.schema});case"double":return uuI({description:e.description,schema:e.schema});case"boolean":return nuI({description:e.description,schema:e.schema});case"int64":return iuI({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:QJ(e.availability)}:{}}}function nuI({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function iuI({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function auI({description:e,schema:t}){let r="string",n=cuI(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function ouI({description:e,schema:t}){let r="integer",n=rHy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function suI({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function uuI({description:e,schema:t}){let r="double",n=rHy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function cuI(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=luI(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function luI(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 rHy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=ANf(r,t),n=ANf(n,t),i=ANf(i,t),!(r==null&&n==null&&a==null&&o==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:o,multipleOf:i}}function ANf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[ksI,euI]:[tuI,ruI];return e<r||e>n?void 0:e}function PNf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=_uI(i)??e.schema,o=ono(i),c=huI(i),u=U3u({context:r,fileContainingReference:t,declarationFile:X7i(o),type:a});return i.type==="nullable"&&(u=r.wrapReferencesToNullableInOptional?`optional<${u}>`:`nullable<${u}>`),i.type==="optional"&&!u.startsWith("optional<")&&(u=`optional<${u}>`),e.description==null&&c==null?u:{type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function wNf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${Y4(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{},type:c}}function jNf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=Q3u(e.key),c=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),f=e.encoding!=null?z3u(e.encoding):void 0,u=`map<${Y4(o)}, ${Y4(c)}>`;if(e.description==null&&f==null&&e.title==null)return u;let s={type:u};return e.description!=null&&(s.docs=e.description),e.encoding!=null&&(s.encoding=f),e.availability!=null&&(s.availability=QJ(e.availability)),s}function ENf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return L3u({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let o=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=Y4(o),f=sno(o),u=iko(o),s=ONf(o),l=eHy(c);if(n.wrapReferencesToNullableInOptional&&(l=Lla(l)),e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=QJ(e.availability)),m}function L3u({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=Y4(o),f=sno(o),u=iko(o),s=ONf(o),l=Lla(c);if(e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=QJ(e.availability)),m}function SNf(){return"unknown"}function DNf(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Zu(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function fuI({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=ako(e,i),o=e.nameOverride??e.generatedName;n.builder.addType(r,{name:o,schema:a.schema});let c=U3u({type:o,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let f={type:c};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.availability!=null&&(f.availability=QJ(e.availability)),f}function duI({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=CNf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=U3u({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function puI({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=INf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=U3u({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function U3u({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function _uI(e){return _1._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 huI(e){return _1._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:()=>{}})}var Rse;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(Rse||(Rse={}));function SPi(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Zu(e)}}function iHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=buI(e);break;case"array":a=yuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=vuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=guI({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=OuI(e.nameOverride,e.generatedName);break;case"optional":a=oHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=muI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=ako(e,i);break;case"literal":a=AuI(e,e.nameOverride,e.generatedName);break;case"object":a=CNf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=INf({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:Zu(e)}return a}function CNf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(Rse.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},f=new Set;for(let O of e.properties){if(O.readonly&&(o=!0),a&&O.readonly)continue;if(Object.keys(O.conflict).length>0){if(Object.entries(O.conflict).every(([q,V])=>!V.differentSchema))continue;Object.entries(O.conflict).forEach(([q])=>{MNf({property:O.key,schemaId:q,context:t,namespace:n}).forEach($=>{f.add($)})})}let P=mC({schema:O.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=O.audiences,M=O.nameOverride,T=QJ(O.availability),z=EuI(O);c[O.key]=juI({typeReference:P,audiences:C,name:M,availability:T,propertyAccess:z})}let u=new Set;for(let O of e.allOfPropertyConflicts)O.allOfSchemaIds.forEach(P=>f.add(P)),O.conflictingTypeSignatures&&u.add(O.propertyKey);let s=[];for(let O of e.allOf){let P=sHy({schema:O.schema,context:t,namespace:n});if(P==null||f.has(O.schema)||f.has(P))continue;let C=mC({schema:_1.reference(O),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(Y4(C))}for(let O of f){let P=BNf(t,O,n);for(let C of P.properties)c[C.key]==null&&(u.has(C.key)&&(c[C.key]="unknown"),c[C.key]=mC({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of P.allOf){if(f.has(C.schema))continue;let M=mC({schema:_1.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(Y4(M))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([O,P])=>wuI(O)?[O,typeof P=="string"?{type:P,name:`_${O}`}:{...P,name:`_${O}`}]:[O,P]))};s.length>0&&(l.extends=s),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=QJ(e.availability)),e.source!=null&&(l.source=SPi(e.source)),l.inline=TNf(e,i);let m=e.nameOverride??e.generatedName;return{name:o&&t.respectReadonlySchemas&&!a?`${m}Read`:m,schema:l}}function MNf({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return MNf({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:o}=BNf(r,t,n),c=a.some(u=>u.key===e),f=[...o.flatMap(u=>MNf({property:e,context:r,schemaId:u.schema,namespace:n}))];if(c||f.length>0)return[t,...f]}return[]}function aHy(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?BNf(e,t.schema,r):t.type==="nullable"?aHy(e,t.value,r):{properties:[],allOf:[]}}function BNf(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:aHy(e,n,r)}function yuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:wNf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function vuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:jNf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function buI(e){let t=Q3u(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function nHy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function ako(e,t){let r={enum:e.values.map(a=>{let o=a.nameOverride??a.generatedName,c=a.value;if(o===c&&a.description==null&&(a.casing==null||nHy(a.casing)))return o;let f={value:a.value};if(o!==c&&(f.name=o),a.description!=null&&(f.docs=a.description),a.casing!=null&&!nHy(a.casing)){let u={},s=!1;a.casing.camel!=null&&(u.camel=a.casing.camel,s=!0),a.casing.screamingSnake!=null&&(u["screaming-snake"]=a.casing.screamingSnake,s=!0),a.casing.snake!=null&&(u.snake=a.casing.snake,s=!0),a.casing.pascal!=null&&(u.pascal=a.casing.pascal,s=!0),s&&(f.casing=u)}return f})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=TNf(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?SPi(e.source):void 0};for(let a of r.enum){let o=typeof a=="string"?a:a.name??a.value;n.has(o.toLowerCase())||(i.enum.push(a),n.add(o.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function guI({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:PNf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function muI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:ENf({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:oHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function oHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:L3u({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function OuI(e,t){return{name:e??t,schema:SNf()}}function AuI(e,t,r){return{name:t??r,schema:DNf(e)}}function INf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?z3u(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let u of e.commonProperties)c[u.key]=mC({schema:u.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let f={};for(let[u,s]of Object.entries(e.schemas))f[u]=mC({schema:s,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?QJ(e.availability):void 0,union:f,encoding:a,source:e.source!=null?SPi(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(mC({schema:c,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:o,encoding:a,source:e.source!=null?SPi(e.source):void 0,inline:TNf(e,i)}}}var PuI=/^[0-9]/;function wuI(e){return PuI.test(e)}function sHy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?sHy({context:t,schema:n.schema,namespace:r}):e}function juI({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{}}}function TNf(e,t){return e.inline===!0||t>0?!0:void 0}function EuI(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return VX.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return VX.ObjectPropertyAccess.WriteOnly}}function uHy(e){let t=e.replace(/^x-|^X-/,"");return $A(t)}function cHy(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??uHy(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(Cw.of("__package__.yml"),{name:"OauthScope",schema:ako(n.scopesEnum,0).schema})}}function jVr({header:e,context:t,fileContainingReference:r,namespace:n}){let i=mC({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=Y4(i),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:$A(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let f={type:a};return c!==e.name&&(f.name=c),e.description!=null&&(f.docs=e.description),e.env!=null&&(f.env=e.env),e.availability!=null&&(f.availability=QJ(e.availability)),f}function V3u({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=mC({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return Y4(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:Y4(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=QJ(e.availability)),a}function G3u({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=qNf({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=Y4(i.value),o=iko(i.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return o!=null&&(c.default=o),i.allowMultiple&&(c["allow-multiple"]=!0),e.description!=null&&(c.docs=e.description),e.parameterNameOverride!=null&&(c.name=e.parameterNameOverride),e.availability!=null&&(c.availability=QJ(e.availability)),SuI(i.value)&&i.value.validation!==void 0&&(c.validation=i.value.validation),c.default==null&&c["allow-multiple"]==null&&c.docs==null&&c.name==null&&c.availability==null&&c.validation==null?a:c}function qNf({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:Cw.of(jF),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(i.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(ino.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:ano(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[c,f]=i.value.schemas;if(c!=null&&f!=null&&W3u({array:c,primitive:f}))return{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&W3u({array:c,primitive:f}))return{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[c,f]of Object.entries(i.value.schemas))return qNf({schema:f,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?_1.optional:_1.nullable;if(e.value.type==="reference"){let a=t.getSchema(e.value.schema,n);if(a==null)return;if(a.type==="array")return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a.value,description:e.description??a.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(e.value.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(ino.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:ano(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[c,f]=e.value.value.schemas;if(c!=null&&f!=null&&W3u({array:c,primitive:f}))return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&W3u({array:f,primitive:c}))return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.objectQueryParameters)return{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[c,f]of Object.entries(e.value.value.schemas))return qNf({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.objectQueryParameters?{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:mC({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:mC({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function W3u({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function SuI(e){return typeof e=="object"&&e!==null&&"type"in e}function lHy({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"]=DuI(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=CuI({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=Z7i(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function DuI(e){let t={};return e.forEach(r=>{let n=Z7i(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function CuI({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=Z7i(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function Z7i(e){switch(e.type){case"primitive":return fHy(e.value);case"object":return dHy(e.properties);case"array":return IuI(e.value);case"map":return MuI(e.value);case"oneOf":return BuI(e.value);case"enum":return e.value;case"literal":return TuI(e.value);case"unknown":return Z7i(e.value);case"null":return null;default:Zu(e)}}function fHy(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:Zu(e)}}function dHy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Z7i(r)]))}function IuI(e){return e.map(t=>Z7i(t))}function MuI(e){return Object.fromEntries(e.map(t=>[fHy(t.key),Z7i(t.value)]))}function BuI(e){return e.type==="discriminated"?dHy(e.value):Z7i(e.value)}function TuI(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Zu(e)}}function oko(e){try{let r=new URL(e).pathname.split("/").filter(n=>n.length>0);if(r.length>0)return r[r.length-1]}catch{}}function H3u(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function J3u(e,t,r=!1){let n=oko(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}function DPi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function K3u(e,t){return t??(e?.groupName!=null?DPi(e.groupName):void 0)}function pHy({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=n!=null?t.groupEnvironmentsByHost?t.getUrlId(n.url)??J3u(n.name,n.url,!0):n.name:void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${n?.name}", server url="${n?.url}", resolved urlId="${i}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let a={path:e.path,url:i,auth:!1};e.audiences!=null&&e.audiences.length>0&&(a.audiences=e.audiences),e.summary!=null&&(a["display-name"]=e.summary),e.description!=null&&(a.docs=e.description);let o=DPi(e.groupName),c={};if(e.handshake.pathParameters.length>0)for(let s of e.handshake.pathParameters)c[s.name]=V3u({pathParameter:s,context:t,fileContainingReference:r,namespace:o});Object.keys(c).length>0&&(a["path-parameters"]=c);let f={};if(e.handshake.queryParameters.length>0)for(let s of e.handshake.queryParameters){let l=G3u({queryParameter:s,context:t,fileContainingReference:r,namespace:o});l!=null&&(f[s.name]=l)}Object.keys(f).length>0&&(a["query-parameters"]=f);let u={};if(e.handshake.headers.length>0)for(let s of e.handshake.headers){let l=jVr({header:s,context:t,fileContainingReference:r,namespace:o});u[s.name]=l}Object.keys(u).length>0&&(a.headers=u),t.builder.addChannel(r,{channel:a});for(let s of e.messages)t.builder.addChannelMessage(r,{messageId:s.name,message:{origin:s.origin,body:mC({schema:s.body,context:t,fileContainingReference:r,namespace:o,declarationDepth:0})}});for(let s of e.examples){let l=lHy({context:t,websocketExample:s});t.builder.addChannelExample(r,{example:l})}}function RNf(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var wht="Base",yHy="Default";function _Hy(e){try{return new URL(e).hostname}catch{return}}function hHy(e){return e??yHy}function quI(e,t){let r=new Map;for(let n of e){if(RNf(n)||!("url"in n)||!n.url)continue;let i=_Hy(n.url)??n.url;r.has(i)||r.set(i,{environmentName:hHy(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.httpServers.push({name:n.name,url:n.url,audiences:n.audiences})}for(let n of t){let i=_Hy(n.url)??n.url;r.has(i)||r.set(i,{environmentName:hHy(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function Ula(e){return Object.entries(e).reduce((t,[r,n])=>(Drt(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function vHy(e){if(e.environmentOverrides!=null){for(let[T,z]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:T,schema:z});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],n=e.ir.servers.some(T=>RNf(T)),i=e.ir.servers;for(let T of i)if(RNf(T)){let z={urls:{}};for(let[U,q]of Object.entries(T.urls))z.urls[U]=q.url;T.name&&(t[T.name]=z)}else if("url"in T&&T.url){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){r.push(z);continue}t[T.name]=z}let a={},o={},c=[];for(let T of e.ir.endpoints)for(let z of T.servers){if(z.url==null&&z.name!=null){a[z.name]||(a[z.name]=[]);continue}if(z.url==null)continue;let U=z.audiences?{url:z.url,audiences:z.audiences}:z.url;if(z.name==null){c.push(U);continue}a[z.name]||(a[z.name]=[]),a[z.name]?.push({url:z.url,audiences:z.audiences}),o[z.name]=U}let f={},u=[];for(let T of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${T.name}", url="${T.url}"`);let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){u.push(z);continue}f[T.name]=z}let s=Object.keys(t).length,l=s>0,m=Object.keys(o).length>0,O=Object.keys(a).some(T=>a[T]?.length===0),P=Object.keys(f).length>0;if(e.groupEnvironmentsByHost&&P&&(l||e.ir.servers.length>0)){let T=Object.entries(f).map(([U,q])=>({name:U,url:typeof q=="string"?q:q.url,audiences:typeof q=="string"?void 0:q.audiences})),z=quI(i,T);if(z.size>0){let U=!0;for(let[q,V]of z.entries()){let $={},re=[...V.httpServers.map(k=>({...k,isHttp:!0})),...V.websocketServers.map(k=>({...k,isHttp:!1}))],Y=new Map;for(let k of re){let ne=oko(k.url),Oe=H3u(k.url);ne&&Oe&&(Y.has(ne)||Y.set(ne,new Set),Y.get(ne)?.add(Oe))}if(V.httpServers.length>0){let k=V.httpServers[0];k!=null&&($[wht]=k.url,e.setUrlId(k.url,wht));for(let ne=1;ne<V.httpServers.length;ne++){let Oe=V.httpServers[ne];if(Oe!=null){let ye=oko(Oe.url),ge=H3u(Oe.url),pe=ye?Y.get(ye):void 0,Ce=pe&&pe.size>1,Se=Ce&&ge!=="https"?`${ye}_${ge}`:ye||`Http${ne+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${Oe.url}", pathSegment="${ye}", protocol="${ge}", hasCollision=${Ce}, urlId="${Se}"`),$[Se]=Oe.url,e.setUrlId(Oe.url,Se)}}}for(let k of V.websocketServers){let ne=oko(k.url),Oe=H3u(k.url),ye=ne?Y.get(ne):void 0,ge=ye&&ye.size>1,pe=ge?`${ne}_${Oe}`:J3u(k.name,k.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${k.name}", url="${k.url}", pathSegment="${ne}", protocol="${Oe}", hasCollision=${ge}, urlId="${pe}"`),$[pe]=k.url,e.setUrlId(k.url,pe)}if(Object.keys($).length>1)e.builder.addEnvironment({name:V.environmentName,schema:{urls:$}});else if(Object.keys($).length===1){let k=Object.values($)[0];k!=null&&e.builder.addEnvironment({name:V.environmentName,schema:k})}U&&(e.builder.setDefaultEnvironment(V.environmentName),Object.keys($).length>1&&e.builder.setDefaultUrl(wht),U=!1)}return}}if(!l&&!m&&P&&e.ir.servers.length===0){for(let[T,z]of Object.entries(f))e.builder.addEnvironment({name:T,schema:z});e.builder.setDefaultEnvironment(Object.keys(f)[0]),e.builder.setDefaultUrl(wht);return}if(c.length>0&&e.logger.debug(`Skipping endpoint level servers ${c.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),!l){let T=e.ir.servers[0]?.url,z=e.ir.servers[0]?.audiences;if(T!=null){let U=z?{url:T,audiences:z}:T;t[yHy]=U}}let C=Object.values(t).map(T=>typeof T=="string"?T:Drt(T)?Object.values(T.urls)[0]:T.url),M=r.filter(T=>{let z=typeof T=="string"?T:T.url;return!C.includes(z)});if(M.length>0&&e.logger.debug(`Skipping top level servers ${M.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),n){let T=!0;for(let[z,U]of Object.entries(t))if(e.builder.addEnvironment({name:z,schema:U}),T){if(e.builder.setDefaultEnvironment(z),Drt(U)){let q=Object.keys(U.urls)[0];q&&e.builder.setDefaultUrl(q)}T=!1}return}if(!m&&!O){let T=!0;for(let[z,U]of Object.entries(t))if(T){if(P){let q=typeof U=="string"?U:Drt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[wht]:q??"",...Ula(f)}}})}else e.builder.addEnvironment({name:z,schema:U});e.builder.setDefaultEnvironment(z),T=!1}else if(P){let q=typeof U=="string"?U:Drt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[wht]:q??"",...Ula(f)}}})}else e.builder.addEnvironment({name:z,schema:U});P&&e.builder.setDefaultUrl(wht)}else if(s===1){let T=Object.keys(t)[0],z=Object.values(t)[0],U=typeof z=="string"?z:Drt(z)?Object.values(z.urls)[0]:z.url;e.builder.addEnvironment({name:T,schema:{urls:{[wht]:U??"",...Ula(o),...Ula(f)}}}),e.builder.setDefaultEnvironment(T),e.builder.setDefaultUrl(wht)}else{let T=new Map;for(let z of e.ir.endpoints)for(let U of z.servers)if(U.url!=null&&U.name!=null){T.has(U.name)||T.set(U.name,new Map);let q=U.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",V=T.get(U.name);V&&V.set(q,U.url)}if(T.size>0){let z=!0;for(let[U,q]of Object.entries(t)){let V=typeof q=="string"?q:Drt(q)?Object.values(q.urls)[0]:q.url;if(!V)continue;let $=V.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",re={[wht]:V};for(let[Y,k]of T.entries()){let ne=k.get($)||k.get("production")||k.values().next().value;ne&&(re[Y]=ne)}P&&Object.assign(re,Ula(f)),Object.keys(re).length>1?e.builder.addEnvironment({name:U,schema:{urls:re}}):e.builder.addEnvironment({name:U,schema:V}),z&&(e.builder.setDefaultEnvironment(U),z=!1)}T.size>0&&e.builder.setDefaultUrl(wht)}else{let z=!0;for(let[U,q]of Object.entries(t)){if(P||Object.keys(o).length>0){let V=typeof q=="string"?q:Drt(q)?Object.values(q.urls)[0]:q.url;e.builder.addEnvironment({name:U,schema:{urls:{[wht]:V??"",...Ula(o),...Ula(f)}}})}else e.builder.addEnvironment({name:U,schema:q});z&&(e.builder.setDefaultEnvironment(U),z=!1)}}}}var NNf=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},RuI=.75,NuI=new Set("authorization");function bHy(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let i="optional<string>";if(n.name==null&&n.env==null&&typeof n.schema=="string")i=n.schema;else if(n!=null){let a=n.schema?ono(n.schema):void 0,o=a!=null?DPi(a):void 0,c=Cw.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?Y4(mC({schema:n.schema,context:e,fileContainingReference:o?QX(Cw.of($A(o)),c):c,namespace:o,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:i})}if(e.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let a of i.headers){if(NuI.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],f=jVr({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:Cw.of(Gk),context:e,namespace:void 0});o=new NNf(f),r[a.name]=o}o.increment()}let n=e.ir.endpoints.length*RuI;for(let[i,a]of Object.entries(r)){let o=t[i],c=a.count===e.ir.endpoints.length,f=a.count>=n;o==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):f&&e.builder.addGlobalHeader({name:i,schema:Lla(a.schema)}))}}}function gHy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?ono(t.schema):void 0,n=r!=null?DPi(r):void 0,i=jVr({header:{...t,schema:t.schema??_1.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:zq.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:Cw.of(Gk),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:Lla(i)})}}function jPe(e){switch(e.type){case"primitive":return OHy(e.value);case"object":return AHy(e.properties);case"array":return PHy(e.value);case"map":return xuI(e.value);case"oneOf":return zuI(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return QuI(e.value);case"unknown":return jPe(e.value);case"null":return null;default:Zu(e)}}function mHy(e){switch(e.type){case"withStreaming":return e.sse?{stream:FuI(e.events)}:{stream:PHy(e.events)};case"withoutStreaming":return{body:jPe(e.value)};default:Zu(e)}}function OHy(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:Zu(e)}}function AHy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,jPe(r)]))}function FuI(e){return e.map(t=>({event:"",data:jPe(t)}))}function PHy(e){return e.map(t=>jPe(t))}function xuI(e){return Object.fromEntries(e.map(t=>[OHy(t.key),jPe(t.value)]))}function zuI(e){return e.type==="discriminated"?AHy(e.value):jPe(e.value)}function QuI(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Zu(e)}}function wHy({endpointExample:e,context:t}){let r={};if(e.type!=="full")return e.value;e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=LuI(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=UuI(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),a=Object.keys(i).length>0,o=new Set(e.headers?.map(c=>c.name)??[]);if(n||a){let c=[];if(e.headers!=null)for(let f of e.headers)f.name!==t.builder.getAuthHeaderName()&&c.push(f);for(let[f,u]of Object.entries(i))if(!o.has(f))if(u!=null&&typeof u=="object"&&u.type!=null){let s=uee({type:u.type,_default:void 0,validation:void 0,visitor:{primitive:l=>l.toString(),map:l=>l.toString(),list:l=>l,optional:l=>l,nullable:l=>l,set:l=>l,named:l=>l,literal:l=>{if(l.type==="string")return l.string;if(l.type==="boolean")return l.boolean.toString()},unknown:Tc}});s!=null&&c.push({name:f,value:NS.literal(L7i.string(s))})}else c.push({name:f,value:NS.primitive(zO.string(f))});r.headers=VuI({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=jPe(e.request)),e.response!=null&&(r.response=mHy(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(c=>c.type==="language"?{name:c.name??void 0,docs:c.description??void 0,language:c.language,code:c.code,install:c.install??void 0}:{name:c.name??void 0,docs:c.description??void 0,sdk:c.sdk,code:c.code}).filter(_j)),r}function LuI(e){let t={};return e.forEach(r=>{let n=jPe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function UuI(e){let t={};return e.forEach(r=>{let n=jPe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function VuI({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=jPe(n.value);i!=null&&(r[n.name]=i)}),r}function jHy(e){return lde._visit(e,{get:()=>VX.HttpMethodSchema.Get,post:()=>VX.HttpMethodSchema.Post,put:()=>VX.HttpMethodSchema.Put,patch:()=>VX.HttpMethodSchema.Patch,delete:()=>VX.HttpMethodSchema.Delete,head:()=>VX.HttpMethodSchema.Head,options:()=>{throw new Error("OPTIONS is unsupported")},trace:()=>{throw new Error("TRACE is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function EHy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function SHy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,o=e.path,c=K3u(e.sdkName,e.namespace),f={};for(let M of e.pathParameters)M.parameterNameOverride&&(o=o.replace(M.name,M.parameterNameOverride)),f[M.parameterNameOverride??M.name]=V3u({pathParameter:M,context:r,fileContainingReference:t,namespace:c}),a.add(M.name);let u={};for(let M of e.queryParameters){let T=G3u({queryParameter:M,context:r,fileContainingReference:t,namespace:c});T!=null&&(u[M.name]=T,a.add(M.name))}let s;if(e.pagination!=null)switch(e.pagination.type){case"cursor":s={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":s={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":s={type:"custom",results:e.pagination.results};break;default:Zu(e.pagination)}let l={path:o,method:jHy(e.method),auth:Object.keys(e.security).length>0?e.security:void 0,docs:e.description??void 0,pagination:s,source:e.source!=null?SPi(e.source):void 0};!JuI({context:r,request:e.request})&&Object.keys(f).length>0&&(l["path-parameters"]=f),e.summary!=null&&(l["display-name"]=e.summary);let m={},O=r.builder.getGlobalHeaderNames(),P=r.builder.getAuthHeaderName();P!=null&&O.add(P);let C=e.headers.filter(M=>!O.has(M.name));for(let M of C){let T=jVr({header:M,context:r,fileContainingReference:t,namespace:c});m[M.name]=T,a.add(typeof T=="string"?M.name:T.name??M.name)}if(e.request!=null){r.setInState(Rse.Request);let M=HuI({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(u).length>0?u:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(m).length>0?m:void 0,usedNames:a,namespace:c});l.request=M.value,i=[...i,...M.schemaIdsToExclude??[]],r.unsetInState(Rse.Request)}else{let M=r.inlinePathParameters&&Object.keys(f).length>0,T=Object.keys(u).length>0,z=Object.keys(m).length>0,U={};(M||T||z)&&(U.name=e.requestNameOverride??e.generatedRequestName),M&&(U["path-parameters"]=f),T&&(U["query-parameters"]=u),z&&(U.headers=m),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:M=>{let T=mC({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:M.description??void 0,type:Y4(T)},M.statusCode!=null&&(l.response["status-code"]=M.statusCode),M.responseProperty!=null&&(l.response.property=M.responseProperty)},streamingJson:M=>{let T=mC({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:Y4(T),format:"json"}},streamingSse:M=>{let T=mC({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:Y4(T),format:"sse"}},file:M=>{l.response={docs:M.description??void 0,type:"file","status-code":M.statusCode}},bytes:M=>{l.response={docs:M.description??void 0,type:"bytes","status-code":M.statusCode}},streamingText:M=>{l["response-stream"]={docs:M.description??void 0,type:"text"}},text:M=>{l.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(),T=e.servers[0];T==null?M!=null&&(l.url=M):l.url=T.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=QJ(e.availability)),Object.entries(e.errors).forEach(([M,T])=>{let z=T.generatedName,U=Cw.of(jF);r.builder.enableUniqueErrorsPerEndpoint&&(z=`${e.generatedRequestName}${T.generatedName}`,T.schema!=null&&(T.schema.type!=="reference"&&T.schema.type!=="oneOf"?T.schema.generatedName=`${e.generatedRequestName}${T.schema.generatedName}`:T.schema.type==="oneOf"&&(T.schema.value.generatedName=`${e.generatedRequestName}${T.schema.value.generatedName}`)));let q={"status-code":parseInt(M)},V=ZGy({location:DHy,namespaceOverride:c});if(T.schema!=null){let Y=mC({schema:T.schema,context:r,fileContainingReference:V,declarationFile:V,namespace:c,declarationDepth:0});q.type=Y4(Y),q.docs=T.description}r.builder.addError(V,{name:z,schema:r.isErrorUnknownSchema(parseInt(M))?{...q,type:"unknown"}:q}),l.errors==null&&(l.errors=[]);let $=r.builder.addImport({file:t,fileToImport:V});l.errors.push($!=null?`${$}.${z}`:z),q.type!=null&&T.examples?.forEach(Y=>{let k={value:jPe(Y.example),name:Y.name,docs:Y.description};r.builder.addErrorExample(V,{name:z,example:k})})}),e.examples.length>0&&(l.examples=WuI({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=GuI({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[FNf,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function WuI({endpointExamples:e,context:t}){return e.map(r=>{try{return wHy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function GuI({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:Zu(e)}}function HuI({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:f,headers:u,usedNames:s,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let m=n.schema.type==="reference"?n.schema.schema:void 0,O=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(O?.type!=="object"||m!=null&&f.includes(m)){let z=mC({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),U={schemaIdsToExclude:[],value:{body:z}},q=Object.keys(o??{}).length>0,V=Object.keys(c??{}).length>0,$=Object.keys(u??{}).length>0;return q&&(U.value["path-parameters"]=o),V&&(U.value["query-parameters"]=c),$&&(U.value.headers=u),(q||V||$)&&(U.value.name=i??a),n.contentType!=null&&(U.value["content-type"]=n.contentType),n.description!=null&&(U.value.docs=n.description),U}let P=Object.fromEntries(O.properties.filter(z=>z.readonly==null?!0:!(EHy(e.method)&&z.readonly)).map(z=>{let U=mC({schema:z.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),q=z.nameOverride??z.key,V=QJ(z.availability);if(!s.has(q)&&z.audiences.length<=0)return s.add(q),z.nameOverride!=null?[z.key,{type:Y4(U),docs:sno(U),name:z.nameOverride,availability:V}]:[z.key,V?{...typeof U=="string"?{type:U}:U,availability:V}:U];let $={type:Y4(U),docs:sno(U)};return s.has(q)&&($.name=z.generatedName),z.audiences.length>0&&($.audiences=z.audiences),V!=null&&($.availability=V),s.add(q),[z.key,$]})),C=O.allOf.map(z=>{let U=mC({schema:_1.reference(z),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return Y4(U)}).filter(z=>z!=="unknown"),M={properties:P};C.length>0&&(M.extends=C),n.additionalProperties&&(M["extra-properties"]=!0);let T={name:i??O.nameOverride??O.generatedName,"path-parameters":o,"query-parameters":c,headers:u,body:M};return n.contentType!=null&&(T["content-type"]=n.contentType),n.description!=null&&(T.docs=n.description),{schemaIdsToExclude:m!=null?[m]:[],value:T}}else if(n.type==="octetStream"){let m={body:"bytes","content-type":n.contentType??R2.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(m.name=i??a),n.description!=null&&(m.docs=n.description),{schemaIdsToExclude:[],value:m}}else if(n.type==="multipart"){let m=Object.fromEntries(n.properties.map(O=>{if(O.schema.type==="file"){let P=O.schema.isArray?"list<file>":"file";if(P=O.schema.isOptional?`optional<${P}>`:P,O.description!=null||O.contentType!=null){let C={type:P};if(O.description!=null&&(C.docs=O.description),O.contentType!=null){let M=O.contentType.split(",")[0];C["content-type"]=M}return[O.key,C]}return[O.key,P]}else{let P=mC({schema:O.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(O.contentType||O.exploded||O.encoding){let C=typeof P=="string"?{type:P}:P;O.contentType!=null&&(C["content-type"]=O.contentType),O.encoding==="form"?C.style="form":O.encoding==="json"?C.style="json":O.exploded&&(C.style="exploded"),P=C}return[O.key,P]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??a,"path-parameters":o,"query-parameters":c,headers:u,body:{properties:m},"content-type":R2.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else Zu(n)}function JuI({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;case"formUrlEncoded":return!0;default:Zu(t)}}function KuI({location:e,namespaceOverride:t}){return t!=null?{...e,file:QX(Cw.of(t),e.file)}:e}function $uI(e){let t=e.namespace,r=e.tags.filter(f=>f!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:Cw.of(`${$A(r)}.yml`),endpointId:e.summary!=null?$A(e.summary):$A(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:Cw.of(jF),endpointId:$A(e.summary)}:{file:Cw.of(jF),endpointId:$A(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:Cw.of(jF),endpointId:n};let i=sko(r),a=sko(n);if(sse(i,a))return{file:Cw.of("__package__.yml"),endpointId:r};let o=ZuI({operationId:n,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let f=0;f<i.length;++f){let u=i[f];if(u!=null&&u===a[f])c.push(u);else{let s=$A(r);return{file:Cw.of(`${s}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:Cw.of($A(c.join("_"))+".yml"),endpointId:$A(a.slice(c.length).join("_")),tag:r}}function uko(e){let t=e.tags[0];if(e.sdkName!=null){let r=mNf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:Cw.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return KuI({namespaceOverride:e.namespace,location:$uI(e)})}function sko(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=wdt(t),t}var YuI=new RegExp("[^a-zA-Z0-9{}]+"),XuI=new RegExp("[{}]","g");function ZuI({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(YuI).join("_").replaceAll(XuI,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:Cw.of($A(t)+".yml"),endpointId:$A(e.slice(0,-1*a.length)),tag:t}}function CHy(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:o,file:c,tag:f}=uko(a),u=c.split(".")[0];u!=null&&t.add(u);let s;if(a.sdkName!=null){let O=e.ir.groups;for(let P of a.sdkName.groupName){let C=typeof P=="string"?P:P.name,M=O[C];if(M==null)break;if(M.summary!=null||M.description!=null){s=O[C];break}}}let l=f==null?void 0:n.tagsById[f];e.setInState(Rse.Endpoint),e.setEndpointMethod(a.method);let m=SHy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(Rse.Endpoint),i=[...i,...m.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:m.value,source:a.source!=null?SPi(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":s?.summary??l?.id,docs:s?.description??l?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function IHy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?DPi(r.groupName):void 0,i=mC({schema:_1.primitive(r),context:e,fileContainingReference:Cw.of(jF),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:Y4(i),docs:r.description??void 0}})}}function MHy(e){for(let t of e.ir.webhooks){let r=tcI({webhook:t,context:e});if(r==null)continue;let n=K3u(t.sdkName,t.namespace),i={};for(let o of t.headers)i[o.name]=jVr({header:o,context:e,fileContainingReference:r.file,namespace:n});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:mC({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),examples:t.examples!=null?t.examples.map(o=>({docs:o.description,name:o.name,payload:jPe(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function kuI({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:QX(Cw.of(t),e.file)}:e}function ecI({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:Cw.of(jF),endpointId:n};let i=sko(r),a=sko(n);if(sse(i,a))return{file:Cw.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<i.length;++c){let f=i[c];if(f!=null&&f===a[c])o.push(f);else{let u=$A(r);return{file:Cw.of(`${u}.yml`),endpointId:n,tag:r}}}if(o.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:Cw.of($A(o.join("_"))+".yml"),endpointId:$A(a.slice(o.length).join("_")),tag:r}}function tcI({webhook:e,context:t}){return e.sdkName!=null?{file:XGy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:kuI({namespaceOverride:e.namespace,location:ecI({webhook:e,context:t})})}var rcI=Cw.of(jF);function THy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return BHy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return BHy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return rcI;default:Zu(e)}}function BHy({namespace:e,groupName:t}){return e!=null&&t!=null?X7i([{type:"namespace",name:e},...t]):e!=null?X7i([{type:"namespace",name:e}]):X7i(t)}var FNf="external",DHy=Cw.of(jF);function qHy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let o=THy(a),c=iHy({schema:a,context:n,declarationFile:o,namespace:r,declarationDepth:0});if(G3i(c.schema)){let f=Y4(c.schema);if(f===(c.name??i)||f===`optional<${c.name??i}>`||f===`nullable<${c.name??i}>`||f===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(o,{name:c.name??i,schema:c.schema})}}function RHy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),vHy(e),bHy(e),gHy(e),cHy(e),IHy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(FNf);let t=CHy(e),r=t.sdkGroups;e.setInState(Rse.Webhook),MHy(e),e.unsetInState(Rse.Webhook),e.setInState(Rse.Channel);for(let i of Object.values(e.ir.channels)){let a=X7i(i.groupName);pHy({channel:i,context:e,declarationFile:a})}e.unsetInState(Rse.Channel);let n=ncI({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});qHy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))qHy({schemas:a,schemaIdsToExclude:n,namespace:i,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 ncI({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),i=new Set(t);for(let a of n)r.includes(a)||i.add(a);return Array.from(i)}var cko=class{context;constructor(t){this.context=t}};var $3u=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[o,c]of Object.entries(n.files)){let f=i!=null?Cw.of(`${i}${"/"}${o}`):Cw.of(o);t[f]=c}let a=Object.keys(n.directories).sort();for(let o of a){let c=i!=null?`${i}${"/"}${o}`:o,f=n.directories[o];r(f,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Cw.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var Vla=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new $3u,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:a}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(o.service.auth=r),n!=null&&(o.service["base-path"]=n),i!=null&&(o.service["display-name"]=i),a!=null&&(o.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 MLr(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))NHy(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(NHy(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??$A((zdt(r)+"/"+Eia(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Cw.of(Gk))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=cau(zdt(LGa.of(`/${t}`)),LGa.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=cau(zdt(LGa.of(`/${t}`)),LGa.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===Cw.of(Gk))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let a=i.types[r];a!=null&&(typeof a=="string"?i.types[r]={type:a,examples:[n]}:(a.examples==null&&(a.examples=[]),a.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let a=i.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(c=>sse(c,n))??!1)||a.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(a.service.source=i),a.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=QX(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,a])=>[i,{...a,path:QX(r,a.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([a,o])=>[a,{...o,path:QX(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===jF?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 NHy(e){return e?.header!=null}var Y3u=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;groupEnvironmentsByHost;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:a,authOverrides:o}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=o,this.globalHeaderOverrides=a,this.detectGlobalHeaders=n?.detectGlobalHeaders??!0,this.objectQueryParameters=n?.objectQueryParameters??!1,this.respectReadonlySchemas=n?.respectReadonlySchemas??!1,this.respectNullableSchemas=n?.respectNullableSchemas??!1,this.onlyIncludeReferencedSchemas=n?.onlyIncludeReferencedSchemas??!1,this.inlinePathParameters=n?.inlinePathParameters??!1,this.useBytesForBinaryResponse=n?.useBytesForBinaryResponse??!1,this.respectForwardCompatibleEnums=n?.respectForwardCompatibleEnums??!1,this.referencedSchemaIds=n?.onlyIncludeReferencedSchemas?new Set:void 0,this.enableUniqueErrorsPerEndpoint=n?.enableUniqueErrorsPerEndpoint??!1,this.wrapReferencesToNullableInOptional=n?.wrapReferencesToNullableInOptional??!0,this.coerceOptionalSchemasToNullable=n?.coerceOptionalSchemasToNullable??!0,this.groupEnvironmentsByHost=n?.groupEnvironmentsByHost??!1,this.builder=new Vla(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let f of r.endpoints)for(let[u,s]of Object.entries(f.errors)){let l=parseInt(u),m=c[l];m==null&&s.schema!=null?c[l]=s.schema:m!=null&&s.schema!=null&&Ixe(m,s.schema)||this.unknownSchema.add(l)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.onlyIncludeReferencedSchemas&&this.isInAnyState(Rse.Channel,Rse.Endpoint,Rse.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:Zu(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:Zu(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function xNf(e){let t=new Y3u(e);return RHy(t)}var X3u=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=xNf({taskContext:t,ir:r,options:XZo({overrides:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.args.respectNullableSchemas,wrapReferencesToNullableInOptional:n?.wrapReferencesToNullableInOptional??this.args.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:n?.coerceOptionalSchemasToNullable??this.args.coerceOptionalSchemasToNullable,onlyIncludeReferencedSchemas:n?.onlyIncludeReferencedSchemas??this.args.onlyIncludeReferencedSchemas,inlinePathParameters:n?.inlinePathParameters??this.args.inlinePathParameters,objectQueryParameters:n?.objectQueryParameters??this.args.objectQueryParameters,useBytesForBinaryResponse:n?.useBytesForBinaryResponse??this.args.useBytesForBinaryResponse,respectForwardCompatibleEnums:n?.respectForwardCompatibleEnums??this.args.respectForwardCompatibleEnums,groupEnvironmentsByHost:n?.groupEnvironmentsByHost??this.args.groupEnvironmentsByHost,removeDiscriminantsFromSchemas:n?.removeDiscriminantsFromSchemas??this.args.removeDiscriminantsFromSchemas}}),authOverrides:n?.auth!=null?{auth:n.auth}: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:i??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Pg.dump(a.rootApiFile)},namedDefinitionFiles:{...Ig(a.definitionFiles,o=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Pg.dump(o),contents:o})),[Cw.of(jF)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Pg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var lko=class extends mqr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;groupEnvironmentsByHost;removeDiscriminantsFromSchemas;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.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.groupEnvironmentsByHost=t.groupEnvironmentsByHost,this.removeDiscriminantsFromSchemas=t.removeDiscriminantsFromSchemas,this.converter=new X3u(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:n},i){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:n},i);return this.converter.convert({context:t,ir:a,settings:i,absoluteFilePath:r})}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new fnt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var ebe={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 uno={of(e){return e}};var FHy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},zNf={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:FHy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},yb={SOURCE:uno.of("source"),SDK_NAMESPACE:uno.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:uno.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:uno.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:uno.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",RETRIES:"x-fern-retries",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",IS_DISCRIMINATED:"x-fern-discriminated",PLAYGROUND_ENABLED:"x-fern-playground-enabled"};var XL={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",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!0,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,groupEnvironmentsByHost:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0,removeDiscriminantsFromSchemas:lm.RemoveDiscriminantsFromSchemas.Always};function jht({options:e,overrides:t}){return{disableExamples:t?.disableExamples??XL.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??XL.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??XL.useTitlesAsName,audiences:t?.audiences??e?.audiences??XL.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??XL.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??XL.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??XL.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??XL.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??XL.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??XL.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??XL.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??XL.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??XL.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??XL.objectQueryParameters,filter:t?.filter??e?.filter??XL.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??XL.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??XL.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??XL.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??XL.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??XL.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??XL.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??XL.inlineAllOfSchemas,resolveAliases:t?.resolveAliases??e?.resolveAliases??XL.resolveAliases,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??XL.groupMultiApiEnvironments,groupEnvironmentsByHost:t?.groupEnvironmentsByHost??e?.groupEnvironmentsByHost??XL.groupEnvironmentsByHost,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??XL.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??XL.coerceOptionalSchemasToNullable,removeDiscriminantsFromSchemas:t?.removeDiscriminantsFromSchemas??e?.removeDiscriminantsFromSchemas??XL.removeDiscriminantsFromSchemas}}var xHy={naming:"v1"};function iv(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function fko(e,t,r,n,i=[]){try{let a=iv(e,t);if(a!=null)return r.parse(a)}catch{let o=wdt(i).join(" -> ");n.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function Wla(e){let t=iv(e,"examples");if(t!=null){if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null)return Object.values(t).map(r=>typeof r=="object"&&r!==null&&"value"in r?r.value:r)}return[]}function zHy({schema:e,logger:t}){return iv(e,yb.ENCODING)??void 0}function QHy(e){return iv(e,yb.FERN_ENUM)}function LHy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let o=iv(n,yb.SDK_NAMESPACE),c=iv(n,yb.SDK_GROUP_NAME),f=iv(n,yb.TYPE_DEFINITION);if(f!=null)return dko({fernType:f,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function dko({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c}){return uee({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.base64({example:void 0})});case"BOOLEAN":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.boolean({default:void 0,example:void 0})});case"DATE":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.date({example:void 0})});case"DATE_TIME":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.datetime({example:void 0})});case"FLOAT":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.float({example:void 0})});case"DOUBLE":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.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 jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.uint({default:void 0,example:void 0})});case"INTEGER":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.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 jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.uint64({default:void 0,example:void 0})});case"LONG":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Zu(f.v1)}},unknown:()=>jh.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:o,groupName:c}),map:({keyType:f,valueType:u})=>f?.type==="primitive"&&u!=null?jh.map({nameOverride:t,generatedName:r,title:n,key:f,value:u,description:i,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:f=>f!=null?jh.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:f=>f!=null?jh.optional({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:f=>f!=null?jh.nullable({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:f=>f!=null?jh.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:f=>jh.literal({nameOverride:t,generatedName:r,title:n,value:f._visit({string:u=>NV.string(u),boolean:u=>NV.boolean(u),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:o,groupName:c}),named:f=>jh.reference({schema:f,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,source:PPe.openapi({file:"<memory>"})})}})}function UHy(e){let t=iv(e,yb.SOURCE);if(t!=null)return t.endsWith(".proto")?PPe.protobuf({file:t}):PPe.openapi({file:t})}function Gla(e){if(e!=null&&typeof e=="boolean")return e}function u0(e){return e?.$ref!=null}function VHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:u,namespace:s,groupName:l,example:m,encoding:O,source:P}){return i===void 0&&(i=u.options.additionalPropertiesDefaultsTo),QNf({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:k0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof i=="boolean"||pko(i,u.options)?jh.unknown({...icI(i),generatedName:`${t}Value`}):WHy(xS(i,!1,u.options.optionalAdditionalProperties?f:!1,u,[...n,"Value"],P,s,void 0,void 0,void 0)),namespace:s,groupName:l,example:m,encoding:O})}function WHy(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=WHy(e.value);break;case"oneOf":e.value.inline=!0;break;default:Zu(e)}return e}function QNf({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:a,wrapAsNullable:o,description:c,availability:f,namespace:u,groupName:s,example:l,encoding:m}){let O=jh.map({nameOverride:e,generatedName:t,title:r,description:c,availability:f,key:n,value:i,namespace:u,groupName:s,encoding:m,example:l,inline:void 0});return o&&(O=jh.nullable({nameOverride:e,generatedName:t,title:r,value:O,description:c,availability:f,namespace:u,groupName:s,inline:void 0})),a&&(O=jh.optional({nameOverride:e,generatedName:t,title:r,value:O,description:c,availability:f,namespace:u,groupName:s,inline:void 0})),O}function pko(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!(u0(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null||"allOf"in e&&e.allOf!=null||"enum"in e&&e.enum!=null)}function icI(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||u0(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function GHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:u,namespace:s,groupName:l,example:m,source:O}){let P=i==null?jh.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:s,groupName:l}):xS(i,!1,!1,u,[...n,"Item"],O,s);return acI({nameOverride:e,generatedName:t,title:r,namespace:s,groupName:l,itemSchema:P,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,example:m})}function acI({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:u,example:s}){let l=jh.array({nameOverride:e,generatedName:t,title:r,value:n,description:o,availability:c,namespace:f,groupName:u,example:s,inline:void 0});return a&&(l=jh.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),i&&(l=jh.optional({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),l}function EPe(e){switch(iv(e,yb.AVAILABILITY)){case"deprecated":return ude.Deprecated;case"beta":return ude.Beta;case"generally-available":return ude.GenerallyAvailable;default:break}if(!u0(e)&&e.deprecated)return ude.Deprecated}function LNf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:u,discriminator:s,context:l,namespace:m,groupName:O,encoding:P,source:C}){let M=s.propertyName,T=Object.fromEntries(Object.entries(s.mapping??{}).map(([U,q])=>{let V=CPi({$ref:q},!1,!1,l,[q],P,C,m);return l.markReferencedByDiscriminatedUnion({$ref:q},M,1),[U,V]})),z=Object.entries(i).filter(([U])=>U!==M).map(([U,q])=>{let V=c!=null&&c.includes(U),[$,re]=l.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=xS(q,$,re,l,[...n,U],C,m);return{key:U,schema:Y}});return HHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:u,properties:z,description:a,availability:o,discriminant:M,subtypes:T,namespace:m,groupName:O,source:C})}function UNf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:u,discriminant:s,variants:l,context:m,namespace:O,groupName:P,encoding:C,source:M}){let T=Object.fromEntries(Object.entries(l).map(([U,q])=>{if(u0(q)){let V=CPi(q,!1,!1,m,[q.$ref],C,M,O);return m.markReferencedByDiscriminatedUnion(q,s,1),[U,V]}else{let V=cno(q,!1,!1,m,[...n,U],C,M,O,new Set([s]));return[U,V]}})),z=Object.entries(i).filter(([U])=>U!==s).map(([U,q])=>{let V=c!=null&&c.includes(U),[$,re]=m.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=xS(q,$,re,m,[...n,U],M,O);return{key:U,schema:Y}});return HHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:u,properties:z,description:a,availability:o,discriminant:s,subtypes:T,namespace:O,groupName:P,source:M})}function HHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,availability:c,discriminant:f,subtypes:u,namespace:s,groupName:l,source:m}){let O=jh.oneOf(_nt.discriminated({description:o,availability:c,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:u,commonProperties:a,namespace:s,groupName:l,encoding:void 0,source:m,inline:void 0}));return i&&(O=jh.nullable({nameOverride:e,generatedName:t,title:r,value:O,namespace:s,groupName:l,description:o,availability:c,inline:void 0})),n&&(O=jh.optional({nameOverride:e,generatedName:t,title:r,value:O,namespace:s,groupName:l,description:o,availability:c,inline:void 0})),O}function JHy(e){if(e.proto!=null)return Sro.protobuf({typeName:e.proto.type})}function k7i({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:o,description:c,availability:f,wrapAsOptional:u,wrapAsNullable:s,namespace:l,groupName:m,context:O,source:P,inline:C}){let M=scI(i??[]),T=new Set(a),z=Array.from(T).map((q,V)=>{let $=n?.[q],re=M[V],Y=ino.test(q),k=$?.name??re,ne=Y?q:ano(q);return k!=null&&!ino.test(k)&&(O?.logger.warn(`Enum name override ${k} is not a valid name. Falling back on ${ne}.`),k=void 0),{nameOverride:k,generatedName:ne,value:q,description:$?.description,availability:f,casing:{snake:$?.casing?.snake??void 0,pascal:$?.casing?.pascal??void 0,screamingSnake:$?.casing?.screamingSnake??void 0,camel:$?.casing?.camel??void 0}}}),U=o!=null?z.find(q=>q.value===o):void 0;return ocI({wrapAsOptional:u,wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:z,_default:U,description:c,availability:f,namespace:l,groupName:m,source:P,inline:C})}function ocI({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:a,_default:o,description:c,availability:f,namespace:u,groupName:s,source:l,inline:m}){let O=jh.enum({nameOverride:r,generatedName:n,title:i,values:a,description:c,availability:f,default:o,example:void 0,namespace:u,groupName:s,source:l,inline:m});return t&&(O=jh.nullable({nameOverride:r,generatedName:n,title:i,value:O,description:c,availability:f,namespace:u,groupName:s,inline:m})),e&&(O=jh.optional({nameOverride:r,generatedName:n,title:i,value:O,description:c,availability:f,namespace:u,groupName:s,inline:m})),O}function scI(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function KHy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsOptional:m,wrapAsNullable:O,example:P,namespace:C,groupName:M}){return n==="int64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint32"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M})}function ucI(e){return typeof e=="string"?NV.string(e):typeof e=="boolean"?NV.boolean(e):NV.string(`${e}`)}function $Hy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:a,description:o,availability:c,namespace:f,groupName:u}){let s=jh.literal({nameOverride:e,generatedName:t,title:r,value:ucI(a),description:o,availability:c,namespace:f,groupName:u});return i&&(s=jh.nullable({nameOverride:e,generatedName:t,title:r,value:s,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),n&&(s=jh.optional({nameOverride:e,generatedName:t,title:r,value:s,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),s}function VNf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsOptional:m,wrapAsNullable:O,example:P,namespace:C,groupName:M}){return n==null||n==="double"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.double({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="float"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.float({example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="int32"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="int64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint32"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="time-delta"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.float({example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.float({example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M})}var ccI={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},lcI={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}}},fcI={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}}},dcI={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},pcI={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},_cI={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},hcI={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ycI={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function _ko(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[ccI,lcI,fcI,dcI,pcI,_cI,hcI,ycI],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:o,newBreadcrumbs:c}=a.applyStrategy(t);t=o,r=[...r,...c]}}while(t.join("")!==i.join(""));return r}function nie(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:aU($A(i))).join("");return/^\d/.test(n)?nko(n)??n:n}function YHy(e){let t=e.join("_");return $A(t)}function J7(e){switch(e.type){case"object":return _1.object({allOf:e.allOf,properties:e.properties.map(t=>bcI(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:e.inline});case"array":return _1.array({description:e.description,availability:e.availability,value:J7(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return _1.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return _1.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"nullable":return _1.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:J7(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return _1.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:J7(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return _1.primitive({description:e.description,availability:e.availability,schema:XHy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return _1.map({description:e.description,availability:e.availability,key:_1.primitive({description:e.key.description,availability:e.key.availability,schema:XHy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:J7(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,inline:e.inline});case"reference":return _1.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return _1.oneOf(vcI(e.value));case"unknown":return _1.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Zu(e)}}function vcI(e){switch(e.type){case"discriminated":return mVr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:J7(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,J7(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return mVr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>J7(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:Zu(e)}}function XHy(e){switch(e.type){case"string":return zq.string(e);case"base64":return zq.base64();case"boolean":return zq.boolean(e);case"date":return zq.date();case"datetime":return zq.datetime();case"double":return zq.double(e);case"float":return zq.float();case"int":return zq.int(e);case"int64":return zq.int64(e);case"uint":return zq.uint();case"uint64":return zq.uint64();default:Zu(e)}}function bcI(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:J7(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function Z3u(e,t){return Ixe(J7(e),J7(t))}function ZHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:o,wrapAsOptional:c,wrapAsNullable:f,allOf:u,context:s,propertiesToExclude:l,namespace:m,groupName:O,fullExamples:P,additionalProperties:C,availability:M,source:T}){let z=[...o??[]],U={...kHy({properties:i,breadcrumbs:n,context:s})},q=[],V=[];for(let ne of u)if(!s.options.inlineAllOfSchemas&&u0(ne)){let Oe=s.resolveSchemaReference(ne);if(Oe.discriminator!=null&&Oe.discriminator.mapping!=null)continue;if(Oe.oneOf!=null||Oe.anyOf!=null){let ge=Oe.oneOf??Oe.anyOf;if(ge!=null){for(let pe of ge){let Ce=u0(pe)?s.resolveSchemaReference(pe):pe,je=xS(Ce,!1,!1,s.DUMMY,n,T,m);je.type==="object"&&q.push(...je.properties.map(Se=>Se.schema.type!=="optional"&&Se.schema.type!=="nullable"?{...Se,schema:jh.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Se.schema,description:void 0,availability:Se.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Se))}continue}}let ye=e8i(ne);if(ye==null)continue;V.push({schemaId:ye,convertedSchema:WNf(ne,[ye],T,s.options.preserveSchemaIds),properties:eJy({schema:ne,context:s,breadcrumbs:n,source:T,namespace:m})}),s.markSchemaAsReferencedByNonRequest(ye)}else if(u0(ne)){let Oe=s.resolveSchemaReference(ne),ye=xS(Oe,!1,!1,s,n,T,m);ye.type==="object"&&q.push(...ye.properties)}else{let Oe=ne.required??[];q=q.map(ge=>(ge.schema.type==="optional"||ge.schema.type==="nullable")&&Oe.includes(ge.key)?{...ge,schema:ge.schema.value}:ge);let ye=xS(ne,!1,!1,s,n,T,m);ye.type==="object"&&q.push(...ye.properties)}let $={};for(let ne of V)for(let[Oe,ye]of Object.entries(ne.properties)){let ge=$[Oe];ge!=null?(ge.schemaIds.push(ne.schemaId),ge.schemas.some(Ce=>Z3u(Ce,ye))||ge.schemas.push(ye)):$[Oe]={schemaIds:[ne.schemaId],schemas:[ye]}}let re=[];for(let[ne,Oe]of Object.entries($))Oe.schemaIds.length>1&&re.push({propertyKey:ne,allOfSchemaIds:Oe.schemaIds,conflictingTypeSignatures:Oe.schemas.length>1});let Y=Object.fromEntries(Object.entries(U).filter(([ne,Oe])=>!(!u0(Oe)&&Oe.type==="null"))),k=Object.entries(Y).map(([ne,Oe])=>{let ye=iv(Oe,yb.AUDIENCES)??[],ge=EPe(Oe),pe=u0(Oe)?!1:Oe.readOnly,Ce=u0(Oe)?!1:Oe.writeOnly,Se=!(z.includes(ne)&&!pe),Ot=iv(Oe,yb.FERN_PROPERTY_NAME),mt=[...n,ne],Qe=YHy(mt),Be=xS(Oe,Se,!1,s,mt,T,m),er={};for(let pt of V){let Ar=pt.properties[ne];Ar!=null&&!Z3u(Be,Ar)?er[pt.schemaId]={differentSchema:!0}:Ar!=null&&(er[pt.schemaId]={differentSchema:!1})}return{key:ne,schema:Be,nameOverride:Ot,audiences:ye,conflict:er,generatedName:Qe,availability:ge,readonly:pe,writeonly:Ce}});return k.push(...q.map(ne=>{let Oe=ne.conflict;for(let ye of V){let ge=ye.properties[ne.key];ge!=null&&!Z3u(ne.schema,ge)?Oe[ye.schemaId]={differentSchema:!0}:ge!=null&&(Oe[ye.schemaId]={differentSchema:!1})}return{...ne,conflict:Oe}})),gcI({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,properties:k.filter(ne=>!l.has(ne.key)),description:a,allOf:V.map(ne=>ne.convertedSchema),allOfPropertyConflicts:re,namespace:m,groupName:O,fullExamples:P,additionalProperties:C,availability:M,source:T,context:s})}function gcI({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,allOf:c,allOfPropertyConflicts:f,namespace:u,groupName:s,fullExamples:l,additionalProperties:m,availability:O,source:P,context:C}){let M=jh.object({description:o,properties:a,nameOverride:e,generatedName:t,title:r,allOf:c,allOfPropertyConflicts:f,namespace:u,groupName:s,fullExamples:l,additionalProperties:pko(m,C.options),availability:O,source:P,inline:void 0});return i&&(M=jh.nullable({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:O,namespace:u,groupName:s,inline:void 0})),n&&(M=jh.optional({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:O,namespace:u,groupName:s,inline:void 0})),M}function kHy({properties:e,breadcrumbs:t,context:r}){return Object.fromEntries(Object.entries(e).filter(([n,i])=>{let a=iv(i,yb.IGNORE);return a&&r.logger.debug(`Property ${t.join(".")}.${n} is marked with x-fern-ignore. Skipping.`),!a}))}function eJy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[o,c]=u0(e)?[t.resolveSchemaReference(e),_ko(e.$ref)]:[e,r];for(let f of o.allOf??[])a={...a,...eJy({schema:f,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[f,u]of Object.entries(kHy({properties:o.properties??{},breadcrumbs:r,context:t}))){let s=xS(u,!1,!1,t,[...c,f],n,i);a[f]=s}return a}function t8i({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsOptional:o,wrapAsNullable:c,context:f,subtypes:u,namespace:s,groupName:l,encoding:m,source:O,subtypeSuffixOverrides:P}){let C=AcI({schemas:u}),M=u.flatMap((z,U)=>{if(!u0(z)&&z.enum!=null&&f.options.coerceEnumsToLiterals&&z.type==="string")return z.enum.map(V=>jh.literal({nameOverride:void 0,generatedName:nie([t,V],f.options.preserveSchemaIds),title:void 0,value:NV.string(String(V)),namespace:s,groupName:void 0,description:void 0,availability:V.availability}));let q=C[U];if(P!=null){let V=P[U];V!=null&&"name"in V&&(q=V.name)}return[xS(z,!1,!1,f,[...n,q??`${U}`],O,s)]}),T=mcI(M);return OcI({uniqueSubtypes:T,nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:c,description:i,availability:a,namespace:s,groupName:l,context:f,encoding:m,source:O})}function mcI(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r],i=!1;for(let a=r+1;a<e.length;++a){let o=e[a];if(n!=null&&o!=null&&Ixe(n,o)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function OcI({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:u,context:s,encoding:l,source:m}){if(Object.entries(e).every(([P,C])=>C.type==="literal")){let P={},C=[];return Object.entries(e).forEach(([M,T])=>{T.type==="literal"&&T.value.type==="string"&&(C.push(T.value.value),T.description!=null&&(P[T.value.value]={description:T.description}))}),k7i({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,fernEnum:P,enumVarNames:void 0,enumValues:C,_default:void 0,namespace:f,groupName:u,context:s,source:m,inline:void 0})}if(e.length===1&&e[0]!=null&&!s.options.preserveSingleSchemaOneOf){let P=e[0];return a&&(P=jh.nullable({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),i&&(P=jh.optional({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),P}return tJy({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,subtypes:e,namespace:f,groupName:u,encoding:l,source:m})}function GNf({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:a,wrapAsNullable:o,context:c,namespace:f,groupName:u,discriminator:s,encoding:l,source:m}){let O=Object.entries(s.mapping??{}).map(([M,T],z)=>{let U={$ref:T},q=CPi(U,!1,!1,c,[T],l,m,f);return c.markSchemaWithDiscriminantValue(U,s.propertyName,M),q.type==="object"&&(q.properties={[s.propertyName]:jh.literal({nameOverride:void 0,generatedName:nie([t,M],c.options.preserveSchemaIds),title:void 0,value:NV.string(M),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...q.properties.filter(V=>V.key!==s.propertyName)}),q}),P=[];for(let M=0;M<O.length;++M){let T=O[M],z=!1;for(let U=M+1;U<O.length;++U){let q=O[U];if(T!=null&&q!=null&&Ixe(T,q)){z=!0;break}}T!=null&&!z&&P.push(T)}if(Object.entries(P).every(([M,T])=>T.type==="literal")){let M={},T=[];return Object.entries(P).forEach(([z,U])=>{U.type==="literal"&&U.value.type==="string"&&(T.push(U.value.value),U.description!=null&&(M[U.value.value]={description:U.description}))}),k7i({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,fernEnum:M,enumVarNames:void 0,enumValues:T,_default:void 0,namespace:f,groupName:u,context:c,source:m,inline:void 0})}return P.length===1&&P[0]!=null&&!c.options.preserveSingleSchemaOneOf?P[0]:tJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,subtypes:P,namespace:f,groupName:u,encoding:l,source:m})}function AcI({schemas:e}){let t={},r=0;for(let i of e){if(!u0(i)){if(i.properties!=null&&Object.entries(i.properties).length>0){let a=Object.keys(i.properties),o={},c=a;for(let[f,u]of Object.entries(t)){let s=meu(u,a);c=meu(c,u),o[f]=s}o[r]=c,t=o}}r++}return e.map((i,a)=>{let o=t[a];if(o!=null&&o.length>0){let c=o.sort();if(c[0]!=null)return c[0]}return Qla(a)??`${a}`})}function tJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:a,availability:o,subtypes:c,namespace:f,groupName:u,encoding:s,source:l}){let m=jh.oneOf(_nt.undiscriminated({description:a,availability:o,nameOverride:e,generatedName:t,title:r,schemas:c,namespace:f,groupName:u,encoding:s,source:l,inline:void 0}));return i&&(m=jh.nullable({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:f,groupName:u,inline:void 0})),n&&(m=jh.optional({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:f,groupName:u,inline:void 0})),m}function lno(e){if(e.default!=null&&typeof e.default=="string")return e.default}function k3u({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=Wla(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function rJy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=Wla(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function EVr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=Wla(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function nJy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=Wla(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var Hla="#/components/schemas/";function oJy(e,t){let r=u0(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"string":case"integer":return!0;case"array":return oJy(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function PcI(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:oJy(t,r):!1}function xS(e,t,r,n,i,a,o,c=!1,f=new Set,u){let s=UHy(e)??a,l=McI({schema:e,logger:n.logger});if(u0(e)){let m=e8i(e);return m!=null?PcI(m,e,n)?cno(n.resolveSchemaReference(e),t,r,n,_ko(e.$ref),l,s,o,f,c,u):(c?n.markSchemaAsReferencedByRequest(m):n.markSchemaAsReferencedByNonRequest(m),CPi(e,t,r,n,i,l,s,o)):cno(n.resolveSchemaReference(e),t,r,n,_ko(e.$ref),l,s,o,f,c,u)}return cno(e,t,r,n,i,l,s,o,f,c,u)}function CPi(e,t,r,n,i,a,o,c){let f=e.$ref.includes("properties")?cno(n.resolveSchemaReference(e),t,r,n,i,a,o,c,new Set):jh.reference(WNf(e,i,o,n.options.preserveSchemaIds));if(r===!1){let u=n.resolveSchemaReference(e);(u.nullable===!0||Array.isArray(u.type)&&u.type.length>=2&&u.type.includes("null"))&&(r=!0)}return r&&(f=jh.nullable({title:void 0,nameOverride:void 0,generatedName:nie(i,n.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(f=jh.optional({title:void 0,nameOverride:void 0,generatedName:nie(i,n.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),f}function wcI(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function cno(e,t,r,n,i,a,o,c,f=new Set,u=!1,s){typeof e=="string"&&(e={type:e});let l=iv(e,yb.TYPE_NAME)??(n.options.useTitlesAsName?wcI(e.title):void 0),m=iv(e,yb.SDK_GROUP_NAME)??iv(e,ebe.TAGS)?.[0],O=(typeof m=="string"?[m]:m)??[];O=n.resolveGroupName(O);let P=nie(i,n.options.preserveSchemaIds),C=e.title,M=e.description,T=EPe(e),z=[];e.example!=null&&z.push({name:void 0,value:e.example,description:void 0});let U=iv(e,ebe.EXAMPLES);U!=null&&Object.keys(U).length>0&&z.push(...Object.entries(U).map(([$,re])=>({name:re?.summary??$,value:re.value,description:re.description})));let q=Wla(e);q!=null&&Object.keys(q).length>0&&z.push(...q.map($=>({name:void 0,value:$,description:void 0})));let V=LHy({schema:e,description:M,title:C,nameOverride:l,generatedName:P,availability:T});if(V!=null){let $=V;return r&&($=jh.nullable({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),t&&($=jh.optional({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),$}try{if(Array.isArray(e.type)){let Y=e.type.indexOf("null"),k=Y!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&k)e.type.splice(Y,1),e.type=e.type[0],e.nullable=!0;else if(k&&(e.type.splice(Y,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let ne=new Set([...e.oneOf,...e.type]);e.oneOf=[...ne]}}if(r=r||e.nullable===!0,"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(k=>k!==null),!rzu(e.enum))return Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.string({default:lno(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:EVr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:O,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T});let Y=QHy(e);return n.options.coerceEnumsToLiterals&&e.enum.length===1&&e.enum[0]!=null&&Y==null?$Hy({nameOverride:l,generatedName:P,title:C,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:M,availability:T,namespace:c,groupName:O}):k7i({nameOverride:l,generatedName:P,title:C,fernEnum:Y,enumVarNames:iv(e,[ebe.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:O,context:n,source:o,inline:void 0})}if(rzu(e.type)&&e.type.length>1){let Y=e.type.includes("null"),k=e.type.filter(ne=>ne!=="null").map(ne=>({type:ne,nullable:Y}));return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:k,namespace:c,groupName:O,encoding:a,source:o})}if(e.type==="boolean"){let Y=iv(e,yb.BOOLEAN_LITERAL);return Y!=null?iJy({nameOverride:l,generatedName:P,title:C,literal:NV.boolean(Y),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O}):Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.boolean({default:jcI(e.default),example:rJy({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O})}if(e.type==="number")return VNf({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Gla(e.exclusiveMinimum),exclusiveMaximum:Gla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:k3u({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:O});if(e.type==="integer")return KHy({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Gla(e.exclusiveMinimum),exclusiveMaximum:Gla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:k3u({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:O});if(e.type==="float")return VNf({nameOverride:l,generatedName:P,title:C,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Gla(e.exclusiveMinimum),exclusiveMaximum:Gla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:k3u({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:O});if(e.type==="string"){if(e.format==="date-time")return Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.datetime({example:EVr({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.date({example:EVr({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O});if(e.format==="json-string"){let k=jh.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:O,example:void 0});return r&&(k=jh.nullable({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:k})),t&&(k=jh.optional({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:k})),k}let Y=uJy(e,"const");return Y!=null?iJy({nameOverride:l,generatedName:P,title:C,literal:NV.string(Y),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O}):Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.string({default:lno(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:EVr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:O,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T})}if(e.type==="array")return GHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,item:e.items,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,example:nJy({schema:e,logger:n.logger,fallback:s}),source:o});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&ezu(e))return VHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,additionalProperties:e.additionalProperties,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,encoding:a,example:e.example,source:o});if(e.oneOf!=null&&e.oneOf.length>0&&iv(e,yb.IS_DISCRIMINATED)===!1)return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf,namespace:c,groupName:O,encoding:a,source:o});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return n.options.discriminatedUnionV2?GNf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,discriminator:e.discriminator,encoding:a,source:o}):LNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,encoding:a,source:o});if(e.oneOf!=null&&e.oneOf.length>0){let Y=iv(e,yb.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||Y?GNf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,discriminator:e.discriminator,encoding:a,source:o}):LNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,encoding:a,source:o});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(ne=>u0(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:O,source:o});let k=xS(e.oneOf[0],t,r,n,i,o,c,u);return SVr(k,M,c,O)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let ye=e.oneOf[0],ge=e.oneOf[1];if(!u0(ye)&&ye.type==="null"){let pe=xS(ge,t,!0,n,i,o,c);return SVr(pe,M,c,O)}else if(!u0(ge)&&ge.type==="null"){let pe=xS(ye,t,!0,n,i,o,c);return SVr(pe,M,c,O)}}let k=DcI({schemas:e.oneOf});if(k!=null)return k7i({nameOverride:l,generatedName:P,title:C,fernEnum:void 0,enumVarNames:void 0,enumValues:k,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:O,context:n,source:o,inline:void 0});let ne=aJy({schemas:e.oneOf,context:n});if(ne!=null&&!n.options.discriminatedUnionV2&&!Y)return UNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:ne.discriminant,variants:ne.schemas,context:n,namespace:c,groupName:O,encoding:a,source:o});let Oe=e.oneOf.filter(ye=>!u0(ye)&&ye.type==="null").length>0;return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||Oe,context:n,subtypes:e.oneOf.filter(ye=>u0(ye)||ye.type!=="null"),encoding:a,namespace:c,groupName:O,source:o})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let ne=xS(e.anyOf[0],t,r,n,i,o,c,u);return SVr(ne,M,c,O)}if(e.anyOf.length===2){let[ne,Oe]=e.anyOf;if(ne!=null&&Oe!=null){if(!u0(ne)&&ne.type==="null"){let ye=xS(Oe,t,!0,n,i,o,c);return SVr(ye,M,c,O)}else if(!u0(Oe)&&Oe.type==="null"){let ye=xS(ne,t,!0,n,i,o,c);return SVr(ye,M,c,O)}}}let Y=aJy({schemas:e.anyOf,context:n});if(Y!=null&&!n.options.discriminatedUnionV2)return UNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:Y.discriminant,variants:Y.schemas,context:n,namespace:c,groupName:O,encoding:a,source:o});let k=e.anyOf.filter(ne=>!u0(ne)&&ne.type==="null").length>0;return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||k,context:n,subtypes:e.anyOf.filter(ne=>u0(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:O,source:o})}if(e.allOf!=null||e.properties!=null){let Y=[];for(let ne of e.allOf??[])(u0(ne)||Object.keys(ne).length>0)&&Y.push(ne);if((e.properties==null||ezu(e))&&Y.length===1&&Y[0]!=null){let ne=xS(Y[0],t,r,n,i,o,c,u);return SVr(ne,M,c,O)}let k=Y.filter(ne=>{let Oe=tzu(ne);return Oe||n.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(ne)}`),Oe});if((e.properties==null||ezu(e))&&k.length===1&&k[0]!=null){let ne=xS(k[0],t,r,n,i,o,c,u);return SVr(ne,M,c,O)}return ZHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},description:M,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:k,context:n,propertiesToExclude:f,namespace:c,groupName:O,fullExamples:z,additionalProperties:e.additionalProperties,availability:T,encoding:a,source:o})}if(e.type==="object"&&EcI(e)&&ScI(e)&&ezu(e))return QNf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${P}Key`,title:void 0,description:void 0,availability:void 0,schema:k0.string({default:lno(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:EVr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:O},valueSchema:jh.unknown({nameOverride:void 0,generatedName:`${P}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:c,groupName:O}),namespace:c,groupName:O,encoding:a,example:e.example});e.type!=null&&n.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let $=e.example??e.default,re=jh.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:O,example:$});return r&&(re=jh.nullable({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),t&&(re=jh.optional({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),re}catch($){return n.logger.debug(`Error converting schema: ${$.message}
|
|
2698
|
+
`)),{ok:!0,value:t}):n}}function NFu(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Dro=class e extends Error{errors;constructor(t){super(t.map(NFu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var Cro=class e extends Error{errors;constructor(t){super(t.map(NFu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function BQ(e){return{optional:()=>dNf(e),transform:t=>pNf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new Cro(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Dro(n.errors)}}}function dNf(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Qq.OPTIONAL};return{...t,...BQ(t)}}function pNf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...BQ(r)}}function vGy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Z8(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:Z8(t,"bigint")}]},getType:()=>Qq.BIGINT};return{...fde(e),...BQ(e)}}var JsI=/^([+-]?\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 bGy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Z8(t,"string")}]}:JsI.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Z8(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Z8(t,"Date object")}]},getType:()=>Qq.DATE};return{...fde(e),...BQ(e)}}function wPe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...fde(r),...BQ(r)}}}function FFu(e){let t=new Set(e);return wPe(Qq.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:Z8(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:Z8(n,"enum")}]}:{ok:!0,value:n})()}function gGy(e){let t=_Nf(e);return{...t,...BQ(t)}}function _Nf(e){return{parse:(t,r)=>Iro(e).parse(t,r),json:(t,r)=>Iro(e).json(t,r),getType:()=>Iro(e).getType()}}function Iro(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function kZo(e){return Object.entries(e)}function eko(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function V7i(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 tko(e){return Object.keys(e)}function mGy(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function Pqr(e){return{withParsedProperties:t=>hNf(e,t)}}function hNf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!V7i(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Z8(n,"object")}]};let a=new Set(Object.keys(t)),o=eko(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...BQ(r),...Pqr(r)}}function OGy(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function W7i(e){return e.isProperty}function xFu(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>W7i(n)?n.rawKey:r),_getParsedProperties:()=>tko(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of kZo(e)){let f=W7i(c)?c.rawKey:o,u=W7i(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,wGy(u)&&a.push(f)}return AGy({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of kZo(e)){let c=W7i(o)?o.valueSchema:o;wGy(c)&&i.push(a)}return AGy({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return W7i(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>Qq.OBJECT};return{...fde(t),...BQ(t),...Pqr(t),...zla(t)}}function AGy({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!V7i(e))return{ok:!1,errors:[{path:a,message:Z8(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function zla(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>PGy({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>PGy({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>Qq.OBJECT};return{...r,...BQ(r),...Pqr(r),...zla(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>Qq.OBJECT};return{...t,...BQ(t),...Pqr(t),...zla(t)}}}}function PGy({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=mGy(tko(t),u=>i.has(u)),c=r(eko(t,o)),f=n(eko(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function wGy(e){return!KsI(e)}function KsI(e){switch(e.getType()){case Qq.ANY:case Qq.UNKNOWN:case Qq.OPTIONAL:return!0;default:return!1}}function jGy(e){return xFu(e)}function EGy(e){let t={..._Nf(e),_getRawProperties:()=>Iro(e)._getRawProperties(),_getParsedProperties:()=>Iro(e)._getParsedProperties()};return{...t,...BQ(t),...Pqr(t),...zla(t)}}function zFu(e){let t={parse:(r,n)=>SGy(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>SGy(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>Qq.LIST};return{...fde(t),...BQ(t)}}function SGy(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:Z8(e,"list"),path:[]}]}}function DGy(e){return wPe(Qq.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Z8(r,`"${e}"`)}]})()}function CGy(e){return wPe(Qq.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Z8(r,`${e.toString()}`)}]})()}var IGy=wPe(Qq.ANY,e=>({ok:!0,value:e}));var MGy=wPe(Qq.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Z8(e,"boolean")}]});var BGy=wPe(Qq.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Z8(e,"number")}]});var TGy=wPe(Qq.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Z8(e,"string")}]});var qGy=wPe(Qq.UNKNOWN,e=>({ok:!0,value:e}));function NGy(e,t){let r={parse:(n,i)=>RGy({value:n,isKeyNumeric:e.getType()===Qq.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>RGy({value:n,isKeyNumeric:e.getType()===Qq.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Qq.RECORD};return{...fde(r),...BQ(r)}}function RGy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return V7i(e)?kZo(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,u=o;if(t){let O=o.length>0?Number(o):NaN;isNaN(O)||(u=O)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:Z8(e,"object")}]}}function FGy(e){let t=zFu(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Z8(n,"Set")}]},getType:()=>Qq.SET};return{...fde(r),...BQ(r)}}function zGy(e){let t={parse:(r,n)=>xGy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>xGy((i,a)=>i.json(r,a),e,n),getType:()=>Qq.UNDISCRIMINATED_UNION};return{...fde(t),...BQ(t)}}function xGy(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function QGy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function UGy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=FFu(tko(t)),a={parse:(o,c)=>LGy({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>LGy({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>Qq.UNION};return{...fde(a),...BQ(a),...Pqr(a)}}function LGy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!V7i(e))return{ok:!1,errors:[{path:c,message:Z8(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var zM=Gr.objectWithoutOptionalProperties({title:Gr.string().optional()});var QFu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var LFu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var UFu=Gr.union("type",{openapi:QFu,protobuf:LFu}).transform({transform:e=>{switch(e.type){case"openapi":return PPe.openapi(e);case"protobuf":return PPe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var jP=Gr.objectWithoutOptionalProperties({source:UFu.optional()});var VFu=Gr.objectWithoutOptionalProperties({typeName:Gr.string()});var WFu=Gr.union("type",{protobuf:VFu}).transform({transform:e=>{switch(e.type){case"protobuf":return Sro.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Cxe=Gr.objectWithoutOptionalProperties({encoding:WFu.optional()});var Ov=Gr.objectWithoutOptionalProperties({description:Gr.string().optional()});var GFu=Gr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var ow=Gr.objectWithoutOptionalProperties({availability:GFu.optional()});var OVr=Gr.number();var Aht=Gr.objectWithoutOptionalProperties({statusCode:OVr.optional()});var jD=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string()});var K4=Gr.objectWithoutOptionalProperties({inline:Gr.boolean().optional()});var ECe=Gr.string();var SCe=Gr.string();var HFu=Gr.objectWithoutOptionalProperties({id:SCe}).extend(Ov);var Mro=Gr.string();var JFu=Gr.objectWithoutOptionalProperties({usernameVariableName:Gr.string().optional(),usernameEnvVar:Gr.string().optional(),passwordVariableName:Gr.string().optional(),passwordEnvVar:Gr.string().optional()});var KFu=Gr.objectWithoutOptionalProperties({tokenVariableName:Gr.string().optional(),tokenEnvVar:Gr.string().optional()});var $Fu=Gr.objectWithoutOptionalProperties({headerName:Gr.string(),prefix:Gr.string().optional(),headerVariableName:Gr.string().optional(),headerEnvVar:Gr.string().optional()});var YFu=Gr.objectWithoutOptionalProperties({queryParameterName:Gr.string()});var XFu=Gr.objectWithoutOptionalProperties({snake:Gr.string().optional(),camel:Gr.string().optional(),screamingSnake:Gr.string().optional(),pascal:Gr.string().optional()});var G7i=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string(),value:Gr.string(),casing:XFu.optional()}).extend(Ov).extend(ow);var ZFu=Gr.objectWithoutOptionalProperties({type:Gr.stringLiteral("namespace"),name:Gr.string()});var kFu=Gr.undiscriminatedUnion([Gr.string(),ZFu]);var H7i=Gr.list(kFu);var QM=Gr.objectWithoutOptionalProperties({groupName:H7i.optional()});var FS=Gr.objectWithoutOptionalProperties({namespace:Gr.string().optional()});var Bro=Gr.objectWithoutOptionalProperties({default:G7i.optional(),values:Gr.list(G7i)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var exu=Gr.objectWithoutOptionalProperties({scopesEnum:Bro.optional()});var txu=Gr.union("type",{basic:JFu,bearer:KFu,header:$Fu,query:YFu,oauth:exu}).transform({transform:e=>{switch(e.type){case"basic":return sde.basic(e);case"bearer":return sde.bearer(e);case"header":return sde.header(e);case"query":return sde.query(e);case"oauth":return sde.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var rko=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string(),audiences:Gr.list(Gr.string()).optional()}).extend(Ov);var rxu=Gr.string();var AVr=Gr.objectWithoutOptionalProperties({sdkMethodName:Gr.string().optional()});var vNf={};yf(vNf,{FullExample:()=>TQ,FullObjectExample:()=>axu,FullOneOfExample:()=>sxu,KeyValuePair:()=>oxu,LiteralExample:()=>nxu,NullExample:()=>ixu,PrimitiveExample:()=>qro,PropertyKey:()=>Tro});var Tro=Gr.string();var qro=Gr.union("type",{int:Gr.object({value:Gr.number()}),int64:Gr.object({value:Gr.number()}),uint:Gr.object({value:Gr.number()}),uint64:Gr.object({value:Gr.number()}),float:Gr.object({value:Gr.number()}),double:Gr.object({value:Gr.number()}),string:Gr.object({value:Gr.string()}),datetime:Gr.object({value:Gr.string()}),date:Gr.object({value:Gr.string()}),base64:Gr.object({value:Gr.string()}),boolean:Gr.object({value:Gr.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return zO.int(e.value);case"int64":return zO.int64(e.value);case"uint":return zO.uint(e.value);case"uint64":return zO.uint64(e.value);case"float":return zO.float(e.value);case"double":return zO.double(e.value);case"string":return zO.string(e.value);case"datetime":return zO.datetime(e.value);case"date":return zO.date(e.value);case"base64":return zO.base64(e.value);case"boolean":return zO.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var nxu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return L7i.boolean(e.value);case"string":return L7i.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var ixu=Gr.objectWithoutOptionalProperties({});var TQ=Gr.union("type",{primitive:Gr.object({value:qro}),object:Gr.lazyObject(()=>axu),array:Gr.object({value:Gr.list(Gr.lazy(()=>TQ))}),map:Gr.object({value:Gr.list(Gr.lazyObject(()=>oxu))}),enum:Gr.object({value:Gr.string()}),literal:Gr.object({value:nxu}),oneOf:Gr.object({value:Gr.lazy(()=>sxu)}),null:ixu,unknown:Gr.object({value:Gr.lazy(()=>TQ)})}).transform({transform:e=>{switch(e.type){case"primitive":return NS.primitive(e.value);case"object":return NS.object(e);case"array":return NS.array(e.value);case"map":return NS.map(e.value);case"enum":return NS.enum(e.value);case"literal":return NS.literal(e.value);case"oneOf":return NS.oneOf(e.value);case"null":return NS.null(e);case"unknown":return NS.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var axu=Gr.objectWithoutOptionalProperties({properties:Gr.record(Tro,Gr.lazy(()=>TQ))});var oxu=Gr.objectWithoutOptionalProperties({key:qro,value:Gr.lazy(()=>TQ)});var sxu=Gr.union("type",{discriminated:Gr.object({value:Gr.record(Tro,Gr.lazy(()=>TQ))}),undiscriminated:Gr.object({value:Gr.lazy(()=>TQ)})}).transform({transform:e=>{switch(e.type){case"discriminated":return U7i.discriminated(e.value);case"undiscriminated":return U7i.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var bNf={};yf(bNf,{AllOfPropertyConflict:()=>kro,ArraySchema:()=>Zxu,Availability:()=>GFu,BooleanSchema:()=>Hxu,BytesResponse:()=>Vro,CasingOverrides:()=>XFu,CommonProperty:()=>o3u,CursorPagination:()=>Cxu,CustomCodeSample:()=>Sxu,CustomCodeSampleLanguage:()=>wxu,CustomCodeSampleSdk:()=>Exu,CustomPagination:()=>Mxu,DiscriminatedOneOfSchema:()=>i3u,DoubleSchema:()=>Wxu,Endpoint:()=>Bxu,EndpointExample:()=>Jro,EndpointResponseExample:()=>Pxu,EndpointSdkName:()=>PVr,EndpointSecurity:()=>Rro,EnumSchema:()=>Bro,EnumValue:()=>G7i,ErrorExample:()=>bxu,FernExample:()=>mxu,FileResponse:()=>Lro,FileSchema:()=>lxu,FormUrlEncodedRequest:()=>hxu,FullEndpointExample:()=>Dxu,GlobalHeader:()=>Kxu,Header:()=>J7i,HeaderExample:()=>Hro,HttpEndpointServer:()=>Wro,HttpError:()=>gxu,HttpMethod:()=>Nro,IdempotencyHeader:()=>$xu,IntSchema:()=>Uxu,JsonRequest:()=>_xu,JsonResponse:()=>Uro,LiteralSchema:()=>Zro,LiteralSchemaValue:()=>Yxu,LongSchema:()=>Vxu,MapSchema:()=>kxu,MultipartRequest:()=>Qro,MultipartRequestProperty:()=>pxu,MultipartRequestPropertyEncoding:()=>dxu,MultipartSchema:()=>fxu,NullableSchema:()=>t3u,ObjectProperty:()=>n3u,ObjectPropertyConflictInfo:()=>eno,ObjectSchema:()=>Xxu,OctetStreamRequest:()=>zro,OffsetPagination:()=>Ixu,OneOfSchema:()=>r3u,OpenApiIntermediateRepresentation:()=>VGy,OptionalSchema:()=>e3u,Pagination:()=>Kro,PathParameter:()=>Fro,PathParameterExample:()=>Oxu,PrimitiveSchema:()=>$7i,PrimitiveSchemaValue:()=>Jxu,QueryParameter:()=>xro,QueryParameterExample:()=>Gro,ReferencedSchema:()=>wVr,Request:()=>yxu,Response:()=>vxu,RetriesConfiguration:()=>$ro,Schema:()=>VI,Schemas:()=>Lxu,SdkGroupInfo:()=>uxu,StreamingResponseExample:()=>Axu,StringSchema:()=>Gxu,SupportedSdkLanguage:()=>jxu,Tags:()=>cxu,TextResponse:()=>K7i,UnDiscriminatedOneOfSchema:()=>a3u,Webhook:()=>Txu,WebhookExampleCall:()=>Xro,WebhookHttpMethod:()=>Yro,WebsocketChannel:()=>Qxu,WebsocketHandshake:()=>qxu,WebsocketMessageExample:()=>xxu,WebsocketMessageOrigin:()=>Rxu,WebsocketMessageSchema:()=>Nxu,WebsocketServer:()=>Fxu,WebsocketSessionExample:()=>zxu});var uxu=Gr.objectWithoutOptionalProperties({summary:Gr.string().optional(),description:Gr.string().optional()});var cxu=Gr.objectWithoutOptionalProperties({tagsById:Gr.record(SCe,HFu),orderedTagIds:Gr.list(SCe).optional()});var Rro=Gr.list(Gr.record(Mro,Gr.list(Gr.string())));var Nro=Gr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var Fro=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>VI),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var xro=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>VI),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var J7i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>VI),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var PVr=Gr.objectWithoutOptionalProperties({groupName:H7i,methodName:Gr.string()});var zro=Gr.objectWithoutOptionalProperties({contentType:Gr.string().optional()}).extend(Ov).extend(jP);var lxu=Gr.objectWithoutOptionalProperties({isOptional:Gr.boolean(),isArray:Gr.boolean()}).extend(Ov);var fxu=Gr.union("type",{file:lxu,json:Gr.object({value:Gr.lazy(()=>VI)})}).transform({transform:e=>{switch(e.type){case"file":return gVr.file(e);case"json":return gVr.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var dxu=Gr.enum_(["json","form"]);var pxu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:fxu,contentType:Gr.string().optional(),exploded:Gr.boolean().optional(),encoding:dxu.optional()}).extend(Ov);var Qro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),properties:Gr.list(pxu)}).extend(Ov).extend(jP);var _xu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP);var hxu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP);var yxu=Gr.union("type",{octetStream:zro,multipart:Qro,json:_xu,formUrlEncoded:hxu}).transform({transform:e=>{switch(e.type){case"octetStream":return Aqr.octetStream(e);case"multipart":return Aqr.multipart(e);case"json":return Aqr.json(e);case"formUrlEncoded":return Aqr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var Lro=Gr.objectWithoutOptionalProperties({}).extend(Ov).extend(jP).extend(Aht);var Uro=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI),responseProperty:Gr.string().optional()}).extend(Ov).extend(jP).extend(Aht);var K7i=Gr.objectWithoutOptionalProperties({}).extend(Ov).extend(jP).extend(Aht);var Vro=Gr.objectWithoutOptionalProperties({}).extend(Ov).extend(jP).extend(Aht);var vxu=Gr.union("type",{file:Lro,json:Uro,text:K7i,bytes:Vro,streamingSse:Uro,streamingText:K7i,streamingJson:Uro}).transform({transform:e=>{switch(e.type){case"file":return kve.file(e);case"json":return kve.json(e);case"text":return kve.text(e);case"bytes":return kve.bytes(e);case"streamingSse":return kve.streamingSse(e);case"streamingText":return kve.streamingText(e);case"streamingJson":return kve.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var bxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),description:Gr.string().optional(),example:Gr.lazy(()=>TQ)});var gxu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>VI).optional(),examples:Gr.list(bxu).optional()}).extend(Ov).extend(jD).extend(jP);var Wro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string().optional(),audiences:Gr.list(Gr.string()).optional()});var mxu=Gr.unknown();var Oxu=Gr.objectWithoutOptionalProperties({name:Gr.string(),parameterNameOverride:Gr.string().optional(),value:Gr.lazy(()=>TQ)});var Gro=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>TQ)});var Hro=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>TQ)});var Axu=Gr.objectWithoutOptionalProperties({sse:Gr.boolean(),events:Gr.list(Gr.lazy(()=>TQ))});var Pxu=Gr.union("type",{withStreaming:Axu,withoutStreaming:Gr.object({value:Gr.lazy(()=>TQ)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return Oht.withStreaming(e);case"withoutStreaming":return Oht.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var wxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),language:Gr.string(),code:Gr.string(),install:Gr.string().optional()}).extend(Ov);var jxu=Gr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var Exu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),sdk:jxu,code:Gr.string()}).extend(Ov);var Sxu=Gr.union("type",{language:wxu,sdk:Exu}).transform({transform:e=>{switch(e.type){case"language":return bVr.language(e);case"sdk":return bVr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var Dxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),pathParameters:Gr.list(Oxu).optional(),queryParameters:Gr.list(Gro).optional(),headers:Gr.list(Hro).optional(),request:Gr.lazy(()=>TQ).optional(),response:Pxu.optional(),codeSamples:Gr.list(Sxu)}).extend(Ov);var Jro=Gr.union("type",{unknown:Gr.object({value:mxu}),full:Dxu}).transform({transform:e=>{switch(e.type){case"unknown":return mht.unknown(e.value);case"full":return mht.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var Cxu=Gr.objectWithoutOptionalProperties({cursor:Gr.string(),nextCursor:Gr.property("next_cursor",Gr.string()),results:Gr.string()});var Ixu=Gr.objectWithoutOptionalProperties({offset:Gr.string(),results:Gr.string(),step:Gr.string().optional(),hasNextPage:Gr.string().optional()});var Mxu=Gr.objectWithoutOptionalProperties({results:Gr.string()});var Kro=Gr.union("type",{cursor:Cxu,offset:Ixu,custom:Mxu}).transform({transform:e=>{switch(e.type){case"cursor":return pnt.cursor(e);case"offset":return pnt.offset(e);case"custom":return pnt.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var $ro=Gr.union("type",{disabled:Gr.object({value:Gr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return ZZo.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Bxu=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:Rro,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:Nro,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(SCe),pathParameters:Gr.list(Fro),queryParameters:Gr.list(xro),headers:Gr.list(J7i),sdkName:PVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:yxu.optional(),response:vxu.optional(),errors:Gr.record(OVr,gxu),servers:Gr.list(Wro),examples:Gr.list(Jro),pagination:Kro.optional(),retries:$ro.optional()}).extend(Ov).extend(ow).extend(jP).extend(FS);var Yro=Gr.enum_(["GET","POST"]);var Xro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),payload:Gr.lazy(()=>TQ)}).extend(Ov);var Txu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:PVr.optional(),method:Yro,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(SCe),headers:Gr.list(J7i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>VI),examples:Gr.list(Xro)}).extend(Ov).extend(jP).extend(FS);var qxu=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(xro),headers:Gr.list(J7i),pathParameters:Gr.list(Fro)});var Rxu=Gr.enum_(["client","server"]);var Nxu=Gr.objectWithoutOptionalProperties({name:Gr.string(),origin:Rxu,body:Gr.lazy(()=>VI)});var Fxu=Gr.objectWithoutOptionalProperties({name:Gr.string(),url:Gr.string()});var xxu=Gr.objectWithoutOptionalProperties({messageType:Gr.string(),payload:Gr.lazy(()=>TQ)}).extend(Ov);var zxu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),queryParameters:Gr.list(Gro).optional(),headers:Gr.list(Hro).optional(),messages:Gr.list(xxu)}).extend(Ov);var Qxu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),path:Gr.string(),groupName:H7i,summary:Gr.string().optional(),handshake:qxu,messages:Gr.list(Nxu),servers:Gr.list(Fxu),examples:Gr.list(zxu)}).extend(Ov).extend(jP);var Lxu=Gr.objectWithoutOptionalProperties({rootSchemas:Gr.record(ECe,Gr.lazy(()=>VI)),namespacedSchemas:Gr.record(rxu,Gr.record(ECe,Gr.lazy(()=>VI)))});var Uxu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var Vxu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional()});var Wxu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var Gxu=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional()});var Hxu=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional()});var Jxu=Gr.union("type",{int:Uxu,int64:Vxu,uint:Gr.object({}),uint64:Gr.object({}),float:Gr.object({}),double:Wxu,string:Gxu,datetime:Gr.object({}),date:Gr.object({}),base64:Gr.object({}),boolean:Hxu}).transform({transform:e=>{switch(e.type){case"int":return zq.int(e);case"int64":return zq.int64(e);case"uint":return zq.uint();case"uint64":return zq.uint64();case"float":return zq.float();case"double":return zq.double(e);case"string":return zq.string(e);case"datetime":return zq.datetime();case"date":return zq.date();case"base64":return zq.base64();case"boolean":return zq.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var $7i=Gr.objectWithoutOptionalProperties({schema:Jxu}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var Kxu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),optional:Gr.boolean().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>VI).optional()});var $xu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>VI).optional()});var VGy=Gr.objectWithoutOptionalProperties({apiVersion:Gr.unknown().optional(),title:Gr.string().optional(),description:Gr.string().optional(),basePath:Gr.string().optional(),servers:Gr.list(rko),websocketServers:Gr.list(rko),groups:Gr.record(Gr.string(),uxu),tags:cxu,hasEndpointsMarkedInternal:Gr.boolean(),endpoints:Gr.list(Bxu),webhooks:Gr.list(Txu),channels:Gr.record(Gr.string(),Qxu),groupedSchemas:Lxu,variables:Gr.record(Gr.string(),$7i),nonRequestReferencedSchemas:Gr.set(ECe),securitySchemes:Gr.record(Mro,txu),globalHeaders:Gr.list(Kxu).optional(),idempotencyHeaders:Gr.list($xu).optional()});var wVr=Gr.objectWithoutOptionalProperties({schema:ECe}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM);var Yxu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return NV.boolean(e.value);case"string":return NV.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Zro=Gr.objectWithoutOptionalProperties({value:Yxu}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var VI=Gr.union("type",{primitive:$7i,object:Gr.lazyObject(()=>Xxu),array:Gr.lazyObject(()=>Zxu),map:Gr.lazyObject(()=>kxu),optional:Gr.lazyObject(()=>e3u),enum:Bro,reference:wVr,literal:Zro,oneOf:Gr.object({value:Gr.lazy(()=>r3u)}),nullable:Gr.lazyObject(()=>t3u),unknown:jD}).transform({transform:e=>{switch(e.type){case"primitive":return _1.primitive(e);case"object":return _1.object(e);case"array":return _1.array(e);case"map":return _1.map(e);case"optional":return _1.optional(e);case"enum":return _1.enum(e);case"reference":return _1.reference(e);case"literal":return _1.literal(e);case"oneOf":return _1.oneOf(e.value);case"nullable":return _1.nullable(e);case"unknown":return _1.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var kro=Gr.objectWithoutOptionalProperties({propertyKey:Gr.string(),allOfSchemaIds:Gr.list(ECe),conflictingTypeSignatures:Gr.boolean()});var Xxu=Gr.objectWithoutOptionalProperties({allOf:Gr.list(wVr),properties:Gr.list(Gr.lazyObject(()=>n3u)),allOfPropertyConflicts:Gr.list(kro),additionalProperties:Gr.boolean()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var eno=Gr.objectWithoutOptionalProperties({differentSchema:Gr.boolean()});var n3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>VI),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),conflict:Gr.record(ECe,eno),generatedName:Gr.string(),nameOverride:Gr.string().optional(),audiences:Gr.list(Gr.string())}).extend(ow);var Zxu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var kxu=Gr.objectWithoutOptionalProperties({key:$7i,value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(zM).extend(K4);var e3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var t3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>VI)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var r3u=Gr.union("type",{discriminated:Gr.lazyObject(()=>i3u),undiscriminated:Gr.lazyObject(()=>a3u)}).transform({transform:e=>{switch(e.type){case"discriminated":return mVr.discriminated(e);case"undiscriminated":return mVr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var i3u=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>o3u)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>VI))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var o3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>VI)});var a3u=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>VI))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var gNf={};yf(gNf,{ArraySchemaWithExample:()=>C3u,Base64WithExample:()=>w3u,BooleanWithExample:()=>j3u,CommonPropertyWithExample:()=>x3u,DateWithExample:()=>P3u,DatetimeWithExample:()=>A3u,DiscriminatedOneOfSchemaWithExample:()=>N3u,DoubleWithExample:()=>m3u,EndpointWithExample:()=>GGy,EnumSchemaWithExample:()=>S3u,FloatWithExample:()=>g3u,HeaderWithExample:()=>Y7i,HttpErrorWithExample:()=>_3u,Int64WithExample:()=>y3u,IntWithExample:()=>h3u,JsonRequestWithExample:()=>l3u,JsonResponseWithExample:()=>rno,MapSchemaWithExample:()=>I3u,NamedFullExample:()=>Pht,NullableSchemaWithExample:()=>B3u,ObjectPropertyWithExample:()=>R3u,ObjectSchemaWithExample:()=>T3u,OneOfSchemaWithExample:()=>q3u,OptionalSchemaWithExample:()=>M3u,ParseFormUrlEncodedRequest:()=>f3u,ParseMultipartRequest:()=>c3u,ParseOctetStreamRequest:()=>u3u,PathParameterWithExample:()=>s3u,PrimitiveSchemaValueWithExample:()=>E3u,PrimitiveSchemaWithExample:()=>nno,QueryParameterWithExample:()=>tno,RequestWithExample:()=>d3u,ResponseWithExample:()=>p3u,SchemaWithExample:()=>$4,StringSchemaWithExample:()=>O3u,Uint64WithExample:()=>b3u,UintWithExample:()=>v3u,UnDiscriminatedOneOfSchemaWithExample:()=>F3u,UnknownSchemaWithExample:()=>D3u,WebhookWithExample:()=>HGy,WebsocketHandshakeWithExample:()=>WGy});var Pht=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),value:Gr.unknown()}).extend(Ov);var tno=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>$4),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var Y7i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>$4),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var WGy=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(tno),headers:Gr.list(Y7i)});var s3u=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>$4),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Ov).extend(ow).extend(jP);var u3u=Gr.objectWithoutOptionalProperties({}).extend(zro).extend(AVr);var c3u=Gr.objectWithoutOptionalProperties({}).extend(Qro).extend(AVr);var l3u=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>$4),contentType:Gr.string().optional(),fullExamples:Gr.list(Pht).optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP).extend(AVr);var f3u=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>$4),contentType:Gr.string().optional(),fullExamples:Gr.list(Pht).optional(),additionalProperties:Gr.boolean()}).extend(Ov).extend(jP).extend(AVr);var d3u=Gr.union("type",{octetStream:u3u,multipart:c3u,json:l3u,formUrlEncoded:f3u}).transform({transform:e=>{switch(e.type){case"octetStream":return jCe.octetStream(e);case"multipart":return jCe.multipart(e);case"json":return jCe.json(e);case"formUrlEncoded":return jCe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var rno=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>$4),responseProperty:Gr.string().optional(),fullExamples:Gr.list(Pht).optional()}).extend(Ov).extend(jP).extend(Aht);var p3u=Gr.union("type",{file:Lro,json:rno,text:K7i,bytes:Vro,streamingSse:rno,streamingText:K7i,streamingJson:rno}).transform({transform:e=>{switch(e.type){case"file":return YL.file(e);case"json":return YL.json(e);case"text":return YL.text(e);case"bytes":return YL.bytes(e);case"streamingSse":return YL.streamingSse(e);case"streamingText":return YL.streamingText(e);case"streamingJson":return YL.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var _3u=Gr.objectWithoutOptionalProperties({statusCode:OVr,schema:Gr.lazy(()=>$4),fullExamples:Gr.list(Pht).optional()}).extend(Ov).extend(jD).extend(jP);var GGy=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:Rro,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:Nro,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(SCe),pathParameters:Gr.list(s3u),queryParameters:Gr.list(tno),headers:Gr.list(Y7i),sdkName:PVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:d3u.optional(),response:p3u.optional(),errors:Gr.record(OVr,_3u),servers:Gr.list(Wro),examples:Gr.list(Jro),pagination:Kro.optional(),retries:$ro.optional()}).extend(Ov).extend(ow).extend(jP).extend(FS);var HGy=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:PVr.optional(),method:Yro,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(SCe),headers:Gr.list(Y7i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>$4),examples:Gr.list(Xro)}).extend(Ov).extend(jP).extend(FS);var h3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var y3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var v3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var b3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var g3u=Gr.objectWithoutOptionalProperties({example:Gr.number().optional()});var m3u=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var O3u=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional(),example:Gr.string().optional()});var A3u=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var P3u=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var w3u=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var j3u=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional(),example:Gr.boolean().optional()});var E3u=Gr.union("type",{int:h3u,int64:y3u,uint:v3u,uint64:b3u,float:g3u,double:m3u,string:O3u,datetime:A3u,date:P3u,base64:w3u,boolean:j3u}).transform({transform:e=>{switch(e.type){case"int":return k0.int(e);case"int64":return k0.int64(e);case"uint":return k0.uint(e);case"uint64":return k0.uint64(e);case"float":return k0.float(e);case"double":return k0.double(e);case"string":return k0.string(e);case"datetime":return k0.datetime(e);case"date":return k0.date(e);case"base64":return k0.base64(e);case"boolean":return k0.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var nno=Gr.objectWithoutOptionalProperties({schema:E3u}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var S3u=Gr.objectWithoutOptionalProperties({default:G7i.optional(),values:Gr.list(G7i),example:Gr.string().optional()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var D3u=Gr.objectWithoutOptionalProperties({example:Gr.unknown()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM);var $4=Gr.union("type",{primitive:nno,object:Gr.lazyObject(()=>T3u),array:Gr.lazyObject(()=>C3u),map:Gr.lazyObject(()=>I3u),optional:Gr.lazyObject(()=>M3u),enum:S3u,reference:wVr,literal:Zro,oneOf:Gr.object({value:Gr.lazy(()=>q3u)}),nullable:Gr.lazyObject(()=>B3u),unknown:D3u}).transform({transform:e=>{switch(e.type){case"primitive":return jh.primitive(e);case"object":return jh.object(e);case"array":return jh.array(e);case"map":return jh.map(e);case"optional":return jh.optional(e);case"enum":return jh.enum(e);case"reference":return jh.reference(e);case"literal":return jh.literal(e);case"oneOf":return jh.oneOf(e.value);case"nullable":return jh.nullable(e);case"unknown":return jh.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var C3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>$4),example:Gr.list(Gr.unknown()).optional()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var I3u=Gr.objectWithoutOptionalProperties({key:nno,value:Gr.lazy(()=>$4),example:Gr.unknown().optional()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(zM).extend(K4);var M3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>$4)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var B3u=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>$4)}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(zM).extend(K4);var T3u=Gr.objectWithoutOptionalProperties({allOf:Gr.list(wVr),properties:Gr.list(Gr.lazyObject(()=>R3u)),allOfPropertyConflicts:Gr.list(kro),fullExamples:Gr.list(Pht).optional(),additionalProperties:Gr.boolean()}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(jP).extend(zM).extend(K4);var R3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>$4),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),audiences:Gr.list(Gr.string()),conflict:Gr.record(ECe,eno),nameOverride:Gr.string().optional(),generatedName:Gr.string()}).extend(ow);var q3u=Gr.union("type",{discriminated:Gr.lazyObject(()=>N3u),undiscriminated:Gr.lazyObject(()=>F3u)}).transform({transform:e=>{switch(e.type){case"discriminated":return _nt.discriminated(e);case"undiscriminated":return _nt.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var N3u=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>x3u)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>$4))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var x3u=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>$4)});var F3u=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>$4))}).extend(QM).extend(FS).extend(jD).extend(Ov).extend(ow).extend(Cxe).extend(jP).extend(zM).extend(K4);var JGy=/^(\d+)/,ino=/^[a-zA-Z][a-zA-Z0-9_]*$/,KGy={"<":"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 Qla(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let o=Math.floor(e/10),c=e%10;return c===0?n[o]:`${n[o]}_${t[c]}`}if(e<1e3){let o=Math.floor(e/100),c=e%100;return c===0?`${t[o]}_hundred`:`${t[o]}_hundred_${Qla(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${Qla(a)}`}function nko(e){let t=e.match(JGy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=Qla(i);return n.length>0?`${a}_${n}`:a}}}function ano(e){let t=nko(e),r=KGy[e];return t!=null?aU($A(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":aU($A(e)))}function Ixe(e,t){return e.type==="primitive"&&t.type==="primitive"?$Gy(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?$sI(e.values,t.values):e.type==="array"&&t.type==="array"?Ixe(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"?Ixe(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?YsI(e.value,t.value):e.type==="object"&&t.type==="object"?XsI(e,t):e.type==="map"&&t.type==="map"?$Gy(e.key.schema,t.key.schema)&&Ixe(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function $Gy(e,t){return e.type===t.type}function $sI(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return sse(r,n)}function YsI(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:Ixe(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:Ixe(r,i)}):!1}function XsI(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let a=r[n];return a==null?!1:Ixe(a,i.schema)})}function QJ(e){switch(e){case ude.Deprecated:return"deprecated";case ude.Beta:return"pre-release";case ude.GenerallyAvailable:return"generally-available";default:return}}function ZsI(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function YGy(e){let t=e?ZsI(e):void 0;if(t==null||t.length===0)return ria;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push($A(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push($A(i.name)):r.push(i.name,ria);break}default:Zu(i.type)}else Zu(i);return r.join("/")}function X7i(e){return Cw.of(`${YGy(e)}.yml`)}function mNf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?ria:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,YGy(r))}function XGy({sdkName:e,namespaceOverride:t}){return Cw.of(`${mNf({sdkName:e,namespaceOverride:t})}.yml`)}function ZGy({location:e,namespaceOverride:t}){return t!=null?QX(Cw.of(t),e):e}function z3u(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Zu(e.type)}}function ono(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:Zu(e)}}function Y4(e){return typeof e=="string"?e:e.type}function sno(e){if(typeof e!="string")return e.docs}function iko(e){if(typeof e!="string")return e.default}function ONf(e){if(typeof e!="string")return e.validation}function eHy(e){let t=Y4(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?kGy(e):{...e,type:kGy(e.type)}}function kGy(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function Lla(e){return Y4(e).startsWith("optional<")?e:typeof e=="string"?tHy(e):{...e,type:tHy(e.type)}}function tHy(e){return e.startsWith("optional<")?e:`optional<${e}>`}var ksI=-2147483648,euI=2147483647,tuI=-17976931348623157e292,ruI=17976931348623157e292;function mC({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:a}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return Q3u(e);case"array":return wNf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return jNf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return PNf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return SNf();case"optional":return L3u({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return ENf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return fuI({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,DNf(e);case"object":return duI({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return puI({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:Zu(e)}}function Q3u(e){switch(e.schema.type){case"string":return auI({description:e.description,schema:e.schema});case"int":return ouI({description:e.description,schema:e.schema});case"float":return suI({description:e.description,schema:e.schema});case"double":return uuI({description:e.description,schema:e.schema});case"boolean":return nuI({description:e.description,schema:e.schema});case"int64":return iuI({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:QJ(e.availability)}:{}}}function nuI({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function iuI({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function auI({description:e,schema:t}){let r="string",n=cuI(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function ouI({description:e,schema:t}){let r="integer",n=rHy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function suI({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function uuI({description:e,schema:t}){let r="double",n=rHy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function cuI(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=luI(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function luI(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 rHy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=ANf(r,t),n=ANf(n,t),i=ANf(i,t),!(r==null&&n==null&&a==null&&o==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:o,multipleOf:i}}function ANf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[ksI,euI]:[tuI,ruI];return e<r||e>n?void 0:e}function PNf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=_uI(i)??e.schema,o=ono(i),c=huI(i),u=U3u({context:r,fileContainingReference:t,declarationFile:X7i(o),type:a});return i.type==="nullable"&&(u=r.wrapReferencesToNullableInOptional?`optional<${u}>`:`nullable<${u}>`),i.type==="optional"&&!u.startsWith("optional<")&&(u=`optional<${u}>`),e.description==null&&c==null?u:{type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function wNf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${Y4(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{},type:c}}function jNf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=Q3u(e.key),c=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),f=e.encoding!=null?z3u(e.encoding):void 0,u=`map<${Y4(o)}, ${Y4(c)}>`;if(e.description==null&&f==null&&e.title==null)return u;let s={type:u};return e.description!=null&&(s.docs=e.description),e.encoding!=null&&(s.encoding=f),e.availability!=null&&(s.availability=QJ(e.availability)),s}function ENf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return L3u({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let o=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=Y4(o),f=sno(o),u=iko(o),s=ONf(o),l=eHy(c);if(n.wrapReferencesToNullableInOptional&&(l=Lla(l)),e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=QJ(e.availability)),m}function L3u({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=mC({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=Y4(o),f=sno(o),u=iko(o),s=ONf(o),l=Lla(c);if(e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=QJ(e.availability)),m}function SNf(){return"unknown"}function DNf(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Zu(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function fuI({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=ako(e,i),o=e.nameOverride??e.generatedName;n.builder.addType(r,{name:o,schema:a.schema});let c=U3u({type:o,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let f={type:c};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.availability!=null&&(f.availability=QJ(e.availability)),f}function duI({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=CNf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=U3u({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function puI({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=INf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=U3u({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:QJ(e.availability)}:{}}}function U3u({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function _uI(e){return _1._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 huI(e){return _1._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:()=>{}})}var Rse;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(Rse||(Rse={}));function SPi(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Zu(e)}}function iHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=buI(e);break;case"array":a=yuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=vuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=guI({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=OuI(e.nameOverride,e.generatedName);break;case"optional":a=oHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=muI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=ako(e,i);break;case"literal":a=AuI(e,e.nameOverride,e.generatedName);break;case"object":a=CNf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=INf({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:Zu(e)}return a}function CNf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(Rse.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},f=new Set;for(let O of e.properties){if(O.readonly&&(o=!0),a&&O.readonly)continue;if(Object.keys(O.conflict).length>0){if(Object.entries(O.conflict).every(([q,V])=>!V.differentSchema))continue;Object.entries(O.conflict).forEach(([q])=>{MNf({property:O.key,schemaId:q,context:t,namespace:n}).forEach($=>{f.add($)})})}let P=mC({schema:O.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=O.audiences,M=O.nameOverride,T=QJ(O.availability),z=EuI(O);c[O.key]=juI({typeReference:P,audiences:C,name:M,availability:T,propertyAccess:z})}let u=new Set;for(let O of e.allOfPropertyConflicts)O.allOfSchemaIds.forEach(P=>f.add(P)),O.conflictingTypeSignatures&&u.add(O.propertyKey);let s=[];for(let O of e.allOf){let P=sHy({schema:O.schema,context:t,namespace:n});if(P==null||f.has(O.schema)||f.has(P))continue;let C=mC({schema:_1.reference(O),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(Y4(C))}for(let O of f){let P=BNf(t,O,n);for(let C of P.properties)c[C.key]==null&&(u.has(C.key)&&(c[C.key]="unknown"),c[C.key]=mC({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of P.allOf){if(f.has(C.schema))continue;let M=mC({schema:_1.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(Y4(M))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([O,P])=>wuI(O)?[O,typeof P=="string"?{type:P,name:`_${O}`}:{...P,name:`_${O}`}]:[O,P]))};s.length>0&&(l.extends=s),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=QJ(e.availability)),e.source!=null&&(l.source=SPi(e.source)),l.inline=TNf(e,i);let m=e.nameOverride??e.generatedName;return{name:o&&t.respectReadonlySchemas&&!a?`${m}Read`:m,schema:l}}function MNf({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return MNf({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:o}=BNf(r,t,n),c=a.some(u=>u.key===e),f=[...o.flatMap(u=>MNf({property:e,context:r,schemaId:u.schema,namespace:n}))];if(c||f.length>0)return[t,...f]}return[]}function aHy(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?BNf(e,t.schema,r):t.type==="nullable"?aHy(e,t.value,r):{properties:[],allOf:[]}}function BNf(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:aHy(e,n,r)}function yuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:wNf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function vuI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:jNf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function buI(e){let t=Q3u(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function nHy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function ako(e,t){let r={enum:e.values.map(a=>{let o=a.nameOverride??a.generatedName,c=a.value;if(o===c&&a.description==null&&(a.casing==null||nHy(a.casing)))return o;let f={value:a.value};if(o!==c&&(f.name=o),a.description!=null&&(f.docs=a.description),a.casing!=null&&!nHy(a.casing)){let u={},s=!1;a.casing.camel!=null&&(u.camel=a.casing.camel,s=!0),a.casing.screamingSnake!=null&&(u["screaming-snake"]=a.casing.screamingSnake,s=!0),a.casing.snake!=null&&(u.snake=a.casing.snake,s=!0),a.casing.pascal!=null&&(u.pascal=a.casing.pascal,s=!0),s&&(f.casing=u)}return f})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=TNf(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?SPi(e.source):void 0};for(let a of r.enum){let o=typeof a=="string"?a:a.name??a.value;n.has(o.toLowerCase())||(i.enum.push(a),n.add(o.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function guI({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:PNf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function muI({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:ENf({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:oHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function oHy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:L3u({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function OuI(e,t){return{name:e??t,schema:SNf()}}function AuI(e,t,r){return{name:t??r,schema:DNf(e)}}function INf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?z3u(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let u of e.commonProperties)c[u.key]=mC({schema:u.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let f={};for(let[u,s]of Object.entries(e.schemas))f[u]=mC({schema:s,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?QJ(e.availability):void 0,union:f,encoding:a,source:e.source!=null?SPi(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(mC({schema:c,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:o,encoding:a,source:e.source!=null?SPi(e.source):void 0,inline:TNf(e,i)}}}var PuI=/^[0-9]/;function wuI(e){return PuI.test(e)}function sHy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?sHy({context:t,schema:n.schema,namespace:r}):e}function juI({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{}}}function TNf(e,t){return e.inline===!0||t>0?!0:void 0}function EuI(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return VX.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return VX.ObjectPropertyAccess.WriteOnly}}function uHy(e){let t=e.replace(/^x-|^X-/,"");return $A(t)}function cHy(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??uHy(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(Cw.of("__package__.yml"),{name:"OauthScope",schema:ako(n.scopesEnum,0).schema})}}function jVr({header:e,context:t,fileContainingReference:r,namespace:n}){let i=mC({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=Y4(i),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:$A(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let f={type:a};return c!==e.name&&(f.name=c),e.description!=null&&(f.docs=e.description),e.env!=null&&(f.env=e.env),e.availability!=null&&(f.availability=QJ(e.availability)),f}function V3u({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=mC({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return Y4(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:Y4(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=QJ(e.availability)),a}function G3u({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=qNf({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=Y4(i.value),o=iko(i.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return o!=null&&(c.default=o),i.allowMultiple&&(c["allow-multiple"]=!0),e.description!=null&&(c.docs=e.description),e.parameterNameOverride!=null&&(c.name=e.parameterNameOverride),e.availability!=null&&(c.availability=QJ(e.availability)),SuI(i.value)&&i.value.validation!==void 0&&(c.validation=i.value.validation),c.default==null&&c["allow-multiple"]==null&&c.docs==null&&c.name==null&&c.availability==null&&c.validation==null?a:c}function qNf({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:Cw.of(jF),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(i.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(ino.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:ano(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[c,f]=i.value.schemas;if(c!=null&&f!=null&&W3u({array:c,primitive:f}))return{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&W3u({array:c,primitive:f}))return{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[c,f]of Object.entries(i.value.schemas))return qNf({schema:f,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?_1.optional:_1.nullable;if(e.value.type==="reference"){let a=t.getSchema(e.value.schema,n);if(a==null)return;if(a.type==="array")return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a.value,description:e.description??a.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(e.value.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(ino.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:ano(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[c,f]=e.value.value.schemas;if(c!=null&&f!=null&&W3u({array:c,primitive:f}))return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&W3u({array:f,primitive:c}))return{value:mC({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.objectQueryParameters)return{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[c,f]of Object.entries(e.value.value.schemas))return qNf({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.objectQueryParameters?{value:mC({schema:e,context:t,fileContainingReference:r,declarationFile:Cw.of(jF),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:mC({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:mC({schema:_1.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:mC({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function W3u({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function SuI(e){return typeof e=="object"&&e!==null&&"type"in e}function lHy({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"]=DuI(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=CuI({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=Z7i(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function DuI(e){let t={};return e.forEach(r=>{let n=Z7i(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function CuI({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=Z7i(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function Z7i(e){switch(e.type){case"primitive":return fHy(e.value);case"object":return dHy(e.properties);case"array":return IuI(e.value);case"map":return MuI(e.value);case"oneOf":return BuI(e.value);case"enum":return e.value;case"literal":return TuI(e.value);case"unknown":return Z7i(e.value);case"null":return null;default:Zu(e)}}function fHy(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:Zu(e)}}function dHy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Z7i(r)]))}function IuI(e){return e.map(t=>Z7i(t))}function MuI(e){return Object.fromEntries(e.map(t=>[fHy(t.key),Z7i(t.value)]))}function BuI(e){return e.type==="discriminated"?dHy(e.value):Z7i(e.value)}function TuI(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Zu(e)}}function oko(e){try{let r=new URL(e).pathname.split("/").filter(n=>n.length>0);if(r.length>0)return r[r.length-1]}catch{}}function H3u(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function J3u(e,t,r=!1){let n=oko(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}function DPi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function K3u(e,t){return t??(e?.groupName!=null?DPi(e.groupName):void 0)}function pHy({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=n!=null?t.groupEnvironmentsByHost?t.getUrlId(n.url)??J3u(n.name,n.url,!0):n.name:void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${n?.name}", server url="${n?.url}", resolved urlId="${i}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let a={path:e.path,url:i,auth:!1};e.audiences!=null&&e.audiences.length>0&&(a.audiences=e.audiences),e.summary!=null&&(a["display-name"]=e.summary),e.description!=null&&(a.docs=e.description);let o=DPi(e.groupName),c={};if(e.handshake.pathParameters.length>0)for(let s of e.handshake.pathParameters)c[s.name]=V3u({pathParameter:s,context:t,fileContainingReference:r,namespace:o});Object.keys(c).length>0&&(a["path-parameters"]=c);let f={};if(e.handshake.queryParameters.length>0)for(let s of e.handshake.queryParameters){let l=G3u({queryParameter:s,context:t,fileContainingReference:r,namespace:o});l!=null&&(f[s.name]=l)}Object.keys(f).length>0&&(a["query-parameters"]=f);let u={};if(e.handshake.headers.length>0)for(let s of e.handshake.headers){let l=jVr({header:s,context:t,fileContainingReference:r,namespace:o});u[s.name]=l}Object.keys(u).length>0&&(a.headers=u),t.builder.addChannel(r,{channel:a});for(let s of e.messages)t.builder.addChannelMessage(r,{messageId:s.name,message:{origin:s.origin,body:mC({schema:s.body,context:t,fileContainingReference:r,namespace:o,declarationDepth:0})}});for(let s of e.examples){let l=lHy({context:t,websocketExample:s});t.builder.addChannelExample(r,{example:l})}}function RNf(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var wht="Base",yHy="Default";function _Hy(e){try{return new URL(e).hostname}catch{return}}function hHy(e){return e??yHy}function quI(e,t){let r=new Map;for(let n of e){if(RNf(n)||!("url"in n)||!n.url)continue;let i=_Hy(n.url)??n.url;r.has(i)||r.set(i,{environmentName:hHy(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.httpServers.push({name:n.name,url:n.url,audiences:n.audiences})}for(let n of t){let i=_Hy(n.url)??n.url;r.has(i)||r.set(i,{environmentName:hHy(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function Ula(e){return Object.entries(e).reduce((t,[r,n])=>(Drt(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function vHy(e){if(e.environmentOverrides!=null){for(let[T,z]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:T,schema:z});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],n=e.ir.servers.some(T=>RNf(T)),i=e.ir.servers;for(let T of i)if(RNf(T)){let z={urls:{}};for(let[U,q]of Object.entries(T.urls))z.urls[U]=q.url;T.name&&(t[T.name]=z)}else if("url"in T&&T.url){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){r.push(z);continue}t[T.name]=z}let a={},o={},c=[];for(let T of e.ir.endpoints)for(let z of T.servers){if(z.url==null&&z.name!=null){a[z.name]||(a[z.name]=[]);continue}if(z.url==null)continue;let U=z.audiences?{url:z.url,audiences:z.audiences}:z.url;if(z.name==null){c.push(U);continue}a[z.name]||(a[z.name]=[]),a[z.name]?.push({url:z.url,audiences:z.audiences}),o[z.name]=U}let f={},u=[];for(let T of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${T.name}", url="${T.url}"`);let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){u.push(z);continue}f[T.name]=z}let s=Object.keys(t).length,l=s>0,m=Object.keys(o).length>0,O=Object.keys(a).some(T=>a[T]?.length===0),P=Object.keys(f).length>0;if(e.groupEnvironmentsByHost&&P&&(l||e.ir.servers.length>0)){let T=Object.entries(f).map(([U,q])=>({name:U,url:typeof q=="string"?q:q.url,audiences:typeof q=="string"?void 0:q.audiences})),z=quI(i,T);if(z.size>0){let U=!0;for(let[q,V]of z.entries()){let $={},re=[...V.httpServers.map(k=>({...k,isHttp:!0})),...V.websocketServers.map(k=>({...k,isHttp:!1}))],Y=new Map;for(let k of re){let ne=oko(k.url),Oe=H3u(k.url);ne&&Oe&&(Y.has(ne)||Y.set(ne,new Set),Y.get(ne)?.add(Oe))}if(V.httpServers.length>0){let k=V.httpServers[0];k!=null&&($[wht]=k.url,e.setUrlId(k.url,wht));for(let ne=1;ne<V.httpServers.length;ne++){let Oe=V.httpServers[ne];if(Oe!=null){let ye=oko(Oe.url),ge=H3u(Oe.url),pe=ye?Y.get(ye):void 0,Ce=pe&&pe.size>1,Se=Ce&&ge!=="https"?`${ye}_${ge}`:ye||`Http${ne+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${Oe.url}", pathSegment="${ye}", protocol="${ge}", hasCollision=${Ce}, urlId="${Se}"`),$[Se]=Oe.url,e.setUrlId(Oe.url,Se)}}}for(let k of V.websocketServers){let ne=oko(k.url),Oe=H3u(k.url),ye=ne?Y.get(ne):void 0,ge=ye&&ye.size>1,pe=ge?`${ne}_${Oe}`:J3u(k.name,k.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${k.name}", url="${k.url}", pathSegment="${ne}", protocol="${Oe}", hasCollision=${ge}, urlId="${pe}"`),$[pe]=k.url,e.setUrlId(k.url,pe)}if(Object.keys($).length>1)e.builder.addEnvironment({name:V.environmentName,schema:{urls:$}});else if(Object.keys($).length===1){let k=Object.values($)[0];k!=null&&e.builder.addEnvironment({name:V.environmentName,schema:k})}U&&(e.builder.setDefaultEnvironment(V.environmentName),Object.keys($).length>1&&e.builder.setDefaultUrl(wht),U=!1)}return}}if(!l&&!m&&P&&e.ir.servers.length===0){for(let[T,z]of Object.entries(f))e.builder.addEnvironment({name:T,schema:z});e.builder.setDefaultEnvironment(Object.keys(f)[0]),e.builder.setDefaultUrl(wht);return}if(c.length>0&&e.logger.debug(`Skipping endpoint level servers ${c.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),!l){let T=e.ir.servers[0]?.url,z=e.ir.servers[0]?.audiences;if(T!=null){let U=z?{url:T,audiences:z}:T;t[yHy]=U}}let C=Object.values(t).map(T=>typeof T=="string"?T:Drt(T)?Object.values(T.urls)[0]:T.url),M=r.filter(T=>{let z=typeof T=="string"?T:T.url;return!C.includes(z)});if(M.length>0&&e.logger.debug(`Skipping top level servers ${M.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),n){let T=!0;for(let[z,U]of Object.entries(t))if(e.builder.addEnvironment({name:z,schema:U}),T){if(e.builder.setDefaultEnvironment(z),Drt(U)){let q=Object.keys(U.urls)[0];q&&e.builder.setDefaultUrl(q)}T=!1}return}if(!m&&!O){let T=!0;for(let[z,U]of Object.entries(t))if(T){if(P){let q=typeof U=="string"?U:Drt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[wht]:q??"",...Ula(f)}}})}else e.builder.addEnvironment({name:z,schema:U});e.builder.setDefaultEnvironment(z),T=!1}else if(P){let q=typeof U=="string"?U:Drt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[wht]:q??"",...Ula(f)}}})}else e.builder.addEnvironment({name:z,schema:U});P&&e.builder.setDefaultUrl(wht)}else if(s===1){let T=Object.keys(t)[0],z=Object.values(t)[0],U=typeof z=="string"?z:Drt(z)?Object.values(z.urls)[0]:z.url;e.builder.addEnvironment({name:T,schema:{urls:{[wht]:U??"",...Ula(o),...Ula(f)}}}),e.builder.setDefaultEnvironment(T),e.builder.setDefaultUrl(wht)}else{let T=new Map;for(let z of e.ir.endpoints)for(let U of z.servers)if(U.url!=null&&U.name!=null){T.has(U.name)||T.set(U.name,new Map);let q=U.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",V=T.get(U.name);V&&V.set(q,U.url)}if(T.size>0){let z=!0;for(let[U,q]of Object.entries(t)){let V=typeof q=="string"?q:Drt(q)?Object.values(q.urls)[0]:q.url;if(!V)continue;let $=V.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",re={[wht]:V};for(let[Y,k]of T.entries()){let ne=k.get($)||k.get("production")||k.values().next().value;ne&&(re[Y]=ne)}P&&Object.assign(re,Ula(f)),Object.keys(re).length>1?e.builder.addEnvironment({name:U,schema:{urls:re}}):e.builder.addEnvironment({name:U,schema:V}),z&&(e.builder.setDefaultEnvironment(U),z=!1)}T.size>0&&e.builder.setDefaultUrl(wht)}else{let z=!0;for(let[U,q]of Object.entries(t)){if(P||Object.keys(o).length>0){let V=typeof q=="string"?q:Drt(q)?Object.values(q.urls)[0]:q.url;e.builder.addEnvironment({name:U,schema:{urls:{[wht]:V??"",...Ula(o),...Ula(f)}}})}else e.builder.addEnvironment({name:U,schema:q});z&&(e.builder.setDefaultEnvironment(U),z=!1)}}}}var NNf=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},RuI=.75,NuI=new Set("authorization");function bHy(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let i="optional<string>";if(n.name==null&&n.env==null&&typeof n.schema=="string")i=n.schema;else if(n!=null){let a=n.schema?ono(n.schema):void 0,o=a!=null?DPi(a):void 0,c=Cw.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?Y4(mC({schema:n.schema,context:e,fileContainingReference:o?QX(Cw.of($A(o)),c):c,namespace:o,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:i})}if(e.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let a of i.headers){if(NuI.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],f=jVr({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:Cw.of(Gk),context:e,namespace:void 0});o=new NNf(f),r[a.name]=o}o.increment()}let n=e.ir.endpoints.length*RuI;for(let[i,a]of Object.entries(r)){let o=t[i],c=a.count===e.ir.endpoints.length,f=a.count>=n;o==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):f&&e.builder.addGlobalHeader({name:i,schema:Lla(a.schema)}))}}}function gHy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?ono(t.schema):void 0,n=r!=null?DPi(r):void 0,i=jVr({header:{...t,schema:t.schema??_1.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:zq.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:Cw.of(Gk),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:Lla(i)})}}function jPe(e){switch(e.type){case"primitive":return OHy(e.value);case"object":return AHy(e.properties);case"array":return PHy(e.value);case"map":return xuI(e.value);case"oneOf":return zuI(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return QuI(e.value);case"unknown":return jPe(e.value);case"null":return null;default:Zu(e)}}function mHy(e){switch(e.type){case"withStreaming":return e.sse?{stream:FuI(e.events)}:{stream:PHy(e.events)};case"withoutStreaming":return{body:jPe(e.value)};default:Zu(e)}}function OHy(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:Zu(e)}}function AHy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,jPe(r)]))}function FuI(e){return e.map(t=>({event:"",data:jPe(t)}))}function PHy(e){return e.map(t=>jPe(t))}function xuI(e){return Object.fromEntries(e.map(t=>[OHy(t.key),jPe(t.value)]))}function zuI(e){return e.type==="discriminated"?AHy(e.value):jPe(e.value)}function QuI(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Zu(e)}}function wHy({endpointExample:e,context:t}){let r={};if(e.type!=="full")return e.value;e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=LuI(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=UuI(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),a=Object.keys(i).length>0,o=new Set(e.headers?.map(c=>c.name)??[]);if(n||a){let c=[];if(e.headers!=null)for(let f of e.headers)f.name!==t.builder.getAuthHeaderName()&&c.push(f);for(let[f,u]of Object.entries(i))if(!o.has(f))if(u!=null&&typeof u=="object"&&u.type!=null){let s=uee({type:u.type,_default:void 0,validation:void 0,visitor:{primitive:l=>l.toString(),map:l=>l.toString(),list:l=>l,optional:l=>l,nullable:l=>l,set:l=>l,named:l=>l,literal:l=>{if(l.type==="string")return l.string;if(l.type==="boolean")return l.boolean.toString()},unknown:Tc}});s!=null&&c.push({name:f,value:NS.literal(L7i.string(s))})}else c.push({name:f,value:NS.primitive(zO.string(f))});r.headers=VuI({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=jPe(e.request)),e.response!=null&&(r.response=mHy(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(c=>c.type==="language"?{name:c.name??void 0,docs:c.description??void 0,language:c.language,code:c.code,install:c.install??void 0}:{name:c.name??void 0,docs:c.description??void 0,sdk:c.sdk,code:c.code}).filter(_j)),r}function LuI(e){let t={};return e.forEach(r=>{let n=jPe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function UuI(e){let t={};return e.forEach(r=>{let n=jPe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function VuI({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=jPe(n.value);i!=null&&(r[n.name]=i)}),r}function jHy(e){return lde._visit(e,{get:()=>VX.HttpMethodSchema.Get,post:()=>VX.HttpMethodSchema.Post,put:()=>VX.HttpMethodSchema.Put,patch:()=>VX.HttpMethodSchema.Patch,delete:()=>VX.HttpMethodSchema.Delete,head:()=>VX.HttpMethodSchema.Head,options:()=>{throw new Error("OPTIONS is unsupported")},trace:()=>{throw new Error("TRACE is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function EHy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function SHy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,o=e.path,c=K3u(e.sdkName,e.namespace),f={};for(let M of e.pathParameters)M.parameterNameOverride&&(o=o.replace(M.name,M.parameterNameOverride)),f[M.parameterNameOverride??M.name]=V3u({pathParameter:M,context:r,fileContainingReference:t,namespace:c}),a.add(M.name);let u={};for(let M of e.queryParameters){let T=G3u({queryParameter:M,context:r,fileContainingReference:t,namespace:c});T!=null&&(u[M.name]=T,a.add(M.name))}let s;if(e.pagination!=null)switch(e.pagination.type){case"cursor":s={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":s={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":s={type:"custom",results:e.pagination.results};break;default:Zu(e.pagination)}let l={path:o,method:jHy(e.method),auth:Object.keys(e.security).length>0?e.security:void 0,docs:e.description??void 0,pagination:s,source:e.source!=null?SPi(e.source):void 0};!JuI({context:r,request:e.request})&&Object.keys(f).length>0&&(l["path-parameters"]=f),e.summary!=null&&(l["display-name"]=e.summary);let m={},O=r.builder.getGlobalHeaderNames(),P=r.builder.getAuthHeaderName();P!=null&&O.add(P);let C=e.headers.filter(M=>!O.has(M.name));for(let M of C){let T=jVr({header:M,context:r,fileContainingReference:t,namespace:c});m[M.name]=T,a.add(typeof T=="string"?M.name:T.name??M.name)}if(e.request!=null){r.setInState(Rse.Request);let M=HuI({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(u).length>0?u:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(m).length>0?m:void 0,usedNames:a,namespace:c});l.request=M.value,i=[...i,...M.schemaIdsToExclude??[]],r.unsetInState(Rse.Request)}else{let M=r.inlinePathParameters&&Object.keys(f).length>0,T=Object.keys(u).length>0,z=Object.keys(m).length>0,U={};(M||T||z)&&(U.name=e.requestNameOverride??e.generatedRequestName),M&&(U["path-parameters"]=f),T&&(U["query-parameters"]=u),z&&(U.headers=m),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:M=>{let T=mC({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:M.description??void 0,type:Y4(T)},M.statusCode!=null&&(l.response["status-code"]=M.statusCode),M.responseProperty!=null&&(l.response.property=M.responseProperty)},streamingJson:M=>{let T=mC({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:Y4(T),format:"json"}},streamingSse:M=>{let T=mC({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:Y4(T),format:"sse"}},file:M=>{l.response={docs:M.description??void 0,type:"file","status-code":M.statusCode}},bytes:M=>{l.response={docs:M.description??void 0,type:"bytes","status-code":M.statusCode}},streamingText:M=>{l["response-stream"]={docs:M.description??void 0,type:"text"}},text:M=>{l.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(),T=e.servers[0];T==null?M!=null&&(l.url=M):l.url=T.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=QJ(e.availability)),Object.entries(e.errors).forEach(([M,T])=>{let z=T.generatedName,U=Cw.of(jF);r.builder.enableUniqueErrorsPerEndpoint&&(z=`${e.generatedRequestName}${T.generatedName}`,T.schema!=null&&(T.schema.type!=="reference"&&T.schema.type!=="oneOf"?T.schema.generatedName=`${e.generatedRequestName}${T.schema.generatedName}`:T.schema.type==="oneOf"&&(T.schema.value.generatedName=`${e.generatedRequestName}${T.schema.value.generatedName}`)));let q={"status-code":parseInt(M)},V=ZGy({location:DHy,namespaceOverride:c});if(T.schema!=null){let Y=mC({schema:T.schema,context:r,fileContainingReference:V,declarationFile:V,namespace:c,declarationDepth:0});q.type=Y4(Y),q.docs=T.description}r.builder.addError(V,{name:z,schema:r.isErrorUnknownSchema(parseInt(M))?{...q,type:"unknown"}:q}),l.errors==null&&(l.errors=[]);let $=r.builder.addImport({file:t,fileToImport:V});l.errors.push($!=null?`${$}.${z}`:z),q.type!=null&&T.examples?.forEach(Y=>{let k={value:jPe(Y.example),name:Y.name,docs:Y.description};r.builder.addErrorExample(V,{name:z,example:k})})}),e.examples.length>0&&(l.examples=WuI({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=GuI({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[FNf,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function WuI({endpointExamples:e,context:t}){return e.map(r=>{try{return wHy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function GuI({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:Zu(e)}}function HuI({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:f,headers:u,usedNames:s,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let m=n.schema.type==="reference"?n.schema.schema:void 0,O=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(O?.type!=="object"||m!=null&&f.includes(m)){let z=mC({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),U={schemaIdsToExclude:[],value:{body:z}},q=Object.keys(o??{}).length>0,V=Object.keys(c??{}).length>0,$=Object.keys(u??{}).length>0;return q&&(U.value["path-parameters"]=o),V&&(U.value["query-parameters"]=c),$&&(U.value.headers=u),(q||V||$)&&(U.value.name=i??a),n.contentType!=null&&(U.value["content-type"]=n.contentType),n.description!=null&&(U.value.docs=n.description),U}let P=Object.fromEntries(O.properties.filter(z=>z.readonly==null?!0:!(EHy(e.method)&&z.readonly)).map(z=>{let U=mC({schema:z.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),q=z.nameOverride??z.key,V=QJ(z.availability);if(!s.has(q)&&z.audiences.length<=0)return s.add(q),z.nameOverride!=null?[z.key,{type:Y4(U),docs:sno(U),name:z.nameOverride,availability:V}]:[z.key,V?{...typeof U=="string"?{type:U}:U,availability:V}:U];let $={type:Y4(U),docs:sno(U)};return s.has(q)&&($.name=z.generatedName),z.audiences.length>0&&($.audiences=z.audiences),V!=null&&($.availability=V),s.add(q),[z.key,$]})),C=O.allOf.map(z=>{let U=mC({schema:_1.reference(z),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return Y4(U)}).filter(z=>z!=="unknown"),M={properties:P};C.length>0&&(M.extends=C),n.additionalProperties&&(M["extra-properties"]=!0);let T={name:i??O.nameOverride??O.generatedName,"path-parameters":o,"query-parameters":c,headers:u,body:M};return n.contentType!=null&&(T["content-type"]=n.contentType),n.description!=null&&(T.docs=n.description),{schemaIdsToExclude:m!=null?[m]:[],value:T}}else if(n.type==="octetStream"){let m={body:"bytes","content-type":n.contentType??R2.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(m.name=i??a),n.description!=null&&(m.docs=n.description),{schemaIdsToExclude:[],value:m}}else if(n.type==="multipart"){let m=Object.fromEntries(n.properties.map(O=>{if(O.schema.type==="file"){let P=O.schema.isArray?"list<file>":"file";if(P=O.schema.isOptional?`optional<${P}>`:P,O.description!=null||O.contentType!=null){let C={type:P};if(O.description!=null&&(C.docs=O.description),O.contentType!=null){let M=O.contentType.split(",")[0];C["content-type"]=M}return[O.key,C]}return[O.key,P]}else{let P=mC({schema:O.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(O.contentType||O.exploded||O.encoding){let C=typeof P=="string"?{type:P}:P;O.contentType!=null&&(C["content-type"]=O.contentType),O.encoding==="form"?C.style="form":O.encoding==="json"?C.style="json":O.exploded&&(C.style="exploded"),P=C}return[O.key,P]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??a,"path-parameters":o,"query-parameters":c,headers:u,body:{properties:m},"content-type":R2.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else Zu(n)}function JuI({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;case"formUrlEncoded":return!0;default:Zu(t)}}function KuI({location:e,namespaceOverride:t}){return t!=null?{...e,file:QX(Cw.of(t),e.file)}:e}function $uI(e){let t=e.namespace,r=e.tags.filter(f=>f!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:Cw.of(`${$A(r)}.yml`),endpointId:e.summary!=null?$A(e.summary):$A(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:Cw.of(jF),endpointId:$A(e.summary)}:{file:Cw.of(jF),endpointId:$A(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:Cw.of(jF),endpointId:n};let i=sko(r),a=sko(n);if(sse(i,a))return{file:Cw.of("__package__.yml"),endpointId:r};let o=ZuI({operationId:n,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let f=0;f<i.length;++f){let u=i[f];if(u!=null&&u===a[f])c.push(u);else{let s=$A(r);return{file:Cw.of(`${s}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:Cw.of($A(c.join("_"))+".yml"),endpointId:$A(a.slice(c.length).join("_")),tag:r}}function uko(e){let t=e.tags[0];if(e.sdkName!=null){let r=mNf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:Cw.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return KuI({namespaceOverride:e.namespace,location:$uI(e)})}function sko(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=wdt(t),t}var YuI=new RegExp("[^a-zA-Z0-9{}]+"),XuI=new RegExp("[{}]","g");function ZuI({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(YuI).join("_").replaceAll(XuI,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:Cw.of($A(t)+".yml"),endpointId:$A(e.slice(0,-1*a.length)),tag:t}}function CHy(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:o,file:c,tag:f}=uko(a),u=c.split(".")[0];u!=null&&t.add(u);let s;if(a.sdkName!=null){let O=e.ir.groups;for(let P of a.sdkName.groupName){let C=typeof P=="string"?P:P.name,M=O[C];if(M==null)break;if(M.summary!=null||M.description!=null){s=O[C];break}}}let l=f==null?void 0:n.tagsById[f];e.setInState(Rse.Endpoint),e.setEndpointMethod(a.method);let m=SHy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(Rse.Endpoint),i=[...i,...m.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:m.value,source:a.source!=null?SPi(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":s?.summary??l?.id,docs:s?.description??l?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function IHy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?DPi(r.groupName):void 0,i=mC({schema:_1.primitive(r),context:e,fileContainingReference:Cw.of(jF),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:Y4(i),docs:r.description??void 0}})}}function MHy(e){for(let t of e.ir.webhooks){let r=tcI({webhook:t,context:e});if(r==null)continue;let n=K3u(t.sdkName,t.namespace),i={};for(let o of t.headers)i[o.name]=jVr({header:o,context:e,fileContainingReference:r.file,namespace:n});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:mC({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),examples:t.examples!=null?t.examples.map(o=>({docs:o.description,name:o.name,payload:jPe(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function kuI({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:QX(Cw.of(t),e.file)}:e}function ecI({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:Cw.of(jF),endpointId:n};let i=sko(r),a=sko(n);if(sse(i,a))return{file:Cw.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<i.length;++c){let f=i[c];if(f!=null&&f===a[c])o.push(f);else{let u=$A(r);return{file:Cw.of(`${u}.yml`),endpointId:n,tag:r}}}if(o.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:Cw.of($A(o.join("_"))+".yml"),endpointId:$A(a.slice(o.length).join("_")),tag:r}}function tcI({webhook:e,context:t}){return e.sdkName!=null?{file:XGy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:kuI({namespaceOverride:e.namespace,location:ecI({webhook:e,context:t})})}var rcI=Cw.of(jF);function THy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return BHy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return BHy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return rcI;default:Zu(e)}}function BHy({namespace:e,groupName:t}){return e!=null&&t!=null?X7i([{type:"namespace",name:e},...t]):e!=null?X7i([{type:"namespace",name:e}]):X7i(t)}var FNf="external",DHy=Cw.of(jF);function qHy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let o=THy(a),c=iHy({schema:a,context:n,declarationFile:o,namespace:r,declarationDepth:0});if(G3i(c.schema)){let f=Y4(c.schema);if(f===(c.name??i)||f===`optional<${c.name??i}>`||f===`nullable<${c.name??i}>`||f===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(o,{name:c.name??i,schema:c.schema})}}function RHy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),vHy(e),bHy(e),gHy(e),cHy(e),IHy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(FNf);let t=CHy(e),r=t.sdkGroups;e.setInState(Rse.Webhook),MHy(e),e.unsetInState(Rse.Webhook),e.setInState(Rse.Channel);for(let i of Object.values(e.ir.channels)){let a=X7i(i.groupName);pHy({channel:i,context:e,declarationFile:a})}e.unsetInState(Rse.Channel);let n=ncI({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});qHy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))qHy({schemas:a,schemaIdsToExclude:n,namespace:i,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 ncI({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),i=new Set(t);for(let a of n)r.includes(a)||i.add(a);return Array.from(i)}var cko=class{context;constructor(t){this.context=t}};var $3u=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[o,c]of Object.entries(n.files)){let f=i!=null?Cw.of(`${i}${"/"}${o}`):Cw.of(o);t[f]=c}let a=Object.keys(n.directories).sort();for(let o of a){let c=i!=null?`${i}${"/"}${o}`:o,f=n.directories[o];r(f,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Cw.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var Vla=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new $3u,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:a}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(o.service.auth=r),n!=null&&(o.service["base-path"]=n),i!=null&&(o.service["display-name"]=i),a!=null&&(o.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 MLr(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))NHy(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(NHy(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??$A((zdt(r)+"/"+Eia(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Cw.of(Gk))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=cau(zdt(LGa.of(`/${t}`)),LGa.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=cau(zdt(LGa.of(`/${t}`)),LGa.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===Cw.of(Gk))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let a=i.types[r];a!=null&&(typeof a=="string"?i.types[r]={type:a,examples:[n]}:(a.examples==null&&(a.examples=[]),a.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let a=i.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(c=>sse(c,n))??!1)||a.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(a.service.source=i),a.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=QX(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,a])=>[i,{...a,path:QX(r,a.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([a,o])=>[a,{...o,path:QX(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===jF?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 NHy(e){return e?.header!=null}var Y3u=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;groupEnvironmentsByHost;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:a,authOverrides:o}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=o,this.globalHeaderOverrides=a,this.detectGlobalHeaders=n?.detectGlobalHeaders??!0,this.objectQueryParameters=n?.objectQueryParameters??!1,this.respectReadonlySchemas=n?.respectReadonlySchemas??!1,this.respectNullableSchemas=n?.respectNullableSchemas??!1,this.onlyIncludeReferencedSchemas=n?.onlyIncludeReferencedSchemas??!1,this.inlinePathParameters=n?.inlinePathParameters??!1,this.useBytesForBinaryResponse=n?.useBytesForBinaryResponse??!1,this.respectForwardCompatibleEnums=n?.respectForwardCompatibleEnums??!1,this.referencedSchemaIds=n?.onlyIncludeReferencedSchemas?new Set:void 0,this.enableUniqueErrorsPerEndpoint=n?.enableUniqueErrorsPerEndpoint??!1,this.wrapReferencesToNullableInOptional=n?.wrapReferencesToNullableInOptional??!0,this.coerceOptionalSchemasToNullable=n?.coerceOptionalSchemasToNullable??!0,this.groupEnvironmentsByHost=n?.groupEnvironmentsByHost??!1,this.builder=new Vla(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let f of r.endpoints)for(let[u,s]of Object.entries(f.errors)){let l=parseInt(u),m=c[l];m==null&&s.schema!=null?c[l]=s.schema:m!=null&&s.schema!=null&&Ixe(m,s.schema)||this.unknownSchema.add(l)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.onlyIncludeReferencedSchemas&&this.isInAnyState(Rse.Channel,Rse.Endpoint,Rse.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:Zu(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:Zu(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function xNf(e){let t=new Y3u(e);return RHy(t)}var X3u=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=xNf({taskContext:t,ir:r,options:XZo({overrides:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.args.respectNullableSchemas,wrapReferencesToNullableInOptional:n?.wrapReferencesToNullableInOptional??this.args.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:n?.coerceOptionalSchemasToNullable??this.args.coerceOptionalSchemasToNullable,onlyIncludeReferencedSchemas:n?.onlyIncludeReferencedSchemas??this.args.onlyIncludeReferencedSchemas,inlinePathParameters:n?.inlinePathParameters??this.args.inlinePathParameters,objectQueryParameters:n?.objectQueryParameters??this.args.objectQueryParameters,useBytesForBinaryResponse:n?.useBytesForBinaryResponse??this.args.useBytesForBinaryResponse,respectForwardCompatibleEnums:n?.respectForwardCompatibleEnums??this.args.respectForwardCompatibleEnums,groupEnvironmentsByHost:n?.groupEnvironmentsByHost??this.args.groupEnvironmentsByHost,removeDiscriminantsFromSchemas:n?.removeDiscriminantsFromSchemas??this.args.removeDiscriminantsFromSchemas}}),authOverrides:n?.auth!=null?{auth:n.auth}: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:i??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Pg.dump(a.rootApiFile)},namedDefinitionFiles:{...Ig(a.definitionFiles,o=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Pg.dump(o),contents:o})),[Cw.of(jF)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Pg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var lko=class extends mqr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;groupEnvironmentsByHost;removeDiscriminantsFromSchemas;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.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.groupEnvironmentsByHost=t.groupEnvironmentsByHost,this.removeDiscriminantsFromSchemas=t.removeDiscriminantsFromSchemas,this.converter=new X3u(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:n},i){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:n},i);return this.converter.convert({context:t,ir:a,settings:i,absoluteFilePath:r})}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new fnt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var ebe={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 uno={of(e){return e}};var FHy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},zNf={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:FHy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},yb={SOURCE:uno.of("source"),SDK_NAMESPACE:uno.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:uno.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:uno.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:uno.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",RETRIES:"x-fern-retries",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",IS_DISCRIMINATED:"x-fern-discriminated",EXPLORER_ENABLED:"x-fern-explorer-enabled"};var XL={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",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!0,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,groupEnvironmentsByHost:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0,removeDiscriminantsFromSchemas:lm.RemoveDiscriminantsFromSchemas.Always};function jht({options:e,overrides:t}){return{disableExamples:t?.disableExamples??XL.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??XL.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??XL.useTitlesAsName,audiences:t?.audiences??e?.audiences??XL.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??XL.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??XL.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??XL.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??XL.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??XL.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??XL.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??XL.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??XL.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??XL.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??XL.objectQueryParameters,filter:t?.filter??e?.filter??XL.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??XL.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??XL.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??XL.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??XL.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??XL.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??XL.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??XL.inlineAllOfSchemas,resolveAliases:t?.resolveAliases??e?.resolveAliases??XL.resolveAliases,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??XL.groupMultiApiEnvironments,groupEnvironmentsByHost:t?.groupEnvironmentsByHost??e?.groupEnvironmentsByHost??XL.groupEnvironmentsByHost,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??XL.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??XL.coerceOptionalSchemasToNullable,removeDiscriminantsFromSchemas:t?.removeDiscriminantsFromSchemas??e?.removeDiscriminantsFromSchemas??XL.removeDiscriminantsFromSchemas}}var xHy={naming:"v1"};function iv(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function fko(e,t,r,n,i=[]){try{let a=iv(e,t);if(a!=null)return r.parse(a)}catch{let o=wdt(i).join(" -> ");n.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function Wla(e){let t=iv(e,"examples");if(t!=null){if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null)return Object.values(t).map(r=>typeof r=="object"&&r!==null&&"value"in r?r.value:r)}return[]}function zHy({schema:e,logger:t}){return iv(e,yb.ENCODING)??void 0}function QHy(e){return iv(e,yb.FERN_ENUM)}function LHy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let o=iv(n,yb.SDK_NAMESPACE),c=iv(n,yb.SDK_GROUP_NAME),f=iv(n,yb.TYPE_DEFINITION);if(f!=null)return dko({fernType:f,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function dko({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c}){return uee({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.base64({example:void 0})});case"BOOLEAN":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.boolean({default:void 0,example:void 0})});case"DATE":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.date({example:void 0})});case"DATE_TIME":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.datetime({example:void 0})});case"FLOAT":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.float({example:void 0})});case"DOUBLE":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.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 jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.uint({default:void 0,example:void 0})});case"INTEGER":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.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 jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.uint64({default:void 0,example:void 0})});case"LONG":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return jh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:k0.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Zu(f.v1)}},unknown:()=>jh.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:o,groupName:c}),map:({keyType:f,valueType:u})=>f?.type==="primitive"&&u!=null?jh.map({nameOverride:t,generatedName:r,title:n,key:f,value:u,description:i,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:f=>f!=null?jh.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:f=>f!=null?jh.optional({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:f=>f!=null?jh.nullable({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:f=>f!=null?jh.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:f=>jh.literal({nameOverride:t,generatedName:r,title:n,value:f._visit({string:u=>NV.string(u),boolean:u=>NV.boolean(u),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:o,groupName:c}),named:f=>jh.reference({schema:f,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,source:PPe.openapi({file:"<memory>"})})}})}function UHy(e){let t=iv(e,yb.SOURCE);if(t!=null)return t.endsWith(".proto")?PPe.protobuf({file:t}):PPe.openapi({file:t})}function Gla(e){if(e!=null&&typeof e=="boolean")return e}function u0(e){return e?.$ref!=null}function VHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:u,namespace:s,groupName:l,example:m,encoding:O,source:P}){return i===void 0&&(i=u.options.additionalPropertiesDefaultsTo),QNf({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:k0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof i=="boolean"||pko(i,u.options)?jh.unknown({...icI(i),generatedName:`${t}Value`}):WHy(xS(i,!1,u.options.optionalAdditionalProperties?f:!1,u,[...n,"Value"],P,s,void 0,void 0,void 0)),namespace:s,groupName:l,example:m,encoding:O})}function WHy(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=WHy(e.value);break;case"oneOf":e.value.inline=!0;break;default:Zu(e)}return e}function QNf({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:a,wrapAsNullable:o,description:c,availability:f,namespace:u,groupName:s,example:l,encoding:m}){let O=jh.map({nameOverride:e,generatedName:t,title:r,description:c,availability:f,key:n,value:i,namespace:u,groupName:s,encoding:m,example:l,inline:void 0});return o&&(O=jh.nullable({nameOverride:e,generatedName:t,title:r,value:O,description:c,availability:f,namespace:u,groupName:s,inline:void 0})),a&&(O=jh.optional({nameOverride:e,generatedName:t,title:r,value:O,description:c,availability:f,namespace:u,groupName:s,inline:void 0})),O}function pko(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!(u0(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null||"allOf"in e&&e.allOf!=null||"enum"in e&&e.enum!=null)}function icI(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||u0(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function GHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:u,namespace:s,groupName:l,example:m,source:O}){let P=i==null?jh.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:s,groupName:l}):xS(i,!1,!1,u,[...n,"Item"],O,s);return acI({nameOverride:e,generatedName:t,title:r,namespace:s,groupName:l,itemSchema:P,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,example:m})}function acI({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:u,example:s}){let l=jh.array({nameOverride:e,generatedName:t,title:r,value:n,description:o,availability:c,namespace:f,groupName:u,example:s,inline:void 0});return a&&(l=jh.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),i&&(l=jh.optional({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),l}function EPe(e){switch(iv(e,yb.AVAILABILITY)){case"deprecated":return ude.Deprecated;case"beta":return ude.Beta;case"generally-available":return ude.GenerallyAvailable;default:break}if(!u0(e)&&e.deprecated)return ude.Deprecated}function LNf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:u,discriminator:s,context:l,namespace:m,groupName:O,encoding:P,source:C}){let M=s.propertyName,T=Object.fromEntries(Object.entries(s.mapping??{}).map(([U,q])=>{let V=CPi({$ref:q},!1,!1,l,[q],P,C,m);return l.markReferencedByDiscriminatedUnion({$ref:q},M,1),[U,V]})),z=Object.entries(i).filter(([U])=>U!==M).map(([U,q])=>{let V=c!=null&&c.includes(U),[$,re]=l.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=xS(q,$,re,l,[...n,U],C,m);return{key:U,schema:Y}});return HHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:u,properties:z,description:a,availability:o,discriminant:M,subtypes:T,namespace:m,groupName:O,source:C})}function UNf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:u,discriminant:s,variants:l,context:m,namespace:O,groupName:P,encoding:C,source:M}){let T=Object.fromEntries(Object.entries(l).map(([U,q])=>{if(u0(q)){let V=CPi(q,!1,!1,m,[q.$ref],C,M,O);return m.markReferencedByDiscriminatedUnion(q,s,1),[U,V]}else{let V=cno(q,!1,!1,m,[...n,U],C,M,O,new Set([s]));return[U,V]}})),z=Object.entries(i).filter(([U])=>U!==s).map(([U,q])=>{let V=c!=null&&c.includes(U),[$,re]=m.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=xS(q,$,re,m,[...n,U],M,O);return{key:U,schema:Y}});return HHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:u,properties:z,description:a,availability:o,discriminant:s,subtypes:T,namespace:O,groupName:P,source:M})}function HHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,availability:c,discriminant:f,subtypes:u,namespace:s,groupName:l,source:m}){let O=jh.oneOf(_nt.discriminated({description:o,availability:c,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:u,commonProperties:a,namespace:s,groupName:l,encoding:void 0,source:m,inline:void 0}));return i&&(O=jh.nullable({nameOverride:e,generatedName:t,title:r,value:O,namespace:s,groupName:l,description:o,availability:c,inline:void 0})),n&&(O=jh.optional({nameOverride:e,generatedName:t,title:r,value:O,namespace:s,groupName:l,description:o,availability:c,inline:void 0})),O}function JHy(e){if(e.proto!=null)return Sro.protobuf({typeName:e.proto.type})}function k7i({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:o,description:c,availability:f,wrapAsOptional:u,wrapAsNullable:s,namespace:l,groupName:m,context:O,source:P,inline:C}){let M=scI(i??[]),T=new Set(a),z=Array.from(T).map((q,V)=>{let $=n?.[q],re=M[V],Y=ino.test(q),k=$?.name??re,ne=Y?q:ano(q);return k!=null&&!ino.test(k)&&(O?.logger.warn(`Enum name override ${k} is not a valid name. Falling back on ${ne}.`),k=void 0),{nameOverride:k,generatedName:ne,value:q,description:$?.description,availability:f,casing:{snake:$?.casing?.snake??void 0,pascal:$?.casing?.pascal??void 0,screamingSnake:$?.casing?.screamingSnake??void 0,camel:$?.casing?.camel??void 0}}}),U=o!=null?z.find(q=>q.value===o):void 0;return ocI({wrapAsOptional:u,wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:z,_default:U,description:c,availability:f,namespace:l,groupName:m,source:P,inline:C})}function ocI({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:a,_default:o,description:c,availability:f,namespace:u,groupName:s,source:l,inline:m}){let O=jh.enum({nameOverride:r,generatedName:n,title:i,values:a,description:c,availability:f,default:o,example:void 0,namespace:u,groupName:s,source:l,inline:m});return t&&(O=jh.nullable({nameOverride:r,generatedName:n,title:i,value:O,description:c,availability:f,namespace:u,groupName:s,inline:m})),e&&(O=jh.optional({nameOverride:r,generatedName:n,title:i,value:O,description:c,availability:f,namespace:u,groupName:s,inline:m})),O}function scI(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function KHy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsOptional:m,wrapAsNullable:O,example:P,namespace:C,groupName:M}){return n==="int64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint32"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M})}function ucI(e){return typeof e=="string"?NV.string(e):typeof e=="boolean"?NV.boolean(e):NV.string(`${e}`)}function $Hy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:a,description:o,availability:c,namespace:f,groupName:u}){let s=jh.literal({nameOverride:e,generatedName:t,title:r,value:ucI(a),description:o,availability:c,namespace:f,groupName:u});return i&&(s=jh.nullable({nameOverride:e,generatedName:t,title:r,value:s,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),n&&(s=jh.optional({nameOverride:e,generatedName:t,title:r,value:s,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),s}function VNf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsOptional:m,wrapAsNullable:O,example:P,namespace:C,groupName:M}){return n==null||n==="double"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.double({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="float"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.float({example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="int32"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="int64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint32"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="uint64"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):n==="time-delta"?Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.float({example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M}):Nse({nameOverride:e,generatedName:t,title:r,primitive:k0.float({example:P}),wrapAsOptional:m,wrapAsNullable:O,description:s,availability:l,namespace:C,groupName:M})}var ccI={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},lcI={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}}},fcI={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}}},dcI={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},pcI={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},_cI={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},hcI={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ycI={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function _ko(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[ccI,lcI,fcI,dcI,pcI,_cI,hcI,ycI],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:o,newBreadcrumbs:c}=a.applyStrategy(t);t=o,r=[...r,...c]}}while(t.join("")!==i.join(""));return r}function nie(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:aU($A(i))).join("");return/^\d/.test(n)?nko(n)??n:n}function YHy(e){let t=e.join("_");return $A(t)}function J7(e){switch(e.type){case"object":return _1.object({allOf:e.allOf,properties:e.properties.map(t=>bcI(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:e.inline});case"array":return _1.array({description:e.description,availability:e.availability,value:J7(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return _1.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return _1.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"nullable":return _1.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:J7(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return _1.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:J7(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return _1.primitive({description:e.description,availability:e.availability,schema:XHy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return _1.map({description:e.description,availability:e.availability,key:_1.primitive({description:e.key.description,availability:e.key.availability,schema:XHy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:J7(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,inline:e.inline});case"reference":return _1.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return _1.oneOf(vcI(e.value));case"unknown":return _1.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Zu(e)}}function vcI(e){switch(e.type){case"discriminated":return mVr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:J7(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,J7(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return mVr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>J7(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:Zu(e)}}function XHy(e){switch(e.type){case"string":return zq.string(e);case"base64":return zq.base64();case"boolean":return zq.boolean(e);case"date":return zq.date();case"datetime":return zq.datetime();case"double":return zq.double(e);case"float":return zq.float();case"int":return zq.int(e);case"int64":return zq.int64(e);case"uint":return zq.uint();case"uint64":return zq.uint64();default:Zu(e)}}function bcI(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:J7(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function Z3u(e,t){return Ixe(J7(e),J7(t))}function ZHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:o,wrapAsOptional:c,wrapAsNullable:f,allOf:u,context:s,propertiesToExclude:l,namespace:m,groupName:O,fullExamples:P,additionalProperties:C,availability:M,source:T}){let z=[...o??[]],U={...kHy({properties:i,breadcrumbs:n,context:s})},q=[],V=[];for(let ne of u)if(!s.options.inlineAllOfSchemas&&u0(ne)){let Oe=s.resolveSchemaReference(ne);if(Oe.discriminator!=null&&Oe.discriminator.mapping!=null)continue;if(Oe.oneOf!=null||Oe.anyOf!=null){let ge=Oe.oneOf??Oe.anyOf;if(ge!=null){for(let pe of ge){let Ce=u0(pe)?s.resolveSchemaReference(pe):pe,je=xS(Ce,!1,!1,s.DUMMY,n,T,m);je.type==="object"&&q.push(...je.properties.map(Se=>Se.schema.type!=="optional"&&Se.schema.type!=="nullable"?{...Se,schema:jh.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Se.schema,description:void 0,availability:Se.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Se))}continue}}let ye=e8i(ne);if(ye==null)continue;V.push({schemaId:ye,convertedSchema:WNf(ne,[ye],T,s.options.preserveSchemaIds),properties:eJy({schema:ne,context:s,breadcrumbs:n,source:T,namespace:m})}),s.markSchemaAsReferencedByNonRequest(ye)}else if(u0(ne)){let Oe=s.resolveSchemaReference(ne),ye=xS(Oe,!1,!1,s,n,T,m);ye.type==="object"&&q.push(...ye.properties)}else{let Oe=ne.required??[];q=q.map(ge=>(ge.schema.type==="optional"||ge.schema.type==="nullable")&&Oe.includes(ge.key)?{...ge,schema:ge.schema.value}:ge);let ye=xS(ne,!1,!1,s,n,T,m);ye.type==="object"&&q.push(...ye.properties)}let $={};for(let ne of V)for(let[Oe,ye]of Object.entries(ne.properties)){let ge=$[Oe];ge!=null?(ge.schemaIds.push(ne.schemaId),ge.schemas.some(Ce=>Z3u(Ce,ye))||ge.schemas.push(ye)):$[Oe]={schemaIds:[ne.schemaId],schemas:[ye]}}let re=[];for(let[ne,Oe]of Object.entries($))Oe.schemaIds.length>1&&re.push({propertyKey:ne,allOfSchemaIds:Oe.schemaIds,conflictingTypeSignatures:Oe.schemas.length>1});let Y=Object.fromEntries(Object.entries(U).filter(([ne,Oe])=>!(!u0(Oe)&&Oe.type==="null"))),k=Object.entries(Y).map(([ne,Oe])=>{let ye=iv(Oe,yb.AUDIENCES)??[],ge=EPe(Oe),pe=u0(Oe)?!1:Oe.readOnly,Ce=u0(Oe)?!1:Oe.writeOnly,Se=!(z.includes(ne)&&!pe),Ot=iv(Oe,yb.FERN_PROPERTY_NAME),mt=[...n,ne],Qe=YHy(mt),Be=xS(Oe,Se,!1,s,mt,T,m),er={};for(let pt of V){let Ar=pt.properties[ne];Ar!=null&&!Z3u(Be,Ar)?er[pt.schemaId]={differentSchema:!0}:Ar!=null&&(er[pt.schemaId]={differentSchema:!1})}return{key:ne,schema:Be,nameOverride:Ot,audiences:ye,conflict:er,generatedName:Qe,availability:ge,readonly:pe,writeonly:Ce}});return k.push(...q.map(ne=>{let Oe=ne.conflict;for(let ye of V){let ge=ye.properties[ne.key];ge!=null&&!Z3u(ne.schema,ge)?Oe[ye.schemaId]={differentSchema:!0}:ge!=null&&(Oe[ye.schemaId]={differentSchema:!1})}return{...ne,conflict:Oe}})),gcI({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,properties:k.filter(ne=>!l.has(ne.key)),description:a,allOf:V.map(ne=>ne.convertedSchema),allOfPropertyConflicts:re,namespace:m,groupName:O,fullExamples:P,additionalProperties:C,availability:M,source:T,context:s})}function gcI({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,allOf:c,allOfPropertyConflicts:f,namespace:u,groupName:s,fullExamples:l,additionalProperties:m,availability:O,source:P,context:C}){let M=jh.object({description:o,properties:a,nameOverride:e,generatedName:t,title:r,allOf:c,allOfPropertyConflicts:f,namespace:u,groupName:s,fullExamples:l,additionalProperties:pko(m,C.options),availability:O,source:P,inline:void 0});return i&&(M=jh.nullable({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:O,namespace:u,groupName:s,inline:void 0})),n&&(M=jh.optional({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:O,namespace:u,groupName:s,inline:void 0})),M}function kHy({properties:e,breadcrumbs:t,context:r}){return Object.fromEntries(Object.entries(e).filter(([n,i])=>{let a=iv(i,yb.IGNORE);return a&&r.logger.debug(`Property ${t.join(".")}.${n} is marked with x-fern-ignore. Skipping.`),!a}))}function eJy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[o,c]=u0(e)?[t.resolveSchemaReference(e),_ko(e.$ref)]:[e,r];for(let f of o.allOf??[])a={...a,...eJy({schema:f,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[f,u]of Object.entries(kHy({properties:o.properties??{},breadcrumbs:r,context:t}))){let s=xS(u,!1,!1,t,[...c,f],n,i);a[f]=s}return a}function t8i({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsOptional:o,wrapAsNullable:c,context:f,subtypes:u,namespace:s,groupName:l,encoding:m,source:O,subtypeSuffixOverrides:P}){let C=AcI({schemas:u}),M=u.flatMap((z,U)=>{if(!u0(z)&&z.enum!=null&&f.options.coerceEnumsToLiterals&&z.type==="string")return z.enum.map(V=>jh.literal({nameOverride:void 0,generatedName:nie([t,V],f.options.preserveSchemaIds),title:void 0,value:NV.string(String(V)),namespace:s,groupName:void 0,description:void 0,availability:V.availability}));let q=C[U];if(P!=null){let V=P[U];V!=null&&"name"in V&&(q=V.name)}return[xS(z,!1,!1,f,[...n,q??`${U}`],O,s)]}),T=mcI(M);return OcI({uniqueSubtypes:T,nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:c,description:i,availability:a,namespace:s,groupName:l,context:f,encoding:m,source:O})}function mcI(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r],i=!1;for(let a=r+1;a<e.length;++a){let o=e[a];if(n!=null&&o!=null&&Ixe(n,o)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function OcI({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:u,context:s,encoding:l,source:m}){if(Object.entries(e).every(([P,C])=>C.type==="literal")){let P={},C=[];return Object.entries(e).forEach(([M,T])=>{T.type==="literal"&&T.value.type==="string"&&(C.push(T.value.value),T.description!=null&&(P[T.value.value]={description:T.description}))}),k7i({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,fernEnum:P,enumVarNames:void 0,enumValues:C,_default:void 0,namespace:f,groupName:u,context:s,source:m,inline:void 0})}if(e.length===1&&e[0]!=null&&!s.options.preserveSingleSchemaOneOf){let P=e[0];return a&&(P=jh.nullable({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),i&&(P=jh.optional({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),P}return tJy({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,subtypes:e,namespace:f,groupName:u,encoding:l,source:m})}function GNf({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:a,wrapAsNullable:o,context:c,namespace:f,groupName:u,discriminator:s,encoding:l,source:m}){let O=Object.entries(s.mapping??{}).map(([M,T],z)=>{let U={$ref:T},q=CPi(U,!1,!1,c,[T],l,m,f);return c.markSchemaWithDiscriminantValue(U,s.propertyName,M),q.type==="object"&&(q.properties={[s.propertyName]:jh.literal({nameOverride:void 0,generatedName:nie([t,M],c.options.preserveSchemaIds),title:void 0,value:NV.string(M),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...q.properties.filter(V=>V.key!==s.propertyName)}),q}),P=[];for(let M=0;M<O.length;++M){let T=O[M],z=!1;for(let U=M+1;U<O.length;++U){let q=O[U];if(T!=null&&q!=null&&Ixe(T,q)){z=!0;break}}T!=null&&!z&&P.push(T)}if(Object.entries(P).every(([M,T])=>T.type==="literal")){let M={},T=[];return Object.entries(P).forEach(([z,U])=>{U.type==="literal"&&U.value.type==="string"&&(T.push(U.value.value),U.description!=null&&(M[U.value.value]={description:U.description}))}),k7i({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,fernEnum:M,enumVarNames:void 0,enumValues:T,_default:void 0,namespace:f,groupName:u,context:c,source:m,inline:void 0})}return P.length===1&&P[0]!=null&&!c.options.preserveSingleSchemaOneOf?P[0]:tJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,subtypes:P,namespace:f,groupName:u,encoding:l,source:m})}function AcI({schemas:e}){let t={},r=0;for(let i of e){if(!u0(i)){if(i.properties!=null&&Object.entries(i.properties).length>0){let a=Object.keys(i.properties),o={},c=a;for(let[f,u]of Object.entries(t)){let s=meu(u,a);c=meu(c,u),o[f]=s}o[r]=c,t=o}}r++}return e.map((i,a)=>{let o=t[a];if(o!=null&&o.length>0){let c=o.sort();if(c[0]!=null)return c[0]}return Qla(a)??`${a}`})}function tJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:a,availability:o,subtypes:c,namespace:f,groupName:u,encoding:s,source:l}){let m=jh.oneOf(_nt.undiscriminated({description:a,availability:o,nameOverride:e,generatedName:t,title:r,schemas:c,namespace:f,groupName:u,encoding:s,source:l,inline:void 0}));return i&&(m=jh.nullable({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:f,groupName:u,inline:void 0})),n&&(m=jh.optional({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:f,groupName:u,inline:void 0})),m}function lno(e){if(e.default!=null&&typeof e.default=="string")return e.default}function k3u({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=Wla(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function rJy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=Wla(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function EVr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=Wla(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function nJy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=Wla(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var Hla="#/components/schemas/";function oJy(e,t){let r=u0(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"string":case"integer":return!0;case"array":return oJy(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function PcI(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:oJy(t,r):!1}function xS(e,t,r,n,i,a,o,c=!1,f=new Set,u){let s=UHy(e)??a,l=McI({schema:e,logger:n.logger});if(u0(e)){let m=e8i(e);return m!=null?PcI(m,e,n)?cno(n.resolveSchemaReference(e),t,r,n,_ko(e.$ref),l,s,o,f,c,u):(c?n.markSchemaAsReferencedByRequest(m):n.markSchemaAsReferencedByNonRequest(m),CPi(e,t,r,n,i,l,s,o)):cno(n.resolveSchemaReference(e),t,r,n,_ko(e.$ref),l,s,o,f,c,u)}return cno(e,t,r,n,i,l,s,o,f,c,u)}function CPi(e,t,r,n,i,a,o,c){let f=e.$ref.includes("properties")?cno(n.resolveSchemaReference(e),t,r,n,i,a,o,c,new Set):jh.reference(WNf(e,i,o,n.options.preserveSchemaIds));if(r===!1){let u=n.resolveSchemaReference(e);(u.nullable===!0||Array.isArray(u.type)&&u.type.length>=2&&u.type.includes("null"))&&(r=!0)}return r&&(f=jh.nullable({title:void 0,nameOverride:void 0,generatedName:nie(i,n.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(f=jh.optional({title:void 0,nameOverride:void 0,generatedName:nie(i,n.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),f}function wcI(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function cno(e,t,r,n,i,a,o,c,f=new Set,u=!1,s){typeof e=="string"&&(e={type:e});let l=iv(e,yb.TYPE_NAME)??(n.options.useTitlesAsName?wcI(e.title):void 0),m=iv(e,yb.SDK_GROUP_NAME)??iv(e,ebe.TAGS)?.[0],O=(typeof m=="string"?[m]:m)??[];O=n.resolveGroupName(O);let P=nie(i,n.options.preserveSchemaIds),C=e.title,M=e.description,T=EPe(e),z=[];e.example!=null&&z.push({name:void 0,value:e.example,description:void 0});let U=iv(e,ebe.EXAMPLES);U!=null&&Object.keys(U).length>0&&z.push(...Object.entries(U).map(([$,re])=>({name:re?.summary??$,value:re.value,description:re.description})));let q=Wla(e);q!=null&&Object.keys(q).length>0&&z.push(...q.map($=>({name:void 0,value:$,description:void 0})));let V=LHy({schema:e,description:M,title:C,nameOverride:l,generatedName:P,availability:T});if(V!=null){let $=V;return r&&($=jh.nullable({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),t&&($=jh.optional({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),$}try{if(Array.isArray(e.type)){let Y=e.type.indexOf("null"),k=Y!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&k)e.type.splice(Y,1),e.type=e.type[0],e.nullable=!0;else if(k&&(e.type.splice(Y,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let ne=new Set([...e.oneOf,...e.type]);e.oneOf=[...ne]}}if(r=r||e.nullable===!0,"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(k=>k!==null),!rzu(e.enum))return Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.string({default:lno(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:EVr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:O,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T});let Y=QHy(e);return n.options.coerceEnumsToLiterals&&e.enum.length===1&&e.enum[0]!=null&&Y==null?$Hy({nameOverride:l,generatedName:P,title:C,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:M,availability:T,namespace:c,groupName:O}):k7i({nameOverride:l,generatedName:P,title:C,fernEnum:Y,enumVarNames:iv(e,[ebe.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:O,context:n,source:o,inline:void 0})}if(rzu(e.type)&&e.type.length>1){let Y=e.type.includes("null"),k=e.type.filter(ne=>ne!=="null").map(ne=>({type:ne,nullable:Y}));return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:k,namespace:c,groupName:O,encoding:a,source:o})}if(e.type==="boolean"){let Y=iv(e,yb.BOOLEAN_LITERAL);return Y!=null?iJy({nameOverride:l,generatedName:P,title:C,literal:NV.boolean(Y),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O}):Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.boolean({default:jcI(e.default),example:rJy({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O})}if(e.type==="number")return VNf({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Gla(e.exclusiveMinimum),exclusiveMaximum:Gla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:k3u({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:O});if(e.type==="integer")return KHy({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Gla(e.exclusiveMinimum),exclusiveMaximum:Gla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:k3u({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:O});if(e.type==="float")return VNf({nameOverride:l,generatedName:P,title:C,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Gla(e.exclusiveMinimum),exclusiveMaximum:Gla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:k3u({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:O});if(e.type==="string"){if(e.format==="date-time")return Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.datetime({example:EVr({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.date({example:EVr({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O});if(e.format==="json-string"){let k=jh.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:O,example:void 0});return r&&(k=jh.nullable({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:k})),t&&(k=jh.optional({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:k})),k}let Y=uJy(e,"const");return Y!=null?iJy({nameOverride:l,generatedName:P,title:C,literal:NV.string(Y),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:O}):Nse({nameOverride:l,generatedName:P,title:C,primitive:k0.string({default:lno(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:EVr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:O,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T})}if(e.type==="array")return GHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,item:e.items,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,example:nJy({schema:e,logger:n.logger,fallback:s}),source:o});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&ezu(e))return VHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,additionalProperties:e.additionalProperties,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,encoding:a,example:e.example,source:o});if(e.oneOf!=null&&e.oneOf.length>0&&iv(e,yb.IS_DISCRIMINATED)===!1)return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf,namespace:c,groupName:O,encoding:a,source:o});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return n.options.discriminatedUnionV2?GNf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,discriminator:e.discriminator,encoding:a,source:o}):LNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,encoding:a,source:o});if(e.oneOf!=null&&e.oneOf.length>0){let Y=iv(e,yb.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||Y?GNf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,discriminator:e.discriminator,encoding:a,source:o}):LNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:O,encoding:a,source:o});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(ne=>u0(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:O,source:o});let k=xS(e.oneOf[0],t,r,n,i,o,c,u);return SVr(k,M,c,O)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let ye=e.oneOf[0],ge=e.oneOf[1];if(!u0(ye)&&ye.type==="null"){let pe=xS(ge,t,!0,n,i,o,c);return SVr(pe,M,c,O)}else if(!u0(ge)&&ge.type==="null"){let pe=xS(ye,t,!0,n,i,o,c);return SVr(pe,M,c,O)}}let k=DcI({schemas:e.oneOf});if(k!=null)return k7i({nameOverride:l,generatedName:P,title:C,fernEnum:void 0,enumVarNames:void 0,enumValues:k,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:O,context:n,source:o,inline:void 0});let ne=aJy({schemas:e.oneOf,context:n});if(ne!=null&&!n.options.discriminatedUnionV2&&!Y)return UNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:ne.discriminant,variants:ne.schemas,context:n,namespace:c,groupName:O,encoding:a,source:o});let Oe=e.oneOf.filter(ye=>!u0(ye)&&ye.type==="null").length>0;return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||Oe,context:n,subtypes:e.oneOf.filter(ye=>u0(ye)||ye.type!=="null"),encoding:a,namespace:c,groupName:O,source:o})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let ne=xS(e.anyOf[0],t,r,n,i,o,c,u);return SVr(ne,M,c,O)}if(e.anyOf.length===2){let[ne,Oe]=e.anyOf;if(ne!=null&&Oe!=null){if(!u0(ne)&&ne.type==="null"){let ye=xS(Oe,t,!0,n,i,o,c);return SVr(ye,M,c,O)}else if(!u0(Oe)&&Oe.type==="null"){let ye=xS(ne,t,!0,n,i,o,c);return SVr(ye,M,c,O)}}}let Y=aJy({schemas:e.anyOf,context:n});if(Y!=null&&!n.options.discriminatedUnionV2)return UNf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:Y.discriminant,variants:Y.schemas,context:n,namespace:c,groupName:O,encoding:a,source:o});let k=e.anyOf.filter(ne=>!u0(ne)&&ne.type==="null").length>0;return t8i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||k,context:n,subtypes:e.anyOf.filter(ne=>u0(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:O,source:o})}if(e.allOf!=null||e.properties!=null){let Y=[];for(let ne of e.allOf??[])(u0(ne)||Object.keys(ne).length>0)&&Y.push(ne);if((e.properties==null||ezu(e))&&Y.length===1&&Y[0]!=null){let ne=xS(Y[0],t,r,n,i,o,c,u);return SVr(ne,M,c,O)}let k=Y.filter(ne=>{let Oe=tzu(ne);return Oe||n.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(ne)}`),Oe});if((e.properties==null||ezu(e))&&k.length===1&&k[0]!=null){let ne=xS(k[0],t,r,n,i,o,c,u);return SVr(ne,M,c,O)}return ZHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},description:M,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:k,context:n,propertiesToExclude:f,namespace:c,groupName:O,fullExamples:z,additionalProperties:e.additionalProperties,availability:T,encoding:a,source:o})}if(e.type==="object"&&EcI(e)&&ScI(e)&&ezu(e))return QNf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${P}Key`,title:void 0,description:void 0,availability:void 0,schema:k0.string({default:lno(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:EVr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:O},valueSchema:jh.unknown({nameOverride:void 0,generatedName:`${P}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:c,groupName:O}),namespace:c,groupName:O,encoding:a,example:e.example});e.type!=null&&n.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let $=e.example??e.default,re=jh.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:O,example:$});return r&&(re=jh.nullable({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),t&&(re=jh.optional({availability:T,namespace:c,groupName:O,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),re}catch($){return n.logger.debug(`Error converting schema: ${$.message}
|
|
2699
2699
|
Location: ${i.join("-> ")}`),jh.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:O,example:void 0})}}function jcI(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 e8i(e){if(e.$ref.startsWith(Hla))return e.$ref.replace(Hla,"")}function WNf(e,t,r,n){let i=iv(e,yb.TYPE_NAME),a=nie(t,n),o=e.description,c=EPe(e),f=e8i(e);if(f==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return _1.reference({generatedName:a,nameOverride:i,title:void 0,schema:f,description:o??void 0,availability:c,namespace:void 0,groupName:void 0,source:r})}function EcI(e){return e.oneOf==null||e.oneOf.length===0}function ScI(e){return e.allOf==null||e.allOf.length===0}function ezu(e){return e.properties==null||N2(e.properties)===0}function rzu(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function SVr(e,t,r,n){if(e.type==="reference")return jh.reference({...e,description:t,availability:e.availability,namespace:r,groupName:n});if(e.type==="optional"){let i=SVr(e.value,t,r,n);return jh.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0})}else if(e.type==="nullable"){let i=SVr(e.value,t,r,n);return jh.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0})}else if(e.type==="primitive"&&t!=null&&e.description==null)return jh.primitive({...e,description:t});return e}function tzu(e){return u0(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>tzu(t)):e.oneOf!=null?e.oneOf.every(t=>tzu(t)):e.anyOf!=null?e.anyOf.every(t=>tzu(t)):!1}function iJy({literal:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:a,availability:o,nameOverride:c,generatedName:f,title:u}){let s=jh.literal({nameOverride:c,generatedName:f,title:u,value:e,namespace:n,groupName:i,description:a,availability:o});return r&&(s=jh.nullable({nameOverride:c,generatedName:f,title:u,value:s,namespace:n,groupName:i,description:a,availability:o,inline:void 0})),t&&(s=jh.optional({nameOverride:c,generatedName:f,title:u,value:s,namespace:n,groupName:i,description:a,availability:o,inline:void 0})),s}function Nse({primitive:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:a,availability:o,generatedName:c,nameOverride:f,title:u}){i=typeof i=="string"?[i]:i;let s=jh.primitive({nameOverride:f,generatedName:c,title:u,schema:e,description:a,availability:o,namespace:n,groupName:i});return r&&(s=jh.nullable({nameOverride:f,generatedName:c,title:u,value:s,namespace:n,groupName:i,description:a,availability:o,inline:void 0})),t&&(s=jh.optional({nameOverride:f,generatedName:c,title:u,value:s,namespace:n,groupName:i,description:a,availability:o,inline:void 0})),s}function DcI({schemas:e}){let t=new Set;for(let r of e){if(u0(r))return;if(r.enum!=null&&rzu(r.enum))r.enum.forEach(n=>t.add(n));else return}return Array.from(t)}function aJy({schemas:e,context:t}){let r={};for(let n of e){let i=sJy({schema:n,context:t});for(let[a,o]of Object.entries(i)){let c=r[a];c!=null?c[o]=n:r[a]={[o]:n}}}for(let[n,i]of Object.entries(r))if(Object.keys(i).length===e.length)return{discriminant:n,schemas:i}}function sJy({schema:e,context:t}){let r=u0(e)?t.resolveSchemaReference(e):e;return CcI({schema:r,context:t})}function CcI({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let n of e.anyOf){let i=sJy({schema:n,context:t});for(let[a,o]of Object.entries(i??{}))r[a]=o}return r}for(let[n,i]of Object.entries(e.properties??{})){let a=u0(i)?t.resolveSchemaReference(i):i;a.type==="string"&&a.enum!=null&&rzu(a.enum)&&IcI(a.enum).length===1&&a.enum[0]!=null&&(r[n]=a.enum[0]);let o=uJy(a,"const");a.type==="string"&&o!=null&&(r[n]=o),n==="type"&&a.example!=null&&(r[n]=a.example)}return r}function IcI(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 uJy(e,t){let r=e[t];if(r!=null)return r}function McI({schema:e,logger:t}){let r=zHy({schema:e,logger:t});if(r!=null)return JHy(r)}var fno=class{document;taskContext;logger;DUMMY;options;namespace;static MESSAGE_REFERENCE_PREFIX="#/components/messages/";constructor({document:t,taskContext:r,options:n,namespace:i}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=n,this.namespace=i}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 n=[];if(this.namespace!=null){let i={type:"namespace",name:this.namespace};n.push(i)}return n.concat(t??[])}resolveSchemaReference(t){if(!t.$ref.startsWith(Hla))throw new Error(`Failed to resolve schema reference: ${t.$ref}`);let n=t.$ref.substring(Hla.length).split("/"),i=this.document.components;if(i==null||i.schemas==null)throw new Error("Document does not have components.schemas.");let[a,o,c]=n;if(a==null||a==="")throw new Error(`${t.$ref} cannot be resolved. No schema key provided.`);let f=i.schemas[a];if(f==null)throw new Error(`Schema "${a}" is undefined in document.components.schemas.`);if(u0(f)&&(f=this.resolveSchemaReference(f)),o==="properties"&&c!=null){let u=f.properties?.[c];if(u==null)throw new Error(`Property "${c}" not found on "${a}". Full ref: ${t.$ref}`);u0(u)?f=this.resolveSchemaReference(u):f=u}return f}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,n){}markSchemaWithDiscriminantValue(t,r,n){}};var nzu=class extends fno{getExampleMessageReference(t){return`#/components/messages/${t.messageId}`}resolveMessageReference(t){let r="#/components/messages/",n=this.document.components;if(n==null||n.messages==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve message reference: ${t.$ref} in v2 components`);let i=t.$ref.substring(r.length),a=n.messages[i];if(a==null)throw new Error(`${t.$ref} is undefined`);return a}};function dno(e,t){let r={};if(e!=null)return{rootSchemas:r,namespacedSchemas:{[e]:t}};let n={};for(let[i,a]of Object.entries(t))switch(a.type){case"object":case"array":case"map":case"optional":case"enum":case"literal":case"reference":case"nullable":case"primitive":{if(a.namespace==null){r[i]=a;continue}let o=a.namespace;n[o]??={},n[o][i]=a;continue}case"oneOf":case"unknown":r[i]=a;continue;default:Zu(a)}return{rootSchemas:r,namespacedSchemas:n}}function r8i(e){if(typeof e=="string")return NS.primitive(zO.string(e));if(typeof e=="number")return Number.isInteger(e)?NS.primitive(zO.int(e)):NS.primitive(zO.double(e));if(typeof e=="boolean")return NS.primitive(zO.boolean(e));if(Array.isArray(e)){let t=e.map(r=>r8i(r));return t.length===0?void 0:NS.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,n]of Object.entries(e)){let i=r8i(n);i!=null&&t.push({key:zO.string(r),value:i})}return NS.map(t)}}function hko(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function cJy(e){if(e!=null&&Array.isArray(e))return e}var n8i=class{schemas;nonRequestReferencedSchemas;context;constructor(t,r,n){this.schemas=t,this.nonRequestReferencedSchemas=r,this.context=n}buildExample({schema:t,exampleId:r,example:n,options:i,skipReadonly:a}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:n,options:{...i,maxCheckerDepth:i.maxCheckerDepth??5},depth:0,skipReadonly:a??!1})}buildExampleHelper({exampleId:t,example:r,schema:n,depth:i,visitedSchemaIds:a,options:o,skipReadonly:c}){switch(n.type){case"enum":return typeof r=="string"&&lJy({schema:n,value:r})?NS.enum(r):n.values[0]!=null?NS.enum(n.values[0]?.value):void 0;case"literal":return NS.literal(n.value);case"nullable":{if(r==null&&!this.hasExample(n.value,0,a,o)&&this.exceedsMaxDepth(i,o))return NS.null({});let f=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:o,skipReadonly:c});return f??NS.null({})}case"optional":{if(r==null&&!this.hasExample(n.value,0,a,o)&&(o.ignoreOptionals||this.exceedsMaxDepth(i,o))||Object.is(r,null))return;let f=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:o,skipReadonly:c});return f!=null&&f.type==="array"&&f.value.length===0||f!=null&&f.type==="map"&&f.value.length===0||f!=null&&f.type==="object"&&Object.keys(f.properties).length===0?void 0:f}case"primitive":{let f=this.buildExampleFromPrimitive({schema:n.schema,example:r,options:o});return NS.primitive(f)}case"reference":{let f=this.schemas[n.schema];if(f!=null&&!a.has(n.schema)){a.add(n.schema);let u=f?.type==="object"&&!this.nonRequestReferencedSchemas.has(n.schema),s=this.buildExampleHelper({example:r,schema:f,exampleId:t,visitedSchemaIds:a,depth:i,options:o,skipReadonly:u||this.context.options.respectReadonlySchemas?c:!1});return a.delete(n.schema),s}return}case"oneOf":switch(n.value.type){case"discriminated":{let f={},u={},s={},l=hko(r),m=l?.[n.value.discriminantProperty],O=n.value.schemas[m],P=[],C=this.getDiscriminatedUnionVariantSchema(n.value,l);C!=null&&P.push(C),P.push(...Object.entries(n.value.schemas));for(let M of P)if(m!=null&&O!=null&&O.type==="object"){u=this.getAllProperties(O),s=this.getAllRequiredProperties(O),f[n.value.discriminantProperty]=NS.primitive(zO.string(m));break}else{let T=this.buildExampleHelper({exampleId:t,schema:M[1],example:void 0,visitedSchemaIds:a,depth:i,options:o,skipReadonly:c});if(T!=null){this.mergeExampleWith(T,f),f[n.value.discriminantProperty]=NS.primitive(zO.string(M[0]));break}}for(let M of n.value.commonProperties){u[M.key]={schema:M.schema,readonly:!1};let T=this.getResolvedSchema(M.schema);T.type!=="optional"&&T.type!=="nullable"&&(s[M.key]=M.schema)}for(let[M,T]of Object.entries(u)){let z=M in s;if(z&&l?.[M]!=null){let U=this.buildExampleHelper({schema:T.schema,exampleId:t,example:l[M],visitedSchemaIds:a,depth:i+1,options:o,skipReadonly:c});if(U!=null)f[M]=U;else return}else{let U=this.buildExampleHelper({exampleId:t,schema:T.schema,example:l?.[M],visitedSchemaIds:a,depth:i+1,options:o,skipReadonly:c});if(U!=null)f[M]=U;else if(z)return}}return NS.oneOf(U7i.discriminated(f))}case"undiscriminated":{let f=this.getUnDiscriminatedUnionVariantSchema(n.value,r);if(f!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:f,visitedSchemaIds:a,depth:i,options:o,skipReadonly:c});break}}return;case"unknown":if(r!=null){let f=r8i(r);if(f!=null)return NS.unknown(f)}return o.ignoreOptionals||this.exceedsMaxDepth(i,o)?void 0:o.isParameter?NS.primitive(zO.string(o.name??"string")):NS.map([{key:zO.string("key"),value:NS.primitive(zO.string("value"))}]);case"array":{let f=cJy(r),u=[];if(f!=null&&f.length>0)for(let s of f){let l=this.buildExampleHelper({exampleId:t,example:s,schema:n.value,depth:i+1,visitedSchemaIds:a,options:o,skipReadonly:c});l!=null&&u.push(l)}else if(n.example!=null&&n.example.length>0)for(let s of n.example){let l=this.buildExampleHelper({exampleId:t,example:s,schema:n.value,depth:i+1,visitedSchemaIds:a,options:o,skipReadonly:c});l!=null&&u.push(l)}else{let s=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,depth:i+1,visitedSchemaIds:a,options:o,skipReadonly:c});s!=null&&u.push(s)}return NS.array(u)}case"map":{let f=hko(r??n.example);if(f!=null&&Object.entries(f).length>0){let l=[];for(let[m,O]of Object.entries(f)){let P=this.buildExampleFromPrimitive({schema:n.key.schema,example:m,options:o}),C=this.buildExampleHelper({exampleId:t,example:O,schema:n.value,visitedSchemaIds:a,depth:i+1,options:o,skipReadonly:c});C!=null&&l.push({key:P,value:C})}return NS.map(l)}if(n.key.schema.type==="string"&&n.value.type==="unknown")return NS.map([{key:zO.string("key"),value:NS.unknown(NS.primitive(zO.string("value")))}]);let u=this.buildExampleFromPrimitive({schema:n.key.schema,example:void 0,options:{...o,name:"key"}}),s=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,visitedSchemaIds:a,depth:i+1,options:{...o,name:"value"},skipReadonly:c});return s!=null&&s.type!=="null"?NS.map([{key:u,value:s}]):NS.map([])}case"object":{let f={},u=n.fullExamples?.find(O=>O.name===t)??n.fullExamples?.find(O=>O.name==null)??n.fullExamples?.[0],s=hko(r)??(u!=null?hko(u.value):{})??{},l=this.getAllProperties(n),m=this.getAllRequiredProperties(n);for(let[O,P]of Object.entries(l)){if(c&&P.readonly||P.schema._visit({optional:V=>typeof V.availability=="string"&&V.availability==="Deprecated",primitive:()=>!1,object:()=>!1,array:()=>!1,map:()=>!1,enum:()=>!1,reference:()=>!1,literal:()=>!1,oneOf:()=>!1,nullable:()=>!1,unknown:()=>!1,_other:()=>!1}))continue;let C=O in m,M=Object.keys(s).includes(O),T=s[O],z=this.getSchemaExample(P.schema),U=T??z,q=this.buildExampleHelper({schema:P.schema,exampleId:t,example:U,visitedSchemaIds:a,depth:i+1,options:{...o,name:O},skipReadonly:c});if(C&&q!=null)f[O]=q;else{if(C)return;(M&&q!=null||!o.ignoreOptionals&&q!=null)&&(f[O]=q)}}if(n.additionalProperties){for(let[O,P]of Object.entries(s))if(!(O in f)){let C=this.buildExampleHelper({schema:jh.unknown({example:P,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0}),exampleId:t,example:P,visitedSchemaIds:a,depth:i+1,options:{...o,name:O},skipReadonly:c});C!=null&&(f[O]=C)}}return NS.object({properties:f})}default:Zu(n)}}mergeExampleWith(t,r){t._visit({array:Tc,enum:Tc,literal:Tc,map:n=>{for(let i of n){let a=i.key;a.type==="string"&&(r[a.value]=i.value)}},object:n=>{for(let[i,a]of Object.entries(n.properties))r[i]=a},oneOf:n=>{if(n.type==="discriminated")for(let[i,a]of Object.entries(n.value))r[i]=a;else this.mergeExampleWith(n.value,r)},primitive:Tc,unknown:Tc,null:Tc,_other:Tc})}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 n=r?.[t.discriminantProperty];if(n==null||typeof n!="string")return Object.entries(t.schemas)[0];let i=t.schemas[n];return i==null?Object.entries(t.schemas)[0]:[n,i]}getUnDiscriminatedUnionVariantSchema(t,r){if(r==null){let a=t.schemas.find(o=>this.hasExample(o,0,new Set,{ignoreOptionals:!1,isParameter:!1}));return a??t.schemas[0]}return t.schemas.map(a=>({schema:a,heuristic:this.calcExampleHeuristic(a,r)})).sort((a,o)=>o.heuristic-a.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return lJy({schema:t,value:r})?5:0;case"object":{if(!QD(r))return 0;let n=this.getAllProperties(t),i=0;for(let[a,o]of Object.entries(n))r[a]!=null?(i++,i+=this.calcExampleHeuristic(o.schema,r[a])):i--;return i}case"array":{if(!Array.isArray(r))return 0;let n=0;for(let i of r)n+=this.calcExampleHeuristic(t.value,i);return n}case"map":{if(!QD(r))return 0;let n=0;for(let[,i]of Object.entries(r))n+=this.calcExampleHeuristic(t.value,i);return n}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let n=this.getResolvedSchema(t);return n==null?0:this.calcExampleHeuristic(n,r)}case"oneOf":return Object.values(t.value.schemas).map(i=>this.calcExampleHeuristic(i,r)).sort((i,a)=>a-i)[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,n=new Set,i){if(this.exceedsMaxCheckerDepth(r,i))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,n,i);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,n,i);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let o of t.properties)if(this.hasExample(o.schema,r+1,n,i))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let a=this.schemas[t.schema];if(a!=null&&!n.has(t.schema)){n.add(t.schema);let o=this.hasExample(a,r,n,i);return n.delete(t.schema),o}return!1}case"unknown":return t.example!=null;case"oneOf":return Object.values(t.value.schemas).some(a=>this.hasExample(a,r,n,i));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 n of t.properties)r[n.key]={schema:n.schema,readonly:n.readonly??!1};for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let a=this.getResolvedSchema(i);a.type==="object"&&(r={...this.getAllProperties(a),...r})}return r}getAllRequiredProperties(t){let r={};for(let n of t.properties){let i=this.getResolvedSchema(n.schema);i.type!=="optional"&&i.type!=="nullable"&&(r[n.key]=n.schema)}for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let a=this.getResolvedSchema(i);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}getSchemaExample(t){return t._visit({primitive:r=>r.schema.example,object:r=>r.fullExamples?.[0]?.value,array:r=>r.example,map:r=>r.example,optional:r=>this.getSchemaExample(r.value),enum:r=>r.example,reference:r=>{let n=this.schemas[r.schema];return n!=null?this.getSchemaExample(n):void 0},literal:()=>{},oneOf:()=>{},nullable:r=>this.getSchemaExample(r.value),unknown:r=>r.example,_other:()=>{}})}buildExampleFromPrimitive({example:t,schema:r,options:n}){switch(r.type){case"string":return t!=null&&typeof t=="string"?zO.string(t):r.example!=null?zO.string(r.example):zO.string(n.name??QP.STRING);case"base64":return t!=null&&typeof t=="string"?zO.base64(t):r.example!=null?zO.base64(r.example):zO.base64(QP.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?zO.boolean(t):r.example!=null?zO.boolean(r.example):zO.boolean(QP.BOOLEAN);case"date":return t!=null&&typeof t=="string"?zO.date(t):r.example!=null?zO.date(r.example):zO.date(QP.DATE);case"datetime":return t!=null&&typeof t=="string"?zO.datetime(t):r.example!=null?zO.datetime(r.example):zO.datetime(QP.DATE_TIME);case"double":return t!=null&&typeof t=="number"?zO.double(t):r.example!=null?zO.double(r.example):zO.double(QP.DOUBLE);case"float":return t!=null&&typeof t=="number"?zO.float(t):r.example!=null?zO.float(r.example):zO.float(QP.FLOAT);case"int":return t!=null&&typeof t=="number"?zO.int(t):r.example!=null?zO.int(r.example):zO.int(QP.INT);case"int64":return t!=null&&typeof t=="number"?zO.int64(t):r.example!=null?zO.int64(r.example):zO.int64(QP.INT64);case"uint":return t!=null&&typeof t=="number"?zO.uint(t):r.example!=null?zO.uint(r.example):zO.uint(QP.UINT);case"uint64":return t!=null&&typeof t=="number"?zO.uint64(t):r.example!=null?zO.uint64(r.example):zO.uint64(QP.UINT64);default:Zu(r)}}};function lJy({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function wqr(e){switch(e.type){case"object":return jh.object({allOf:e.allOf,properties:e.properties.map(t=>TcI(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,fullExamples:void 0,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:void 0});case"array":return jh.array({description:e.description,availability:e.availability,value:wqr(e.value),generatedName:e.generatedName,title:e.title,namespace:e.namespace,nameOverride:e.nameOverride,groupName:e.groupName,example:void 0,inline:void 0});case"enum":return jh.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,example:void 0,source:e.source,inline:void 0});case"literal":return jh.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName});case"nullable":return jh.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:wqr(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"optional":return jh.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:wqr(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"primitive":return jh.primitive({description:e.description,availability:e.availability,schema:fJy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return jh.map({description:e.description,availability:e.availability,key:jh.primitive({description:e.key.description,availability:e.key.availability,schema:fJy(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,namespace:e.namespace,groupName:e.groupName}),value:wqr(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,example:void 0,inline:void 0});case"reference":return jh.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return jh.oneOf(BcI(e.value));case"unknown":return jh.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:void 0,example:void 0,namespace:void 0,groupName:void 0,description:void 0,availability:void 0});default:Zu(e)}}function BcI(e){switch(e.type){case"discriminated":return _nt.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:wqr(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,wqr(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return _nt.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>wqr(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:Zu(e)}}function fJy(e){switch(e.type){case"string":return k0.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return k0.base64({example:void 0});case"boolean":return k0.boolean({default:e.default,example:void 0});case"date":return k0.date({example:void 0});case"datetime":return k0.datetime({example:void 0});case"double":return k0.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 k0.float({example:void 0});case"int":return k0.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 k0.int64({default:e.default,example:void 0});case"uint":return k0.uint({default:void 0,example:void 0});case"uint64":return k0.uint64({default:void 0,example:void 0});default:Zu(e)}}function TcI(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:wqr(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function izu(e){return e.type!=="optional"&&e.type!=="nullable"}function HNf(e){return e==="POST"||e==="PUT"||e==="PATCH"}function yko(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 azu=class{schemas;context;globalHeaders;exampleTypeFactory;logger;constructor(t,r,n){this.schemas=t,this.context=r,this.globalHeaders=n,this.schemas=t,this.exampleTypeFactory=new n8i(t,r.nonRequestReferencedSchemas,r),this.logger=r.logger}buildEndpointExample(t){let r=RcI(t.request),n=NcI(t.response);if(r?.type==="unsupported"||n?.type==="unsupported")return[];let i=[];if(r!=null&&r.type==="present"){let l=this.isSchemaRequired(r.schema);if(r.examples.length===0){let m=this.exampleTypeFactory.buildExample({skipReadonly:HNf(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});m!=null&&i.push([void 0,m])}else for(let{name:m,value:O}of r.examples){let P=this.exampleTypeFactory.buildExample({skipReadonly:HNf(t.method),schema:r.schema,exampleId:m,example:O,options:{isParameter:!1,ignoreOptionals:!0}});P!=null&&i.push([m,P])}if(l&&i.length===0)return this.logger.trace(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let a=[];if(n!=null&&n.type==="present"){let l=this.isSchemaRequired(n.schema);if(n.examples.length===0){let m=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:void 0,example:void 0,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});m!=null&&(t.response?.type==="json"?a.push([void 0,Oht.withoutStreaming(m)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,Oht.withStreaming({sse:t.response?.type==="streamingSse",events:[m]})]))}else for(let{name:m,value:O}of n.examples){let P=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:m,example:O,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});P!=null&&(t.response?.type==="json"?a.push([m,Oht.withoutStreaming(P)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,Oht.withStreaming({sse:t.response?.type==="streamingSse",events:[P]})]))}if(l&&a.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let o=[];for(let l of t.pathParameters){let m=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!jqr(O)&&(this.logger.debug(`Expected a primitive example but got ${O.type} for path parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),m&&O==null)return[];O!=null&&o.push({name:l.name,parameterNameOverride:l.parameterNameOverride,value:O})}let c=[];for(let l of t.queryParameters){let m=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!jqr(O)&&(this.logger.debug(`Expected a primitive example but got ${O.type} for query parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),m&&O==null)return[];O!=null&&c.push({name:l.name,value:O})}let f=[];for(let l of t.headers){let m=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!jqr(O)&&(this.logger.debug(`Expected a primitive example but got ${O.type} for header ${l.name} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),m&&O==null)return[];O!=null&&f.push({name:l.name,value:O})}for(let l of this.globalHeaders){let m=l.schema!=null?wqr(l.schema):jh.primitive({nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,schema:k0.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})}),O=this.exampleTypeFactory.buildExample({schema:m,exampleId:void 0,example:void 0,options:{name:l.header,isParameter:!0,ignoreOptionals:!0}});if(O!=null&&!jqr(O)&&(this.logger.debug(`Expected a primitive example but got ${O.type} for global header ${l.header} for ${t.method.toUpperCase()} ${t.path}`),O=void 0),O==null)return[];O!=null&&f.push({name:l.header,value:O})}let u=[];t.request!=null&&t.response!=null?u=qcI(i,a):t.request!=null?u=i.map(([l,m])=>({id:l,request:m,response:void 0})):t.response!=null&&(u=a.map(([l,m])=>({id:l,request:void 0,response:m})));let s=t.examples.filter(l=>yko(l)).flatMap(l=>{if(l.type==="unknown"){if(l.value!=null){let m=l.value["code-samples"];if(m!=null)return this.convertCodeSamples(m)}return}else return l.codeSamples}).filter(l=>_j(l));return u.length===0?[mht.full({name:void 0,description:void 0,pathParameters:o,queryParameters:c,headers:f,request:void 0,response:void 0,codeSamples:s})]:u.map(({id:l,request:m,response:O})=>mht.full({name:l,description:void 0,pathParameters:o,queryParameters:c,headers:f,request:m,response:O,codeSamples:s}))}convertCodeSamples(t){return t.map(r=>"language"in r?bVr.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):bVr.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?cde.Csharp:r.sdk,code:r.code})).filter(_j)}isSchemaRequired(t){return izu(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function qcI(e,t){let r=[];if(e.length<=1){let[i,a]=e[0]??[];if(t.length===0)return r.push({id:i,request:a,response:void 0}),r;for(let[o,c]of t)r.push({id:o??i,request:a,response:c});return r}if(t.length<=1){let[i,a]=t[0]??[];if(t.length===0)return r.push({id:i,request:void 0,response:a}),r;for(let[o,c]of e)r.push({id:o??i,request:c,response:a});return r}let n=new Set;for(let[i,a]of e){let o=t.find(([f])=>f==null)?.[1]??t[0]?.[1];if(i==null){if(o==null)continue;r.push({id:void 0,request:a,response:o});continue}let c=!1;for(let f=0;f<t.length;f++){let[u,s]=t[f];u==null||n.has(f)||i===u&&(r.push({id:i,request:a,response:s}),u!=null&&n.add(f),c=!0)}!c&&o!=null&&r.push({id:i,request:a,response:o})}for(let i=0;i<t.length;i++){if(n.has(i))continue;let[a,o]=t[i],c=e.find(([f])=>f==null)?.[1]??e[0]?.[1];c!=null&&r.push({id:a,request:c,response:o})}return r}function RcI(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:FcI(e),examples:[]}:e.type==="json"||e.type==="formUrlEncoded"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function NcI(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 jqr(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return jqr(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undiscriminated":return jqr(e.value.value);default:return!1}case"null":return!0;default:Zu(e)}}function FcI(e){return jh.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:wqr(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0,readonly:void 0,writeonly:void 0,inline:void 0}).filter(_j),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,source:e.source,inline:void 0})}var pno=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new n8i(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,handshake:n,source:i,namespace:a}){let o=[];for(let c of r){let f=[];for(let l of n.queryParameters){let m=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:c.queryParameters?.[l.name],options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});O!=null&&!jqr(O)&&(O=void 0),!(m&&O==null)&&O!=null&&f.push({name:l.name,value:O})}let u=[];for(let l of n.headers){let m=this.isSchemaRequired(l.schema),O=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:c.headers?.[l.name],options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});O!=null&&!jqr(O)&&(O=void 0),!(m&&O==null)&&O!=null&&u.push({name:l.name,value:O})}let s=[];for(let l of c.messages){let m=t.getExampleMessageReference(l),O=t.resolveMessageReference({$ref:m}),P=u0(O.payload)?t.resolveSchemaReference(O.payload):O.payload,C=this.exampleTypeFactory.buildExample({schema:xS(P,!1,!1,t,[l.messageId],i,a),exampleId:void 0,example:l.value,options:{isParameter:!1,ignoreOptionals:!0}});C!=null&&s.push({messageType:l.type,payload:C,description:void 0})}o.push({name:c.summary,queryParameters:f,headers:u,description:c.description,messages:s})}return o}buildWebsocketSessionExample({handshake:t,messages:r}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},i=[];for(let o of t.queryParameters){let c=this.isSchemaRequired(o.schema),f=this.exampleTypeFactory.buildExample({schema:o.schema,exampleId:void 0,example:void 0,options:{name:o.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!jqr(f)&&(f=void 0),c&&f==null)return;f!=null&&i.push({name:o.name,value:f})}let a=[];for(let o of t.headers){let c=this.isSchemaRequired(o.schema),f=this.exampleTypeFactory.buildExample({schema:o.schema,exampleId:void 0,example:void 0,options:{name:o.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!jqr(f)&&(f=void 0),c&&f==null)return;f!=null&&a.push({name:o.name,value:f})}for(let o of r){let c=this.exampleTypeFactory.buildExample({schema:o.payload,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});c!=null&&n.messages.push({messageType:o.type,payload:c,description:void 0})}return n}isSchemaRequired(t){return izu(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 DCe={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 ozu(e){return iv(e,DCe.FERN_EXAMPLES)??[]}function szu(e,t){return t.includes("://")?t:`${e}://${t}`}function uzu(e){return e.startsWith("/")?e:"/"+e}function _Jy({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let a={},o={};for(let[u,s]of Object.entries(i.components?.schemas??{})){let l=xS(s,!1,!1,e,[u],r,e.namespace);a[u]=l}let c=new pno(a,e),f={};for(let[u,s]of Object.entries(i.servers??{}))f[u]={name:u,url:szu(s.protocol,s.url)};for(let[u,s]of Object.entries(i.channels??{})){let l=iv(s,DCe.IGNORE);if(l!=null&&l){e.logger.debug(`Channel ${u} is marked with x-fern-ignore. Skipping.`);continue}let m=[];if(s.parameters!=null)for(let[T,z]of Object.entries(s.parameters??{}))m.push({name:T,description:z.description,parameterNameOverride:void 0,schema:z.schema!=null?xS(z.schema,!1,!1,e,t,r,e.namespace):jh.primitive({schema:k0.string({default:void 0,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:void 0}),description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:EPe(z),source:r});let O=[],P=[];if(s.bindings?.ws!=null){if(s.bindings.ws.headers!=null){let T=s.bindings.ws.headers.required??[];for(let[z,U]of Object.entries(s.bindings.ws.headers.properties??{})){if(u0(U)){let re=e.resolveSchemaReference(U);O.push({name:z,schema:CPi(U,!1,!1,e,t,void 0,r,e.namespace),description:re.description,parameterNameOverride:void 0,env:void 0,availability:EPe(re),source:r});continue}let q=T.includes(z),[V,$]=e.options.coerceOptionalSchemasToNullable?[!1,!q]:[!q,!1];O.push({name:z,schema:xS(U,V,$,e,[...t,z],r,e.namespace),description:U.description,parameterNameOverride:void 0,env:void 0,availability:EPe(U),source:r})}}if(s.bindings.ws.query!=null){let T=s.bindings.ws.query.required??[];for(let[z,U]of Object.entries(s.bindings.ws.query.properties??{})){if(u0(U)){let re=e.resolveSchemaReference(U);P.push({name:z,schema:CPi(U,!1,!1,e,t,void 0,r,e.namespace),description:re.description,parameterNameOverride:void 0,availability:EPe(re),source:r});continue}let q=T.includes(z),[V,$]=e.options.coerceOptionalSchemasToNullable?[!1,!q]:[!q,!1];P.push({name:z,schema:xS(U,V,$,e,[...t,z],r,e.namespace),description:U.description,parameterNameOverride:void 0,availability:EPe(U),source:r})}}}let C;s.publish!=null&&("oneOf"in s.publish.message?C=dJy({generatedName:s.publish.operationId??"PublishEvent",event:s.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):C=pJy({action:"Publish",channelPath:u,message:s.publish.message,context:e,source:r}));let M;if(s.subscribe!=null&&("oneOf"in s.subscribe.message?M=dJy({generatedName:s.subscribe.operationId??"SubscribeEvent",event:s.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):M=pJy({action:"Subscribe",channelPath:u,message:s.subscribe.message,context:e,source:r})),O.length>0||P.length>0||C!=null||M!=null){let T=ozu(s),z=[];if(T.length>0)z=c.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:T,handshake:{headers:O,queryParameters:P},source:r,namespace:e.namespace});else{let $=[];C!=null&&$.push({type:"publish",payload:C}),M!=null&&$.push({type:"subscribe",payload:M});let re=c.buildWebsocketSessionExample({handshake:{headers:O,queryParameters:P},messages:$});re!=null&&z.push(re)}let U=iv(s,DCe.FERN_CHANNEL_ADDRESS),q=U??uzu(u),V=[];C!=null&&V.push({origin:"client",name:"publish",body:J7(C)}),M!=null&&V.push({origin:"server",name:"subscribe",body:J7(M)}),o[u]={audiences:iv(s,yb.AUDIENCES)??[],handshake:{headers:O.map($=>({...$,schema:J7($.schema),env:$.env})),queryParameters:P.map($=>({...$,schema:J7($.schema)})),pathParameters:m.map($=>({...$,parameterNameOverride:void 0,schema:J7($.schema)}))},groupName:e.resolveGroupName([iv(s,DCe.FERN_SDK_GROUP_NAME)??u]),messages:V,servers:(s.servers?.map($=>f[$])??Object.values(f)).filter($=>$!=null&&$.name!=null).map($=>({...$,name:$.name})),summary:iv(s,DCe.FERN_DISPLAY_NAME),path:q,description:s.description,examples:z,source:r}}}return{groupedSchemas:dno(e.namespace,a),channels:o??void 0,servers:Object.values(f).map(u=>({...u,name:u.name})),basePath:iv(i,DCe.BASE_PATH)}}function dJy({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:a,asyncApiOptions:o}){if("oneOf"in t.message&&t.message.oneOf!=null){let c=[],f=[];for(let u of t.message.oneOf){let s,l={type:"notFound"};if(u0(u)){let m=r.resolveMessageReference(u);!u0(m.payload)&&o.naming==="v2"?(l=m.name?{type:"name",name:m.name}:l,s={...m.payload,title:m.name??m.payload.title,description:m.name??m.payload.description}):s=m.payload}else s=u;f.push(l),c.push(s)}return t8i({description:t.description??t.message.description,availability:EPe(t.message),subtypes:c,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsOptional:!1,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypeSuffixOverrides:o.naming==="v2"?f:[]})}}function pJy({action:e,channelPath:t,message:r,context:n,source:i}){if(r.payload!=null){let a=r.payload;return u0(r.payload)&&(a=n.resolveSchemaReference(r.payload)),xS(a,!1,!1,n,[t,e],i,n.namespace)}}var czu=class extends fno{getExampleMessageReference(t){return`#/channels/${t.channelId}/messages/${t.messageId}`}resolveParameterReference(t){let r="#/components/parameters/";if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve ${t.$ref}`);let n=t.$ref.substring(r.length),i=this.document.components.parameters[n];if(i==null)throw new Error(`${t.$ref} is undefined`);return"$ref"in i?this.resolveParameterReference(i):i}resolveMessageReference(t,r=!1){let n="#/channels/",i="#/components/messages/";if(t.$ref.startsWith(n)){let f=t.$ref.split("/"),u=f[2],s=f[4];if(u==null||s==null||!this.document.channels?.[u])throw new Error(`Failed to resolve message reference ${t.$ref} in channel ${u}`);let m=this.document.channels[u].messages?.[s];if(m==null)throw new Error(`${t.$ref} is undefined`);return"$ref"in m&&!r?this.resolveMessageReference(m):{...m,name:s}}let a=this.document.components;if(!t.$ref.startsWith(i)||!a?.messages)throw new Error(`Failed to resolve message reference: ${t.$ref} in v3 components`);let o=t.$ref.substring(i.length),c=a.messages[o];if(c==null)throw new Error(`${t.$ref} is undefined`);return{...c,name:o}}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}};var hJy="#/channels/",yJy="#/servers/",JNf="$message.";function bJy({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let a={},o={},c={},f=[],u={};e.logger.debug("Parsing V3 AsyncAPI...");for(let[T,z]of Object.entries(i.components?.schemas??{}))a[T]=xS(z,!1,!1,e,[T],r,e.namespace);for(let[T,z]of Object.entries(i.channels??{}))if(o[T]||(o[T]={}),z.messages)for(let[U,q]of Object.entries(z.messages))if(c[U]||(c[U]=[]),e.isReferenceObject(q)){let V=e.resolveMessageReference(q);c[U].push({channelId:T,payload:V.payload})}else e.isMessageWithPayload(q)&&c[U].push({channelId:T,payload:q.payload});for(let[T,z]of Object.entries(c))if(z.length===1){let U=z[0],q=U.channelId;o[q]=o[q]||{},o[q][T]=xS(U.payload,!1,!1,e,[T],r,e.namespace)}else{f.push(T);for(let{channelId:U,payload:q}of z){let V=`${U}_${T}`;o[U]||(o[U]={}),o[U][V]=xS(q,!1,!1,e,[V],r,e.namespace)}}let s=Object.values(o).reduce((T,z)=>({...T,...z}),{}),l=new pno(s,e),m={};for(let[T,z]of Object.entries(i.servers??{}))m[T]={name:T,url:szu(z.protocol,z.host)};let O={};for(let[T,z]of Object.entries(i.operations??{})){if(iv(z,DCe.IGNORE))continue;let U=xcI(z);if(O[U]||(O[U]={subscribe:[],publish:[],__parsedMessages:[]}),z.action==="receive")O[U].subscribe.push(...z.messages);else if(z.action==="send")O[U].publish.push(...z.messages);else throw new Error(`Operation ${T} has an invalid action: ${z.action}`)}for(let[T,z]of Object.entries(O)){let U=[];U.push(...vJy({messages:z.subscribe,channelPath:T,origin:"server",messageSchemas:o[T]??{},duplicatedMessageIds:f,context:e})),U.push(...vJy({messages:z.publish,channelPath:T,origin:"client",messageSchemas:o[T]??{},duplicatedMessageIds:f,context:e})),O[T]!=null&&(O[T].__parsedMessages=U)}for(let[T,z]of Object.entries(i.channels??{})){if(iv(z,DCe.IGNORE))continue;let U=[],q=[],V=[];if(z.parameters!=null)for(let[$,re]of Object.entries(z.parameters)){let Y=e.isReferenceObject(re)?e.resolveParameterReference(re):re,{type:k,parameterKey:ne}=Y.location!=null?zcI(Y.location):{type:z.address?.includes(`={${$}}`)?"query":"path",parameterKey:$},Oe=iv(Y,DCe.FERN_PARAMETER_OPTIONAL),ye=aU($A(T))+aU($A($)),ge={...Y,type:"string",title:ye,example:Y.examples?.[0],default:Y.default,enum:Y.enum,required:void 0},pe=xS(ge,!1,!1,e,[ne],r,e.namespace);Oe&&(pe=jh.optional({value:pe,description:void 0,availability:void 0,generatedName:"",title:ye,namespace:void 0,groupName:void 0,nameOverride:void 0,inline:void 0}));let Ce={name:ne,description:Y.description,parameterNameOverride:void 0,schema:pe,variableReference:void 0,availability:EPe(re),source:r};k==="header"?U.push({...Ce,env:void 0}):k==="path"?q.push(Ce):(k==="payload"||k==="query")&&V.push(Ce)}if(U.length>0||V.length>0||O[T]!=null&&(O[T].publish!=null||O[T].subscribe!=null)){let $=ozu(z),re=O[T]?.__parsedMessages??[],Y=[];if($.length>0)Y=l.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:$,handshake:{headers:U,queryParameters:V},source:r,namespace:e.namespace});else{let ye=[],{examplePublishMessage:ge,exampleSubscribeMessage:pe}=LcI({messages:re,messageSchemas:o[T]??{}});ge!=null&&ye.push(ge),pe!=null&&ye.push(pe);let Ce=l.buildWebsocketSessionExample({handshake:{headers:U,queryParameters:V},messages:ye});Ce!=null&&Y.push(Ce)}let k=iv(z,DCe.FERN_SDK_GROUP_NAME),ne=(z.servers?.map(ye=>QcI(m,ye))??Object.values(m)).map(ye=>({...ye,name:ye.name})),Oe=z.address?.split("?")[0]??uzu(T);u[T]={audiences:iv(z,yb.AUDIENCES)??[],handshake:{headers:U.map(ye=>({...ye,schema:J7(ye.schema),env:ye.env})),queryParameters:V.map(ye=>({...ye,schema:J7(ye.schema)})),pathParameters:q.map(ye=>({...ye,parameterNameOverride:void 0,schema:J7(ye.schema)}))},groupName:e.resolveGroupName(typeof k=="string"?[k]:k??[T]),messages:re,summary:iv(z,DCe.FERN_DISPLAY_NAME),servers:ne,path:Oe,description:z.description,examples:Y,source:r}}else e.logger.warn(`Skipping AsyncAPI channel ${T} as it does not qualify for inclusion (no headers, query params, or operations)`)}let P=dno(e.namespace,a),C=Object.values(m).map(T=>({...T,name:T.name})),M=iv(i,DCe.BASE_PATH);return{groupedSchemas:P,channels:u,servers:C,basePath:M}}function xcI(e){if(!e.channel.$ref.startsWith(hJy))throw new Error(`Failed to resolve channel path from operation ${e.channel.$ref}`);return e.channel.$ref.substring(hJy.length)}function zcI(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(JNf))throw new Error(`Invalid location format: ${e}; expected ${JNf} prefix`);let n=t.substring(JNf.length);if(n!=="header"&&n!=="path"&&n!=="payload")throw new Error(`Invalid message type: ${n}. Must be one of: header, path, payload`);return{type:n,parameterKey:r}}catch{throw new Error(`Invalid location format: ${e}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`)}}function QcI(e,t){if(!t.$ref.startsWith(yJy))throw new Error(`Failed to resolve server name from server ref ${t.$ref}`);let r=t.$ref.substring(yJy.length),n=e[r];if(n==null)throw new Error(`Failed to find server with name ${r}`);return n}function vJy({messages:e,channelPath:t,origin:r,messageSchemas:n,duplicatedMessageIds:i,context:a}){let o=[];return e.forEach((c,f)=>{let s=a.resolveMessageReference(c,!0).name;i.includes(s)&&(s=`${t}_${s}`);let l=n[s];l!=null&&o.push({origin:r,name:s??`${r}Message${f+1}`,body:J7(l)})}),o}function LcI({messages:e,messageSchemas:t}){let r=e.find(o=>o.origin==="client")?.name,n=e.find(o=>o.origin==="server")?.name,i=r!=null?t[r]:void 0,a=n!=null?t[n]:void 0;return{examplePublishMessage:i!=null&&r!=null?{type:r,payload:i}:void 0,exampleSubscribeMessage:a!=null&&n!=null?{type:n,payload:a}:void 0}}function gJy({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:a}){let o=[];if(a!=null&&o.push(a),parseFloat(e.asyncapi)<3){let c=e;c.tags?.[0]!=null?o.push(c.tags[0].name):i.naming!=="v2"&&o.push("websocket");let f=new nzu({document:c,taskContext:t,options:r,namespace:a});return _Jy({context:f,breadcrumbs:o,source:n,asyncApiOptions:i,document:c})}else{let c=e,f=new czu({document:c,taskContext:t,options:r,namespace:a});return bJy({context:f,breadcrumbs:o,source:n,asyncApiOptions:i,document:c})}}function mJy(e){return iv(e,yb.ASYNC_CONFIG)}var OJy="$request.";function AJy(e){let t=iv(e,yb.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:UcI(t["stream-condition"]),responseStream:t["response-stream"],response:t.response}}function UcI(e){return e.startsWith(OJy)?e.slice(OJy.length):e}function PJy(e){let t=e;if(t.cursor!=null)return pnt.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});if("offset"in e){let r=e;return pnt.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 pnt.custom({results:r.results})}throw new Error("Invalid pagination extension")}function wJy(e,t){let r=iv(t,yb.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=iv(e,yb.PAGINATION);if(typeof n=="boolean")throw new Error("Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.");return n==null?void 0:PJy(n)}return PJy(r)}}function jJy(e){let t=VcI(e),r={};return KNf({obj:t,occurrences:r,breadcrumbs:[]}),r}function KNf({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)KNf({obj:n,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let n=e.$ref;t[n]==null?t[n]=1:t[n]+=1;return}for(let n in e)KNf({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function VcI(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?vko(r.get):void 0,put:r?.put!=null?vko(r.put):void 0,post:r?.post!=null?vko(r.post):void 0,patch:r?.patch!=null?vko(r.patch):void 0,delete:r?.delete!=null?vko(r.delete):void 0}]))}}function vko(e){return{...e,requestBody:e.requestBody!=null?u0(e.requestBody)?e.requestBody:WcI(e.requestBody):void 0}}function WcI(e){let t,r;for(let n in e.content){let i=R2.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[R2.MULTIPART_FORM_DATA]:r}}:e}var lzu=class{endpoints;parser=new Voa;constructor({context:t,options:r}){this.endpoints=r.filter?.endpoints?new Set(this.validateAndFilterEndpoints({context:t,endpoints:r.filter.endpoints})):void 0}skipEndpoint({method:t,path:r}){return this.endpoints!=null&&!this.endpoints.has(`${t} ${r}`)}hasEndpoints(){return this.endpoints!=null}validateAndFilterEndpoints({context:t,endpoints:r}){let n=[];for(let i of r){let a=this.parser.tryParse(i);if(a==null){t.logger.debug(`Ignoring configured filter endpoint "${i}"; expected format "POST /users/get"`);continue}n.push(`${a.method} ${a.path}`)}return n}};var EJy="#/components/parameters/",SJy="#/components/responses/",DJy="#/components/examples/",CJy="#/components/requestBodies/",IJy="#/components/securitySchemes/",_no=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:o}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=jJy(t),this.options=i,this.source=a,this.filter=new lzu({context:r,options:i}),this.DUMMY=this.getDummy(),this.namespace=o}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};r.push(n)}return r.concat(t??[])}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveSchemaReference(t){let r=t.$ref.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return{"x-fern-type":"unknown"};if(Array.isArray(n)){let a=parseInt(i,10);if(isNaN(a)||a<0||a>=n.length)return{"x-fern-type":"unknown"};n=n[a]}else n=n[i]}return n==null?(this.logger.debug(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(u0(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(EJy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(EJy.length),n=this.document.components.parameters[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return u0(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(CJy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(CJy.length),n=this.document.components.requestBodies[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return u0(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(SJy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(SJy.length),n=this.document.components.responses[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return u0(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(DJy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(DJy.length),n=this.document.components.examples[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return u0(n)?this.resolveExampleReference(n):n}resolveSecuritySchemeReference(t){if(this.document.components==null||this.document.components.securitySchemes==null||!t.$ref.startsWith(IJy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(IJy.length),n=this.document.components.securitySchemes[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return u0(n)?this.resolveSecuritySchemeReference(n):n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}};var Jla=class extends _no{constructor({document:t,taskContext:r,options:n,source:i,namespace:a}){super({document:t,taskContext:r,authHeaders:new Set,options:n,source:i,namespace:a})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,n){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,n){}getDiscriminatedUnionMetadata(t){}};var fzu=require("fs"),dzu=require("path");var GcI=nl.object({lang:nl.string(),label:nl.optional(nl.string()),source:nl.string()}),$Nf=nl.array(GcI);var MJy={README_EXT:"x-readme"};function HcI(e){if(!Array.isArray(e))return!1;for(let t of e)if(!QD(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function BJy(e){let t=iv(e,MJy.README_EXT);if(!QD(t))return[];let r=t["code-samples"];if(!HcI(r))return[];let n=[];for(let i of r)n.push({name:i.name,language:i.language,code:i.code,install:i.install,docs:void 0});return n}function JcI(e){return QD(e)&&typeof e.$ref=="string"}function KcI(e,t){if(e!=null){if(typeof e=="string")return e;if(JcI(e)){let r=(0,dzu.resolve)(t??process.cwd(),e.$ref);if((0,fzu.existsSync)(r))try{return(0,fzu.readFileSync)(r,"utf-8")}catch{return}}}}function $cI(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!QD(n))continue;let a=KcI(n.code,t);a!=null&&r.push({...n,code:a})}return r}function TJy(e,t,r){let n=iv(t,yb.EXAMPLES),i=r.source.type==="openapi"?(0,dzu.dirname)(r.source.file):void 0,o=(n??[]).map(l=>{if(!QD(l))return l;let O=l["code-samples"];if(O!=null){let P=$cI(O,i);return{...l,"code-samples":P}}return l}).filter(l=>{let m=VX.serialization.ExampleEndpointCallSchema.parse(l);return m.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),m.ok}),c=fko(t,ebe.REDOCLY_CODE_SAMPLES_KEBAB,$Nf,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],u=[...fko(t,ebe.REDOCLY_CODE_SAMPLES_CAMEL,$Nf,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...c];u.length>0&&o.push({"code-samples":u.map(l=>({name:l.label??l.lang,language:l.lang,code:l.source,install:void 0,docs:void 0}))});let s=BJy(t);return s.length>0&&o.push({"code-samples":s}),o.map(mht.unknown)}function qJy(e){let t=iv(e,yb.AVAILABILITY);if(t==="ga"||t==="generally-available")return ude.GenerallyAvailable;if(t==="beta"||t==="pre-release")return ude.Beta;if(t==="deprecated")return ude.Deprecated;if(e.deprecated)return ude.Deprecated}function RJy(e){let t=iv(e,yb.RETRIES);if(t!=null&&t.disabled===!0)return RFu.RetriesConfiguration.disabled(t.disabled)}function pzu(e,t){return{url:YcI({url:e.url,variables:e.variables??{}}),description:e.description,name:XcI(e,t),audiences:iv(e,yb.AUDIENCES)}}function YcI({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,i.default]));for(let[n,i]of Object.entries(r))e=e.replace(`{${n}}`,encodeURIComponent(i));return e}function XcI(e,t){let r=iv(e,[yb.SERVER_NAME_V1,yb.SERVER_NAME_V2]);if(r!=null)return r;if(e.description?.toLowerCase()==="production")return"Production";if(e.description?.toLowerCase()==="sandbox")return"Sandbox";if(t?.groupMultiApiEnvironments&&e.description!=null&&e.description.trim()!==""){let n=e.description.toLowerCase();return n==="prd"?"Production":n==="sbx"?"Sandbox":n==="staging"||n==="stg"?"Staging":n==="development"||n==="dev"?"Development":e.description}}function NJy(e){return iv(e,yb.PARAMETER_NAME)}function FJy(e){return iv(e,yb.SDK_VARIABLE)}function _zu({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:a}){let o={pathParameters:[],queryParameters:[],headers:[]};for(let c of r){let f=iv(c,yb.IGNORE);if(f!=null&&f){n.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let u=u0(c)?n.resolveParameterReference(c):c,s=u.required??!1,l=EPe(u),m=[...i,u.name],O=nie(m,n.options.preserveSchemaIds),[P,C]=n.options.coerceOptionalSchemasToNullable?[!1,!s]:[!s,!1],M=u.schema!=null?xS(u.schema,P,C,n,m,a,n.namespace,!1,new Set,EVr({schema:u,logger:n.logger})):s?jh.primitive({nameOverride:void 0,generatedName:O,title:void 0,schema:k0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:EVr({schema:u,logger:n.logger})}),description:void 0,availability:l,namespace:void 0,groupName:void 0}):jh.optional({nameOverride:void 0,generatedName:O,title:void 0,value:jh.primitive({nameOverride:void 0,generatedName:O,title:void 0,schema:k0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:EVr({schema:u,logger:n.logger})}),description:void 0,availability:void 0,namespace:void 0,groupName:void 0}),description:void 0,availability:l,namespace:void 0,groupName:void 0,inline:void 0});if(u.in==="header"&&u.schema!=null&&!u0(u.schema)&&u.schema.default!=null){let z=u.schema.default;typeof z=="string"&&z.length>0&&(M=jh.literal({nameOverride:void 0,generatedName:O,title:void 0,value:NV.string(z),description:void 0,availability:l,namespace:void 0,groupName:void 0}))}let T={name:u.name,schema:M,description:u.description,parameterNameOverride:NJy(u),availability:l,source:a};u.in==="query"?o.queryParameters.push(T):u.in==="path"?o.pathParameters.push({...T,variableReference:FJy(u)}):u.in==="header"?!ZcI.has(u.name.toLowerCase())&&!n.authHeaders.has(u.name)?o.headers.push({...T,env:void 0}):n.logger.debug(`Ignoring ${u.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${u.in} parameter, ${u.name}, in ${t.toUpperCase()} ${e}`)}return o}var ZcI=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]);function xJy(e,t){for(let r of Object.keys(e))if(r.includes("text/event-stream")){let n=e[r];if(n==null)continue;let i=n.schema;return{contentType:r,schema:i??{},examples:bko(n,t)}}}function kcI(e){return e.includes("json")||e==="*/*"}function YNf({content:e,context:t}){for(let[r,n]of Object.entries(e))if(hzu({mediaType:r,mediaTypeObject:n,context:t})!=null)return[r,n]}function hzu({mediaType:e,mediaTypeObject:t,context:r}){if(!kcI(e))return;let n=t.schema;return{contentType:e.includes("*")?void 0:e,schema:n??{},examples:bko(t,r)}}function yzu({content:e,context:t}){let r=YNf({content:e,context:t});if(!r)return;let[n,i]=r;return hzu({mediaType:n,mediaTypeObject:i,context:t})}function zJy(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:bko(n,t)}}}function bko(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=iv(e,ebe.EXAMPLES);return n!=null&&Object.keys(n).length>0&&r.push(...Object.entries(n).map(([i,a])=>({name:a.summary??i,value:a.value,description:a.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([i,a])=>{let o=u0(a)?t.resolveExampleReference(a):a;return{name:o.summary??i,value:o.value,description:o.description}})),r}function elI({content:e,context:t}){for(let[r,n]of Object.entries(e))if(LJy({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function LJy({mediaType:e,mediaTypeObject:t,context:r}){if(R2.parse(e)?.isURLEncoded())return{schema:t.schema,contentType:e,examples:bko(t,r)}}function tlI({content:e}){for(let[t,r]of Object.entries(e))if(UJy({mediaType:t,mediaTypeObject:r}))return[t,r]}function UJy({mediaType:e,mediaTypeObject:t}){if(R2.parse(e)?.isMultipart())return{schema:t.schema,encoding:t.encoding}}function VJy({mediaType:e}){return R2.parse(e)?.isBinary()??!1}function rlI({content:e}){for(let[t,r]of Object.entries(e))if(VJy({mediaType:t}))return[t,r]}function nlI(e,t){let r=u0(e)?XNf(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!u0(i)&&i.type==="string"&&i.format==="binary")!=null}function bzu({content:e,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:o}){let c=rlI({content:e});if(c){let[m,O]=c;return DVr({mediaType:m,mediaTypeObject:O,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:o})}let f=tlI({content:e}),u=YNf({content:e,context:n}),s=ilI({json:u,multipart:f,document:r,visitor:{json:([m,O])=>DVr({mediaType:m,mediaTypeObject:O,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:o}),multipart:([m,O])=>DVr({mediaType:m,mediaTypeObject:O,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:o}),neither:()=>{}}});if(s)return s;let l=elI({content:e,context:n});if(l){let[m,O]=l;return DVr({mediaType:m,mediaTypeObject:O,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:o})}}function ilI({json:e,multipart:t,document:r,visitor:n}){if(!e&&!t)return n.neither();let[,i]=e??[void 0,void 0],[,a]=t??[void 0,void 0];return!i?.schema&&!a?.schema?n.neither():i?.schema&&a?.schema?i.schema&&nlI(i.schema,r)?n.multipart(t):n.json(e):i?.schema?n.json(e):a?.schema?n.multipart(t):n.neither()}function DVr({mediaType:e,mediaTypeObject:t,description:r,document:n,context:i,requestBreadcrumbs:a,source:o,namespace:c}){let f=alI({mediaTypeObject:t});if(VJy({mediaType:e}))return jCe.octetStream({description:r,source:o,sdkMethodName:f,contentType:e});let u=UJy({mediaType:e,mediaTypeObject:t}),s=u?.schema,l=u?.encoding;if(s){let P=u0(s)?XNf(s,n):{id:void 0,schema:s},C=xS(P.schema,!1,!1,i,a,o,c,!1),M=[];if(C.type==="object"){let T=new Set(P.schema.required??[]);for(let z of C.properties){let U=T.has(z.key),{isFile:q,isOptional:V,isArray:$,description:re}=vzu({schema:z.schema,isOptional:!U});if(q){let Y=QJy(z.key,l);M.push({key:z.key,schema:gVr.file({isOptional:V,isArray:$,description:re}),description:re,contentType:Y,exploded:!1,encoding:Y==null?i.options.defaultFormParameterEncoding:void 0})}else{let Y=QJy(z.key,l);M.push({key:z.key,schema:gVr.json(z.schema),description:void 0,contentType:Y,exploded:l?.[z.key]?.explode,encoding:Y==null?i.options.defaultFormParameterEncoding:slI(Y)})}}}return jCe.multipart({name:u0(s)&&i.getNumberOfOccurrencesForRef(s)===1?P.id:void 0,description:P.schema.description,properties:M,source:o,sdkMethodName:f})}let m=hzu({mediaType:e,mediaTypeObject:t,context:i});if(m){let P=xS(m.schema,!1,!1,i,a,o,c,!0);return jCe.json({description:void 0,schema:P,contentType:m.contentType,fullExamples:m.examples,additionalProperties:!u0(m.schema)&&pko(m.schema.additionalProperties,i.options),source:o,sdkMethodName:f})}let O=LJy({mediaType:e,mediaTypeObject:t,context:i});if(O!=null&&O.schema!=null){let P=xS(O.schema,!1,!1,i,a,o,c,!1);return jCe.formUrlEncoded({schema:P,description:r,contentType:O.contentType,source:o,fullExamples:O.examples,additionalProperties:!1,sdkMethodName:f})}}function alI({mediaTypeObject:e}){return iv(e,yb.SDK_METHOD_NAME)}var olI={"application/json":"json"};function slI(e){return e?olI[e]:void 0}function XNf(e,t){if(!e.$ref.startsWith(Hla))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=e8i(e);if(r==null)throw new Error(`Failed to resolve schema reference because missing schema id: ${e.$ref}`);let n=t.components?.schemas?.[r];if(n==null)throw new Error(`Failed to resolve schema reference because missing: ${e.$ref}`);return u0(n)?XNf(n,t):{id:r,schema:n}}function vzu({schema:e,isOptional:t,isArray:r,description:n}){return clI(e)?vzu({schema:e.value,isOptional:!0,isArray:r,description:e.description}):llI(e)?vzu({schema:e.value,isOptional:t,isArray:r,description:e.description}):flI(e)?vzu({schema:e.value,isOptional:t,isArray:!0,description:e.description}):ulI(e)?{isFile:!0,isOptional:t??!1,isArray:r??!1,description:n??e.description}:{isFile:!1,isOptional:t??!1,isArray:r??!1,description:void 0}}function ulI(e){return e.type==="primitive"&&e.schema.type==="string"&&e.schema.format==="binary"}function clI(e){return e.type==="optional"}function llI(e){return e.type==="nullable"}function flI(e){return e.type==="array"}function QJy(e,t){return t?.[e]?.contentType}var ZNf={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"},WJy=new Set(Object.values(ZNf));var dlI=["200","201","202","204"];function HJy({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:a,source:o}){if(t==null)return{value:void 0,errors:{}};let c=plI({responses:t,context:r,source:o,namespace:r.namespace}),f=!1,u;for(let s of i!=null?[i]:dlI){let l=t[s];l!=null&&(f=!0,u==null&&(u=GJy({operationContext:e,response:l,context:r,responseBreadcrumbs:n,streamFormat:a,source:o,namespace:r.namespace,statusCode:typeof s=="string"?parseInt(s):s})))}if(u==null&&!f&&t.default!=null&&(u=GJy({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:a,source:o,namespace:r.namespace})),u!=null)switch(u.type){case"json":return{value:u,errors:c};case"streamingJson":case"streamingSse":return{value:u,errors:c};case"bytes":case"file":case"text":case"streamingText":return{value:u,errors:c};default:Zu(u)}return{value:void 0,errors:c}}function GJy({operationContext:e,streamFormat:t,response:r,context:n,responseBreadcrumbs:i,source:a,namespace:o,statusCode:c}){let f=u0(r)?n.resolveResponseReference(r):r;if(f.content!=null&&Object.entries(f.content).find(([m,O])=>{if(O.schema==null)return!1;let P=u0(O.schema)?n.resolveSchemaReference(O.schema):O.schema;return P.type==="string"&&P.format==="binary"}))return n.options.useBytesForBinaryResponse&&t==null?YL.bytes({description:f.description,source:a,statusCode:c}):YL.file({description:f.description,source:a,statusCode:c});let u=xJy(f.content??{},n);if(u!=null&&t!=null)switch(t){case"json":return YL.streamingJson({statusCode:c,description:f.description,responseProperty:iv(e.operation,yb.RESPONSE_PROPERTY),fullExamples:u.examples,schema:xS(u.schema,!1,!1,n,i,a,o),source:a});case"sse":return YL.streamingSse({description:f.description,responseProperty:void 0,fullExamples:u.examples,schema:xS(u.schema,!1,!1,n,i,a,o),source:a,statusCode:c})}let s=yzu({context:n,content:f.content??{}});if(s){if(t!=null)switch(t){case"json":return YL.streamingJson({description:f.description,responseProperty:void 0,fullExamples:s.examples,schema:xS(s.schema,!1,!1,n,i,a,o),source:a,statusCode:c});case"sse":return YL.streamingSse({description:f.description,responseProperty:void 0,fullExamples:s.examples,schema:xS(s.schema,!1,!1,n,i,a,o),source:a,statusCode:c})}return YL.json({description:f.description,schema:xS(s.schema,!1,!1,n,i,a,o),responseProperty:iv(e.operation,yb.RESPONSE_PROPERTY),fullExamples:s.examples,source:a,statusCode:c})}for(let[l,m]of Object.entries(f.content??{})){let O=R2.parse(l);if(O!=null){if(O.isOctetStream()||O.isPDF()||O.isAudio()||O.isImage()||O.isVideo()||O.isMultiPartMixed())return YL.file({description:f.description,source:a,statusCode:c});if(O.isPlainText()){let P=m.schema;if(P==null)return YL.text({description:f.description,source:a,statusCode:c});let C=u0(P)?n.resolveSchemaReference(P):P;return C.type==="string"&&C.format==="byte"?YL.file({description:f.description,source:a,statusCode:c}):YL.text({description:f.description,source:a,statusCode:c})}}}}function plI({responses:e,context:t,source:r,namespace:n}){let i={};for(let[a,o]of Object.entries(e)){if(a==="default")continue;let c=parseInt(a);if(c<400||c>600)continue;let f=u0(o)?t.resolveResponseReference(o):o,u=zJy(f.content??{},t),s=ZNf[c];if(s==null){t.logger.warn(`No error name found for status code ${a}`);continue}i[c]={statusCode:c,nameOverride:void 0,generatedName:s,description:f.description,schema:xS(u?.schema??{},!1,!1,t,[s,"Body"],r,n),fullExamples:u?.examples,source:r}}return i}function IPi({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,source:a}){let{document:o,operation:c,path:f,method:u,baseBreadcrumbs:s}=e,l=iv(c,yb.IDEMPOTENT),m=iv(c,[yb.REQUEST_NAME_V1,yb.REQUEST_NAME_V2]),O=[...s,"Request"],P=_zu({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:O,path:f,httpMethod:u,source:a}),C=/{([^}]+)}/g,M=[...f.matchAll(C)].map(k=>k[1]).filter(k=>k!==void 0);if(M.length>0){let k=new Map(P.pathParameters.map(ye=>[ye.name,ye])),ne=[],Oe=new Set;for(let ye of M){let ge=k.get(ye);Oe.add(ye),ge?ne.push(ge):ne.push({name:ye,variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:jh.primitive({schema:k0.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0})}for(let ye of P.pathParameters)Oe.has(ye.name)||ne.push(ye);P.pathParameters=ne}let T=(()=>{if(e.method==="GET")return[void 0];if(!c.requestBody)return[void 0];let k=u0(c.requestBody)?t.resolveRequestBodyReference(c.requestBody):c.requestBody,ne=Object.values(k.content).every(ye=>hlI({mediaTypeObject:ye})!=null),Oe=[];if(ne)return Oe.push(...Object.entries(k.content).map(([ye,ge])=>{let pe=DVr({mediaType:ye,mediaTypeObject:ge,description:k.description,document:o,context:new Jla({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:O,source:a,namespace:t.namespace});return JJy({context:t,convertedParameters:P})&&pe!=null&&(pe.type==="json"||pe.type==="formUrlEncoded")&&pe.schema.type!=="object"&&c.requestBody!=null?pe=DVr({mediaType:ye,mediaTypeObject:ge,description:k.description,document:o,context:t,requestBreadcrumbs:[...O,"Body"],source:a,namespace:t.namespace}):c.requestBody!=null&&(pe=DVr({mediaType:ye,mediaTypeObject:ge,description:k.description,document:o,context:t,requestBreadcrumbs:[...O],source:a,namespace:t.namespace})),pe}).filter(ye=>ye!=null)),Oe.length===0?[void 0]:Oe;{let ye=bzu({content:k.content,description:k.description,document:o,context:new Jla({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:O,source:a,namespace:t.namespace});return JJy({context:t,convertedParameters:P})&&ye!=null&&(ye.type==="json"||ye.type==="formUrlEncoded")&&ye.schema.type!=="object"&&c.requestBody!=null?ye=bzu({content:k.content,description:k.description,document:o,context:t,requestBreadcrumbs:[...O,"Body"],source:a,namespace:t.namespace}):c.requestBody!=null&&(ye=bzu({content:k.content,description:k.description,document:o,context:t,requestBreadcrumbs:[...O],source:a,namespace:t.namespace})),[ye]}})(),z=T.length>1,U=[...s,"Response"],q=HJy({operationContext:e,streamFormat:i,responses:c.responses,context:t,responseBreadcrumbs:U,responseStatusCode:r,source:a}),V=RJy(c),$=qJy(c),re=TJy(e,c,t),Y=iv(c,yb.SERVER_NAME_V2);return T.map(k=>({summary:c.summary,internal:iv(c,ebe.INTERNAL),idempotent:l,audiences:iv(c,yb.AUDIENCES)??[],operationId:c.operationId!=null&&n!=null?c.operationId+"_"+n:c.operationId,tags:t.resolveTagsToTagIds(c.tags),namespace:t.namespace,sdkName:ylI({operationContext:e,request:k}),pathParameters:P.pathParameters,queryParameters:P.queryParameters,headers:P.headers,requestNameOverride:m??void 0,generatedRequestName:nie(z?_lI({breadcrumbs:O,request:k}):O,t.options.preserveSchemaIds),request:k,response:q.value,errors:q.errors,servers:Y!=null?[{name:Y,url:void 0,audiences:void 0}]:(c.servers??[]).map(ne=>pzu(ne,{groupMultiApiEnvironments:t.options.groupMultiApiEnvironments})),description:c.description,authed:blI(c,o),security:vlI(c),availability:$,method:u,path:f,examples:re,pagination:e.pagination,source:a,retries:V}))}function _lI({breadcrumbs:e,request:t}){return t?[...e,t.type]:e}function hlI({mediaTypeObject:e}){return iv(e,yb.SDK_METHOD_NAME)}function ylI({operationContext:e,request:t}){return!t||!t.sdkMethodName?e.sdkMethodName:e.sdkMethodName?{groupName:[...e.sdkMethodName.groupName],methodName:t.sdkMethodName??e.sdkMethodName.methodName}:{groupName:[],methodName:t.sdkMethodName}}function vlI(e){return e.security??[]}function blI(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function JJy({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function $Jy({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:a,operationParameters:o}=e,c=r.discriminant.name,f=r.discriminant.value,u=r["response-status-code"],s=KJy({context:t,headerToIgnore:c,parameters:a}),l=KJy({context:t,headerToIgnore:c,parameters:o}),m=IPi({operationContext:{...e,pathItemParameters:s,operationParameters:l,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([P])=>parseInt(P)!==u))}},context:t,streamFormat:void 0,source:n}),O=IPi({operationContext:{...e,pathItemParameters:s,operationParameters:l,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:u,streamFormat:void 0,source:n});return O.forEach(P=>{P.headers.push({name:c,schema:jh.literal({nameOverride:void 0,generatedName:nie([c],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:NV.string(f),namespace:void 0,groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n})}),{sync:m,async:O}}function KJy({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=u0(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}var kNf="stream";function kJy({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:IPi({operationContext:e,context:t,streamFormat:r.format,source:t.source}),nonStreaming:[]};case"streamCondition":{let n=YJy({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0});if(n?.schemaReference!=null){let u=e8i(n.schemaReference);u!=null&&t.excludeSchema(u)}let i=XJy({operation:e.operation,response:r.responseStream}),a=IPi({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+kNf}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:n?.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,kNf]},context:t,streamFormat:r.format,suffix:kNf,source:t.source});a.forEach(u=>{u.examples=u.examples.filter(s=>ZJy(s,t)!==!1)});let o=YJy({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),c=XJy({operation:e.operation,response:r.response}),f=IPi({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:o?.requestBody,responses:c}},context:t,source:t.source});return f.forEach(u=>{u.examples=u.examples.filter(s=>ZJy(s,t)!==!0)}),{streaming:a,nonStreaming:f}}default:Zu(r)}}function YJy({context:e,operation:t,streamingExtension:r,isStreaming:n}){if(t.requestBody==null)return;let i=u0(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,a=yzu({content:i.content,context:e});if(a==null)return;let o=u0(a.schema)?e.resolveSchemaReference(a.schema):a.schema;if(o.allOf==null&&o.properties==null)return;let c=o.properties?.[r.streamConditionProperty];c!=null&&u0(c)&&(c=void 0);let f={...o,properties:{...o.properties,[r.streamConditionProperty]:{type:"boolean","x-fern-boolean-literal":n,...c??{}}},title:void 0,required:[...o.required??[],r.streamConditionProperty]};return{requestBody:{content:{[R2.APPLICATION_JSON]:{schema:f}}},schemaReference:u0(a.schema)?a.schema:void 0}}function XJy({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[R2.APPLICATION_JSON]:{schema:t}}}}}function ZJy(e,t){return e._visit({unknown:r=>{let n=VX.serialization.ExampleEndpointCallSchema.parse(r);if(n.ok&&n.value.response!=null)return n.value.response.stream!=null},full:()=>{},_other:()=>{}})}var eKy=require("crypto");function tKy({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:a,method:o,baseBreadcrumbs:c,sdkMethodName:f}=t,u=[...c,"Payload"],s=_zu({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:u,path:a,httpMethod:o,source:r});if(i.requestBody==null)return e.logger.error(`Skipping webhook ${o.toUpperCase()} ${a}: Missing a request body`),[];let l=i.operationId??mlI({path:a,method:o,sdkMethodName:f});if(o!=="POST"&&o!=="GET")return e.logger.error(`Skipping webhook ${o.toUpperCase()} ${a}: Not POST or GET`),[];let m=u0(i.requestBody)?e.resolveRequestBodyReference(i.requestBody):i.requestBody;return Object.entries(m.content).map(([O,P])=>DVr({mediaType:O,mediaTypeObject:P,description:m.description,document:n,context:e,requestBreadcrumbs:[...c,"Payload"],source:r,namespace:e.namespace})).filter(O=>O!=null).map(O=>{if(O==null||O.type!=="json"&&O.type!=="formUrlEncoded"){e.logger.error(`Skipping webhook ${a} because non-json and non-formUrlEncoded request body`);return}return{summary:i.summary,audiences:iv(i,yb.AUDIENCES)??[],sdkName:f,namespace:e.namespace,method:o,operationId:l,tags:e.resolveTagsToTagIds(i.tags),headers:s.headers,generatedPayloadName:nie(u,e.options.preserveSchemaIds),payload:O.schema,description:i.description,examples:glI(O.fullExamples),source:r}}).filter(O=>O!=null)}function glI(e){if(e==null)return[];let t=[];for(let r of e){let n=r8i(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function mlI({path:e,method:t,sdkMethodName:r}){let n=r?.methodName??OlI(e),i=(0,eKy.createHash)("sha256").update(e).digest("hex").slice(0,8);return AlI(`${n}_${t.toLowerCase()}_${i}`)}function OlI(e){return e.replace(/[{$}#]/g,"").replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/_+/g,"_").toLowerCase().slice(0,64)}function AlI(e){return e.split("_").map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function eFf({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=iv(r,yb.IGNORE);if(i!=null&&i){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let a=PlI(r,e),o=wJy(e.document,r),c={...t,sdkMethodName:a,baseBreadcrumbs:wlI({operation:r,sdkMethodName:a,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:o};if(n)return{type:"webhook",value:tKy({context:e,operationContext:c,source:e.source})};let f=AJy(r);if(f!=null){let l=kJy({context:e,operationContext:c,streamingExtension:f});return l!=null?{type:"streaming",streaming:l.streaming,nonStreaming:l.nonStreaming}:void 0}let u=mJy(r);if(u!=null){let l=$Jy({context:e,operationContext:c,asyncExtension:u,source:e.source});return{type:"async",async:l.async,sync:l.sync}}return{type:"http",value:IPi({context:e,operationContext:c,streamFormat:void 0,source:e.source})}}function PlI(e,t){let r=iv(e,yb.SDK_METHOD_NAME),n=iv(e,yb.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function wlI({sdkMethodName:e,operation:t,httpMethod:r,path:n,shouldUseIdiomaticRequestNames:i}){let a=[];if(e!=null){if(i&&a.push(e.methodName),e.groupName.length>0){let o=e.groupName[e.groupName.length-1];o!=null&&a.push(typeof o=="string"?o:o.name)}i||a.push(e.methodName)}else t.operationId!=null?a.push(t.operationId):a.push($A(`${r}_${n.split("/").join("_")}`));return a}function rKy(e,t,r,n){let i=[],a=iKy(t),o={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let c of a){if(n.filter.skipEndpoint({method:c.method,path:e})){n.logger.debug(`Skipping endpoint "${c.method} ${e}"`);continue}let f=jlI({operation:c.operation}),u=eFf({context:n,pathItemContext:{...o,method:c.method},operation:c.operation,convertToWebhook:f});u&&i.push(u)}return i}function nKy(e,t,r,n){let i=[],a=iKy(t),o={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let c of a){if(n.filter.skipEndpoint({method:c.method,path:e})){n.logger.debug(`Skipping endpoint "${c.method} ${e}"`);continue}let f=eFf({context:n,pathItemContext:{...o,method:c.method},operation:c.operation,convertToWebhook:!0});f&&i.push(f)}return i}function iKy(e){let t=[];return e.get!=null&&t.push({method:lde.Get,operation:e.get}),e.post!=null&&t.push({method:lde.Post,operation:e.post}),e.put!=null&&t.push({method:lde.Put,operation:e.put}),e.delete!=null&&t.push({method:lde.Delete,operation:e.delete}),e.patch!=null&&t.push({method:lde.Patch,operation:e.patch}),e.head!=null&&t.push({method:lde.Head,operation:e.head}),t}function jlI({operation:e}){return iv(e,[yb.WEBHOOK])??!1}function aKy(e){let t=iv(e,yb.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=iv(e,yb.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function oKy(e){return iv(e,yb.FERN_BASIC_AUTH)}function uKy(e,t,r,n){if(u0(e)){if(n==null)throw new Error(`Converting referenced security schemes requires context: ${JSON.stringify(e)}`);let i=n.resolveSecuritySchemeReference(e);return sKy(i,t,r)}return sKy(e,t,r)}function sKy(e,t,r){try{if(e.type==="apiKey"&&e.in==="header"){let n=iv(e,ebe.BEARER_FORMAT),i=iv(e,yb.FERN_HEADER_AUTH);return sde.header({headerName:e.name,prefix:n!=null?"Bearer":i?.prefix,headerVariableName:i?.name??iv(e,yb.HEADER_VARIABLE_NAME),headerEnvVar:i?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="bearer"){let n=iv(e,yb.FERN_BEARER_TOKEN);return sde.bearer({tokenVariableName:n?.name??iv(e,yb.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:n?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="basic"){let n=oKy(e),i=aKy(e);return sde.basic({usernameVariableName:n?.username?.name??i.usernameVariable,usernameEnvVar:n?.username?.env,passwordVariableName:n?.password?.name??i.passwordVariable,passwordEnvVar:n?.password?.env})}else{if(e.type==="openIdConnect")return sde.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return sde.oauth({scopesEnum:ElI(e,t)})}}catch(n){r.logger.debug(`Error converting security scheme: ${n?.message}`)}r.logger.debug(`Skipping security scheme: ${JSON.stringify(e,null)} - not currently supported. Please reach out to Fern support team!`)}function ElI(e,t){let r=e.flows.authorizationCode?.scopes??e.flows.clientCredentials?.scopes??e.flows.implicit?.scopes??e.flows.password?.scopes;if(r!=null){let n=k7i({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([a,o])=>[a,{description:o}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsOptional:!1,wrapAsNullable:!1,namespace:void 0,groupName:void 0,context:void 0,source:t,inline:void 0}),i=J7(n);if(i.type==="enum")return i}}function cKy(e){return iv(e,yb.BASE_PATH)}var SlI=nl.record(nl.string(),nl.object({summary:nl.string().optional(),description:nl.string().optional()}));function lKy({document:e,context:t}){return fko(e,yb.GROUPS,SlI,t.logger)}function fKy({context:e,document:t}){return iv(t,yb.FERN_VERSION)??void 0}function dKy(e){let t=iv(e,yb.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?dko({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function pKy(e){let t=iv(e,yb.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?dko({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function _Ky(e,t){let r=iv(e,yb.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([n,i])=>{if(i.type==="string")return[n,{nameOverride:void 0,generatedName:nie([n],t),title:i.title,schema:zq.string({default:lno(i),pattern:i.pattern,format:i.format,minLength:i.minLength,maxLength:i.maxLength}),description:i.description,availability:void 0,namespace:void 0,groupName:void 0}];throw new Error(`Variable ${n} has unsupported schema ${JSON.stringify(i)}`)}))}var DlI="webhooks";function hKy(e){return iv(e,DlI)??{}}var gko=class extends _no{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discriminatedUnionReferences={};discriminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:o}){super({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:o})}getDummy(){return new Jla({document:this.document,taskContext:this.taskContext,options:this.options,source:this.source,namespace:this.namespace})}markSchemaAsReferencedByNonRequest(t){this.nonRequestReferencedSchemas.add(t)}markSchemaAsReferencedByRequest(t){this.singleRequestReferencedSchemas.has(t)?this.twoOrMoreRequestsReferencedSchemas.add(t):this.singleRequestReferencedSchemas.add(t)}getReferencedSchemas(){return new Set([...this.nonRequestReferencedSchemas,...this.twoOrMoreRequestsReferencedSchemas])}markReferencedByDiscriminatedUnion(t,r,n){let i=this.discriminatedUnionReferences[t.$ref];i!=null?(i.discriminants.add(r),i.numReferences+=n):this.discriminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:n}}getReferencesFromDiscriminatedUnion(t){return this.discriminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,n){let i=this.discriminatedUnionMetadata[t.$ref];i!=null?i.discriminants.set(r,n):this.discriminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,n]])}}getDiscriminatedUnionMetadata(t){return this.discriminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}};function yKy(e){return iv(e,yb.RESOLUTIONS)}function vKy({openapi:e}){let t=yKy(e);if(t==null)return e;let r={};for(let n of t){let i=`#/components/schemas/${n.name}`;for(let a of n.resolutions)e=ClI({openapi:e,schemaReference:a,schemaName:n.name}),e=bKy({openapi:e,replaceReference:a,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(o=>[i,o]))}}return e}function ClI({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(a=>a.replaceAll("~1","/")),i=e;for(let a of n){let o=i[a];if(o==null)return e;i=o}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function bKy({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(f=>t.startsWith(f)).sort((f,u)=>u.length-f.length)[0];if(i!=null){let f=n[i];if(f!=null){let u=r.replace(i,f);return bKy({openapi:e,replaceReference:t,schemaReference:u,replacedReferences:{}})}}let a=t.replace("#/","").split("/").map(f=>f.replaceAll("~1","/")),o=e;for(let f of a.slice(0,-1)){let u=o[f];if(u==null)return e;o=u}let c=a[a.length-1];return c==null||(o[c]={$ref:r}),e}function mKy({openApi:e,taskContext:t,options:r,source:n,namespace:i}){e=vKy({openapi:e});let a=new gko({document:e,taskContext:t,authHeaders:new Set,options:r,source:n,namespace:i}),o=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([k,ne])=>{let Oe=uKy(ne,n,t,a);return Oe==null?null:[k,Oe]}).filter(k=>k!==null)),c=new Set(...Object.entries(o).map(([k,ne])=>ne.type==="basic"||ne.type==="bearer"?"Authorization":ne.type==="header"?ne.headerName:null)),f=_Ky(e,r.preserveSchemaIds),u=dKy(e),s=pKy(e),l=r.audiences??[],m=[],O=[],P=new gko({document:e,taskContext:t,authHeaders:c,options:r,source:n,namespace:i});P.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied..."),Object.entries(e.paths??{}).forEach(([k,ne])=>{if(ne==null)return;let Oe=rKy(k,ne,e,P);for(let ye of Oe){let ge=gKy({operation:ye});if(!(l.length>0&&!l.some(pe=>ge.includes(pe))))switch(ye.type){case"async":m.push(...ye.sync),m.push(...ye.async);break;case"http":m.push(...ye.value);break;case"streaming":m.push(...ye.streaming),ye.nonStreaming&&m.push(...ye.nonStreaming);break;case"webhook":O.push(...ye.value);break;default:Zu(ye)}}}),Object.entries(hKy(e)).forEach(([k,ne])=>{if(ne==null)return;t.logger.debug(`Converting path ${k}`);let Oe=nKy(k,ne,e,P);for(let ye of Oe){let ge=gKy({operation:ye});l.length>0&&!l.some(pe=>ge.includes(pe))||O.push(...ye.value)}});let C=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([k,ne])=>{let Oe=iv(ne,yb.SDK_NAMESPACE);if(!u0(ne)){let ye=iv(ne,yb.IGNORE);if(ye!=null&&ye)return[];if(WJy.has(k))return[k,xS({...ne,"x-fern-type-name":`${k}Body`},!1,!1,P,[k],n,Oe??i)]}return[k,xS(ne,!1,!1,P,[k],n,Oe??i)]}).filter(k=>k.length>0)),M=IlI(C,P,n),T=MlI(M,P),z={};for(let[k,ne]of Object.entries(T)){let Oe=J7(ne);P.isSchemaExcluded(k)||(z[k]=Oe)}let U=new n8i(T,P.nonRequestReferencedSchemas,P),q=O.map(k=>{let Oe=k.examples;if(!r.disableExamples&&Oe.length===0){let ye=U.buildExample({schema:k.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});ye!=null&&(Oe=[{name:void 0,description:void 0,payload:ye}])}return{...k,payload:J7(k.payload),examples:Oe}}),V=new azu(T,P,u),$=m.map(k=>{let ne=k.examples,Oe=ne;if(!r.disableExamples&&(ne.length===0||ne.every(yko))){let pe=V.buildEndpointExample(k);pe.length>0&&(Oe=[...pe,...ne.filter(Ce=>!yko(Ce))])}let ye=k.request,ge=k.response;return{...k,request:ye?.type==="json"||ye?.type==="formUrlEncoded"?{...ye,schema:J7(ye.schema)}:ye,response:ge?.type==="json"?{...ge,schema:J7(ge.schema)}:ge,queryParameters:k.queryParameters.map(pe=>({description:pe.description,name:pe.name,schema:J7(pe.schema),parameterNameOverride:pe.parameterNameOverride,availability:pe.availability,source:pe.source})),pathParameters:k.pathParameters.map(pe=>({description:pe.description,name:pe.name,schema:J7(pe.schema),parameterNameOverride:pe.parameterNameOverride,variableReference:pe.variableReference,availability:pe.availability,source:pe.source})),headers:k.headers.map(pe=>({description:pe.description,name:pe.name,schema:J7(pe.schema),parameterNameOverride:pe.parameterNameOverride,env:pe.env,availability:pe.availability,source:pe.source})),examples:Oe,errors:Ig(k.errors,pe=>{let Ce=pe.fullExamples?.map(je=>{let Se=r8i(je.value);if(Se!=null)return{name:je.name,description:je.description,example:Se}}).filter(_j);if(Ce?.length===0){let je=U.buildExample({schema:pe.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});je!=null&&Ce.push({name:void 0,description:void 0,example:je})}return{generatedName:pe.generatedName,nameOverride:pe.nameOverride,schema:J7(pe.schema),description:pe.description,source:pe.source,examples:Ce}}),retries:k.retries}}),re=lKy({document:e,context:P});return{apiVersion:fKy({context:P,document:e}),basePath:cKy(e),title:e.info.title??"",description:e.info.description,groups:Object.fromEntries(Object.entries(re??{}).map(([k,ne])=>[k,{summary:ne.summary??void 0,description:ne.description??void 0}])),servers:(e.servers??[]).map(k=>pzu(k,{groupMultiApiEnvironments:r.groupMultiApiEnvironments})),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(k=>[k.name,{id:k.name,description:k.description}])),orderedTagIds:e.tags?.map(k=>k.name)},endpoints:$,webhooks:q,channels:{},groupedSchemas:dno(i,z),securitySchemes:o,hasEndpointsMarkedInternal:$.some(k=>k.internal),nonRequestReferencedSchemas:P.getReferencedSchemas(),variables:f,globalHeaders:u,idempotencyHeaders:s}}function IlI(e,t,r){if(t.options.removeDiscriminantsFromSchemas===lm.RemoveDiscriminantsFromSchemas.Never)return e;let n={};for(let[i,a]of Object.entries(e)){if(a.type!=="object"){n[i]=a;continue}let o={$ref:`#/components/schemas/${i}`},c=t.getReferencesFromDiscriminatedUnion(o);if(c==null){n[i]=a;continue}if(t.getReferencedSchemas().has(i)){n[i]=a;continue}let u={...a,type:"object",properties:a.properties.filter(l=>!c.discriminants.has(l.key)),allOfPropertyConflicts:a.allOfPropertyConflicts.filter(l=>!c.discriminants.has(l.propertyKey)),source:r};n[i]=u;let s=OKy({schema:a,schemas:e});for(let l of[...new Set(s)]){let m=n[l]??e[l];m==null||m.type!=="object"||(n[l]={...m,type:"object",properties:m.properties.filter(O=>!c.discriminants.has(O.key)),allOfPropertyConflicts:m.allOfPropertyConflicts.filter(O=>!c.discriminants.has(O.propertyKey))})}}return n}function MlI(e,t){let r={};for(let[n,i]of Object.entries(e)){if(i.type!=="object"){r[n]=i;continue}let a={$ref:`#/components/schemas/${n}`},o=t.getDiscriminatedUnionMetadata(a);if(o==null){r[n]=i;continue}let c=[];for(let u of i.properties)if(o.discriminants.has(u.key)){let s=o.discriminants.get(u.key);s!=null&&c.push({...u,schema:jh.literal({nameOverride:void 0,generatedName:nie([i.generatedName,s],t.options.preserveSchemaIds),title:void 0,value:NV.string(s),namespace:void 0,groupName:void 0,description:void 0,availability:i.availability})})}else c.push(u);let f={...i,type:"object",properties:c};r[n]=f}return r}function OKy({schema:e,schemas:t}){let r=[];for(let n of e.allOf){r.push(n.schema);let i=t[n.schema];i!=null&&i.type==="object"&&r.push(...OKy({schema:i,schemas:t}))}return r}function gzu(e){return[...new Set(e)]}function gKy({operation:e}){let t=[];switch(e.type){case"async":t=gzu(e.async.flatMap(r=>r.audiences));break;case"http":t=gzu(e.value.flatMap(r=>r.audiences));break;case"streaming":t=gzu(e.streaming.flatMap(r=>r.audiences));break;case"webhook":t=gzu(e.value.flatMap(r=>r.audiences));break;default:Zu(e)}return t}function Kla({context:e,documents:t,options:r}){let n={apiVersion:void 0,title:void 0,description:void 0,basePath:void 0,servers:[],websocketServers:[],tags:{tagsById:{},orderedTagIds:void 0},hasEndpointsMarkedInternal:!1,endpoints:[],webhooks:[],channels:{},groupedSchemas:{rootSchemas:{},namespacedSchemas:{}},variables:{},nonRequestReferencedSchemas:new Set,securitySchemes:{},globalHeaders:[],idempotencyHeaders:[],groups:{}},i=0;for(let a of t)try{let o=a.source!=null?a.source:PPe.openapi({file:"<memory>"});switch(a.type){case"openapi":{let c=mKy({taskContext:e,openApi:a.value,options:jht({options:a.settings,overrides:r}),source:o,namespace:a.namespace});n=RlI(n,c,jht({options:a.settings,overrides:r})),i++;break}case"asyncapi":{let c=gJy({document:a.value,taskContext:e,options:jht({options:a.settings,overrides:r}),source:o,asyncApiOptions:BlI({options:a.settings}),namespace:a.namespace});c.servers!=null&&(n.websocketServers=[...n.websocketServers,...c.servers.map(f=>({...f,audiences:void 0,description:void 0}))]),c.channels!=null&&(n.channels={...n.channels,...c.channels}),c.groupedSchemas!=null&&(n.groupedSchemas=mzu(n.groupedSchemas,c.groupedSchemas)),c.basePath!=null&&(n.basePath=c.basePath),i++;break}default:Zu(a)}}catch(o){e.logger.debug(`Skipping parsing document ${a.type==="openapi"?a.value.info?.title:a.source?.file}`),o instanceof Error&&e.logger.debug(o.message,o.stack?`
|
|
2700
2700
|
`+o.stack:"")}return n}function BlI({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??xHy.naming}}function Ozu(e){let t=String(e.description||e.name||e["x-fern-server-name"]||"default").trim(),r=t.toUpperCase();return r==="PRODUCTION"||r==="PRD"||r==="PROD"?"PRD":r==="SANDBOX"||r==="SBX"?"SBX":r==="STAGING"||r==="STG"?"STG":r==="PERFORMANCE"||r==="PRF"||r==="PERF"?"PRF":r==="E2E"||r==="E_2_E"?"E2E":r==="QAL"||r==="QUALITY"?"QAL":t}function TlI(e){try{let n=new URL(e).hostname.split("."),i=new Set(["api","www","service","services","example","com","org","net","io"]);for(let o of n){let c=o.split("-")[0];if(c&&!i.has(c.toLowerCase())&&c.length>2)return c.toLowerCase()}let a=n[0]?.split("-")[0];return a?a.toLowerCase():"api"}catch{let t=e.match(/https?:\/\/([^./-]+)/);return t&&t[1]?t[1].toLowerCase():"api"}}function qlI(e,t){if(e.length===0||t.length===0||e.length!==t.length)return!1;let r=new Map;for(let a of e){let o=Ozu(a);r.set(o,a.url)}let n=!0,i=!0;for(let a of t){let o=Ozu(a),c=r.get(o);c?c===a.url&&(i=!1):n=!1}return n&&i}function AKy(e){if(e.length===0||!e[0])return"api";let t=e[0].url;return TlI(t)}function RlI(e,t,r){if(!(r?.groupMultiApiEnvironments===!0))return{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:mzu(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}};if(qlI(e.servers,t.servers)){let a=[],o=[],c=AKy(e.servers),f=AKy(t.servers),u=new Map;for(let m of e.servers){let O=Ozu(m);u.has(O)||u.set(O,{});let P=u.get(O);P&&(P[c]={url:m.url,audiences:m.audiences})}for(let m of t.servers){let O=Ozu(m);u.has(O)||u.set(O,{});let P=u.get(O);P&&(P[f]={url:m.url,audiences:m.audiences})}for(let[m,O]of u.entries()){let P={type:"grouped",name:m,description:`${m} environment`,urls:O};a.push(P)}let s=e.endpoints.map(m=>({...m,type:"multi-api",apiName:c,servers:[{name:c,url:void 0,audiences:void 0}]})),l=t.endpoints.map(m=>({...m,type:"multi-api",apiName:f,servers:[{name:f,url:void 0,audiences:void 0}]}));return o=[...s,...l],{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:a.map(m=>(m.type==="single",m)),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:o.map(m=>{if(m.type==="multi-api"){let{type:C,apiName:M,servers:T,...z}=m;return{...z,__apiName:M,servers:T}}let{type:O,...P}=m;return P}),webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:mzu(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}}}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:mzu(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 mzu(e,t){e.rootSchemas={...e.rootSchemas,...t.rootSchemas};for(let[r,n]of Object.entries(t.namespacedSchemas))e.namespacedSchemas[r]!=null?e.namespacedSchemas[r]={...e.namespacedSchemas[r],...n}:e.namespacedSchemas[r]=n;return e}var Tnv=Hi(_2u(),1),h2u={config:new Tnv.Config({apis:{},styleguide:{plugins:[zNf],rules:{struct:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!1};function lio(e){if(e.settings==null&&e.raw?.api?.auth==null)return;let t={detectGlobalHeaders:!0};return e.settings?.unions==="v1"&&(t.discriminatedUnionV2=!0),e.raw?.api?.auth!=null&&(t.auth=e.raw?.api?.auth),t}function Pes(e){return e.swagger!=null}function d7f(e){return e.openapi!=null}function wes({options:e,overrides:t}={}){return{...jht({options:e,overrides:t}),...XZo({options:e,overrides:t})}}function M8i(e,t={}){return{...Object.fromEntries(Vk(e.namedDefinitionFiles).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...Vk(e.importedDefinitions).reduce((r,[n,i])=>({...r,...oLo(M8i(i.definition,{defaultURL:i.url}),(a,o)=>QX(n,Cw.of(o)))}),{})}}function jes(e,t={}){return{...Object.fromEntries(Vk(e.packageMarkers).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...Vk(e.importedDefinitions).reduce((r,[n,i])=>({...r,...oLo(jes(i.definition,{defaultURL:i.url}),(a,o)=>QX(n,Cw.of(o)))}),{})}}function KPi(e){return{...jes(e),...M8i(e)}}function qht(e,t){return KPi(e.definition)[t]?.contents}function Cee(e,t){for(let[r,n]of Vk(KPi(e.definition)))t(r,n.contents,{isPackageMarker:Eia(r)===jF,defaultUrl:n.defaultUrl})}function mfa(e,t){for(let[r,n]of Vk(jes(e.definition)))t(r,n.contents)}function Rht({breadcrumbs:e=[],title:t,subtitle:r}){let n=[];return e.length>0&&n.push(Mf.blue(e.join(" -> "))),n.push(t),r!=null&&n.push(Mf.dim(r)),n.join(`
|
|
2701
2701
|
`)}var qnv={None:"none",Header:"header"};var x2u={};yf(x2u,{ConjureAliasDeclaration:()=>A2u,ConjureArgument:()=>R2u,ConjureArgumentWithParamType:()=>q2u,ConjureAuthDefinition:()=>_io,ConjureAuthDefinitionType:()=>B2u,ConjureDefinitions:()=>I2u,ConjureEndpointDefinition:()=>N2u,ConjureEnumDeclaration:()=>D2u,ConjureEnumVariant:()=>S2u,ConjureEnumWithDocs:()=>E2u,ConjureObjectDeclaration:()=>j2u,ConjureParamType:()=>T2u,ConjurePrimitive:()=>O2u,ConjureService:()=>F2u,ConjureServiceName:()=>m2u,ConjureType:()=>q8i,ConjureTypeDeclaration:()=>C2u,ConjureTypeReference:()=>R8i,ConjureTypeWithDocs:()=>P2u,ConjureTypes:()=>M2u,ConjureUnionDeclaration:()=>w2u,DefinitionFile:()=>uiv,WithDocs:()=>FVr,commons:()=>v7f,conjure:()=>b7f,services:()=>g7f,types:()=>m7f});var v7f={};yf(v7f,{WithDocs:()=>FVr});var em={};yf(em,{JsonError:()=>fio,ParseError:()=>dio,any:()=>$nv,bigint:()=>Nnv,boolean:()=>Ynv,booleanLiteral:()=>Knv,date:()=>Fnv,discriminant:()=>aiv,enum_:()=>v2u,getObjectLikeUtils:()=>qqr,getObjectUtils:()=>Ofa,getSchemaUtils:()=>qQ,isProperty:()=>T8i,lazy:()=>xnv,lazyObject:()=>Gnv,list:()=>g2u,number:()=>Xnv,object:()=>b2u,objectWithoutOptionalProperties:()=>Wnv,optional:()=>p7f,property:()=>Qnv,record:()=>tiv,set:()=>riv,string:()=>Znv,stringLiteral:()=>Jnv,transform:()=>_7f,undiscriminatedUnion:()=>iiv,union:()=>siv,unknown:()=>knv,withParsedProperties:()=>y7f});var Uq={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 k8(e,t){return`Expected ${t}. Received ${PBI(e)}.`}function PBI(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 _de(e){return{...e,json:Rnv(e.json),parse:Rnv(e.parse)}}function Rnv(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
2702
2702
|
`)),{ok:!0,value:t}):n}}function y2u(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var fio=class e extends Error{errors;constructor(t){super(t.map(y2u).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var dio=class e extends Error{errors;constructor(t){super(t.map(y2u).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function qQ(e){return{optional:()=>p7f(e),transform:t=>_7f(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new dio(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new fio(n.errors)}}}function p7f(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Uq.OPTIONAL};return{...t,...qQ(t)}}function _7f(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...qQ(r)}}function Nnv(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:k8(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:k8(t,"bigint")}]},getType:()=>Uq.BIGINT};return{..._de(e),...qQ(e)}}var wBI=/^([+-]?\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 Fnv(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:k8(t,"string")}]}:wBI.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:k8(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:k8(t,"Date object")}]},getType:()=>Uq.DATE};return{..._de(e),...qQ(e)}}function BPe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{..._de(r),...qQ(r)}}}function v2u(e){let t=new Set(e);return BPe(Uq.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:k8(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:k8(n,"enum")}]}:{ok:!0,value:n})()}function xnv(e){let t=h7f(e);return{...t,...qQ(t)}}function h7f(e){return{parse:(t,r)=>pio(e).parse(t,r),json:(t,r)=>pio(e).json(t,r),getType:()=>pio(e).getType()}}function pio(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function Ees(e){return Object.entries(e)}function Ses(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function B8i(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 Des(e){return Object.keys(e)}function znv(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function qqr(e){return{withParsedProperties:t=>y7f(e,t)}}function y7f(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!B8i(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:k8(n,"object")}]};let a=new Set(Object.keys(t)),o=Ses(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...qQ(r),...qqr(r)}}function Qnv(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function T8i(e){return e.isProperty}function b2u(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>T8i(n)?n.rawKey:r),_getParsedProperties:()=>Des(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of Ees(e)){let f=T8i(c)?c.rawKey:o,u=T8i(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,Vnv(u)&&a.push(f)}return Lnv({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of Ees(e)){let c=T8i(o)?o.valueSchema:o;Vnv(c)&&i.push(a)}return Lnv({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return T8i(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>Uq.OBJECT};return{..._de(t),...qQ(t),...qqr(t),...Ofa(t)}}function Lnv({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!B8i(e))return{ok:!1,errors:[{path:a,message:k8(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function Ofa(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>Unv({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>Unv({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>Uq.OBJECT};return{...r,...qQ(r),...qqr(r),...Ofa(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>Uq.OBJECT};return{...t,...qQ(t),...qqr(t),...Ofa(t)}}}}function Unv({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=znv(Des(t),u=>i.has(u)),c=r(Ses(t,o)),f=n(Ses(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function Vnv(e){return!jBI(e)}function jBI(e){switch(e.getType()){case Uq.ANY:case Uq.UNKNOWN:case Uq.OPTIONAL:return!0;default:return!1}}function Wnv(e){return b2u(e)}function Gnv(e){let t={...h7f(e),_getRawProperties:()=>pio(e)._getRawProperties(),_getParsedProperties:()=>pio(e)._getParsedProperties()};return{...t,...qQ(t),...qqr(t),...Ofa(t)}}function g2u(e){let t={parse:(r,n)=>Hnv(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>Hnv(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>Uq.LIST};return{..._de(t),...qQ(t)}}function Hnv(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:k8(e,"list"),path:[]}]}}function Jnv(e){return BPe(Uq.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:k8(r,`"${e}"`)}]})()}function Knv(e){return BPe(Uq.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:k8(r,`${e.toString()}`)}]})()}var $nv=BPe(Uq.ANY,e=>({ok:!0,value:e}));var Ynv=BPe(Uq.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:k8(e,"boolean")}]});var Xnv=BPe(Uq.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:k8(e,"number")}]});var Znv=BPe(Uq.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:k8(e,"string")}]});var knv=BPe(Uq.UNKNOWN,e=>({ok:!0,value:e}));function tiv(e,t){let r={parse:(n,i)=>eiv({value:n,isKeyNumeric:e.getType()===Uq.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>eiv({value:n,isKeyNumeric:e.getType()===Uq.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Uq.RECORD};return{..._de(r),...qQ(r)}}function eiv({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return B8i(e)?Ees(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,u=o;if(t){let O=o.length>0?Number(o):NaN;isNaN(O)||(u=O)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:k8(e,"object")}]}}function riv(e){let t=g2u(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:k8(n,"Set")}]},getType:()=>Uq.SET};return{..._de(r),...qQ(r)}}function iiv(e){let t={parse:(r,n)=>niv((i,a)=>i.parse(r,a),e,n),json:(r,n)=>niv((i,a)=>i.json(r,a),e,n),getType:()=>Uq.UNDISCRIMINATED_UNION};return{..._de(t),...qQ(t)}}function niv(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function aiv(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function siv(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=v2u(Des(t)),a={parse:(o,c)=>oiv({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>oiv({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>Uq.UNION};return{..._de(a),...qQ(a),...qqr(a)}}function oiv({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!B8i(e))return{ok:!1,errors:[{path:c,message:k8(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var FVr=em.objectWithoutOptionalProperties({docs:em.string().optional()});var b7f={};yf(b7f,{ConjureServiceName:()=>m2u,DefinitionFile:()=>uiv});var m2u=em.string();var O2u=em.enum_(["rid","string","safelong","integer","double","boolean","binary"]);var q8i=em.undiscriminatedUnion([O2u,em.string()]);var A2u=em.objectWithoutOptionalProperties({alias:q8i,docs:em.string().optional()});var P2u=em.objectWithoutOptionalProperties({type:q8i,docs:em.string().optional()});var R8i=em.undiscriminatedUnion([q8i,P2u]);var w2u=em.objectWithoutOptionalProperties({union:em.record(em.string(),R8i)});var j2u=em.objectWithoutOptionalProperties({fields:em.record(em.string(),R8i)});var E2u=em.objectWithoutOptionalProperties({value:em.string()}).extend(FVr);var S2u=em.undiscriminatedUnion([em.string(),E2u]);var D2u=em.objectWithoutOptionalProperties({values:em.list(S2u)});var C2u=em.undiscriminatedUnion([A2u,w2u,j2u,D2u]);var I2u=em.objectWithoutOptionalProperties({objects:em.record(em.string(),C2u).optional()});var M2u=em.objectWithoutOptionalProperties({conjureImports:em.property("conjure-imports",em.record(em.string(),em.string()).optional()),definitions:I2u.optional()});var B2u=em.enum_(["none","header"]);var _io=em.undiscriminatedUnion([B2u,em.string()]);var T2u=em.enum_(["path","query","body"]);var q2u=em.objectWithoutOptionalProperties({paramType:em.property("param-type",T2u),type:em.string()}).extend(FVr);var R2u=em.undiscriminatedUnion([em.string(),q2u]);var N2u=em.objectWithoutOptionalProperties({http:em.string(),auth:_io.optional(),args:em.record(em.string(),R2u).optional(),returns:R8i.optional()}).extend(FVr);var F2u=em.objectWithoutOptionalProperties({name:em.string().optional(),package:em.string().optional(),basePath:em.property("base-path",em.string().optional()),defaultAuth:em.property("default-auth",_io.optional()),endpoints:em.record(em.string(),N2u).optional()}).extend(FVr);var uiv=em.objectWithoutOptionalProperties({types:M2u.optional(),services:em.record(m2u,F2u).optional()});var g7f={};yf(g7f,{ConjureArgument:()=>R2u,ConjureArgumentWithParamType:()=>q2u,ConjureAuthDefinition:()=>_io,ConjureAuthDefinitionType:()=>B2u,ConjureEndpointDefinition:()=>N2u,ConjureParamType:()=>T2u,ConjureService:()=>F2u});var m7f={};yf(m7f,{ConjureAliasDeclaration:()=>A2u,ConjureDefinitions:()=>I2u,ConjureEnumDeclaration:()=>D2u,ConjureEnumVariant:()=>S2u,ConjureEnumWithDocs:()=>E2u,ConjureObjectDeclaration:()=>j2u,ConjurePrimitive:()=>O2u,ConjureType:()=>q8i,ConjureTypeDeclaration:()=>C2u,ConjureTypeReference:()=>R8i,ConjureTypeWithDocs:()=>P2u,ConjureTypes:()=>M2u,ConjureUnionDeclaration:()=>w2u});var civ=require("fs/promises");async function liv(e,t){let r=[];for(let n of await sve(e,t))r.push(await EBI({relativeFilepath:j3(e,n),absoluteFilepath:n}));return r}async function EBI({relativeFilepath:e,absoluteFilepath:t}){let r=(await(0,civ.readFile)(t)).toString().replaceAll(/: rid(?:$|\s)/g,`: string
|
|
2703
|
-
`).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:x2u.conjure.DefinitionFile.parseOrThrow(Pg.load(r),{unrecognizedObjectKeys:"passthrough",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0})}}function fiv(e,t){if(SBI(e))return t.alias(e);if(DBI(e))return t.enum(e);if(CBI(e))return t.object(e);if(IBI(e))return t.union(e);Zu(e)}function SBI(e){return e?.alias!=null}function DBI(e){return e?.values!=null}function CBI(e){return e?.fields!=null}function IBI(e){return e?.union!=null}var Ces=class extends cko{fernDefinitionBuilder=new Vla(!1);conjureFilepathToFernFilepath={};async import({absolutePathToConjureFolder:t,authOverrides:r,environmentOverrides:n,globalHeaderOverrides:i}){if(r!=null){for(let[a,o]of Object.entries(r["auth-schemes"]??{}))this.fernDefinitionBuilder.addAuthScheme({name:a,schema:o});r.auth!=null&&this.fernDefinitionBuilder.setAuth(r.auth)}if(n!=null){for(let[a,o]of Object.entries(n.environments??{}))this.fernDefinitionBuilder.addEnvironment({name:a,schema:o});n["default-environment"]!=null&&this.fernDefinitionBuilder.setDefaultEnvironment(n["default-environment"]),n["default-url"]!=null&&this.fernDefinitionBuilder.setDefaultUrl(n["default-url"])}return await div(t,(a,o,c)=>{for(let[s,l]of Object.entries(c.services??{})){let m=Oeu({value:s,suffix:"Service"});this.conjureFilepathToFernFilepath[o]=eu.of(`${m}/__package__.yml`);return}let u=w9o(o)?.split(".")[0];u!=null&&(this.conjureFilepathToFernFilepath[o]=eu.of(`${u}/__package__.yml`))}),await div(t,(a,o,c)=>{if(c.services==null||Object.keys(c.services??{}).length===0){let f=this.conjureFilepathToFernFilepath[o];if(f==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${o}`);for(let[u,s]of Object.entries(c.types?.conjureImports??{})){let l=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:eu.of(s)});this.fernDefinitionBuilder.addImport({file:f,fileToImport:eu.of(l),alias:u})}this.importAllTypes({conjureFile:c,fernFilePath:f});return}for(let[f,u]of Object.entries(c.services)){let s=Oeu({value:f,suffix:"Service"}),l=eu.of(`${s}/__package__.yml`),m={};u.basePath!=null&&(m["base-path"]=u.basePath),u.docs!=null&&(m.docs=u.docs),this.fernDefinitionBuilder.setServiceInfo(l,m),this.importAllTypes({conjureFile:c,fernFilePath:l});for(let[O,P]of Object.entries(c.types?.conjureImports??{})){let C=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:eu.of(P)});this.fernDefinitionBuilder.addImport({file:l,fileToImport:eu.of(C),alias:O})}for(let[O,P]of Object.entries(u.endpoints??{})){let C=PJl(P.http);if(C.type==="failure"){this.context?.logger.error(`Failed to parse ${P.http}. Skipping.`);continue}let T={auth:(P.auth??u.defaultAuth)!==qnv.None,path:C.path,method:C.method,response:P.returns==="binary"?"file":P.returns};P.docs!=null&&(T.docs=P.docs);let z={};if(P.args!=null)for(let U of C.pathParameters){let q=P.args[U];if(q==null)throw new Error(`Failed to find path parameter ${U} in ${P.http}`);z[U]=typeof q=="string"?q:{type:q.type}}Object.entries(z).length>0&&(T["path-parameters"]=z);for(let[U,q]of Object.entries(P.args??{}))if(z[U]==null)if(typeof q=="string")T.request?typeof T.request=="string"&&(T.request={body:T.request}):T.request={},T.request.body=q==="binary"?"bytes":q;else switch(q.paramType){case"body":T.request={body:q.type==="binary"?"bytes":q.type};break;case"query":T.request==null?T.request={"query-parameters":{[U]:q.type}}:typeof T.request!="string"&&T.request?.["query-parameters"]==null?T.request["query-parameters"]={[U]:q.type}:typeof T.request!="string"&&T.request?.["query-parameters"]!=null&&(T.request["query-parameters"][U]=q.type)}T.request!=null&&typeof T.request!="string"&&T.request?.["query-parameters"]!=null&&(T.request.name=`${O}Request`),this.fernDefinitionBuilder.addEndpoint(l,{name:O,schema:T,source:void 0})}}}),this.fernDefinitionBuilder.build()}convertBinaryType(t){return typeof t=="string"?t==="binary"?{type:"string",validation:{format:"binary"}}:t:t.type==="binary"?{...t,type:"string",validation:{format:"binary"}}:t}importAllTypes({conjureFile:t,fernFilePath:r}){for(let[n,i]of Object.entries(t.types?.definitions?.objects??{}))fiv(i,{alias:a=>{let o=a.alias==="binary"?{type:"string",validation:{format:"binary"}}:a.alias;this.fernDefinitionBuilder.addType(r,{name:n,schema:typeof o=="string"?{type:o,docs:a.docs}:{...o,docs:a.docs}})},object:a=>{this.fernDefinitionBuilder.addType(r,{name:n,schema:{properties:Object.fromEntries(Object.entries(a.fields).map(([o,c])=>[o,this.convertBinaryType(c)]))}})},enum:a=>{this.fernDefinitionBuilder.addType(r,{name:n,schema:{enum:a.values}})},union:a=>{this.fernDefinitionBuilder.addType(r,{name:n,schema:{union:Object.fromEntries(Object.entries(a.union).map(([o,c])=>{let f=this.convertBinaryType(c);return[o,{type:typeof f=="string"?f:f.type,docs:typeof f=="string"?void 0:f.docs,key:o}]}))}})}})}getFernFileToImport({absoluteFilePathToConjureFile:t,importFilePath:r,absoluteFilePathToConjureFolder:n}){let i=Ql(Mg(t),eu.of(r)),a=tFe(n,i),o=this.conjureFilepathToFernFilepath[a];if(o==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${a}`);return o}};async function div(e,t){for(let r of await liv(e,"{yml,yaml}"))await t(r.absoluteFilepath,r.relativeFilepath,r.fileContents)}function piv(e,t){return Ig(e,t)}var z2u=class extends mqr{type="conjure";absolutePathToConjureFolder;constructor({relativePathToConjureDirectory:t,...r}){super(r),this.absolutePathToConjureFolder=Ql(r.absoluteFilePath,t)}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new fnt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion,sources:void 0})}async getDefinition({context:t},r){let i=await new Ces(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:F_.of("/DUMMY_PATH"),rootApiFile:{defaultUrl:i.rootApiFile["default-url"],contents:i.rootApiFile,rawContents:Pg.dump(i.rootApiFile)},namedDefinitionFiles:{...piv(i.definitionFiles,a=>({absoluteFilepath:F_.of("/DUMMY_PATH"),rawContents:Pg.dump(a),contents:a})),[eu.of(jF)]:{absoluteFilepath:F_.of("/DUMMY_PATH"),rawContents:Pg.dump(i.packageMarkerFile),contents:i.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}getAbsoluteFilePaths(){return[this.absolutePathToConjureFolder]}};var Tsv=Hi(giv(),1);var zT;(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"})(zT||(zT={}));function miv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Q2u(e,t){for(let[r,n]of Vk(e))BBI({relativeFilepath:r,failure:n,logger:t})}function BBI({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case zT.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 zT.FILE_READ:r.error("Failed to open file: "+e);break;case zT.FILE_MISSING:r.error("Missing file: "+e);break;case zT.FILE_PARSE:t.error instanceof J9o?r.error(Rht({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case zT.STRUCTURE_VALIDATION:for(let n of t.error.issues)for(let{title:i,subtitle:a}of TBI(n))r.error(Rht({title:i,subtitle:a,breadcrumbs:[e,...n.path]}));break;case zT.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case zT.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${btu}: `+t.dependencyName);break;case zT.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case zT.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case zT.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let n=t.error.error.instancePath.split("/").filter(i=>i!=="").map(miv);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?n.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&n.push(t.error.error.params.additionalProperty),r.error(Rht({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...n]}))}for(let n of t.error.allErrors)if(n!==t.error.error){let i=n.instancePath.split("/").filter(a=>a!=="").map(miv);n.keyword==="required"&&n.params?.missingProperty?i.push(n.params.missingProperty):n.keyword==="additionalProperties"&&n.params?.additionalProperty&&i.push(n.params.additionalProperty),r.debug(Rht({title:n.message??"Unknown error",breadcrumbs:[e,...i]}))}break;default:Zu(t)}}function TBI(e){switch(e.code){case qy.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Mf.underline(e.expected)} but received ${Mf.underline(e.received)}`}];case qy.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Mf.underline(t)}`}));case qy.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Mf.underline(t)).join(", ")}`}];case qy.invalid_union:case qy.invalid_arguments:case qy.invalid_return_type:case qy.invalid_date:case qy.invalid_string:case qy.too_small:case qy.too_big:case qy.invalid_intersection_types:case qy.not_multiple_of:case qy.custom:default:return[{title:e.message}]}}var Oiv=require("fs/promises");async function Aiv(e,t){let r=[];for(let n of await sve(e,t))r.push(await qBI({relativeFilepath:j3(e,n),absoluteFilepath:n}));return r}async function qBI({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Oiv.readFile)(t)).toString()}}async function Piv(e){let t={},r={};function n(i){try{t[i.relativeFilepath]={defaultUrl:void 0,contents:Pg.load(i.fileContents,{schema:Pg.CORE_SCHEMA}),rawContents:i.fileContents}}catch(a){r[i.relativeFilepath]={type:zT.FILE_PARSE,error:a}}}return await Promise.all(e.map(n)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}var l2f=Hi(hzi(),1);var Asv=require("fs"),zio=require("fs/promises");var Psv=require("os"),wsv=Hi(require("path"),1),jsv=require("stream/promises"),Esv=Hi(J6u(),1),Ssv=Hi(RDe(),1);var lRI=dAi();async function Dsv({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:n,cliVersion:i,settings:a,loadAPIWorkspace:o}){let c,f={type:zT.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},u=t.dependencies[e];return u==null?f={type:zT.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${vRI(u)}`},async s=>{switch(u.type){case"version":c=await hRI({context:s,dependency:u,cliVersion:i,settings:a,loadAPIWorkspace:o});return;case"local":c=await _RI({context:s,dependency:u,cliVersion:i,settings:a,loadAPIWorkspace:o});return;default:Zu(u)}}),c!=null?{didSucceed:!0,definition:c}:{didSucceed:!1,failure:f}}var Csv="dependencies";var fRI="metadata.json",dRI=".fern";function pRI(e){return Ql(F_.of((0,Psv.homedir)()),eu.of(dRI),eu.of(Csv),eu.of(e.organization),eu.of(e.apiName),eu.of(e.version))}async function _RI({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){if(i==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await i({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 o=await a.workspace.getDefinition({context:t,relativePathToDependency:eu.of(e.path)},n);return t.logger.info("Loaded..."),o}async function hRI({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){let a=pRI(e),o=Ql(a,eu.of(Csv)),c=Ql(a,eu.of(fRI)),f;if(!await Vv(o)||!await Vv(c)){t.logger.info("Downloading manifest...");let l=await lRI.definitionRegistry.get(l2f.FernFiddle.OrganizationId(e.organization),l2f.FernFiddle.ApiId(e.apiName),e.version);if(!l.ok){l.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:C=>{t.failWithoutThrowing("Failed to download API manifest",C)}});return}let m=l.body.yamlSchemaVersion!=null?parseInt(l.body.yamlSchemaVersion):void 0,O=gla(r),P=gla(l.body.cliVersion);if(m!=null){if(m>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${l.body.cliVersion}`);return}else if(m<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(O.major!==P.major||O.minor!==P.minor){t.failWithoutThrowing(`CLI version is ${l.body.cliVersion}. Expected ${O.major}.${O.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+l.body.definitionS3DownloadUrl),await(0,zio.mkdir)(o,{recursive:!0});try{await yRI({s3PreSignedReadUrl:l.body.definitionS3DownloadUrl,absolutePathToLocalOutput:o})}catch(C){t.failWithoutThrowing("Failed to download API",C);return}f=l.body,await(0,zio.writeFile)(c,JSON.stringify(f))}else f=JSON.parse((await(0,zio.readFile)(c)).toString());if(t.logger.info("Parsing..."),i==null){t.failWithoutThrowing("Failed to load API");return}let u=await i({absolutePathToWorkspace:o,context:t,cliVersion:f.cliVersion,workspaceName:void 0});if(!u.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",u.failures);return}if(u.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await u.workspace.getDefinition({context:t},n)}async function yRI({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await $X.get(e,{responseType:"stream"}),n=await Ssv.default.dir(),i=wsv.default.join(n.path,"api.tgz");await(0,jsv.pipeline)(r.data,(0,Asv.createWriteStream)(i)),await(0,Esv.extract)({file:i,cwd:t})}function vRI(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Zu(e)}}async function Isv({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:n,settings:i,loadAPIWorkspace:a}){let o={},c={},f={};return await Promise.all(Vk(t.packageMarkers).map(async([u,s])=>{if(s.contents.export==null)o[u]=s;else{let{export:l,...m}=s.contents;if(N2(m)>0)f[u]={type:zT.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:u};else{let O=Mg(u);if(aBr(t.namedDefinitionFiles).some(C=>C!==u&&C.startsWith(O)))f[u]={type:zT.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:O};else{let C=await Dsv({dependencyName:typeof s.contents.export=="string"?s.contents.export:s.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:n,settings:i,loadAPIWorkspace:a});C.didSucceed?c[Mg(u)]={definition:C.definition,url:typeof s.contents.export=="object"?s.contents.export.url:void 0}:f[u]=C.failure}}}})),N2(f)>0?{didSucceed:!1,failures:f}:{didSucceed:!0,packageMarkers:o,importedDefinitions:c}}var Msv=Hi(require("path"),1);var f2f={};yf(f2f,{additionalProperties:()=>ORI,default:()=>PRI,definitions:()=>ARI,properties:()=>gRI,required:()=>mRI,type:()=>bRI});var bRI="object",gRI={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"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},mRI=["name"],ORI=!1,ARI={"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.AuthScope":{type:"string"},"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:{$ref:"#/definitions/auth.AuthScope"}},{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.TokenBearerAuthSchema":{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.InferredAuthenticatedRequestHeader":{type:"object",properties:{"response-property":{type:"string"},"header-name":{type:"string"},"value-prefix":{oneOf:[{type:"string"},{type:"null"}]}},required:["response-property","header-name"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchemaObject":{type:"object",properties:{endpoint:{type:"string"},"expiry-response-property":{oneOf:[{type:"string"},{type:"null"}]},"authenticated-request-headers":{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.InferredAuthenticatedRequestHeader"}},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.InferredGetTokenEndpointSchemaObject"}]},"auth.InferredBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},"get-token":{$ref:"#/definitions/auth.InferredGetTokenEndpointSchema"}},required:["scheme","get-token"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{anyOf:[{$ref:"#/definitions/auth.TokenBearerAuthSchema"},{$ref:"#/definitions/auth.InferredBearerAuthSchema"}]},"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},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},PRI={type:bRI,properties:gRI,required:mRI,additionalProperties:ORI,definitions:ARI};var d2f={};yf(d2f,{additionalProperties:()=>ERI,default:()=>DRI,definitions:()=>SRI,properties:()=>jRI,type:()=>wRI});var wRI="object",jRI={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"}]}},ERI=!1,SRI={"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","HEAD"]},"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"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"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.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"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:[{$ref:"#/definitions/service.HttpEndpointAuth"},{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"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{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}},DRI={type:wRI,properties:jRI,additionalProperties:ERI,definitions:SRI};var p2f={};yf(p2f,{additionalProperties:()=>MRI,default:()=>TRI,definitions:()=>BRI,properties:()=>IRI,type:()=>CRI});var CRI="object",IRI={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"}]}},MRI=!1,BRI={"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","HEAD"]},"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"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"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.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"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:[{$ref:"#/definitions/service.HttpEndpointAuth"},{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"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{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"}]}},TRI={type:CRI,properties:IRI,additionalProperties:MRI,definitions:BRI};function Bsv({files:e,absolutePathToDefinition:t}){let r,n={},i={},a={};for(let[o,c]of Vk(e)){let f=c.contents,u=s=>{a[o]={type:zT.JSONSCHEMA_VALIDATION,error:s}};if(o===Gk){let s=lBr(f,f2f);if(s.success){let l=VX.serialization.RootApiFileSchema.parseOrThrow(f);r={defaultUrl:l["default-url"],contents:l,rawContents:c.rawContents}}else u(s)}else if(Msv.default.basename(o)===jF){let s=lBr(f,p2f);if(s.success){let l=VX.serialization.PackageMarkerFileSchema.parseOrThrow(f);i[o]={defaultUrl:typeof l.export=="object"?l.export.url:void 0,contents:l,rawContents:c.rawContents}}else u(s)}else{let s=lBr(f,d2f);if(s.success){let l=VX.serialization.DefinitionFileSchema.parseOrThrow(f);n[o]={defaultUrl:void 0,contents:l,rawContents:c.rawContents,absoluteFilePath:Ql(t,o)}}else u(s)}}return r==null?{didSucceed:!1,failures:{[eu.of(Gk)]:{type:zT.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:n,rootApiFile:r,packageMarkers:i}}var GVr=class extends mqr{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...n}){super(n),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 n=(0,Tsv.default)(r??{}),i=this.fernWorkspaces[n];if(i==null){let a=t||this.context,o=Ql(this.absoluteFilePath,eu.of(wne)),c=await uZl({absolutePathToWorkspace:this.absoluteFilePath,context:a}),f=await Aiv(o,"{yml,yaml}"),u=await Piv(f);if(!u.didSucceed)return Q2u(u.failures,a.logger),a.failAndThrow();let s=Bsv({files:u.files,absolutePathToDefinition:o});if(!s.didSucceed)return Q2u(s.failures,a.logger),a.failAndThrow();let l=await Isv({dependenciesConfiguration:c,structuralValidationResult:s,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!l.didSucceed)return Q2u(l.failures,a.logger),a.failAndThrow();let m={absoluteFilePath:o,rootApiFile:s.rootApiFile,namedDefinitionFiles:s.namedDefinitionFiles,packageMarkers:l.packageMarkers,importedDefinitions:l.importedDefinitions};r?.auth!=null&&(m={...m,rootApiFile:{...m.rootApiFile,contents:{...m.rootApiFile.contents,auth:r?.auth}}}),i=new fnt({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:c,workspaceName:this.workspaceName,definition:m,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[n]=i}return i}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var Hfv=require("fs/promises");var Ufv=Hi(Lfv(),1);async function Wts(e){return(await(0,Ufv.convertObj)(e,{})).openapi}var Wfv=require("fs/promises");var Vfv=require("fs/promises");async function aao({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:n}){let i=null;try{let a=(await(0,Vfv.readFile)(e,"utf8")).toString();try{i=JSON.parse(a)}catch{i=Pg.load(a,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}return gJl({data:t,overrides:i,allowNullKeys:n})}async function yQf({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,Wfv.readFile)(t)).toString(),i=await Pg.load(n);return r!=null?await aao({absoluteFilePathToOverrides:r,context:e,data:i}):i}var Hts=Hi(_2u(),1);var Gfv=Hi(_2u(),1),vQf=Hi(require("path"),1),Gts=class extends Gfv.BaseResolver{absolutePathToOpenAPIOverrides;constructor(t){super(),this.absolutePathToOpenAPIOverrides=t}resolveExternalRef(t,r){let n=super.resolveExternalRef(t,r);return n.startsWith("http://")||n.startsWith("https://")||hBr(F_.of(n))?n:this.absolutePathToOpenAPIOverrides!=null?vQf.default.resolve(vQf.default.dirname(this.absolutePathToOpenAPIOverrides),r):n}};async function bQf({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,parsed:r}){return(r!=null?await(0,Hts.bundle)({...h2u,doc:{source:new Hts.Source(e,"<openapi>"),parsed:r},externalRefResolver:new Gts(t)}):await(0,Hts.bundle)({...h2u,ref:e,externalRefResolver:new Gts(t)})).bundle.parsed}var G4I=["examples","example",yb.EXAMPLES,ebe.REDOCLY_CODE_SAMPLES_CAMEL,ebe.REDOCLY_CODE_SAMPLES_KEBAB];async function Jts({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r}){let n=await bQf({absolutePathToOpenAPI:t}),i;if(r!=null?i=r:typeof n=="object"&&n[yb.OPENAPI_OVERIDES_FILEPATH]!=null&&(i=Ql(Mg(t),eu.of(n[yb.OPENAPI_OVERIDES_FILEPATH]))),i!=null){let a=await aao({absoluteFilePathToOverrides:i,context:e,data:n,allowNullKeys:G4I});return await bQf({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,parsed:a})}return n}var zqr=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r}){let n=[];for(let i of r)try{let a=(await(0,Hfv.readFile)(i.absoluteFilepath)).toString(),o=j3(this.absoluteFilePath,i.source.file);i.source.relativePathToDependency!=null&&(o=Ql(i.source.relativePathToDependency,o));let c=i.source.type==="protobuf"?PPe.protobuf({file:o}):PPe.openapi({file:o});if(a.includes("openapi")||a.includes("swagger"))try{let f=await Jts({absolutePathToOpenAPI:i.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:i.absoluteFilepathToOverrides});if(d7f(f)){n.push({type:"openapi",value:f,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}else if(Pes(f)){(!f.schemes||f.schemes.length===0)&&(f.schemes=["https"]);let u=await Wts(f);n.push({type:"openapi",value:u,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}}catch(f){t.logger.debug(`Failed to parse OpenAPI document at ${i.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("asyncapi"))try{let f=await yQf({context:t,absoluteFilePath:i.absoluteFilepath,absoluteFilePathToOverrides:i.absoluteFilepathToOverrides});n.push({type:"asyncapi",value:f,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}catch(f){t.logger.error(`Failed to parse AsyncAPI document at ${i.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("openrpc"))try{let f=await yQf({context:t,absoluteFilePath:i.absoluteFilepath,absoluteFilePathToOverrides:i.absoluteFilepathToOverrides});n.push({type:"asyncapi",value:f,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}catch(f){t.logger.error(`Failed to parse OpenRPC document at ${i.absoluteFilepath}: ${f}. Skipping...`);continue}t.logger.warn(`${i.absoluteFilepath} is not a valid OpenAPI, AsyncAPI, or OpenRPC file. Skipping...`)}catch(a){t.logger.error(`Failed to read or process file ${i.absoluteFilepath}: ${a}. Skipping...`);continue}return n}};var H4I=nl.object({type:nl.string(),channelId:nl.string().optional(),messageId:nl.string(),value:nl.any()}),J4I=nl.object({summary:nl.string().optional(),description:nl.string().optional(),"query-parameters":nl.record(nl.string()).optional(),headers:nl.record(nl.string()).optional(),messages:nl.array(H4I)}),Jfv=nl.array(J4I);var t5u=class extends kE{channel;baseDir;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:n,baseDir:i}){super({breadcrumbs:t??[],context:n}),this.channel=r,this.baseDir=i}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=Jfv.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(n=>({summary:n.summary,description:n.description,queryParameters:n["query-parameters"],headers:n.headers,messages:n.messages.map(i=>({type:i.type,channelId:i.channelId,messageId:i.messageId,value:i.value}))}))}};var oao=class extends gO{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a}){super({context:t,breadcrumbs:r}),this.websocketGroup=n,this.channel=i,this.channelPath=a}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:n}){let a=new t5u({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel,baseDir:this.context.documentBaseDir}).convert();return a==null?{}:Object.fromEntries(a.map((o,c)=>[c.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:o.queryParameters,headers:o.headers,messages:o.messages.map(f=>({type:n==="v2"?f.type:f.messageId,body:f.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var p2i=class extends G7.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:n,parameterNamePrefix:i}){super({context:t,breadcrumbs:r,parameter:n}),this.parameterNamePrefix=i}convert(){let t,r={},i=new Tse.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,a=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},c=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:a,wrapAsOptional:i}).convert();return c!=null&&(t=c.type,r=c.inlinedTypes??{}),this.convertToOutput({schema:a,typeReference:t,inlinedTypes:r})}};var r5u=class extends kE{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:n}){super({breadcrumbs:t,context:n}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var sao=class extends kE{channel;key="x-fern-display-name";constructor({breadcrumbs:t,channel:r,context:n}){super({breadcrumbs:t,context:n}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var n5u=class extends oao{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a})}convert(){let t=[],r=[],n=[],a=new sao({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:n}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let o;this.channel.subscribe!=null&&(o=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let c;this.channel.publish!=null&&(c=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let f=[];o!=null&&f.push(o),c!=null&&f.push(c);let s=new r5u({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),l=this.transformToValidPath(s??this.channelPath),m=this.channel.servers?.[0]??Object.keys(this.context.spec.servers??{})[0],O=nZ(l),P=$A(this.channelPath),C=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(P),displayName:a,baseUrl:m,path:O,auth:!1,headers:n,queryParameters:r,pathParameters:t,messages:f,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:l,baseUrl:m,asyncApiVersion:"v2"})}},audiences:C,inlinedTypes:this.inlinedTypes}}convertMessage({context:t,operation:r,origin:n}){let i,a=n==="server"?"subscribe":"publish",o=[...this.breadcrumbs,a],c=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:o});c!=null&&(r.message=c);let f=Vna($A(`${this.channelPath}_${a}`)).replace(/ /g,"");if("oneOf"in r.message){let s=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:r.message,schemaIdOverride:f}).convert();s!=null&&s.schema!=null&&(i=s.schema,this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let u=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:o});if(u!=null){let l=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:u,schemaIdOverride:f}).convert();l!=null&&l.schema!=null&&(i=l.schema,this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes})}}if(i!=null){let u=i,s=Bh.named({fernFilepath:t.createFernFilepath(),name:u.typeDeclaration.name.name,typeId:u.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),l=Mfe.reference({bodyType:s,docs:r.description}),m=n==="server"?"subscribe":"publish";return{type:m,displayName:m,origin:n,body:l,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description}}}convertPathParameters({context:t,pathParameters:r}){for(let[n,i]of Object.entries(this.channel.parameters??{})){let a=t.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs});if(a==null)continue;let c=new p2i({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...a,name:n,in:"path",description:a.description,required:a.required??!0}}).convert();c!=null&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type==="path"&&r.push(c.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[i,a]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,i]});if(o==null)continue;let f=new p2i({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"header",required:n.includes(i),schema:o,description:"description"in o?o.description:void 0}}).convert();f!=null&&f.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[i,a]of Object.entries(this.channel.bindings.ws.query.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,i]});if(o==null)continue;let f=new p2i({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"query",required:n.includes(i),schema:o,description:"description"in o?o.description:void 0,deprecated:o.deprecated??!1}}).convert();f!=null&&f.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}};var uao=class extends gO{servers;constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r}),this.servers=n}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[n,i]of Object.entries(this.servers)){let a=this.buildSingleBaseUrlEnvironment(this.context,n,i);t.push(a),r==null&&(r=a.id)}return{defaultEnvironment:r,environments:jJ.singleBaseUrl({environments:t})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var i5u=class extends uao{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.url),docs:void 0}}};var gQf="$message.",Kfv="#/channels/",$fv="#/servers/",a5u=class extends oao{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a,operations:o}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a}),this.operations=o}convert(){let t=[],r=[],n=[],a=new sao({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:this.channelPath});let o=Object.entries(this.operations).reduce((m,[O,P])=>{try{this.getChannelPathFromOperation(P)===this.channelPath&&(m[O]=P)}catch{}return m},{}),c=[];for(let[m,O]of Object.entries(o))for(let P of O.messages){let C=this.context.convertReferenceToTypeReference({reference:P});if(C.ok){let M=Mfe.reference({bodyType:C.reference,docs:O.description});c.push({type:m,displayName:m,origin:O.action==="send"?"client":"server",body:M,availability:this.context.getAvailability({node:O,breadcrumbs:this.breadcrumbs}),docs:O.description})}}let f=this.resolveChannelServersFromReference(this.channel.servers??[])??Object.keys(this.context.spec.servers??{})[0],u=this.transformToValidPath(this.channel.address??this.channelPath),s=nZ(u),l=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(a),displayName:a,baseUrl:f,path:s,auth:!1,headers:n,queryParameters:r,pathParameters:t,messages:c,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:u,baseUrl:f,asyncApiVersion:"v3"})}},audiences:l,inlinedTypes:this.inlinedTypes}}convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:i}){for(let a of Object.values(this.channel.parameters??{})){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(o==null)continue;let c=this.convertChannelParameterLocation(o.location);if(c==null)continue;let{type:f,parameterKey:u}=c,l=new p2i({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...o,name:u,in:f},parameterNamePrefix:this.channelPath}).convert();if(l!=null)switch(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},l.type){case"path":t.push(l.parameter);break;case"query":r.push(l.parameter);break;case"header":n.push(l.parameter);break}}}convertChannelParameterLocation(t){try{let[r,n]=t.split("#/");if(r==null||n==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(gQf)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${gQf} prefix`,path:this.breadcrumbs});return}let i=r.substring(gQf.length);if(i!=="header"&&i!=="path"&&i!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${i}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return i==="payload"?{type:"query",parameterKey:n}:{type:i,parameterKey:n}}catch{this.context.errorCollector.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){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith($fv)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let n=r.$ref.substring($fv.length);if(n==null){this.context.errorCollector.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(Kfv))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(Kfv.length)}};var o5u=class extends uao{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.host),docs:void 0}}};var Kts=class extends dqr{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,n]of Object.entries(t.channels??{}))for(let[i,a]of Object.entries(n.messages??{})){if(!this.context.isMessageWithPayload(a)&&!this.context.isReferenceObject(a))continue;let o=["channels",r,"messages",i],c=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:o});if(!this.context.isMessageWithPayload(c))continue;let f=this.context.resolveMaybeReference({schemaOrReference:c.payload,breadcrumbs:o});if(f==null)continue;let u=`${r}_${i}`;this.convertSchema({id:u,breadcrumbs:o,schema:f})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let n=["components","messages",t],i=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:n});i!=null&&this.convertSchema({id:t,breadcrumbs:n,schema:i})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:n}){let a=new G7.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:n}).convert();a!=null&&this.addSchemaOutputToIr(t,a)}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new o5u({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new i5u({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let i=new Tse.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,a;if(this.isAsyncAPIV3(this.context)){let c=this.context.spec.operations??{};a=new a5u({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t,operations:c}).convert()}else a=new n5u({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t}).convert();a!=null&&(this.addWebsocketChannelToIr({websocketChannel:a.channel,channelPath:t,audiences:a.audiences,websocketGroup:i}),this.addTypesToIr(a.inlinedTypes))}}};var $ts=class extends Oee{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let a,o=t.$ref.match(/^.*\/schemas\/(.+)$/),c=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),f=t.$ref.match(/^.*\/messages\/(.+)$/);if(o&&o[1])return a=o[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a});if(c&&c[2]){let u=c[1],s=c[2];return a=`${u}_${s}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a})}else return f&&f[1]?(a=f[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.title:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.title??n),{ok:!0,reference:Bh.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.name:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.name??n),{ok:!0,reference:Bh.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.messageId??o.value.name:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.messageId??o.value.name??n),{ok:!0,reference:Bh.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var tdv=Hi(s5u(),1);var u5u=class extends kE{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}};var c5u=class extends kE{document;key="x-fern-playground";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-playground",path:this.breadcrumbs});return}return t}}};function Yfv({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?gO.OPTIONAL_STRING:gO.STRING,env:r.env,v2Examples:r.optional?void 0:Y4I({header:r,context:t}),availability:void 0,docs:void 0}))}function Y4I({header:e,context:t}){let r=new lht({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:n}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:n}}}var l5u=class extends G7.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={};if(this.parameter.schema!=null){let n=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),a=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:n}).convert();a!=null&&(t=a.type,r=a.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var f5u=class extends G7.AbstractConverters.AbstractMediaTypeObjectConverter{contentType;mediaType;description;required;schemaId;streamingExtension;queryParameters;constructor({context:t,breadcrumbs:r,contentType:n,mediaType:i,description:a,required:o,group:c,method:f,streamingExtension:u,queryParameters:s}){super({context:t,breadcrumbs:r,group:c,method:f}),this.contentType=n,this.mediaType=i,this.description=a,this.required=o,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=u,this.queryParameters=s??[]}convert(){return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleStreamConditionJsonOrFormContent({contentType:this.contentType})}convertNonStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleJsonOrFormContent({contentType:this.contentType});if(R2.parse(this.contentType)?.isMultipart())return this.handleMultipartContent({contentType:this.contentType});if(this.isBinaryContentType())return this.handleBinaryContent({contentType:this.contentType})}isOrderedJsonOrFormContentType(){let t=R2.parse(this.contentType);return t?t.isJSON()||t.isURLEncoded()||t.isPlainText()||t.isCSV()||t.isHTML()||t.isXML()||t.isDNS()||t.isApplicationText():!1}isBinaryContentType(){let t=R2.parse(this.contentType);return t?t.isBinary():!1}handleJsonOrFormContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(n==null)return;let i=n.schema?.typeDeclaration.shape;return i?.type==="object"?this.hasBodyQueryParameterOverlap(i.properties)?{requestBody:U7.reference({contentType:t,docs:this.description,requestBodyType:n.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}:{requestBody:U7.inlinedRequestBody({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:i.extendedProperties,extends:i.extends,properties:i.properties,extraProperties:i.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes})}:{requestBody:U7.reference({contentType:t,docs:this.description,requestBodyType:n.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}}handleMultipartContent({contentType:t}){let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(n==null)return;let i=n.schema?.typeDeclaration.shape;if(i?.type==="object")return{requestBody:U7.fileUpload({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:i.properties.map(a=>{let o=r.encoding?.[a.name.wireValue];return this.convertRequestBodyProperty({property:a,contentType:t,encoding:o})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes}),examples:n.examples}}handleBinaryContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:U7.bytes({contentType:t,isOptional:this.required===!1,docs:this.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:n}){let{isFile:i,isOptional:a,isArray:o}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return i?o?zne.file(CFe.fileArray({key:t.name,isOptional:a,contentType:r,docs:t.docs})):zne.file(CFe.file({key:t.name,isOptional:a,contentType:r,docs:t.docs})):zne.bodyProperty({...t,contentType:n?.contentType??r,style:Z4I({encoding:n}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(n==null)return;let i=n.properties?.[this.streamingExtension.streamConditionProperty];if(i==null||this.context.isReferenceObject(i))return;let a=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!0,contentType:t,mediaTypeObject:r}),o=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(a==null||o==null))return{requestBody:o.requestBody,streamRequestBody:a.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...a.inlinedTypes,...o.inlinedTypes}})}}buildStreamConditionInlinedRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:n,contentType:i,mediaTypeObject:a}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let o={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{type:"boolean",const:n,...t}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},c={...a,schema:o},f=this.parseMediaTypeObject({mediaTypeObject:c,schemaId:this.schemaId,contentType:i});if(f==null)return;let u=f.schema?.typeDeclaration.shape;if(u?.type==="object")return{requestBody:U7.inlinedRequestBody({contentType:i,docs:void 0,name:this.context.casingsGenerator.generateName(n?`${this.schemaId}_streaming`:this.schemaId),extendedProperties:u.extendedProperties,extends:u.extends,properties:u.properties,extraProperties:u.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:c,exampleGenerationStrategy:"request"})}),inlinedTypes:f.inlinedTypes}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:n}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:n}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:n}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:n??!1}}hasBodyQueryParameterOverlap(t){if(this.queryParameters.length===0)return!1;let r=new Set(this.queryParameters.map(n=>n.name.wireValue.toLowerCase()));return t.some(n=>r.has(n.name.wireValue.toLowerCase()))}},X4I={"application/json":"json"};function Z4I({encoding:e}){if(e){if(e.explode)return"exploded";if(e.style==="form")return"form";if(e.contentType)return X4I[e.contentType]}}var k4I=/{([^}]+)}/g,e7I=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),cao=class extends gO{operation;method;path;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:n,method:i,path:a}){super({context:t,breadcrumbs:r}),this.operation=n,this.method=i,this.path=a}convertHttpMethod(){switch(this.method){case"get":return fU.Get;case"post":return fU.Post;case"put":return fU.Put;case"delete":return fU.Delete;case"patch":return fU.Patch;case"head":return fU.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],n=[],i=[];if(!this.operation.parameters)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i};for(let a of this.operation.parameters){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:t});if(o==null)continue;let f=new l5u({context:this.context,breadcrumbs:t,parameter:o}).convert();if(f!=null)switch(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},f.type){case"path":r.push(f.parameter);break;case"query":n.push(f.parameter);break;case"header":{let u=f.parameter.name.name.originalName,s=f.parameter.name.wireValue,l=!1,m=this.context.authOverrides?.["auth-schemes"];if(m!=null){for(let P of Object.values(m))if(i7I(P)&&P.header.toLowerCase()===s.toLowerCase()){l=!0;break}}let O=this.context.globalHeaderNames;if(O!=null){for(let P of O)if(P.toLowerCase()===s.toLowerCase()){l=!0;break}}!e7I.has(u.toLowerCase())&&!l&&i.push(f.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i}}checkMissingPathParameters(t){let n=[...this.path.matchAll(k4I)].map(i=>i[1]).filter(i=>!t.some(a=>a.name.originalName===i));for(let i of n){if(i==null)continue;let a=`${i}_example`;t.push({name:this.context.casingsGenerator.generateName(i),valueType:gO.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[a]:this.generateStringParameterExample({example:i})}}})}}convertRequestBody({breadcrumbs:t,group:r,method:n,streamingExtension:i,queryParameters:a}){if(this.operation.requestBody==null)return;let o=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(o==null)return null;let c=[];for(let[f,u]of Object.entries(o.content)){let l=new f5u({context:this.context,breadcrumbs:t,contentType:f,mediaType:u,description:o.description,required:o.required,group:r??[],method:n,streamingExtension:i,queryParameters:a}).convert();l!=null&&(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},c.push({requestBody:l.requestBody,streamRequestBody:l.streamRequestBody,examples:l.examples}))}return c}computeGroupNameAndLocationFromExtensions(){let r=new Tse.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,i=new Tse.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:i,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?$A(this.operation.summary):$A(`${this.method}_${this.path.split("/").join("_")}`))}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:r};let n=Xfv(t),i=Xfv(r);return sse(n,i)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:n,methodName:r,methodNameTokens:i})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:n,methodNameTokens:i}){if(r.some((c,f)=>c!==i[f]))return{group:[t],method:n};let o=i.slice(r.length);return{group:[t],method:$A(o.join("_"))}}generateStringParameterExample({example:t}){let r=new G7.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:n}=r.convert();return n}};function Xfv(e){let t=t7I(e)?r7I(e):n7I(e);return t=t.map(r=>r.toLowerCase()),t=wdt(t),t}function t7I(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function r7I(e){return e.split(/(?=[A-Z])/)}function n7I(e){return e.split(/[^a-zA-Z0-9]+/)}function i7I(e){return e?.header!=null}var lao=class extends cao{constructor({context:t,breadcrumbs:r,operation:n,method:i,path:a}){super({context:t,breadcrumbs:r,operation:n,method:i,path:a})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=[...this.breadcrumbs,"Payload"],{headers:a,queryParameters:o}=this.convertParameters({breadcrumbs:i}),c=this.convertRequestBody({breadcrumbs:i,group:r,method:n,streamingExtension:void 0,queryParameters:o});if(c==null)return;let f=c[0]?.requestBody;if(f==null)return;let u;if(f.type==="inlinedRequestBody")u=Bve.inlinedPayload({name:f.name,extends:f.extends,properties:f.properties});else if(f.type==="reference")u=Bve.reference({payloadType:f.requestBodyType,docs:f.docs});else return;return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,webhook:{id:`${r?.join(".")??""}.${n}`,name:this.context.casingsGenerator.generateName(n),displayName:this.operation.summary,method:t,headers:a,payload:u,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,n])=>[r,{name:r,payload:n}]))}};var AQf=Hi(s5u(),1);var Zfv=["get","post","put","delete","patch","head"];var d5u=class extends kE{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}};var a7I=nl.object({cursor:nl.string(),next_cursor:nl.string(),results:nl.string()}),o7I=nl.object({offset:nl.string(),results:nl.string(),step:nl.string().optional(),"has-next-page":nl.string().optional()}),mQf=nl.union([nl.boolean(),a7I,o7I]);var OQf="$request.",p5u="$response.",_5u=class extends kE{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:n,context:i}){super({breadcrumbs:t,context:i}),this.operation=r,this.document=n}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=mQf.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let n=this.getExtensionValue(this.document);if(n==null)return;if(typeof n=="boolean"){this.context.errorCollector.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 i=mQf.safeParse(n);if(!i.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${i.error.message}`,path:this.breadcrumbs});return}if(typeof i.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:i.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:Oee.maybeTrimPrefix(r.cursor,OQf),nextCursor:Oee.maybeTrimPrefix(r.next_cursor,p5u),results:Oee.maybeTrimPrefix(r.results,p5u)};let n=t;return{type:"offset",offset:Oee.maybeTrimPrefix(n.offset,OQf),results:Oee.maybeTrimPrefix(n.results,p5u),step:n.step!=null?Oee.maybeTrimPrefix(n.step,OQf):void 0,hasNextPage:n["has-next-page"]!=null?Oee.maybeTrimPrefix(n["has-next-page"],p5u):void 0}}};var s7I="$request.",u7I=nl.object({"stream-condition":nl.string().optional(),format:nl.enum(["sse","json"]).optional(),"stream-description":nl.string().optional(),"response-stream":nl.any(),response:nl.any()}),c7I=nl.union([nl.boolean(),u7I]),h5u=class extends kE{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=c7I.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json"}:void 0;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",streamDescription:r.data["stream-description"],streamConditionProperty:Oee.maybeTrimPrefix(r.data["stream-condition"],s7I),responseStream:r.data["response-stream"],response:r.data.response}}};var y5u=class extends kE{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}};var b5u=require("fs"),kfv=require("path");function l7I(e){return QD(e)&&typeof e.$ref=="string"}function f7I(e,t){if(e!=null){if(typeof e=="string")return e;if(l7I(e)){let r=(0,kfv.resolve)(t??process.cwd(),e.$ref);if((0,b5u.existsSync)(r))try{return(0,b5u.readFileSync)(r,"utf-8")}catch{return}}}}function d7I(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!QD(n))continue;let a=f7I(n.code,t);a!=null&&r.push({...n,code:a})}return r}var v5u=class extends kE{operation;baseDir;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:n,baseDir:i}){super({breadcrumbs:r,context:t}),this.operation=n,this.baseDir=i}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).map(a=>{if(!QD(a))return a;let c=a["code-samples"];if(c!=null){let f=d7I(c,this.baseDir);return{...a,"code-samples":f}}return a}).filter(a=>{let o=VX.serialization.ExampleEndpointCallSchema.parse(a);return o.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),o.ok})}};var g5u=class extends kE{operation;key="x-fern-playground-enabled";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-playground-enabled",path:this.breadcrumbs});return}return t}}};var Yts=class extends G7.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;constructor({context:t,breadcrumbs:r,responseBody:n,group:i,method:a,statusCode:o,streamingExtension:c}){super({context:t,breadcrumbs:r,group:i,method:a}),this.responseBody=n,this.statusCode=o,this.streamingExtension=c}convert(){return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,n=[...this.group,this.method,"Response",this.statusCode].join("_"),i=`${n}_streaming`,a=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:i}),o=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:n});return this.convertStreamConditionResponse({convertedStreamingSchema:a,convertedNonStreamingSchema:o})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{});for(let n of r){let i=this.responseBody.content?.[n];if(i==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:i,schemaId:t,contentType:this.streamingExtension.format});if(a!=null)return this.convertStreamingResponse({mediaTypeObject:i,convertedSchema:a})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(a=>a.includes("json"));for(let a of r){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null&&this.shouldReturnJsonResponse(a))return this.returnJsonResponse({mediaTypeObject:o,convertedSchema:c})}let n=Object.keys(this.responseBody.content??{}).filter(a=>!a.includes("json"));for(let a of n){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null){if(this.isBinarySchema(c))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:o}):this.returnFileDownloadResponse({mediaTypeObject:o});if(this.shouldReturnTextResponse(a))return this.returnTextResponse({mediaTypeObject:o})}}let i=parseInt(this.statusCode);if(!isNaN(i)&&i>=200&&i<300){let a={schema:{type:"object",description:"Empty response body"}},o=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:"application/json",resolveSchema:!0});if(o!=null)return this.returnJsonResponse({mediaTypeObject:a,convertedSchema:o})}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(t==null||r==null)return;let n=this.responseBody.description;return this.streamingExtension?.type==="streamCondition"&&this.streamingExtension.streamDescription!=null&&(n=this.streamingExtension.streamDescription),{responseBody:vN.json(Sfe.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:vN.streaming(Dfe.json({docs:n,payload:t.type,terminator:void 0,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes}}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:vN.streaming(Dfe.json({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};case"sse":return{responseBody:vN.streaming(Dfe.sse({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:vN.json(Sfe.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:vN.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:vN.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnTextResponse({mediaTypeObject:t}){return{responseBody:vN.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return R2.parse(t)?.isText()??!1}};var m5u=class extends G7.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;constructor({context:t,breadcrumbs:r,responseError:n,group:i,method:a,methodName:o,statusCode:c}){super({context:t,breadcrumbs:r,group:i,method:a}),this.responseError=n,this.statusCode=c,this.methodName=o}convert(){if(!this.responseError.content){let n=fZo[this.statusCode];if(n==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let i=this.getErrorIdFromErrorName(n);return{error:{error:{name:this.context.casingsGenerator.generateName(i),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:i},docs:this.responseError.description},errorType:Bh.unknown(),displayName:n,statusCode:this.statusCode,inlinedTypes:{},examples:{}}}let t=Object.keys(this.responseError.content).filter(n=>n.includes("json")),r=fZo[this.statusCode];if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let n of[...t]){let i=this.responseError.content?.[n];if(i==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:i,schemaId:edv(`${this.methodName}Request${r}`),contentType:n});if(a==null)continue;let o=this.getErrorIdFromErrorName(r);if(a.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.schema.typeDeclaration.name.fernFilepath,convertedSchema:a});if(a.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.type.fernFilepath,convertedSchema:a})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:n,convertedSchema:i}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:n,errorId:r},docs:this.responseError.description},errorType:i.type,displayName:t,statusCode:this.statusCode,inlinedTypes:i.inlinedTypes,examples:i.examples}}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?edv(`${this.methodName}Request${t}`):t}};function edv(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var O5u=class e extends cao{idempotent;idToAuthScheme;topLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:n,method:i,path:a,idempotent:o,idToAuthScheme:c,topLevelServers:f,streamingExtension:u}){super({context:t,breadcrumbs:r,operation:n,method:i,path:a}),this.idempotent=o,this.idToAuthScheme=c,this.topLevelServers=f,this.streamingExtension=u}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=this.getGroupDisplayName(r),{headers:a,pathParameters:o,queryParameters:c}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),f=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:n,streamingExtension:this.streamingExtension,queryParameters:c}),u=f?.[0]?.requestBody,s=f?.[0]?.streamRequestBody,l={requestBodies:f?.map(pe=>pe.requestBody)},m=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:n,streamingExtension:this.streamingExtension}),O=m?.response,P=m?.streamResponse,C=m!=null?m.errors:[],M={},T=C.map(pe=>pe.error),z=nZ(this.path),U=this.getEndpointBaseUrl(),q=this.getEndpointBaseUrls(),V=this.convertExamples({httpPath:z,httpMethod:t,baseUrl:U}),$=new Set(this.operation.security?.flatMap(pe=>Object.keys(pe))??[]),re=this.authSchemeToHeaders(Array.from($));re.length>0&&a.push(...re);for(let pe of C){let Ce=pe.error,je=pe.errorType,Se=Ce.error.errorId,Ot=pe.examples;M[Se]={name:Ce.error,displayName:pe.displayName,discriminantValue:{name:Ce.error.name,wireValue:Se},type:je,statusCode:pe.statusCode,docs:Ce.docs,examples:[],v2Examples:{userSpecifiedExamples:Ot??{},autogeneratedExamples:{}}}}let Y=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],ne=new g5u({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation}).convert(),Oe={displayName:this.operation.summary,method:t,baseUrl:U,v2BaseUrls:q,path:z,pathParameters:o,queryParameters:c,headers:a.filter((pe,Ce,je)=>Ce===je.findIndex(Se=>Se.name.wireValue===pe.name.wireValue)),sdkRequest:void 0,errors:T,auth:this.operation.security!=null||this.context.spec.security!=null,security:this.operation.security??this.context.spec.security,availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:z,allPathParameters:o,pagination:void 0,transport:void 0,source:FAe.openapi(),audiences:Y,retries:void 0,apiPlayground:ne},ye=this.context.namespace!=null?[this.context.namespace]:[],ge=r?.map(pe=>$A(pe));return ye.push(...ge??[]),{audiences:Y,group:r,groupDisplayName:i,errors:M,endpoint:{...Oe,id:`endpoint_${ye.join("/")}.${n}`,name:this.context.casingsGenerator.generateName(n),requestBody:u,v2RequestBodies:l,response:O,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:V.examples},v2Responses:{responses:m?.v2Responses}},streamEndpoint:P!=null&&P.body!=null?{...Oe,id:`endpoint_${ye.join("/")}.${n}_stream`,name:this.context.casingsGenerator.generateName(`${n}_stream`),requestBody:s,v2RequestBodies:void 0,response:P,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:V.streamExamples},v2Responses:{responses:[{statusCode:200,body:P.body}]}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??[])}}convertResponseBody({breadcrumbs:t,group:r,method:n,streamingExtension:i}){if(this.operation.responses==null)return;let a,o=!1;for(let[c,f]of Object.entries(this.operation.responses)){let u=parseInt(c);if(!(isNaN(u)||u<200||u>=300&&u<400)){if(a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}}),u>=200&&u<300){let s=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(s==null)continue;let m=new Yts({context:this.context,breadcrumbs:[...t,c],responseBody:s,group:r??[],method:n,statusCode:c,streamingExtension:i}).convert();m!=null&&(this.inlinedTypes={...this.inlinedTypes,...m.inlinedTypes},o||(o=!0,a.response={statusCode:u,body:m.responseBody},a.streamResponse={statusCode:u,body:m.streamResponseBody}),a.v2Responses=[...a.v2Responses??[],{statusCode:u,body:m.responseBody}])}if(u>=400&&u<600){let s=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(s==null)continue;let m=new m5u({context:this.context,breadcrumbs:[...t,c],responseError:s,group:r??[],method:n,methodName:this.evaluateMethodNameFromOperation(),statusCode:u}).convert();m!=null&&(this.inlinedTypes={...this.inlinedTypes,...m.inlinedTypes},a.errors.push(m))}}}if(this.streamingExtension!=null){a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}});let f=new Yts({context:this.context,breadcrumbs:[...t,"stream"],responseBody:{description:""},group:r??[],method:n,statusCode:"stream",streamingExtension:i}).convert();f!=null&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},a.response={statusCode:200,body:f.responseBody},a.streamResponse={statusCode:200,body:f.streamResponseBody},a.v2Responses=[{statusCode:200,body:f.responseBody}])}return a}authSchemeToHeaders(t){let r=[];for(let n of t){let i=this.idToAuthScheme?.[n];if(i==null)continue;let a={valueType:gO.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0};switch(i.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"header":r.push({name:i.name,...a});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:n}){let a=new v5u({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert();return a==null?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:a}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:a}),streamExamples:{}}}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){let a=i.filter(u=>!(u.response!=null&&"stream"in u.response)),o=i.filter(u=>u.response!=null&&"stream"in u.response),c=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:a}),f=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:o});return{examples:c,streamExamples:f}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){return Object.fromEntries(i.map((a,o)=>[this.getExampleName({example:a,exampleIndex:o}),{displayName:void 0,request:a.request!=null||a["path-parameters"]!=null||a["query-parameters"]!=null||a.headers!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,a["path-parameters"]??{})},baseUrl:void 0,environment:n,auth:void 0,pathParameters:a["path-parameters"]??{},queryParameters:a["query-parameters"]??{},headers:a.headers??{},requestBody:a.request??void 0}:void 0,response:a.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:a})}:void 0,codeSamples:a["code-samples"]?.map(c=>{let f=("language"in c?c.language:c.sdk)??void 0;return{name:c.name,docs:void 0,language:f,code:c.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return ip.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return ip.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let r=new Tse.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert();if(r!=null)return this.context.logger.debug(`[getEndpointBaseUrl] Endpoint ${this.method.toUpperCase()} ${this.path} specifies a server with "${yb.SERVER_NAME_V2}" extension. Returning server type: ${r}`),r;let n=this.operation.servers?.[0];if(n==null)return;let a=this.topLevelServers?.find(o=>o.url===n.url)??n;return rnt.getServerName({server:a,context:this.context})}getEndpointBaseUrls(){let t=this.operation.servers;return t?.map(n=>{let a=this.topLevelServers?.find(o=>o.url===n.url)??n;return rnt.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(n=>`${r[n.pathParameter]?.toString()??n.pathParameter}${n.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(n=>n.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let n=t?.[t.length-1];if(n!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===n?r:void 0}};var A5u=class extends gO{pathItem;path;idToAuthScheme;topLevelServers;constructor({context:t,breadcrumbs:r,pathItem:n,path:i,idToAuthScheme:a,topLevelServers:o}){super({context:t,breadcrumbs:r}),this.pathItem=n,this.path=i,this.idToAuthScheme=a,this.topLevelServers=o}convert(){let t=[],r=[],n={};for(let i of Zfv){let a=this.pathItem[i];if(a==null)continue;let o=[...this.breadcrumbs,i],c=this.tryParseAsWebhook({operationBreadcrumbs:o,operation:a,method:i,context:this.context});if(c!=null){r.push(c),Object.assign(n,c.inlinedTypes);continue}let u=new h5u({breadcrumbs:o,operation:a,context:this.context}).convert(),s=this.tryParseAsHttpEndpoint({operationBreadcrumbs:o,operation:a,method:i,streamingExtension:u});s!=null&&(t.push(s),Object.assign(n,s.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:n}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:n,context:i}){return new y5u({breadcrumbs:n,operation:t,context:i}).convert()?new lao({context:this.context,breadcrumbs:n,operation:t,method:AQf.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert():void 0}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:n,streamingExtension:i}){new _5u({breadcrumbs:n,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let f=new d5u({breadcrumbs:n,operation:t,context:this.context}).convert();return new O5u({context:this.context,breadcrumbs:n,operation:t,method:AQf.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:f,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,streamingExtension:i}).convert()}};var P5u=class extends gO{securityScheme;schemeId;constructor({context:t,breadcrumbs:r,securityScheme:n,schemeId:i}){super({context:t,breadcrumbs:r}),this.securityScheme=n,this.schemeId=i}convert(){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return L8.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return L8.basic({key:this.schemeId,username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return L8.header({key:this.schemeId,name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:this.securityScheme.name},valueType:gO.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return L8.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var Xts=class extends dqr{constructor({breadcrumbs:t,context:r,audiences:n}){super({breadcrumbs:t,context:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.convertSecuritySchemes(),this.convertGlobalHeaders(),this.convertPlayground(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:t,errors:r}=this.convertPaths();this.addErrorsToIr(r);let{defaultUrl:n}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(n),this.finalizeIr()}convertGlobalHeaders(){this.context.globalHeaderOverrides;let r=new u5u({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let n=Yfv({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(n),this.context.setGlobalHeaders(n)}}convertPlayground(){let r=new c5u({breadcrumbs:["x-fern-playground"],document:this.context.spec,context:this.context}).convert();this.ir.apiPlayground=r??!0}convertSecuritySchemes(){if(this.context.authOverrides){this.addAuthToIR(jTf({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator}));return}let t=[];for(let[r,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",r]});if(i==null)continue;let o=new P5u({context:this.context,breadcrumbs:["components","securitySchemes",r],securityScheme:i,schemeId:r}).convert();o!=null&&t.push(o)}t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertServers({endpointLevelServers:t}){if(this.context.environmentOverrides){let i=oZo({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return i!=null&&this.addEnvironmentsToIr({environmentConfig:i.environmentsConfig,audiences:i.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let n=new rnt({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:n?.value}),{defaultUrl:n?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new G7.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertWebhooks(){for(let[,t]of Object.entries(this.context.spec.webhooks??{})){if(t==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in t)){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}if(t.post?.operationId==null){this.context.errorCollector.collect({message:"Skipping webhook as no operationId is present",path:this.breadcrumbs});continue}let r=t.post.operationId,i=new lao({context:this.context,breadcrumbs:["webhooks",r],operation:t.post,method:tdv.OpenAPIV3.HttpMethods.POST,path:r}).convert();i!=null&&(this.addWebhookToIr({webhook:i.webhook,operationId:r,audiences:i.audiences,group:i.group}),this.addTypesToIr(i.inlinedTypes))}}convertPaths(){let t=[],r={};for(let[n,i]of Object.entries(this.context.spec.paths??{})){if(i==null)continue;let o=new A5u({context:this.context,breadcrumbs:["paths",n],topLevelServers:this.context.spec.servers,pathItem:i,path:n}).convert();if(o!=null){for(let c of o.endpoints){if(c.streamEndpoint!=null&&this.addEndpointToIr({endpoint:c.streamEndpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),c.servers)for(let f of c.servers)this.shouldAddServerToCollectedServers({server:f,currentServers:t})&&t.push(f);if(c.errors)for(let[f,u]of Object.entries(c.errors))r[f]=u}for(let c of o.webhooks){let f=this.context.getGroup({groupParts:c.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:c.webhook,operationId:f.join("."),group:f,audiences:c.audiences})}this.addTypesToIr(o.inlinedTypes)}}return{endpointLevelServers:t,errors:r}}};var w5u=class extends kE{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:n}){super({breadcrumbs:t,context:n}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}};var Zts=class extends Oee{globalHeaderNames;tagToDisplayName={};isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;i==="reference_identifier"?c=n??o.value.title:i==="discriminator_key"?c=o.value.title??n:i==="schema_identifier"&&(c=o.value.title);let f;if(a.includes("/")){let s=new G7.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:o.value,id:a}).convert();s!=null&&(f={[a]:s.convertedSchema})}return{ok:!0,reference:Bh.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,default:void 0,inline:!1,displayName:c}),inlinedTypes:f}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>r.name.wireValue)}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let i=new w5u({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=i}return this.tagToDisplayName[t]??t}};var p7I=nl.object({description:nl.string().optional(),required:nl.boolean().optional(),deprecated:nl.boolean().optional(),allowEmptyValue:nl.boolean().optional(),style:nl.string().optional(),explode:nl.boolean().optional(),allowReserved:nl.boolean().optional(),schema:nl.any().optional(),example:nl.any().optional(),examples:nl.record(nl.string(),nl.any()).optional(),content:nl.record(nl.string(),nl.any()).optional()}),_7I=p7I.extend({name:nl.string(),in:nl.string()}),h7I=nl.array(_7I),j5u=class extends kE{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return h7I.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${r instanceof Error?r.message:String(r)}`,path:this.breadcrumbs});return}}};var E5u=class extends gO{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:n,pathParameters:i=[],queryParameters:a=[],headers:o=[],topLevelServers:c=[]}){super({context:t,breadcrumbs:r}),this.method=n,this.pathParameters=i,this.queryParameters=a,this.headers=o,this.topLevelServers=c}convert(){let t={},r="";for(let u of this.pathParameters)r+=`/{${u.name.originalName}}`;let n=nZ(r),i=[];for(let[u,s]of this.method.params.entries()){let l;if(this.context.isReferenceObject(s)){let C=this.context.resolveReference({reference:s});if(C.resolved)l=C.value;else continue}else l=s;let m=[this.method.name,"Param",l.name].join("_"),P=new G7.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",l.name],schemaIdOverride:m,context:this.context,schemaOrReference:l.schema,wrapAsOptional:!l.required}).convert();P!=null&&(i.push({docs:l.description,availability:this.context.getAvailability({node:s,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:l.name,wireValue:l.name}),valueType:P.type,v2Examples:P.schema?.typeDeclaration.v2Examples,propertyAccess:void 0}),t={...P.inlinedTypes,...t,...P.schema!=null?{[m]:P.schema}:{}})}let a;if(this.method.result!=null){let u=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(u!=null){let s=new G7.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:u.schema}),l=[this.method.name,"Result"].join("_"),m=s.convert();m!=null&&(a={docs:u.description,v2Examples:m.schema?.typeDeclaration.v2Examples,responseBodyType:m.type},t={...m.inlinedTypes,...t,...m.schema!=null?{[l]:m.schema}:{}})}}let o=this.getEndpointBaseUrls(),c=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:o,basePath:void 0,auth:!1,security:void 0,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:n,fullPath:n,requestBody:i.length>0?U7.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:i,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,v2RequestBodies:void 0,sdkRequest:void 0,response:a!=null?{body:vN.json(Sfe.response(a)),statusCode:void 0}:void 0,v2Responses:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples()},transport:void 0,availability:void 0,source:FAe.openrpc(),audiences:c,retries:void 0,apiPlayground:void 0},audiences:c,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(n=>n.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(n=>{if(this.topLevelServers.find(c=>c.name===n.name&&c.url!==n.url)!=null)return n.url;let o=this.topLevelServers.find(c=>c.url===n.url)??n;return rnt.getServerName({server:o,context:this.context})})}convertExamples(){let t={},r=0;if(this.method.examples&&this.method.examples.length>0){for(let n of this.method.examples??[]){let i;if(this.context.isReferenceObject(n)){let f=this.context.resolveReference({reference:n});if(f.resolved)i=f.value;else continue}else i=n;let a;if(i.result)if(this.context.isReferenceObject(i.result)){let f=this.context.resolveReference({reference:i.result});f.resolved&&(a=f.value)}else a=i.result;let o=i.name??`Example ${r+1}`,c=[];if(i.params&&Array.isArray(i.params)){c=[];for(let f of i.params)if(this.context.isReferenceObject(f)){let u=this.context.resolveReference({reference:f});if(u.resolved)c.push(u.value);else continue}else c.push(f)}t[o]={displayName:void 0,request:{docs:void 0,endpoint:{method:"POST",path:"/{apiKey}"},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:c.map(f=>f.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?ip.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:i.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++r}return t}};var S5u=class extends G7.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={};if(this.parameter.schema!=null){let i=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();i!=null&&(t=i.type,r=i.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var kts=class extends dqr{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let n=new rnt({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:n?.value}),{defaultUrl:n?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new G7.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertMethods(){let t=[],n=new j5u({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),i=[],a=[],o=[];if(n&&n.length>0)for(let[f,u]of n.entries()){let l=new S5u({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${f}]`],parameter:u}).convert();if(l!=null)switch(l.type){case"path":{i.push(l.parameter);break}case"query":{a.push(l.parameter);break}case"header":{o.push(l.parameter);break}}}let c=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let f of this.context.spec.methods??[]){let u=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:["methods"]});if(u==null)continue;let l=new E5u({context:this.context,breadcrumbs:["methods"],method:u,pathParameters:i,queryParameters:a,headers:o,topLevelServers:this.context.spec.servers}).convert();if(l!=null&&(this.addEndpointToIr({endpoint:l.endpoint,audiences:l.audiences,endpointGroup:c,serviceName:"service_root"}),this.addTypesToIr(l.inlinedTypes),l.servers))for(let m of l.servers)this.shouldAddServerToCollectedServers({server:m,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(m))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(n=>n.name===t.name&&n.url!==t.url)?{...t,name:t.url}:t}};var ers=class extends Oee{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.title:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.title??n),{ok:!0,reference:Bh.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var Wpv=require("fs/promises");var rdv={[lm.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,aU(e)])),[lm.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"]),[lm.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"]),[lm.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","kwargs"]),[lm.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","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[lm.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","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[lm.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"]),[lm.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[lm.GenerationLanguage.SWIFT]:new Set([])};var y7I=["go","ruby"];function I5u({generationLanguage:e,keywords:t,smartCasing:r}){let n={generateName:(i,a)=>{let o=l=>({unsafeName:l,safeName:v7I({name:l,keywords:b7I({generationLanguage:e,keywords:t})})}),c=$A(i),f=aU(c),u=Una(i),s=xna(c);return r&&(!O7I(s)&&(e==null||y7I.includes(e))&&(c=s.map((l,m)=>{if(m>0){let O=D5u(l);if(O!=null)return O;if(C5u(l))return l.toUpperCase()}return l}).join(""),f=aU(s.map((l,m)=>{let O=D5u(l);return O??(C5u(l)?l.toUpperCase():m===0?aU(l):l)}).join(""))),u=i.split(" ").map(l=>l.split(/(\d+)/).map(Una).join("")).join("_")),{originalName:i,camelCase:o(a?.casingOverrides?.camel??c),snakeCase:o(a?.casingOverrides?.snake??u),screamingSnakeCase:o(a?.casingOverrides?.["screaming-snake"]??u.toUpperCase()),pascalCase:o(a?.casingOverrides?.pascal??f)}},generateNameAndWireValue:({name:i,wireValue:a,opts:o})=>({name:n.generateName(i,o),wireValue:a})};return n}function v7I({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":m7I(e)?"_"+e:e}function b7I({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return rdv[e]}var g7I=/^[0-9]/;function m7I(e){return g7I.test(e)}function O7I(e){return e.some((t,r)=>{if(r===0)return!1;let n=e[r-1];if(n==null)return!1;let i=D5u(n)!=null||C5u(n),a=D5u(t)!=null||C5u(t);return i&&a})}function D5u(e){return P7I.get(e.toUpperCase())}function C5u(e){return A7I.has(e.toUpperCase())}var A7I=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"]),P7I=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var ndv=require("fs/promises");async function PQf({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,ndv.readFile)(t)).toString(),i;try{i=JSON.parse(n)}catch{i=Pg.load(n)}return r!=null?await aao({absoluteFilePathToOverrides:r,context:e,data:i}):i}var Mpv=Hi(Ipv(),1);function h2i(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...o}={}){let c=i.reduce((u,s)=>({...u,[s]:"<redacted>"}),a),f=[t,...r].join(" ");for(let[u,s]of Object.entries(c))f=f.replaceAll(u,s);return e?.debug(`+ ${f}`),(0,Mpv.default)(t,r,o)}async function FG(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...o}={}){let c=h2i(e,t,r,{doNotPipeOutput:n,secrets:i,substitutions:a,...o});n||(c.stdout?.pipe(process.stdout),c.stderr?.pipe(process.stderr));let f=await c;return f.stdout==null&&(f.stdout=""),f.stderr==null&&(f.stderr=""),f}function y2i(e,{logger:t,...r}={}){return(n,i)=>FG(t,e,n,{...r,...i})}var jnt=require("fs/promises"),Qpv=Hi(require("path"),1),QQf=Hi(RDe(),1);var Bpv="buf.gen.yaml",y2I="output",Tpv=`${y2I}/ir.json`,qpv="protoc-gen-fern",Rpv=`version: v1
|
|
2703
|
+
`).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:x2u.conjure.DefinitionFile.parseOrThrow(Pg.load(r),{unrecognizedObjectKeys:"passthrough",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0})}}function fiv(e,t){if(SBI(e))return t.alias(e);if(DBI(e))return t.enum(e);if(CBI(e))return t.object(e);if(IBI(e))return t.union(e);Zu(e)}function SBI(e){return e?.alias!=null}function DBI(e){return e?.values!=null}function CBI(e){return e?.fields!=null}function IBI(e){return e?.union!=null}var Ces=class extends cko{fernDefinitionBuilder=new Vla(!1);conjureFilepathToFernFilepath={};async import({absolutePathToConjureFolder:t,authOverrides:r,environmentOverrides:n,globalHeaderOverrides:i}){if(r!=null){for(let[a,o]of Object.entries(r["auth-schemes"]??{}))this.fernDefinitionBuilder.addAuthScheme({name:a,schema:o});r.auth!=null&&this.fernDefinitionBuilder.setAuth(r.auth)}if(n!=null){for(let[a,o]of Object.entries(n.environments??{}))this.fernDefinitionBuilder.addEnvironment({name:a,schema:o});n["default-environment"]!=null&&this.fernDefinitionBuilder.setDefaultEnvironment(n["default-environment"]),n["default-url"]!=null&&this.fernDefinitionBuilder.setDefaultUrl(n["default-url"])}return await div(t,(a,o,c)=>{for(let[s,l]of Object.entries(c.services??{})){let m=Oeu({value:s,suffix:"Service"});this.conjureFilepathToFernFilepath[o]=eu.of(`${m}/__package__.yml`);return}let u=w9o(o)?.split(".")[0];u!=null&&(this.conjureFilepathToFernFilepath[o]=eu.of(`${u}/__package__.yml`))}),await div(t,(a,o,c)=>{if(c.services==null||Object.keys(c.services??{}).length===0){let f=this.conjureFilepathToFernFilepath[o];if(f==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${o}`);for(let[u,s]of Object.entries(c.types?.conjureImports??{})){let l=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:eu.of(s)});this.fernDefinitionBuilder.addImport({file:f,fileToImport:eu.of(l),alias:u})}this.importAllTypes({conjureFile:c,fernFilePath:f});return}for(let[f,u]of Object.entries(c.services)){let s=Oeu({value:f,suffix:"Service"}),l=eu.of(`${s}/__package__.yml`),m={};u.basePath!=null&&(m["base-path"]=u.basePath),u.docs!=null&&(m.docs=u.docs),this.fernDefinitionBuilder.setServiceInfo(l,m),this.importAllTypes({conjureFile:c,fernFilePath:l});for(let[O,P]of Object.entries(c.types?.conjureImports??{})){let C=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:eu.of(P)});this.fernDefinitionBuilder.addImport({file:l,fileToImport:eu.of(C),alias:O})}for(let[O,P]of Object.entries(u.endpoints??{})){let C=PJl(P.http);if(C.type==="failure"){this.context?.logger.error(`Failed to parse ${P.http}. Skipping.`);continue}let T={auth:(P.auth??u.defaultAuth)!==qnv.None,path:C.path,method:C.method,response:P.returns==="binary"?"file":P.returns};P.docs!=null&&(T.docs=P.docs);let z={};if(P.args!=null)for(let U of C.pathParameters){let q=P.args[U];if(q==null)throw new Error(`Failed to find path parameter ${U} in ${P.http}`);z[U]=typeof q=="string"?q:{type:q.type}}Object.entries(z).length>0&&(T["path-parameters"]=z);for(let[U,q]of Object.entries(P.args??{}))if(z[U]==null)if(typeof q=="string")T.request?typeof T.request=="string"&&(T.request={body:T.request}):T.request={},T.request.body=q==="binary"?"bytes":q;else switch(q.paramType){case"body":T.request={body:q.type==="binary"?"bytes":q.type};break;case"query":T.request==null?T.request={"query-parameters":{[U]:q.type}}:typeof T.request!="string"&&T.request?.["query-parameters"]==null?T.request["query-parameters"]={[U]:q.type}:typeof T.request!="string"&&T.request?.["query-parameters"]!=null&&(T.request["query-parameters"][U]=q.type)}T.request!=null&&typeof T.request!="string"&&T.request?.["query-parameters"]!=null&&(T.request.name=`${O}Request`),this.fernDefinitionBuilder.addEndpoint(l,{name:O,schema:T,source:void 0})}}}),this.fernDefinitionBuilder.build()}convertBinaryType(t){return typeof t=="string"?t==="binary"?{type:"string",validation:{format:"binary"}}:t:t.type==="binary"?{...t,type:"string",validation:{format:"binary"}}:t}importAllTypes({conjureFile:t,fernFilePath:r}){for(let[n,i]of Object.entries(t.types?.definitions?.objects??{}))fiv(i,{alias:a=>{let o=a.alias==="binary"?{type:"string",validation:{format:"binary"}}:a.alias;this.fernDefinitionBuilder.addType(r,{name:n,schema:typeof o=="string"?{type:o,docs:a.docs}:{...o,docs:a.docs}})},object:a=>{this.fernDefinitionBuilder.addType(r,{name:n,schema:{properties:Object.fromEntries(Object.entries(a.fields).map(([o,c])=>[o,this.convertBinaryType(c)]))}})},enum:a=>{this.fernDefinitionBuilder.addType(r,{name:n,schema:{enum:a.values}})},union:a=>{this.fernDefinitionBuilder.addType(r,{name:n,schema:{union:Object.fromEntries(Object.entries(a.union).map(([o,c])=>{let f=this.convertBinaryType(c);return[o,{type:typeof f=="string"?f:f.type,docs:typeof f=="string"?void 0:f.docs,key:o}]}))}})}})}getFernFileToImport({absoluteFilePathToConjureFile:t,importFilePath:r,absoluteFilePathToConjureFolder:n}){let i=Ql(Mg(t),eu.of(r)),a=tFe(n,i),o=this.conjureFilepathToFernFilepath[a];if(o==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${a}`);return o}};async function div(e,t){for(let r of await liv(e,"{yml,yaml}"))await t(r.absoluteFilepath,r.relativeFilepath,r.fileContents)}function piv(e,t){return Ig(e,t)}var z2u=class extends mqr{type="conjure";absolutePathToConjureFolder;constructor({relativePathToConjureDirectory:t,...r}){super(r),this.absolutePathToConjureFolder=Ql(r.absoluteFilePath,t)}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new fnt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion,sources:void 0})}async getDefinition({context:t},r){let i=await new Ces(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:F_.of("/DUMMY_PATH"),rootApiFile:{defaultUrl:i.rootApiFile["default-url"],contents:i.rootApiFile,rawContents:Pg.dump(i.rootApiFile)},namedDefinitionFiles:{...piv(i.definitionFiles,a=>({absoluteFilepath:F_.of("/DUMMY_PATH"),rawContents:Pg.dump(a),contents:a})),[eu.of(jF)]:{absoluteFilepath:F_.of("/DUMMY_PATH"),rawContents:Pg.dump(i.packageMarkerFile),contents:i.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}getAbsoluteFilePaths(){return[this.absolutePathToConjureFolder]}};var Tsv=Hi(giv(),1);var zT;(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"})(zT||(zT={}));function miv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Q2u(e,t){for(let[r,n]of Vk(e))BBI({relativeFilepath:r,failure:n,logger:t})}function BBI({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case zT.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 zT.FILE_READ:r.error("Failed to open file: "+e);break;case zT.FILE_MISSING:r.error("Missing file: "+e);break;case zT.FILE_PARSE:t.error instanceof J9o?r.error(Rht({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case zT.STRUCTURE_VALIDATION:for(let n of t.error.issues)for(let{title:i,subtitle:a}of TBI(n))r.error(Rht({title:i,subtitle:a,breadcrumbs:[e,...n.path]}));break;case zT.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case zT.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${btu}: `+t.dependencyName);break;case zT.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case zT.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case zT.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let n=t.error.error.instancePath.split("/").filter(i=>i!=="").map(miv);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?n.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&n.push(t.error.error.params.additionalProperty),r.error(Rht({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...n]}))}for(let n of t.error.allErrors)if(n!==t.error.error){let i=n.instancePath.split("/").filter(a=>a!=="").map(miv);n.keyword==="required"&&n.params?.missingProperty?i.push(n.params.missingProperty):n.keyword==="additionalProperties"&&n.params?.additionalProperty&&i.push(n.params.additionalProperty),r.debug(Rht({title:n.message??"Unknown error",breadcrumbs:[e,...i]}))}break;default:Zu(t)}}function TBI(e){switch(e.code){case qy.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Mf.underline(e.expected)} but received ${Mf.underline(e.received)}`}];case qy.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Mf.underline(t)}`}));case qy.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Mf.underline(t)).join(", ")}`}];case qy.invalid_union:case qy.invalid_arguments:case qy.invalid_return_type:case qy.invalid_date:case qy.invalid_string:case qy.too_small:case qy.too_big:case qy.invalid_intersection_types:case qy.not_multiple_of:case qy.custom:default:return[{title:e.message}]}}var Oiv=require("fs/promises");async function Aiv(e,t){let r=[];for(let n of await sve(e,t))r.push(await qBI({relativeFilepath:j3(e,n),absoluteFilepath:n}));return r}async function qBI({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Oiv.readFile)(t)).toString()}}async function Piv(e){let t={},r={};function n(i){try{t[i.relativeFilepath]={defaultUrl:void 0,contents:Pg.load(i.fileContents,{schema:Pg.CORE_SCHEMA}),rawContents:i.fileContents}}catch(a){r[i.relativeFilepath]={type:zT.FILE_PARSE,error:a}}}return await Promise.all(e.map(n)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}var l2f=Hi(hzi(),1);var Asv=require("fs"),zio=require("fs/promises");var Psv=require("os"),wsv=Hi(require("path"),1),jsv=require("stream/promises"),Esv=Hi(J6u(),1),Ssv=Hi(RDe(),1);var lRI=dAi();async function Dsv({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:n,cliVersion:i,settings:a,loadAPIWorkspace:o}){let c,f={type:zT.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},u=t.dependencies[e];return u==null?f={type:zT.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${vRI(u)}`},async s=>{switch(u.type){case"version":c=await hRI({context:s,dependency:u,cliVersion:i,settings:a,loadAPIWorkspace:o});return;case"local":c=await _RI({context:s,dependency:u,cliVersion:i,settings:a,loadAPIWorkspace:o});return;default:Zu(u)}}),c!=null?{didSucceed:!0,definition:c}:{didSucceed:!1,failure:f}}var Csv="dependencies";var fRI="metadata.json",dRI=".fern";function pRI(e){return Ql(F_.of((0,Psv.homedir)()),eu.of(dRI),eu.of(Csv),eu.of(e.organization),eu.of(e.apiName),eu.of(e.version))}async function _RI({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){if(i==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await i({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 o=await a.workspace.getDefinition({context:t,relativePathToDependency:eu.of(e.path)},n);return t.logger.info("Loaded..."),o}async function hRI({dependency:e,context:t,cliVersion:r,settings:n,loadAPIWorkspace:i}){let a=pRI(e),o=Ql(a,eu.of(Csv)),c=Ql(a,eu.of(fRI)),f;if(!await Vv(o)||!await Vv(c)){t.logger.info("Downloading manifest...");let l=await lRI.definitionRegistry.get(l2f.FernFiddle.OrganizationId(e.organization),l2f.FernFiddle.ApiId(e.apiName),e.version);if(!l.ok){l.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:C=>{t.failWithoutThrowing("Failed to download API manifest",C)}});return}let m=l.body.yamlSchemaVersion!=null?parseInt(l.body.yamlSchemaVersion):void 0,O=gla(r),P=gla(l.body.cliVersion);if(m!=null){if(m>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${l.body.cliVersion}`);return}else if(m<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(O.major!==P.major||O.minor!==P.minor){t.failWithoutThrowing(`CLI version is ${l.body.cliVersion}. Expected ${O.major}.${O.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+l.body.definitionS3DownloadUrl),await(0,zio.mkdir)(o,{recursive:!0});try{await yRI({s3PreSignedReadUrl:l.body.definitionS3DownloadUrl,absolutePathToLocalOutput:o})}catch(C){t.failWithoutThrowing("Failed to download API",C);return}f=l.body,await(0,zio.writeFile)(c,JSON.stringify(f))}else f=JSON.parse((await(0,zio.readFile)(c)).toString());if(t.logger.info("Parsing..."),i==null){t.failWithoutThrowing("Failed to load API");return}let u=await i({absolutePathToWorkspace:o,context:t,cliVersion:f.cliVersion,workspaceName:void 0});if(!u.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",u.failures);return}if(u.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await u.workspace.getDefinition({context:t},n)}async function yRI({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await $X.get(e,{responseType:"stream"}),n=await Ssv.default.dir(),i=wsv.default.join(n.path,"api.tgz");await(0,jsv.pipeline)(r.data,(0,Asv.createWriteStream)(i)),await(0,Esv.extract)({file:i,cwd:t})}function vRI(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Zu(e)}}async function Isv({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:n,settings:i,loadAPIWorkspace:a}){let o={},c={},f={};return await Promise.all(Vk(t.packageMarkers).map(async([u,s])=>{if(s.contents.export==null)o[u]=s;else{let{export:l,...m}=s.contents;if(N2(m)>0)f[u]={type:zT.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:u};else{let O=Mg(u);if(aBr(t.namedDefinitionFiles).some(C=>C!==u&&C.startsWith(O)))f[u]={type:zT.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:O};else{let C=await Dsv({dependencyName:typeof s.contents.export=="string"?s.contents.export:s.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:n,settings:i,loadAPIWorkspace:a});C.didSucceed?c[Mg(u)]={definition:C.definition,url:typeof s.contents.export=="object"?s.contents.export.url:void 0}:f[u]=C.failure}}}})),N2(f)>0?{didSucceed:!1,failures:f}:{didSucceed:!0,packageMarkers:o,importedDefinitions:c}}var Msv=Hi(require("path"),1);var f2f={};yf(f2f,{additionalProperties:()=>ORI,default:()=>PRI,definitions:()=>ARI,properties:()=>gRI,required:()=>mRI,type:()=>bRI});var bRI="object",gRI={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"}]},product:{oneOf:[{$ref:"#/definitions/products.ProductDeclarationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},mRI=["name"],ORI=!1,ARI={"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.AuthScope":{type:"string"},"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:{$ref:"#/definitions/auth.AuthScope"}},{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.TokenBearerAuthSchema":{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.InferredAuthenticatedRequestHeader":{type:"object",properties:{"response-property":{type:"string"},"header-name":{type:"string"},"value-prefix":{oneOf:[{type:"string"},{type:"null"}]}},required:["response-property","header-name"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchemaObject":{type:"object",properties:{endpoint:{type:"string"},"expiry-response-property":{oneOf:[{type:"string"},{type:"null"}]},"authenticated-request-headers":{oneOf:[{type:"array",items:{$ref:"#/definitions/auth.InferredAuthenticatedRequestHeader"}},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.InferredGetTokenEndpointSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.InferredGetTokenEndpointSchemaObject"}]},"auth.InferredBearerAuthSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},"get-token":{$ref:"#/definitions/auth.InferredGetTokenEndpointSchema"}},required:["scheme","get-token"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{anyOf:[{$ref:"#/definitions/auth.TokenBearerAuthSchema"},{$ref:"#/definitions/auth.InferredBearerAuthSchema"}]},"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},"products.ProductValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},versions:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"products.ProductValue":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductValueDetailed"}]},"products.ProductDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"products.ProductDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/products.ProductDeclarationHeaderObjectSchema"}]},"products.ProductDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/products.ProductValue"}},header:{$ref:"#/definitions/products.ProductDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},PRI={type:bRI,properties:gRI,required:mRI,additionalProperties:ORI,definitions:ARI};var d2f={};yf(d2f,{additionalProperties:()=>ERI,default:()=>DRI,definitions:()=>SRI,properties:()=>jRI,type:()=>wRI});var wRI="object",jRI={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"}]}},ERI=!1,SRI={"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","HEAD"]},"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"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"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.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"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:[{$ref:"#/definitions/service.HttpEndpointAuth"},{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"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{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}},DRI={type:wRI,properties:jRI,additionalProperties:ERI,definitions:SRI};var p2f={};yf(p2f,{additionalProperties:()=>MRI,default:()=>TRI,definitions:()=>BRI,properties:()=>IRI,type:()=>CRI});var CRI="object",IRI={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"}]}},MRI=!1,BRI={"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","HEAD"]},"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"}]},"auth.AuthScope":{type:"string"},"service.HttpEndpointSecurityItem":{type:"object",additionalProperties:{type:"array",items:{$ref:"#/definitions/auth.AuthScope"}}},"service.HttpEndpointSecurity":{type:"array",items:{$ref:"#/definitions/service.HttpEndpointSecurityItem"}},"service.HttpEndpointAuth":{anyOf:[{type:"boolean"},{$ref:"#/definitions/service.HttpEndpointSecurity"}]},"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.RetriesDisabledSchema":{type:"object",properties:{disabled:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"service.RetriesConfiguration":{anyOf:[{$ref:"#/definitions/service.RetriesDisabledSchema"}]},"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:[{$ref:"#/definitions/service.HttpEndpointAuth"},{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"}]},retries:{oneOf:[{$ref:"#/definitions/service.RetriesConfiguration"},{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"}]}},TRI={type:CRI,properties:IRI,additionalProperties:MRI,definitions:BRI};function Bsv({files:e,absolutePathToDefinition:t}){let r,n={},i={},a={};for(let[o,c]of Vk(e)){let f=c.contents,u=s=>{a[o]={type:zT.JSONSCHEMA_VALIDATION,error:s}};if(o===Gk){let s=lBr(f,f2f);if(s.success){let l=VX.serialization.RootApiFileSchema.parseOrThrow(f);r={defaultUrl:l["default-url"],contents:l,rawContents:c.rawContents}}else u(s)}else if(Msv.default.basename(o)===jF){let s=lBr(f,p2f);if(s.success){let l=VX.serialization.PackageMarkerFileSchema.parseOrThrow(f);i[o]={defaultUrl:typeof l.export=="object"?l.export.url:void 0,contents:l,rawContents:c.rawContents}}else u(s)}else{let s=lBr(f,d2f);if(s.success){let l=VX.serialization.DefinitionFileSchema.parseOrThrow(f);n[o]={defaultUrl:void 0,contents:l,rawContents:c.rawContents,absoluteFilePath:Ql(t,o)}}else u(s)}}return r==null?{didSucceed:!1,failures:{[eu.of(Gk)]:{type:zT.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:n,rootApiFile:r,packageMarkers:i}}var GVr=class extends mqr{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...n}){super(n),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 n=(0,Tsv.default)(r??{}),i=this.fernWorkspaces[n];if(i==null){let a=t||this.context,o=Ql(this.absoluteFilePath,eu.of(wne)),c=await uZl({absolutePathToWorkspace:this.absoluteFilePath,context:a}),f=await Aiv(o,"{yml,yaml}"),u=await Piv(f);if(!u.didSucceed)return Q2u(u.failures,a.logger),a.failAndThrow();let s=Bsv({files:u.files,absolutePathToDefinition:o});if(!s.didSucceed)return Q2u(s.failures,a.logger),a.failAndThrow();let l=await Isv({dependenciesConfiguration:c,structuralValidationResult:s,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!l.didSucceed)return Q2u(l.failures,a.logger),a.failAndThrow();let m={absoluteFilePath:o,rootApiFile:s.rootApiFile,namedDefinitionFiles:s.namedDefinitionFiles,packageMarkers:l.packageMarkers,importedDefinitions:l.importedDefinitions};r?.auth!=null&&(m={...m,rootApiFile:{...m.rootApiFile,contents:{...m.rootApiFile.contents,auth:r?.auth}}}),i=new fnt({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:c,workspaceName:this.workspaceName,definition:m,cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[n]=i}return i}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var Hfv=require("fs/promises");var Ufv=Hi(Lfv(),1);async function Wts(e){return(await(0,Ufv.convertObj)(e,{})).openapi}var Wfv=require("fs/promises");var Vfv=require("fs/promises");async function aao({absoluteFilePathToOverrides:e,data:t,context:r,allowNullKeys:n}){let i=null;try{let a=(await(0,Vfv.readFile)(e,"utf8")).toString();try{i=JSON.parse(a)}catch{i=Pg.load(a,{json:!0})}}catch{return r.failAndThrow(`Failed to read overrides from file ${e}`)}return gJl({data:t,overrides:i,allowNullKeys:n})}async function yQf({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,Wfv.readFile)(t)).toString(),i=await Pg.load(n);return r!=null?await aao({absoluteFilePathToOverrides:r,context:e,data:i}):i}var Hts=Hi(_2u(),1);var Gfv=Hi(_2u(),1),vQf=Hi(require("path"),1),Gts=class extends Gfv.BaseResolver{absolutePathToOpenAPIOverrides;constructor(t){super(),this.absolutePathToOpenAPIOverrides=t}resolveExternalRef(t,r){let n=super.resolveExternalRef(t,r);return n.startsWith("http://")||n.startsWith("https://")||hBr(F_.of(n))?n:this.absolutePathToOpenAPIOverrides!=null?vQf.default.resolve(vQf.default.dirname(this.absolutePathToOpenAPIOverrides),r):n}};async function bQf({absolutePathToOpenAPI:e,absolutePathToOpenAPIOverrides:t,parsed:r}){return(r!=null?await(0,Hts.bundle)({...h2u,doc:{source:new Hts.Source(e,"<openapi>"),parsed:r},externalRefResolver:new Gts(t)}):await(0,Hts.bundle)({...h2u,ref:e,externalRefResolver:new Gts(t)})).bundle.parsed}var G4I=["examples","example",yb.EXAMPLES,ebe.REDOCLY_CODE_SAMPLES_CAMEL,ebe.REDOCLY_CODE_SAMPLES_KEBAB];async function Jts({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r}){let n=await bQf({absolutePathToOpenAPI:t}),i;if(r!=null?i=r:typeof n=="object"&&n[yb.OPENAPI_OVERIDES_FILEPATH]!=null&&(i=Ql(Mg(t),eu.of(n[yb.OPENAPI_OVERIDES_FILEPATH]))),i!=null){let a=await aao({absoluteFilePathToOverrides:i,context:e,data:n,allowNullKeys:G4I});return await bQf({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,parsed:a})}return n}var zqr=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r}){let n=[];for(let i of r)try{let a=(await(0,Hfv.readFile)(i.absoluteFilepath)).toString(),o=j3(this.absoluteFilePath,i.source.file);i.source.relativePathToDependency!=null&&(o=Ql(i.source.relativePathToDependency,o));let c=i.source.type==="protobuf"?PPe.protobuf({file:o}):PPe.openapi({file:o});if(a.includes("openapi")||a.includes("swagger"))try{let f=await Jts({absolutePathToOpenAPI:i.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:i.absoluteFilepathToOverrides});if(d7f(f)){n.push({type:"openapi",value:f,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}else if(Pes(f)){(!f.schemes||f.schemes.length===0)&&(f.schemes=["https"]);let u=await Wts(f);n.push({type:"openapi",value:u,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}}catch(f){t.logger.debug(`Failed to parse OpenAPI document at ${i.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("asyncapi"))try{let f=await yQf({context:t,absoluteFilePath:i.absoluteFilepath,absoluteFilePathToOverrides:i.absoluteFilepathToOverrides});n.push({type:"asyncapi",value:f,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}catch(f){t.logger.error(`Failed to parse AsyncAPI document at ${i.absoluteFilepath}: ${f}. Skipping...`);continue}if(a.includes("openrpc"))try{let f=await yQf({context:t,absoluteFilePath:i.absoluteFilepath,absoluteFilePathToOverrides:i.absoluteFilepathToOverrides});n.push({type:"asyncapi",value:f,source:c,namespace:i.namespace,settings:jht({options:i.settings})});continue}catch(f){t.logger.error(`Failed to parse OpenRPC document at ${i.absoluteFilepath}: ${f}. Skipping...`);continue}t.logger.warn(`${i.absoluteFilepath} is not a valid OpenAPI, AsyncAPI, or OpenRPC file. Skipping...`)}catch(a){t.logger.error(`Failed to read or process file ${i.absoluteFilepath}: ${a}. Skipping...`);continue}return n}};var H4I=nl.object({type:nl.string(),channelId:nl.string().optional(),messageId:nl.string(),value:nl.any()}),J4I=nl.object({summary:nl.string().optional(),description:nl.string().optional(),"query-parameters":nl.record(nl.string()).optional(),headers:nl.record(nl.string()).optional(),messages:nl.array(H4I)}),Jfv=nl.array(J4I);var t5u=class extends kE{channel;baseDir;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:n,baseDir:i}){super({breadcrumbs:t??[],context:n}),this.channel=r,this.baseDir=i}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=Jfv.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(n=>({summary:n.summary,description:n.description,queryParameters:n["query-parameters"],headers:n.headers,messages:n.messages.map(i=>({type:i.type,channelId:i.channelId,messageId:i.messageId,value:i.value}))}))}};var oao=class extends gO{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a}){super({context:t,breadcrumbs:r}),this.websocketGroup=n,this.channel=i,this.channelPath=a}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:n}){let a=new t5u({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel,baseDir:this.context.documentBaseDir}).convert();return a==null?{}:Object.fromEntries(a.map((o,c)=>[c.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:o.queryParameters,headers:o.headers,messages:o.messages.map(f=>({type:n==="v2"?f.type:f.messageId,body:f.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var p2i=class extends G7.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:n,parameterNamePrefix:i}){super({context:t,breadcrumbs:r,parameter:n}),this.parameterNamePrefix=i}convert(){let t,r={},i=new Tse.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,a=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},c=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:a,wrapAsOptional:i}).convert();return c!=null&&(t=c.type,r=c.inlinedTypes??{}),this.convertToOutput({schema:a,typeReference:t,inlinedTypes:r})}};var r5u=class extends kE{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:n}){super({breadcrumbs:t,context:n}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var sao=class extends kE{channel;key="x-fern-display-name";constructor({breadcrumbs:t,channel:r,context:n}){super({breadcrumbs:t,context:n}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}};var n5u=class extends oao{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a})}convert(){let t=[],r=[],n=[],a=new sao({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:n}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let o;this.channel.subscribe!=null&&(o=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let c;this.channel.publish!=null&&(c=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let f=[];o!=null&&f.push(o),c!=null&&f.push(c);let s=new r5u({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),l=this.transformToValidPath(s??this.channelPath),m=this.channel.servers?.[0]??Object.keys(this.context.spec.servers??{})[0],O=nZ(l),P=$A(this.channelPath),C=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(P),displayName:a,baseUrl:m,path:O,auth:!1,headers:n,queryParameters:r,pathParameters:t,messages:f,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:l,baseUrl:m,asyncApiVersion:"v2"})}},audiences:C,inlinedTypes:this.inlinedTypes}}convertMessage({context:t,operation:r,origin:n}){let i,a=n==="server"?"subscribe":"publish",o=[...this.breadcrumbs,a],c=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:o});c!=null&&(r.message=c);let f=Vna($A(`${this.channelPath}_${a}`)).replace(/ /g,"");if("oneOf"in r.message){let s=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:r.message,schemaIdOverride:f}).convert();s!=null&&s.schema!=null&&(i=s.schema,this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let u=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:o});if(u!=null){let l=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:o,schemaOrReference:u,schemaIdOverride:f}).convert();l!=null&&l.schema!=null&&(i=l.schema,this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes})}}if(i!=null){let u=i,s=Bh.named({fernFilepath:t.createFernFilepath(),name:u.typeDeclaration.name.name,typeId:u.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),l=Mfe.reference({bodyType:s,docs:r.description}),m=n==="server"?"subscribe":"publish";return{type:m,displayName:m,origin:n,body:l,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description}}}convertPathParameters({context:t,pathParameters:r}){for(let[n,i]of Object.entries(this.channel.parameters??{})){let a=t.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs});if(a==null)continue;let c=new p2i({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...a,name:n,in:"path",description:a.description,required:a.required??!0}}).convert();c!=null&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type==="path"&&r.push(c.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[i,a]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,i]});if(o==null)continue;let f=new p2i({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"header",required:n.includes(i),schema:o,description:"description"in o?o.description:void 0}}).convert();f!=null&&f.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[i,a]of Object.entries(this.channel.bindings.ws.query.properties??{})){let o=t.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,i]});if(o==null)continue;let f=new p2i({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"query",required:n.includes(i),schema:o,description:"description"in o?o.description:void 0,deprecated:o.deprecated??!1}}).convert();f!=null&&f.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},r.push(f.parameter))}}}};var uao=class extends gO{servers;constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r}),this.servers=n}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[n,i]of Object.entries(this.servers)){let a=this.buildSingleBaseUrlEnvironment(this.context,n,i);t.push(a),r==null&&(r=a.id)}return{defaultEnvironment:r,environments:jJ.singleBaseUrl({environments:t})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var i5u=class extends uao{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.url),docs:void 0}}};var gQf="$message.",Kfv="#/channels/",$fv="#/servers/",a5u=class extends oao{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a,operations:o}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:a}),this.operations=o}convert(){let t=[],r=[],n=[],a=new sao({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:this.channelPath});let o=Object.entries(this.operations).reduce((m,[O,P])=>{try{this.getChannelPathFromOperation(P)===this.channelPath&&(m[O]=P)}catch{}return m},{}),c=[];for(let[m,O]of Object.entries(o))for(let P of O.messages){let C=this.context.convertReferenceToTypeReference({reference:P});if(C.ok){let M=Mfe.reference({bodyType:C.reference,docs:O.description});c.push({type:m,displayName:m,origin:O.action==="send"?"client":"server",body:M,availability:this.context.getAvailability({node:O,breadcrumbs:this.breadcrumbs}),docs:O.description})}}let f=this.resolveChannelServersFromReference(this.channel.servers??[])??Object.keys(this.context.spec.servers??{})[0],u=this.transformToValidPath(this.channel.address??this.channelPath),s=nZ(u),l=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[];return{channel:{name:this.context.casingsGenerator.generateName(a),displayName:a,baseUrl:f,path:s,auth:!1,headers:n,queryParameters:r,pathParameters:t,messages:c,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:u,baseUrl:f,asyncApiVersion:"v3"})}},audiences:l,inlinedTypes:this.inlinedTypes}}convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:i}){for(let a of Object.values(this.channel.parameters??{})){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(o==null)continue;let c=this.convertChannelParameterLocation(o.location);if(c==null)continue;let{type:f,parameterKey:u}=c,l=new p2i({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...o,name:u,in:f},parameterNamePrefix:this.channelPath}).convert();if(l!=null)switch(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},l.type){case"path":t.push(l.parameter);break;case"query":r.push(l.parameter);break;case"header":n.push(l.parameter);break}}}convertChannelParameterLocation(t){try{let[r,n]=t.split("#/");if(r==null||n==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(gQf)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${gQf} prefix`,path:this.breadcrumbs});return}let i=r.substring(gQf.length);if(i!=="header"&&i!=="path"&&i!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${i}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return i==="payload"?{type:"query",parameterKey:n}:{type:i,parameterKey:n}}catch{this.context.errorCollector.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){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith($fv)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let n=r.$ref.substring($fv.length);if(n==null){this.context.errorCollector.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(Kfv))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(Kfv.length)}};var o5u=class extends uao{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.host),docs:void 0}}};var Kts=class extends dqr{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,n]of Object.entries(t.channels??{}))for(let[i,a]of Object.entries(n.messages??{})){if(!this.context.isMessageWithPayload(a)&&!this.context.isReferenceObject(a))continue;let o=["channels",r,"messages",i],c=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:o});if(!this.context.isMessageWithPayload(c))continue;let f=this.context.resolveMaybeReference({schemaOrReference:c.payload,breadcrumbs:o});if(f==null)continue;let u=`${r}_${i}`;this.convertSchema({id:u,breadcrumbs:o,schema:f})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let n=["components","messages",t],i=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:n});i!=null&&this.convertSchema({id:t,breadcrumbs:n,schema:i})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:n}){let a=new G7.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:n}).convert();a!=null&&this.addSchemaOutputToIr(t,a)}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new o5u({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new i5u({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let i=new Tse.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,a;if(this.isAsyncAPIV3(this.context)){let c=this.context.spec.operations??{};a=new a5u({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t,operations:c}).convert()}else a=new n5u({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t}).convert();a!=null&&(this.addWebsocketChannelToIr({websocketChannel:a.channel,channelPath:t,audiences:a.audiences,websocketGroup:i}),this.addTypesToIr(a.inlinedTypes))}}};var $ts=class extends Oee{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let a,o=t.$ref.match(/^.*\/schemas\/(.+)$/),c=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),f=t.$ref.match(/^.*\/messages\/(.+)$/);if(o&&o[1])return a=o[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a});if(c&&c[2]){let u=c[1],s=c[2];return a=`${u}_${s}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a})}else return f&&f[1]?(a=f[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.title:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.title??n),{ok:!0,reference:Bh.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.name:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.name??n),{ok:!0,reference:Bh.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:a}){let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.messageId??o.value.name:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.messageId??o.value.name??n),{ok:!0,reference:Bh.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var tdv=Hi(s5u(),1);var u5u=class extends kE{document;key="x-fern-explorer";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer",path:this.breadcrumbs});return}return t}}};var c5u=class extends kE{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}};function Yfv({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?gO.OPTIONAL_STRING:gO.STRING,env:r.env,v2Examples:r.optional?void 0:Y4I({header:r,context:t}),availability:void 0,docs:void 0}))}function Y4I({header:e,context:t}){let r=new lht({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:n}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:n}}}var l5u=class extends G7.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={};if(this.parameter.schema!=null){let n=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),a=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:n}).convert();a!=null&&(t=a.type,r=a.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var f5u=class extends G7.AbstractConverters.AbstractMediaTypeObjectConverter{contentType;mediaType;description;required;schemaId;streamingExtension;queryParameters;constructor({context:t,breadcrumbs:r,contentType:n,mediaType:i,description:a,required:o,group:c,method:f,streamingExtension:u,queryParameters:s}){super({context:t,breadcrumbs:r,group:c,method:f}),this.contentType=n,this.mediaType=i,this.description=a,this.required=o,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=u,this.queryParameters=s??[]}convert(){return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleStreamConditionJsonOrFormContent({contentType:this.contentType})}convertNonStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleJsonOrFormContent({contentType:this.contentType});if(R2.parse(this.contentType)?.isMultipart())return this.handleMultipartContent({contentType:this.contentType});if(this.isBinaryContentType())return this.handleBinaryContent({contentType:this.contentType})}isOrderedJsonOrFormContentType(){let t=R2.parse(this.contentType);return t?t.isJSON()||t.isURLEncoded()||t.isPlainText()||t.isCSV()||t.isHTML()||t.isXML()||t.isDNS()||t.isApplicationText():!1}isBinaryContentType(){let t=R2.parse(this.contentType);return t?t.isBinary():!1}handleJsonOrFormContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(n==null)return;let i=n.schema?.typeDeclaration.shape;return i?.type==="object"?this.hasBodyQueryParameterOverlap(i.properties)?{requestBody:U7.reference({contentType:t,docs:this.description,requestBodyType:n.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}:{requestBody:U7.inlinedRequestBody({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:i.extendedProperties,extends:i.extends,properties:i.properties,extraProperties:i.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes})}:{requestBody:U7.reference({contentType:t,docs:this.description,requestBodyType:n.type,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}}handleMultipartContent({contentType:t}){let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(n==null)return;let i=n.schema?.typeDeclaration.shape;if(i?.type==="object")return{requestBody:U7.fileUpload({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:i.properties.map(a=>{let o=r.encoding?.[a.name.wireValue];return this.convertRequestBodyProperty({property:a,contentType:t,encoding:o})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes}),examples:n.examples}}handleBinaryContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:U7.bytes({contentType:t,isOptional:this.required===!1,docs:this.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:n}){let{isFile:i,isOptional:a,isArray:o}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return i?o?zne.file(CFe.fileArray({key:t.name,isOptional:a,contentType:r,docs:t.docs})):zne.file(CFe.file({key:t.name,isOptional:a,contentType:r,docs:t.docs})):zne.bodyProperty({...t,contentType:n?.contentType??r,style:Z4I({encoding:n}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(n==null)return;let i=n.properties?.[this.streamingExtension.streamConditionProperty];if(i==null||this.context.isReferenceObject(i))return;let a=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!0,contentType:t,mediaTypeObject:r}),o=this.buildStreamConditionInlinedRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(a==null||o==null))return{requestBody:o.requestBody,streamRequestBody:a.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...a.inlinedTypes,...o.inlinedTypes}})}}buildStreamConditionInlinedRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:n,contentType:i,mediaTypeObject:a}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let o={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{type:"boolean",const:n,...t}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},c={...a,schema:o},f=this.parseMediaTypeObject({mediaTypeObject:c,schemaId:this.schemaId,contentType:i});if(f==null)return;let u=f.schema?.typeDeclaration.shape;if(u?.type==="object")return{requestBody:U7.inlinedRequestBody({contentType:i,docs:void 0,name:this.context.casingsGenerator.generateName(n?`${this.schemaId}_streaming`:this.schemaId),extendedProperties:u.extendedProperties,extends:u.extends,properties:u.properties,extraProperties:u.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:c,exampleGenerationStrategy:"request"})}),inlinedTypes:f.inlinedTypes}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:n}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:n}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:n}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:n??!1}}hasBodyQueryParameterOverlap(t){if(this.queryParameters.length===0)return!1;let r=new Set(this.queryParameters.map(n=>n.name.wireValue.toLowerCase()));return t.some(n=>r.has(n.name.wireValue.toLowerCase()))}},X4I={"application/json":"json"};function Z4I({encoding:e}){if(e){if(e.explode)return"exploded";if(e.style==="form")return"form";if(e.contentType)return X4I[e.contentType]}}var k4I=/{([^}]+)}/g,e7I=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),cao=class extends gO{operation;method;path;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:n,method:i,path:a}){super({context:t,breadcrumbs:r}),this.operation=n,this.method=i,this.path=a}convertHttpMethod(){switch(this.method){case"get":return fU.Get;case"post":return fU.Post;case"put":return fU.Put;case"delete":return fU.Delete;case"patch":return fU.Patch;case"head":return fU.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],n=[],i=[];if(!this.operation.parameters)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i};for(let a of this.operation.parameters){let o=this.context.resolveMaybeReference({schemaOrReference:a,breadcrumbs:t});if(o==null)continue;let f=new l5u({context:this.context,breadcrumbs:t,parameter:o}).convert();if(f!=null)switch(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},f.type){case"path":r.push(f.parameter);break;case"query":n.push(f.parameter);break;case"header":{let u=f.parameter.name.name.originalName,s=f.parameter.name.wireValue,l=!1,m=this.context.authOverrides?.["auth-schemes"];if(m!=null){for(let P of Object.values(m))if(i7I(P)&&P.header.toLowerCase()===s.toLowerCase()){l=!0;break}}let O=this.context.globalHeaderNames;if(O!=null){for(let P of O)if(P.toLowerCase()===s.toLowerCase()){l=!0;break}}!e7I.has(u.toLowerCase())&&!l&&i.push(f.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i}}checkMissingPathParameters(t){let n=[...this.path.matchAll(k4I)].map(i=>i[1]).filter(i=>!t.some(a=>a.name.originalName===i));for(let i of n){if(i==null)continue;let a=`${i}_example`;t.push({name:this.context.casingsGenerator.generateName(i),valueType:gO.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[a]:this.generateStringParameterExample({example:i})}}})}}convertRequestBody({breadcrumbs:t,group:r,method:n,streamingExtension:i,queryParameters:a}){if(this.operation.requestBody==null)return;let o=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(o==null)return null;let c=[];for(let[f,u]of Object.entries(o.content)){let l=new f5u({context:this.context,breadcrumbs:t,contentType:f,mediaType:u,description:o.description,required:o.required,group:r??[],method:n,streamingExtension:i,queryParameters:a}).convert();l!=null&&(this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes},c.push({requestBody:l.requestBody,streamRequestBody:l.streamRequestBody,examples:l.examples}))}return c}computeGroupNameAndLocationFromExtensions(){let r=new Tse.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,i=new Tse.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:i,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?$A(this.operation.summary):$A(`${this.method}_${this.path.split("/").join("_")}`))}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:r};let n=Xfv(t),i=Xfv(r);return sse(n,i)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:n,methodName:r,methodNameTokens:i})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:n,methodNameTokens:i}){if(r.some((c,f)=>c!==i[f]))return{group:[t],method:n};let o=i.slice(r.length);return{group:[t],method:$A(o.join("_"))}}generateStringParameterExample({example:t}){let r=new G7.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:n}=r.convert();return n}};function Xfv(e){let t=t7I(e)?r7I(e):n7I(e);return t=t.map(r=>r.toLowerCase()),t=wdt(t),t}function t7I(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function r7I(e){return e.split(/(?=[A-Z])/)}function n7I(e){return e.split(/[^a-zA-Z0-9]+/)}function i7I(e){return e?.header!=null}var lao=class extends cao{constructor({context:t,breadcrumbs:r,operation:n,method:i,path:a}){super({context:t,breadcrumbs:r,operation:n,method:i,path:a})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=[...this.breadcrumbs,"Payload"],{headers:a,queryParameters:o}=this.convertParameters({breadcrumbs:i}),c=this.convertRequestBody({breadcrumbs:i,group:r,method:n,streamingExtension:void 0,queryParameters:o});if(c==null)return;let f=c[0]?.requestBody;if(f==null)return;let u;if(f.type==="inlinedRequestBody")u=Bve.inlinedPayload({name:f.name,extends:f.extends,properties:f.properties});else if(f.type==="reference")u=Bve.reference({payloadType:f.requestBodyType,docs:f.docs});else return;return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,webhook:{id:`${r?.join(".")??""}.${n}`,name:this.context.casingsGenerator.generateName(n),displayName:this.operation.summary,method:t,headers:a,payload:u,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(f.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,n])=>[r,{name:r,payload:n}]))}};var AQf=Hi(s5u(),1);var Zfv=["get","post","put","delete","patch","head"];var d5u=class extends kE{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}};var a7I=nl.object({cursor:nl.string(),next_cursor:nl.string(),results:nl.string()}),o7I=nl.object({offset:nl.string(),results:nl.string(),step:nl.string().optional(),"has-next-page":nl.string().optional()}),mQf=nl.union([nl.boolean(),a7I,o7I]);var OQf="$request.",p5u="$response.",_5u=class extends kE{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:n,context:i}){super({breadcrumbs:t,context:i}),this.operation=r,this.document=n}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=mQf.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let n=this.getExtensionValue(this.document);if(n==null)return;if(typeof n=="boolean"){this.context.errorCollector.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 i=mQf.safeParse(n);if(!i.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${i.error.message}`,path:this.breadcrumbs});return}if(typeof i.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:i.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:Oee.maybeTrimPrefix(r.cursor,OQf),nextCursor:Oee.maybeTrimPrefix(r.next_cursor,p5u),results:Oee.maybeTrimPrefix(r.results,p5u)};let n=t;return{type:"offset",offset:Oee.maybeTrimPrefix(n.offset,OQf),results:Oee.maybeTrimPrefix(n.results,p5u),step:n.step!=null?Oee.maybeTrimPrefix(n.step,OQf):void 0,hasNextPage:n["has-next-page"]!=null?Oee.maybeTrimPrefix(n["has-next-page"],p5u):void 0}}};var s7I="$request.",u7I=nl.object({"stream-condition":nl.string().optional(),format:nl.enum(["sse","json"]).optional(),"stream-description":nl.string().optional(),"response-stream":nl.any(),response:nl.any()}),c7I=nl.union([nl.boolean(),u7I]),h5u=class extends kE{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=c7I.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json"}:void 0;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",streamDescription:r.data["stream-description"],streamConditionProperty:Oee.maybeTrimPrefix(r.data["stream-condition"],s7I),responseStream:r.data["response-stream"],response:r.data.response}}};var y5u=class extends kE{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}};var b5u=require("fs"),kfv=require("path");function l7I(e){return QD(e)&&typeof e.$ref=="string"}function f7I(e,t){if(e!=null){if(typeof e=="string")return e;if(l7I(e)){let r=(0,kfv.resolve)(t??process.cwd(),e.$ref);if((0,b5u.existsSync)(r))try{return(0,b5u.readFileSync)(r,"utf-8")}catch{return}}}}function d7I(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!QD(n))continue;let a=f7I(n.code,t);a!=null&&r.push({...n,code:a})}return r}var v5u=class extends kE{operation;baseDir;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:n,baseDir:i}){super({breadcrumbs:r,context:t}),this.operation=n,this.baseDir=i}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).map(a=>{if(!QD(a))return a;let c=a["code-samples"];if(c!=null){let f=d7I(c,this.baseDir);return{...a,"code-samples":f}}return a}).filter(a=>{let o=VX.serialization.ExampleEndpointCallSchema.parse(a);return o.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),o.ok})}};var g5u=class extends kE{operation;key="x-fern-explorer-enabled";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer-enabled",path:this.breadcrumbs});return}return t}}};var Yts=class extends G7.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;constructor({context:t,breadcrumbs:r,responseBody:n,group:i,method:a,statusCode:o,streamingExtension:c}){super({context:t,breadcrumbs:r,group:i,method:a}),this.responseBody=n,this.statusCode=o,this.streamingExtension=c}convert(){return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,n=[...this.group,this.method,"Response",this.statusCode].join("_"),i=`${n}_streaming`,a=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:i}),o=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:n});return this.convertStreamConditionResponse({convertedStreamingSchema:a,convertedNonStreamingSchema:o})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{});for(let n of r){let i=this.responseBody.content?.[n];if(i==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:i,schemaId:t,contentType:this.streamingExtension.format});if(a!=null)return this.convertStreamingResponse({mediaTypeObject:i,convertedSchema:a})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(a=>a.includes("json"));for(let a of r){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null&&this.shouldReturnJsonResponse(a))return this.returnJsonResponse({mediaTypeObject:o,convertedSchema:c})}let n=Object.keys(this.responseBody.content??{}).filter(a=>!a.includes("json"));for(let a of n){let o=this.responseBody.content?.[a];if(o==null)continue;let c=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:a});if(c!=null){if(this.isBinarySchema(c))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:o}):this.returnFileDownloadResponse({mediaTypeObject:o});if(this.shouldReturnTextResponse(a))return this.returnTextResponse({mediaTypeObject:o})}}let i=parseInt(this.statusCode);if(!isNaN(i)&&i>=200&&i<300){let a={schema:{type:"object",description:"Empty response body"}},o=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:t,contentType:"application/json",resolveSchema:!0});if(o!=null)return this.returnJsonResponse({mediaTypeObject:a,convertedSchema:o})}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(t==null||r==null)return;let n=this.responseBody.description;return this.streamingExtension?.type==="streamCondition"&&this.streamingExtension.streamDescription!=null&&(n=this.streamingExtension.streamDescription),{responseBody:vN.json(Sfe.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:vN.streaming(Dfe.json({docs:n,payload:t.type,terminator:void 0,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes}}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:vN.streaming(Dfe.json({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};case"sse":return{responseBody:vN.streaming(Dfe.sse({docs:this.responseBody.description,payload:r.type,terminator:void 0,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:vN.json(Sfe.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:r.inlinedTypes,examples:r.examples}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:vN.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:vN.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}returnTextResponse({mediaTypeObject:t}){return{responseBody:vN.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:{}}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return R2.parse(t)?.isText()??!1}};var m5u=class extends G7.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;constructor({context:t,breadcrumbs:r,responseError:n,group:i,method:a,methodName:o,statusCode:c}){super({context:t,breadcrumbs:r,group:i,method:a}),this.responseError=n,this.statusCode=c,this.methodName=o}convert(){if(!this.responseError.content){let n=fZo[this.statusCode];if(n==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let i=this.getErrorIdFromErrorName(n);return{error:{error:{name:this.context.casingsGenerator.generateName(i),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:i},docs:this.responseError.description},errorType:Bh.unknown(),displayName:n,statusCode:this.statusCode,inlinedTypes:{},examples:{}}}let t=Object.keys(this.responseError.content).filter(n=>n.includes("json")),r=fZo[this.statusCode];if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let n of[...t]){let i=this.responseError.content?.[n];if(i==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:i,schemaId:edv(`${this.methodName}Request${r}`),contentType:n});if(a==null)continue;let o=this.getErrorIdFromErrorName(r);if(a.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.schema.typeDeclaration.name.fernFilepath,convertedSchema:a});if(a.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:o,fernFilepath:a.type.fernFilepath,convertedSchema:a})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:n,convertedSchema:i}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:n,errorId:r},docs:this.responseError.description},errorType:i.type,displayName:t,statusCode:this.statusCode,inlinedTypes:i.inlinedTypes,examples:i.examples}}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?edv(`${this.methodName}Request${t}`):t}};function edv(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var O5u=class e extends cao{idempotent;idToAuthScheme;topLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:n,method:i,path:a,idempotent:o,idToAuthScheme:c,topLevelServers:f,streamingExtension:u}){super({context:t,breadcrumbs:r,operation:n,method:i,path:a}),this.idempotent=o,this.idToAuthScheme=c,this.topLevelServers=f,this.streamingExtension=u}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=this.getGroupDisplayName(r),{headers:a,pathParameters:o,queryParameters:c}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),f=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:n,streamingExtension:this.streamingExtension,queryParameters:c}),u=f?.[0]?.requestBody,s=f?.[0]?.streamRequestBody,l={requestBodies:f?.map(pe=>pe.requestBody)},m=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:n,streamingExtension:this.streamingExtension}),O=m?.response,P=m?.streamResponse,C=m!=null?m.errors:[],M={},T=C.map(pe=>pe.error),z=nZ(this.path),U=this.getEndpointBaseUrl(),q=this.getEndpointBaseUrls(),V=this.convertExamples({httpPath:z,httpMethod:t,baseUrl:U}),$=new Set(this.operation.security?.flatMap(pe=>Object.keys(pe))??[]),re=this.authSchemeToHeaders(Array.from($));re.length>0&&a.push(...re);for(let pe of C){let Ce=pe.error,je=pe.errorType,Se=Ce.error.errorId,Ot=pe.examples;M[Se]={name:Ce.error,displayName:pe.displayName,discriminantValue:{name:Ce.error.name,wireValue:Se},type:je,statusCode:pe.statusCode,docs:Ce.docs,examples:[],v2Examples:{userSpecifiedExamples:Ot??{},autogeneratedExamples:{}}}}let Y=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],ne=new g5u({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation}).convert(),Oe={displayName:this.operation.summary,method:t,baseUrl:U,v2BaseUrls:q,path:z,pathParameters:o,queryParameters:c,headers:a.filter((pe,Ce,je)=>Ce===je.findIndex(Se=>Se.name.wireValue===pe.name.wireValue)),sdkRequest:void 0,errors:T,auth:this.operation.security!=null||this.context.spec.security!=null,security:this.operation.security??this.context.spec.security,availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:z,allPathParameters:o,pagination:void 0,transport:void 0,source:FAe.openapi(),audiences:Y,retries:void 0,apiPlayground:ne},ye=this.context.namespace!=null?[this.context.namespace]:[],ge=r?.map(pe=>$A(pe));return ye.push(...ge??[]),{audiences:Y,group:r,groupDisplayName:i,errors:M,endpoint:{...Oe,id:`endpoint_${ye.join("/")}.${n}`,name:this.context.casingsGenerator.generateName(n),requestBody:u,v2RequestBodies:l,response:O,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:V.examples},v2Responses:{responses:m?.v2Responses}},streamEndpoint:P!=null&&P.body!=null?{...Oe,id:`endpoint_${ye.join("/")}.${n}_stream`,name:this.context.casingsGenerator.generateName(`${n}_stream`),requestBody:s,v2RequestBodies:void 0,response:P,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:V.streamExamples},v2Responses:{responses:[{statusCode:200,body:P.body}]}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??[])}}convertResponseBody({breadcrumbs:t,group:r,method:n,streamingExtension:i}){if(this.operation.responses==null)return;let a,o=!1;for(let[c,f]of Object.entries(this.operation.responses)){let u=parseInt(c);if(!(isNaN(u)||u<200||u>=300&&u<400)){if(a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}}),u>=200&&u<300){let s=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(s==null)continue;let m=new Yts({context:this.context,breadcrumbs:[...t,c],responseBody:s,group:r??[],method:n,statusCode:c,streamingExtension:i}).convert();m!=null&&(this.inlinedTypes={...this.inlinedTypes,...m.inlinedTypes},o||(o=!0,a.response={statusCode:u,body:m.responseBody},a.streamResponse={statusCode:u,body:m.streamResponseBody}),a.v2Responses=[...a.v2Responses??[],{statusCode:u,body:m.responseBody}])}if(u>=400&&u<600){let s=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:[...t,c]});if(s==null)continue;let m=new m5u({context:this.context,breadcrumbs:[...t,c],responseError:s,group:r??[],method:n,methodName:this.evaluateMethodNameFromOperation(),statusCode:u}).convert();m!=null&&(this.inlinedTypes={...this.inlinedTypes,...m.inlinedTypes},a.errors.push(m))}}}if(this.streamingExtension!=null){a==null&&(a={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{}});let f=new Yts({context:this.context,breadcrumbs:[...t,"stream"],responseBody:{description:""},group:r??[],method:n,statusCode:"stream",streamingExtension:i}).convert();f!=null&&(this.inlinedTypes={...this.inlinedTypes,...f.inlinedTypes},a.response={statusCode:200,body:f.responseBody},a.streamResponse={statusCode:200,body:f.streamResponseBody},a.v2Responses=[{statusCode:200,body:f.responseBody}])}return a}authSchemeToHeaders(t){let r=[];for(let n of t){let i=this.idToAuthScheme?.[n];if(i==null)continue;let a={valueType:gO.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0};switch(i.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...a});break;case"header":r.push({name:i.name,...a});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:n}){let a=new v5u({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert();return a==null?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:a}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:a}),streamExamples:{}}}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){let a=i.filter(u=>!(u.response!=null&&"stream"in u.response)),o=i.filter(u=>u.response!=null&&"stream"in u.response),c=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:a}),f=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:o});return{examples:c,streamExamples:f}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){return Object.fromEntries(i.map((a,o)=>[this.getExampleName({example:a,exampleIndex:o}),{displayName:void 0,request:a.request!=null||a["path-parameters"]!=null||a["query-parameters"]!=null||a.headers!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,a["path-parameters"]??{})},baseUrl:void 0,environment:n,auth:void 0,pathParameters:a["path-parameters"]??{},queryParameters:a["query-parameters"]??{},headers:a.headers??{},requestBody:a.request??void 0}:void 0,response:a.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:a})}:void 0,codeSamples:a["code-samples"]?.map(c=>{let f=("language"in c?c.language:c.sdk)??void 0;return{name:c.name,docs:void 0,language:f,code:c.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return ip.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return ip.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let r=new Tse.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert();if(r!=null)return this.context.logger.debug(`[getEndpointBaseUrl] Endpoint ${this.method.toUpperCase()} ${this.path} specifies a server with "${yb.SERVER_NAME_V2}" extension. Returning server type: ${r}`),r;let n=this.operation.servers?.[0];if(n==null)return;let a=this.topLevelServers?.find(o=>o.url===n.url)??n;return rnt.getServerName({server:a,context:this.context})}getEndpointBaseUrls(){let t=this.operation.servers;return t?.map(n=>{let a=this.topLevelServers?.find(o=>o.url===n.url)??n;return rnt.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(n=>`${r[n.pathParameter]?.toString()??n.pathParameter}${n.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(n=>n.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let n=t?.[t.length-1];if(n!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===n?r:void 0}};var A5u=class extends gO{pathItem;path;idToAuthScheme;topLevelServers;constructor({context:t,breadcrumbs:r,pathItem:n,path:i,idToAuthScheme:a,topLevelServers:o}){super({context:t,breadcrumbs:r}),this.pathItem=n,this.path=i,this.idToAuthScheme=a,this.topLevelServers=o}convert(){let t=[],r=[],n={};for(let i of Zfv){let a=this.pathItem[i];if(a==null)continue;let o=[...this.breadcrumbs,i],c=this.tryParseAsWebhook({operationBreadcrumbs:o,operation:a,method:i,context:this.context});if(c!=null){r.push(c),Object.assign(n,c.inlinedTypes);continue}let u=new h5u({breadcrumbs:o,operation:a,context:this.context}).convert(),s=this.tryParseAsHttpEndpoint({operationBreadcrumbs:o,operation:a,method:i,streamingExtension:u});s!=null&&(t.push(s),Object.assign(n,s.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:n}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:n,context:i}){return new y5u({breadcrumbs:n,operation:t,context:i}).convert()?new lao({context:this.context,breadcrumbs:n,operation:t,method:AQf.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert():void 0}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:n,streamingExtension:i}){new _5u({breadcrumbs:n,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let f=new d5u({breadcrumbs:n,operation:t,context:this.context}).convert();return new O5u({context:this.context,breadcrumbs:n,operation:t,method:AQf.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:f,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,streamingExtension:i}).convert()}};var P5u=class extends gO{securityScheme;schemeId;constructor({context:t,breadcrumbs:r,securityScheme:n,schemeId:i}){super({context:t,breadcrumbs:r}),this.securityScheme=n,this.schemeId=i}convert(){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return L8.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return L8.basic({key:this.schemeId,username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return L8.header({key:this.schemeId,name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:this.securityScheme.name},valueType:gO.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return L8.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var Xts=class extends dqr{constructor({breadcrumbs:t,context:r,audiences:n}){super({breadcrumbs:t,context:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.convertSecuritySchemes(),this.convertGlobalHeaders(),this.convertPlayground(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:t,errors:r}=this.convertPaths();this.addErrorsToIr(r);let{defaultUrl:n}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(n),this.finalizeIr()}convertGlobalHeaders(){this.context.globalHeaderOverrides;let r=new c5u({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let n=Yfv({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(n),this.context.setGlobalHeaders(n)}}convertPlayground(){let r=new u5u({breadcrumbs:["x-fern-explorer"],document:this.context.spec,context:this.context}).convert();this.ir.apiPlayground=r??!0}convertSecuritySchemes(){if(this.context.authOverrides){this.addAuthToIR(jTf({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator}));return}let t=[];for(let[r,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",r]});if(i==null)continue;let o=new P5u({context:this.context,breadcrumbs:["components","securitySchemes",r],securityScheme:i,schemeId:r}).convert();o!=null&&t.push(o)}t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertServers({endpointLevelServers:t}){if(this.context.environmentOverrides){let i=oZo({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return i!=null&&this.addEnvironmentsToIr({environmentConfig:i.environmentsConfig,audiences:i.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let n=new rnt({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:n?.value}),{defaultUrl:n?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new G7.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertWebhooks(){for(let[,t]of Object.entries(this.context.spec.webhooks??{})){if(t==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in t)){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}if(t.post?.operationId==null){this.context.errorCollector.collect({message:"Skipping webhook as no operationId is present",path:this.breadcrumbs});continue}let r=t.post.operationId,i=new lao({context:this.context,breadcrumbs:["webhooks",r],operation:t.post,method:tdv.OpenAPIV3.HttpMethods.POST,path:r}).convert();i!=null&&(this.addWebhookToIr({webhook:i.webhook,operationId:r,audiences:i.audiences,group:i.group}),this.addTypesToIr(i.inlinedTypes))}}convertPaths(){let t=[],r={};for(let[n,i]of Object.entries(this.context.spec.paths??{})){if(i==null)continue;let o=new A5u({context:this.context,breadcrumbs:["paths",n],topLevelServers:this.context.spec.servers,pathItem:i,path:n}).convert();if(o!=null){for(let c of o.endpoints){if(c.streamEndpoint!=null&&this.addEndpointToIr({endpoint:c.streamEndpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName}),c.servers)for(let f of c.servers)this.shouldAddServerToCollectedServers({server:f,currentServers:t})&&t.push(f);if(c.errors)for(let[f,u]of Object.entries(c.errors))r[f]=u}for(let c of o.webhooks){let f=this.context.getGroup({groupParts:c.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:c.webhook,operationId:f.join("."),group:f,audiences:c.audiences})}this.addTypesToIr(o.inlinedTypes)}}return{endpointLevelServers:t,errors:r}}};var w5u=class extends kE{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:n}){super({breadcrumbs:t,context:n}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}};var Zts=class extends Oee{globalHeaderNames;tagToDisplayName={};isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;i==="reference_identifier"?c=n??o.value.title:i==="discriminator_key"?c=o.value.title??n:i==="schema_identifier"&&(c=o.value.title);let f;if(a.includes("/")){let s=new G7.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:o.value,id:a}).convert();s!=null&&(f={[a]:s.convertedSchema})}return{ok:!0,reference:Bh.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,default:void 0,inline:!1,displayName:c}),inlinedTypes:f}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>r.name.wireValue)}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let i=new w5u({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=i}return this.tagToDisplayName[t]??t}};var p7I=nl.object({description:nl.string().optional(),required:nl.boolean().optional(),deprecated:nl.boolean().optional(),allowEmptyValue:nl.boolean().optional(),style:nl.string().optional(),explode:nl.boolean().optional(),allowReserved:nl.boolean().optional(),schema:nl.any().optional(),example:nl.any().optional(),examples:nl.record(nl.string(),nl.any()).optional(),content:nl.record(nl.string(),nl.any()).optional()}),_7I=p7I.extend({name:nl.string(),in:nl.string()}),h7I=nl.array(_7I),j5u=class extends kE{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return h7I.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${r instanceof Error?r.message:String(r)}`,path:this.breadcrumbs});return}}};var E5u=class extends gO{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:n,pathParameters:i=[],queryParameters:a=[],headers:o=[],topLevelServers:c=[]}){super({context:t,breadcrumbs:r}),this.method=n,this.pathParameters=i,this.queryParameters=a,this.headers=o,this.topLevelServers=c}convert(){let t={},r="";for(let u of this.pathParameters)r+=`/{${u.name.originalName}}`;let n=nZ(r),i=[];for(let[u,s]of this.method.params.entries()){let l;if(this.context.isReferenceObject(s)){let C=this.context.resolveReference({reference:s});if(C.resolved)l=C.value;else continue}else l=s;let m=[this.method.name,"Param",l.name].join("_"),P=new G7.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",l.name],schemaIdOverride:m,context:this.context,schemaOrReference:l.schema,wrapAsOptional:!l.required}).convert();P!=null&&(i.push({docs:l.description,availability:this.context.getAvailability({node:s,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:l.name,wireValue:l.name}),valueType:P.type,v2Examples:P.schema?.typeDeclaration.v2Examples,propertyAccess:void 0}),t={...P.inlinedTypes,...t,...P.schema!=null?{[m]:P.schema}:{}})}let a;if(this.method.result!=null){let u=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(u!=null){let s=new G7.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:u.schema}),l=[this.method.name,"Result"].join("_"),m=s.convert();m!=null&&(a={docs:u.description,v2Examples:m.schema?.typeDeclaration.v2Examples,responseBodyType:m.type},t={...m.inlinedTypes,...t,...m.schema!=null?{[l]:m.schema}:{}})}}let o=this.getEndpointBaseUrls(),c=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:o,basePath:void 0,auth:!1,security:void 0,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:n,fullPath:n,requestBody:i.length>0?U7.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:i,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,v2RequestBodies:void 0,sdkRequest:void 0,response:a!=null?{body:vN.json(Sfe.response(a)),statusCode:void 0}:void 0,v2Responses:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples()},transport:void 0,availability:void 0,source:FAe.openrpc(),audiences:c,retries:void 0,apiPlayground:void 0},audiences:c,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(n=>n.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(n=>{if(this.topLevelServers.find(c=>c.name===n.name&&c.url!==n.url)!=null)return n.url;let o=this.topLevelServers.find(c=>c.url===n.url)??n;return rnt.getServerName({server:o,context:this.context})})}convertExamples(){let t={},r=0;if(this.method.examples&&this.method.examples.length>0){for(let n of this.method.examples??[]){let i;if(this.context.isReferenceObject(n)){let f=this.context.resolveReference({reference:n});if(f.resolved)i=f.value;else continue}else i=n;let a;if(i.result)if(this.context.isReferenceObject(i.result)){let f=this.context.resolveReference({reference:i.result});f.resolved&&(a=f.value)}else a=i.result;let o=i.name??`Example ${r+1}`,c=[];if(i.params&&Array.isArray(i.params)){c=[];for(let f of i.params)if(this.context.isReferenceObject(f)){let u=this.context.resolveReference({reference:f});if(u.resolved)c.push(u.value);else continue}else c.push(f)}t[o]={displayName:void 0,request:{docs:void 0,endpoint:{method:"POST",path:"/{apiKey}"},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:c.map(f=>f.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?ip.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:i.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++r}return t}};var S5u=class extends G7.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={};if(this.parameter.schema!=null){let i=new G7.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();i!=null&&(t=i.type,r=i.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}};var kts=class extends dqr{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let n=new rnt({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:n?.value}),{defaultUrl:n?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new G7.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertMethods(){let t=[],n=new j5u({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),i=[],a=[],o=[];if(n&&n.length>0)for(let[f,u]of n.entries()){let l=new S5u({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${f}]`],parameter:u}).convert();if(l!=null)switch(l.type){case"path":{i.push(l.parameter);break}case"query":{a.push(l.parameter);break}case"header":{o.push(l.parameter);break}}}let c=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let f of this.context.spec.methods??[]){let u=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:["methods"]});if(u==null)continue;let l=new E5u({context:this.context,breadcrumbs:["methods"],method:u,pathParameters:i,queryParameters:a,headers:o,topLevelServers:this.context.spec.servers}).convert();if(l!=null&&(this.addEndpointToIr({endpoint:l.endpoint,audiences:l.audiences,endpointGroup:c,serviceName:"service_root"}),this.addTypesToIr(l.inlinedTypes),l.servers))for(let m of l.servers)this.shouldAddServerToCollectedServers({server:m,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(m))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(n=>n.name===t.name&&n.url!==t.url)?{...t,name:t.url}:t}};var ers=class extends Oee{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let a=this.getTypeIdFromSchemaReference(t);if(a==null)return{ok:!1};let o=this.resolveReference({reference:t,breadcrumbs:r});if(!o.resolved)return{ok:!1};let c;return i==="reference_identifier"?c=n??o.value.title:(i==="discriminator_key"||i==="schema_identifier")&&(c=o.value.title??n),{ok:!0,reference:Bh.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(a),typeId:a,displayName:c,default:void 0,inline:!1})}}};var Wpv=require("fs/promises");var rdv={[lm.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,aU(e)])),[lm.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"]),[lm.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"]),[lm.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","kwargs"]),[lm.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","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[lm.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","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[lm.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"]),[lm.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[lm.GenerationLanguage.SWIFT]:new Set([])};var y7I=["go","ruby"];function I5u({generationLanguage:e,keywords:t,smartCasing:r}){let n={generateName:(i,a)=>{let o=l=>({unsafeName:l,safeName:v7I({name:l,keywords:b7I({generationLanguage:e,keywords:t})})}),c=$A(i),f=aU(c),u=Una(i),s=xna(c);return r&&(!O7I(s)&&(e==null||y7I.includes(e))&&(c=s.map((l,m)=>{if(m>0){let O=D5u(l);if(O!=null)return O;if(C5u(l))return l.toUpperCase()}return l}).join(""),f=aU(s.map((l,m)=>{let O=D5u(l);return O??(C5u(l)?l.toUpperCase():m===0?aU(l):l)}).join(""))),u=i.split(" ").map(l=>l.split(/(\d+)/).map(Una).join("")).join("_")),{originalName:i,camelCase:o(a?.casingOverrides?.camel??c),snakeCase:o(a?.casingOverrides?.snake??u),screamingSnakeCase:o(a?.casingOverrides?.["screaming-snake"]??u.toUpperCase()),pascalCase:o(a?.casingOverrides?.pascal??f)}},generateNameAndWireValue:({name:i,wireValue:a,opts:o})=>({name:n.generateName(i,o),wireValue:a})};return n}function v7I({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":m7I(e)?"_"+e:e}function b7I({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return rdv[e]}var g7I=/^[0-9]/;function m7I(e){return g7I.test(e)}function O7I(e){return e.some((t,r)=>{if(r===0)return!1;let n=e[r-1];if(n==null)return!1;let i=D5u(n)!=null||C5u(n),a=D5u(t)!=null||C5u(t);return i&&a})}function D5u(e){return P7I.get(e.toUpperCase())}function C5u(e){return A7I.has(e.toUpperCase())}var A7I=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"]),P7I=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var ndv=require("fs/promises");async function PQf({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,ndv.readFile)(t)).toString(),i;try{i=JSON.parse(n)}catch{i=Pg.load(n)}return r!=null?await aao({absoluteFilePathToOverrides:r,context:e,data:i}):i}var Mpv=Hi(Ipv(),1);function h2i(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...o}={}){let c=i.reduce((u,s)=>({...u,[s]:"<redacted>"}),a),f=[t,...r].join(" ");for(let[u,s]of Object.entries(c))f=f.replaceAll(u,s);return e?.debug(`+ ${f}`),(0,Mpv.default)(t,r,o)}async function FG(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...o}={}){let c=h2i(e,t,r,{doNotPipeOutput:n,secrets:i,substitutions:a,...o});n||(c.stdout?.pipe(process.stdout),c.stderr?.pipe(process.stderr));let f=await c;return f.stdout==null&&(f.stdout=""),f.stderr==null&&(f.stderr=""),f}function y2i(e,{logger:t,...r}={}){return(n,i)=>FG(t,e,n,{...r,...i})}var jnt=require("fs/promises"),Qpv=Hi(require("path"),1),QQf=Hi(RDe(),1);var Bpv="buf.gen.yaml",y2I="output",Tpv=`${y2I}/ir.json`,qpv="protoc-gen-fern",Rpv=`version: v1
|
|
2704
2704
|
`,Npv=`version: v2
|
|
2705
2705
|
`,x5u=e=>{let t=`version: v1
|
|
2706
2706
|
`;if(e.length>0){t+=`deps:
|
|
@@ -3015,10 +3015,10 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
3015
3015
|
?)[ \r ]*`,O5f="[\u0300-\u036F]",YQI=new RegExp(O5f+"+$"),XQI="("+eyv+"+)|"+($QI+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(O5f+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(O5f+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+KQI)+("|"+JQI+")"),dLu=class{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(XQI,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Kht("EOF",new Snt(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new wg("Unexpected character: '"+t[r]+"'",new Kht(t[r],new Snt(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(`
|
|
3016
3016
|
`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Kht(i,new Snt(this,r,this.tokenRegex.lastIndex))}},A5f=class{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new wg("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}},ZQI=Vhv;Ks("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Ks("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Ks("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Ks("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Ks("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});Ks("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Ks("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var shv={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ks("\\char",function(e){var t=e.popToken(),r,n="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new wg("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=shv[t.text],n==null||n>=r)throw new wg("Invalid base-"+r+" digit "+t.text);for(var i;(i=shv[e.future().text])!=null&&i<r;)n*=r,n+=i,e.popToken()}return"\\@char{"+n+"}"});var x5f=(e,t,r,n)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new wg("\\newcommand's first argument must be a macro name");var a=i[0].text,o=e.isDefined(a);if(o&&!t)throw new wg("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!o&&!r)throw new wg("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var c=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var f="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)f+=u.text,u=e.expandNextToken();if(!f.match(/^\s*[0-9]+\s*$/))throw new wg("Invalid number of arguments: "+f);c=parseInt(f),i=e.consumeArg().tokens}return o&&n||e.macros.set(a,{tokens:i,numArgs:c}),""};Ks("\\newcommand",e=>x5f(e,!1,!0,!1));Ks("\\renewcommand",e=>x5f(e,!0,!1,!1));Ks("\\providecommand",e=>x5f(e,!0,!0,!0));Ks("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});Ks("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});Ks("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),m2i[r],QV.math[r],QV.text[r]),""});Ks("\\bgroup","{");Ks("\\egroup","}");Ks("~","\\nobreakspace");Ks("\\lq","`");Ks("\\rq","'");Ks("\\aa","\\r a");Ks("\\AA","\\r A");Ks("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");Ks("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Ks("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");Ks("\u212C","\\mathscr{B}");Ks("\u2130","\\mathscr{E}");Ks("\u2131","\\mathscr{F}");Ks("\u210B","\\mathscr{H}");Ks("\u2110","\\mathscr{I}");Ks("\u2112","\\mathscr{L}");Ks("\u2133","\\mathscr{M}");Ks("\u211B","\\mathscr{R}");Ks("\u212D","\\mathfrak{C}");Ks("\u210C","\\mathfrak{H}");Ks("\u2128","\\mathfrak{Z}");Ks("\\Bbbk","\\Bbb{k}");Ks("\xB7","\\cdotp");Ks("\\llap","\\mathllap{\\textrm{#1}}");Ks("\\rlap","\\mathrlap{\\textrm{#1}}");Ks("\\clap","\\mathclap{\\textrm{#1}}");Ks("\\mathstrut","\\vphantom{(}");Ks("\\underbar","\\underline{\\text{#1}}");Ks("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Ks("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");Ks("\\ne","\\neq");Ks("\u2260","\\neq");Ks("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");Ks("\u2209","\\notin");Ks("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");Ks("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");Ks("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");Ks("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");Ks("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");Ks("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");Ks("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");Ks("\u27C2","\\perp");Ks("\u203C","\\mathclose{!\\mkern-0.8mu!}");Ks("\u220C","\\notni");Ks("\u231C","\\ulcorner");Ks("\u231D","\\urcorner");Ks("\u231E","\\llcorner");Ks("\u231F","\\lrcorner");Ks("\xA9","\\copyright");Ks("\xAE","\\textregistered");Ks("\uFE0F","\\textregistered");Ks("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Ks("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Ks("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Ks("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Ks("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Ks("\u22EE","\\vdots");Ks("\\varGamma","\\mathit{\\Gamma}");Ks("\\varDelta","\\mathit{\\Delta}");Ks("\\varTheta","\\mathit{\\Theta}");Ks("\\varLambda","\\mathit{\\Lambda}");Ks("\\varXi","\\mathit{\\Xi}");Ks("\\varPi","\\mathit{\\Pi}");Ks("\\varSigma","\\mathit{\\Sigma}");Ks("\\varUpsilon","\\mathit{\\Upsilon}");Ks("\\varPhi","\\mathit{\\Phi}");Ks("\\varPsi","\\mathit{\\Psi}");Ks("\\varOmega","\\mathit{\\Omega}");Ks("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Ks("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Ks("\\boxed","\\fbox{$\\displaystyle{#1}$}");Ks("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Ks("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Ks("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Ks("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Ks("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var uhv={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Ks("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in uhv?t=uhv[r]:(r.slice(0,4)==="\\not"||r in QV.math&&VE.contains(["bin","rel"],QV.math[r].group))&&(t="\\dotsb"),t});var z5f={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ks("\\dotso",function(e){var t=e.future().text;return t in z5f?"\\ldots\\,":"\\ldots"});Ks("\\dotsc",function(e){var t=e.future().text;return t in z5f&&t!==","?"\\ldots\\,":"\\ldots"});Ks("\\cdots",function(e){var t=e.future().text;return t in z5f?"\\@cdots\\,":"\\@cdots"});Ks("\\dotsb","\\cdots");Ks("\\dotsm","\\cdots");Ks("\\dotsi","\\!\\cdots");Ks("\\dotsx","\\ldots\\,");Ks("\\DOTSI","\\relax");Ks("\\DOTSB","\\relax");Ks("\\DOTSX","\\relax");Ks("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Ks("\\,","\\tmspace+{3mu}{.1667em}");Ks("\\thinspace","\\,");Ks("\\>","\\mskip{4mu}");Ks("\\:","\\tmspace+{4mu}{.2222em}");Ks("\\medspace","\\:");Ks("\\;","\\tmspace+{5mu}{.2777em}");Ks("\\thickspace","\\;");Ks("\\!","\\tmspace-{3mu}{.1667em}");Ks("\\negthinspace","\\!");Ks("\\negmedspace","\\tmspace-{4mu}{.2222em}");Ks("\\negthickspace","\\tmspace-{5mu}{.277em}");Ks("\\enspace","\\kern.5em ");Ks("\\enskip","\\hskip.5em\\relax");Ks("\\quad","\\hskip1em\\relax");Ks("\\qquad","\\hskip2em\\relax");Ks("\\tag","\\@ifstar\\tag@literal\\tag@paren");Ks("\\tag@paren","\\tag@literal{({#1})}");Ks("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new wg("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Ks("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Ks("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Ks("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Ks("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Ks("\\newline","\\\\\\relax");Ks("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var tyv=S0(tWr["Main-Regular"][84][1]-.7*tWr["Main-Regular"][65][1]);Ks("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+tyv+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ks("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+tyv+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Ks("\\hspace","\\@ifstar\\@hspacer\\@hspace");Ks("\\@hspace","\\hskip #1\\relax");Ks("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Ks("\\ordinarycolon",":");Ks("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Ks("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Ks("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Ks("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Ks("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Ks("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Ks("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Ks("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Ks("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Ks("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Ks("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Ks("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Ks("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Ks("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Ks("\u2237","\\dblcolon");Ks("\u2239","\\eqcolon");Ks("\u2254","\\coloneqq");Ks("\u2255","\\eqqcolon");Ks("\u2A74","\\Coloneqq");Ks("\\ratio","\\vcentcolon");Ks("\\coloncolon","\\dblcolon");Ks("\\colonequals","\\coloneqq");Ks("\\coloncolonequals","\\Coloneqq");Ks("\\equalscolon","\\eqqcolon");Ks("\\equalscoloncolon","\\Eqqcolon");Ks("\\colonminus","\\coloneq");Ks("\\coloncolonminus","\\Coloneq");Ks("\\minuscolon","\\eqcolon");Ks("\\minuscoloncolon","\\Eqcolon");Ks("\\coloncolonapprox","\\Colonapprox");Ks("\\coloncolonsim","\\Colonsim");Ks("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ks("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ks("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ks("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ks("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");Ks("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Ks("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Ks("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Ks("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Ks("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Ks("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Ks("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Ks("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Ks("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");Ks("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");Ks("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");Ks("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");Ks("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");Ks("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");Ks("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");Ks("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");Ks("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");Ks("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");Ks("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");Ks("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");Ks("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");Ks("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");Ks("\\imath","\\html@mathml{\\@imath}{\u0131}");Ks("\\jmath","\\html@mathml{\\@jmath}{\u0237}");Ks("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");Ks("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");Ks("\u27E6","\\llbracket");Ks("\u27E7","\\rrbracket");Ks("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");Ks("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");Ks("\u2983","\\lBrace");Ks("\u2984","\\rBrace");Ks("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");Ks("\u29B5","\\minuso");Ks("\\darr","\\downarrow");Ks("\\dArr","\\Downarrow");Ks("\\Darr","\\Downarrow");Ks("\\lang","\\langle");Ks("\\rang","\\rangle");Ks("\\uarr","\\uparrow");Ks("\\uArr","\\Uparrow");Ks("\\Uarr","\\Uparrow");Ks("\\N","\\mathbb{N}");Ks("\\R","\\mathbb{R}");Ks("\\Z","\\mathbb{Z}");Ks("\\alef","\\aleph");Ks("\\alefsym","\\aleph");Ks("\\Alpha","\\mathrm{A}");Ks("\\Beta","\\mathrm{B}");Ks("\\bull","\\bullet");Ks("\\Chi","\\mathrm{X}");Ks("\\clubs","\\clubsuit");Ks("\\cnums","\\mathbb{C}");Ks("\\Complex","\\mathbb{C}");Ks("\\Dagger","\\ddagger");Ks("\\diamonds","\\diamondsuit");Ks("\\empty","\\emptyset");Ks("\\Epsilon","\\mathrm{E}");Ks("\\Eta","\\mathrm{H}");Ks("\\exist","\\exists");Ks("\\harr","\\leftrightarrow");Ks("\\hArr","\\Leftrightarrow");Ks("\\Harr","\\Leftrightarrow");Ks("\\hearts","\\heartsuit");Ks("\\image","\\Im");Ks("\\infin","\\infty");Ks("\\Iota","\\mathrm{I}");Ks("\\isin","\\in");Ks("\\Kappa","\\mathrm{K}");Ks("\\larr","\\leftarrow");Ks("\\lArr","\\Leftarrow");Ks("\\Larr","\\Leftarrow");Ks("\\lrarr","\\leftrightarrow");Ks("\\lrArr","\\Leftrightarrow");Ks("\\Lrarr","\\Leftrightarrow");Ks("\\Mu","\\mathrm{M}");Ks("\\natnums","\\mathbb{N}");Ks("\\Nu","\\mathrm{N}");Ks("\\Omicron","\\mathrm{O}");Ks("\\plusmn","\\pm");Ks("\\rarr","\\rightarrow");Ks("\\rArr","\\Rightarrow");Ks("\\Rarr","\\Rightarrow");Ks("\\real","\\Re");Ks("\\reals","\\mathbb{R}");Ks("\\Reals","\\mathbb{R}");Ks("\\Rho","\\mathrm{P}");Ks("\\sdot","\\cdot");Ks("\\sect","\\S");Ks("\\spades","\\spadesuit");Ks("\\sub","\\subset");Ks("\\sube","\\subseteq");Ks("\\supe","\\supseteq");Ks("\\Tau","\\mathrm{T}");Ks("\\thetasym","\\vartheta");Ks("\\weierp","\\wp");Ks("\\Zeta","\\mathrm{Z}");Ks("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Ks("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Ks("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Ks("\\bra","\\mathinner{\\langle{#1}|}");Ks("\\ket","\\mathinner{|{#1}\\rangle}");Ks("\\braket","\\mathinner{\\langle{#1}\\rangle}");Ks("\\Bra","\\left\\langle#1\\right|");Ks("\\Ket","\\left|#1\\right\\rangle");var ryv=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,o=t.macros.get("|"),c=t.macros.get("\\|");t.macros.beginGroup();var f=l=>m=>{e&&(m.macros.set("|",o),i.length&&m.macros.set("\\|",c));var O=l;if(!l&&i.length){var P=m.future();P.text==="|"&&(m.popToken(),O=!0)}return{tokens:O?i:n,numArgs:0}};t.macros.set("|",f(!1)),i.length&&t.macros.set("\\|",f(!0));var u=t.consumeArg().tokens,s=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:s.reverse(),numArgs:0}};Ks("\\bra@ket",ryv(!1));Ks("\\bra@set",ryv(!0));Ks("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Ks("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Ks("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Ks("\\angln","{\\angl n}");Ks("\\blue","\\textcolor{##6495ed}{#1}");Ks("\\orange","\\textcolor{##ffa500}{#1}");Ks("\\pink","\\textcolor{##ff00af}{#1}");Ks("\\red","\\textcolor{##df0030}{#1}");Ks("\\green","\\textcolor{##28ae7b}{#1}");Ks("\\gray","\\textcolor{gray}{#1}");Ks("\\purple","\\textcolor{##9d38bd}{#1}");Ks("\\blueA","\\textcolor{##ccfaff}{#1}");Ks("\\blueB","\\textcolor{##80f6ff}{#1}");Ks("\\blueC","\\textcolor{##63d9ea}{#1}");Ks("\\blueD","\\textcolor{##11accd}{#1}");Ks("\\blueE","\\textcolor{##0c7f99}{#1}");Ks("\\tealA","\\textcolor{##94fff5}{#1}");Ks("\\tealB","\\textcolor{##26edd5}{#1}");Ks("\\tealC","\\textcolor{##01d1c1}{#1}");Ks("\\tealD","\\textcolor{##01a995}{#1}");Ks("\\tealE","\\textcolor{##208170}{#1}");Ks("\\greenA","\\textcolor{##b6ffb0}{#1}");Ks("\\greenB","\\textcolor{##8af281}{#1}");Ks("\\greenC","\\textcolor{##74cf70}{#1}");Ks("\\greenD","\\textcolor{##1fab54}{#1}");Ks("\\greenE","\\textcolor{##0d923f}{#1}");Ks("\\goldA","\\textcolor{##ffd0a9}{#1}");Ks("\\goldB","\\textcolor{##ffbb71}{#1}");Ks("\\goldC","\\textcolor{##ff9c39}{#1}");Ks("\\goldD","\\textcolor{##e07d10}{#1}");Ks("\\goldE","\\textcolor{##a75a05}{#1}");Ks("\\redA","\\textcolor{##fca9a9}{#1}");Ks("\\redB","\\textcolor{##ff8482}{#1}");Ks("\\redC","\\textcolor{##f9685d}{#1}");Ks("\\redD","\\textcolor{##e84d39}{#1}");Ks("\\redE","\\textcolor{##bc2612}{#1}");Ks("\\maroonA","\\textcolor{##ffbde0}{#1}");Ks("\\maroonB","\\textcolor{##ff92c6}{#1}");Ks("\\maroonC","\\textcolor{##ed5fa6}{#1}");Ks("\\maroonD","\\textcolor{##ca337c}{#1}");Ks("\\maroonE","\\textcolor{##9e034e}{#1}");Ks("\\purpleA","\\textcolor{##ddd7ff}{#1}");Ks("\\purpleB","\\textcolor{##c6b9fc}{#1}");Ks("\\purpleC","\\textcolor{##aa87ff}{#1}");Ks("\\purpleD","\\textcolor{##7854ab}{#1}");Ks("\\purpleE","\\textcolor{##543b78}{#1}");Ks("\\mintA","\\textcolor{##f5f9e8}{#1}");Ks("\\mintB","\\textcolor{##edf2df}{#1}");Ks("\\mintC","\\textcolor{##e0e5cc}{#1}");Ks("\\grayA","\\textcolor{##f6f7f7}{#1}");Ks("\\grayB","\\textcolor{##f0f1f2}{#1}");Ks("\\grayC","\\textcolor{##e3e5e6}{#1}");Ks("\\grayD","\\textcolor{##d6d8da}{#1}");Ks("\\grayE","\\textcolor{##babec2}{#1}");Ks("\\grayF","\\textcolor{##888d93}{#1}");Ks("\\grayG","\\textcolor{##626569}{#1}");Ks("\\grayH","\\textcolor{##3b3e40}{#1}");Ks("\\grayI","\\textcolor{##21242c}{#1}");Ks("\\kaBlue","\\textcolor{##314453}{#1}");Ks("\\kaGreen","\\textcolor{##71B307}{#1}");var nyv={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},P5f=class{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new A5f(ZQI,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new dLu(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new Kht("EOF",n.loc)),this.pushTokens(i),r.range(n,"")}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,o=0,c=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++o;else if(a.text==="}"){if(--o,o===-1)throw new wg("Extra }",a)}else if(a.text==="EOF")throw new wg("Unexpected end of input in a macro argument, expected '"+(t&&n?t[c]:"}")+"'",a);if(t&&n)if((o===0||o===1&&t[c]==="{")&&a.text===t[c]){if(++c,c===t.length){r.splice(-c,c);break}}else c=0}while(o!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new wg("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;i<n.length;i++){var a=this.popToken();if(n[i]!==a.text)throw new wg("Use of the macro doesn't match its definition",a)}}for(var o=[],c=0;c<t;c++)o.push(this.consumeArg(r&&r[c+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new wg("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new wg("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var c=a.length-1;c>=0;--c){var f=a[c];if(f.text==="#"){if(c===0)throw new wg("Incomplete placeholder at end of macro body",f);if(f=a[--c],f.text==="#")a.splice(c+1,1);else if(/^[1-9]$/.test(f.text))a.splice(c,2,...o[+f.text-1]);else throw new wg("Not a valid argument number",f)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Kht(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(a+1))!==-1;)++a;for(var c=new dLu(i,this.settings),f=[],u=c.lex();u.text!=="EOF";)f.push(u),u=c.lex();f.reverse();var s={tokens:f,numArgs:a};return s}return i}isDefined(t){return this.macros.has(t)||m2i.hasOwnProperty(t)||QV.math.hasOwnProperty(t)||QV.text.hasOwnProperty(t)||nyv.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:m2i.hasOwnProperty(t)&&!m2i[t].primitive}},chv=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,nLu=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),f5f={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},lhv={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},pLu=class e{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new P5f(t,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new wg("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new Kht("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.indexOf(i.text)!==-1||r&&i.text===r||t&&m2i[i.text]&&m2i[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i<t.length;i++)if(t[i].type==="infix"){if(r!==-1)throw new wg("only one infix operator per group",t[i].token);r=i,n=t[i].replaceWith}if(r!==-1&&n){var a,o,c=t.slice(0,r),f=t.slice(r+1);c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c},f.length===1&&f[0].type==="ordgroup"?o=f[0]:o={type:"ordgroup",mode:this.mode,body:f};var u;return n==="\\\\abovefrac"?u=this.callFunction(n,[a,t[r],o],[]):u=this.callFunction(n,[a,o],[]),[u]}else return t}handleSupSubscript(t){var r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();var i=this.parseGroup(t);if(!i)throw new wg("Expected group after '"+n+"'",r);return i}formatUnsupportedCmd(t){for(var r=[],n=0;n<t.length;n++)r.push({type:"textord",mode:"text",text:t[n]});var i={type:"text",mode:this.mode,body:r},a={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return a}parseAtom(t){var r=this.parseGroup("atom",t);if(this.mode==="text")return r;for(var n,i;;){this.consumeSpaces();var a=this.fetch();if(a.text==="\\limits"||a.text==="\\nolimits"){if(r&&r.type==="op"){var o=a.text==="\\limits";r.limits=o,r.alwaysHandleSupSub=!0}else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=a.text==="\\limits");else throw new wg("Limit controls must follow a math operator",a);this.consume()}else if(a.text==="^"){if(n)throw new wg("Double superscript",a);n=this.handleSupSubscript("superscript")}else if(a.text==="_"){if(i)throw new wg("Double subscript",a);i=this.handleSupSubscript("subscript")}else if(a.text==="'"){if(n)throw new wg("Double superscript",a);var c={type:"textord",mode:this.mode,text:"\\prime"},f=[c];for(this.consume();this.fetch().text==="'";)f.push(c),this.consume();this.fetch().text==="^"&&f.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:f}}else if(nLu[a.text]){var u=chv.test(a.text),s=[];for(s.push(new Kht(nLu[a.text])),this.consume();;){var l=this.fetch().text;if(!nLu[l]||chv.test(l)!==u)break;s.unshift(new Kht(nLu[l])),this.consume()}var m=this.subparse(s);u?i={type:"ordgroup",mode:"math",body:m}:n={type:"ordgroup",mode:"math",body:m}}else break}return n||i?{type:"supsub",mode:this.mode,base:r,sup:n,sub:i}:r}parseFunction(t,r){var n=this.fetch(),i=n.text,a=m2i[i];if(!a)return null;if(this.consume(),r&&r!=="atom"&&!a.allowedInArgument)throw new wg("Got function '"+i+"' with no arguments"+(r?" as "+r:""),n);if(this.mode==="text"&&!a.allowedInText)throw new wg("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&a.allowedInMath===!1)throw new wg("Can't use function '"+i+"' in math mode",n);var{args:o,optArgs:c}=this.parseArguments(i,a);return this.callFunction(i,o,c,n,t)}callFunction(t,r,n,i,a){var o={funcName:t,parser:this,token:i,breakOnTokenText:a},c=m2i[t];if(c&&c.handler)return c.handler(o,r,n);throw new wg("No function handler for "+t)}parseArguments(t,r){var n=r.numArgs+r.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],a=[],o=0;o<n;o++){var c=r.argTypes&&r.argTypes[o],f=o<r.numOptionalArgs;(r.primitive&&c==null||r.type==="sqrt"&&o===1&&a[0]==null)&&(c="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",c,f);if(f)a.push(u);else if(u!=null)i.push(u);else throw new wg("Null argument, please report this as a bug")}return{args:i,optArgs:a}}parseGroupOfType(t,r,n){switch(r){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var a=this.parseStringGroup("raw",n);return a!=null?{type:"raw",mode:"text",string:a.text}:null}case"primitive":{if(n)throw new wg("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new wg("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new wg("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,r){var n=this.gullet.scanArgument(r);if(n==null)return null;for(var i="",a;(a=this.fetch()).text!=="EOF";)i+=a.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(t,r){for(var n=this.fetch(),i=n,a="",o;(o=this.fetch()).text!=="EOF"&&t.test(a+o.text);)i=o,a+=i.text,this.consume();if(a==="")throw new wg("Invalid "+r+": '"+n.text+"'",n);return n.range(i,a)}parseColorGroup(t){var r=this.parseStringGroup("color",t);if(r==null)return null;var n=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);if(!n)throw new wg("Invalid color: '"+r.text+"'",r);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(t){var r,n=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup("size",t),!r)return null;!t&&r.text.length===0&&(r.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!i)throw new wg("Invalid size: '"+r.text+"'",r);var a={number:+(i[1]+i[2]),unit:i[3]};if(!phv(a))throw new wg("Invalid unit: '"+a.unit+"'",r);return{type:"size",mode:this.mode,value:a,isBlank:n}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var r=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;var n=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(t,r){var n=this.gullet.scanArgument(t);if(n==null)return null;var i=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:a};return r&&this.switchMode(i),o}parseGroup(t,r){var n=this.fetch(),i=n.text,a;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var c=this.parseExpression(!1,o),f=this.fetch();this.expect(o),this.gullet.endGroup(),a={type:"ordgroup",mode:this.mode,loc:Snt.range(n,f),body:c,semisimple:i==="\\begingroup"||void 0}}else if(a=this.parseFunction(r,t)||this.parseSymbol(),a==null&&i[0]==="\\"&&!nyv.hasOwnProperty(i)){if(this.settings.throwOnError)throw new wg("Undefined control sequence: "+i,n);a=this.formatUnsupportedCmd(i),this.consume()}return a}formLigatures(t){for(var r=t.length-1,n=0;n<r;++n){var i=t[n],a=i.text;a==="-"&&t[n+1].text==="-"&&(n+1<r&&t[n+2].text==="-"?(t.splice(n,3,{type:"textord",mode:"text",loc:Snt.range(i,t[n+2]),text:"---"}),r-=2):(t.splice(n,2,{type:"textord",mode:"text",loc:Snt.range(i,t[n+1]),text:"--"}),r-=1)),(a==="'"||a==="`")&&t[n+1].text===a&&(t.splice(n,2,{type:"textord",mode:"text",loc:Snt.range(i,t[n+1]),text:a+a}),r-=1)}}parseSymbol(){var t=this.fetch(),r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var n=r.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new wg(`\\verb assertion failed --
|
|
3017
3017
|
please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}lhv.hasOwnProperty(r[0])&&!QV[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+r[0]+'" used in math mode',t),r=lhv[r[0]]+r.slice(1));var a=YQI.exec(r);a&&(r=r.substring(0,a.index),r==="i"?r="\u0131":r==="j"&&(r="\u0237"));var o;if(QV[this.mode][r]){this.settings.strict&&this.mode==="math"&&h5f.indexOf(r)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var c=QV[this.mode][r].group,f=Snt.range(t),u;if(V6I.hasOwnProperty(c)){var s=c;u={type:"atom",mode:this.mode,family:s,loc:f,text:r}}else u={type:c,mode:this.mode,loc:f,text:r};o=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(dhv(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),o={type:"textord",mode:"text",loc:Snt.range(t),text:r};else return null;if(this.consume(),a)for(var l=0;l<a[0].length;l++){var m=a[0][l];if(!f5f[m])throw new wg("Unknown accent ' "+m+"'",t);var O=f5f[m][this.mode]||f5f[m].text;if(!O)throw new wg("Accent "+m+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:Snt.range(t),label:O,isStretchy:!1,isShifty:!0,base:o}}return o}};pLu.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var Q5f=function(t,r){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new pLu(t,r);delete n.gullet.macros.current["\\df@tag"];var i=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new wg("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new Kht("\\df@tag")])}]}return i},iyv=function(t,r,n){r.textContent="";var i=L5f(t,n).toNode();r.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),iyv=function(){throw new wg("KaTeX doesn't work in quirks mode.")});var kQI=function(t,r){var n=L5f(t,r).toMarkup();return n},e5I=function(t,r){var n=new drs(r);return Q5f(t,n)},ayv=function(t,r,n){if(n.throwOnError||!(t instanceof wg))throw t;var i=a_.makeSpan(["katex-error"],[new Vxe(r)]);return i.setAttribute("title",t.toString()),i.setAttribute("style","color:"+n.errorColor),i},L5f=function(t,r){var n=new drs(r);try{var i=Q5f(t,n);return fQI(i,t,n)}catch(a){return ayv(a,t,n)}},t5I=function(t,r){var n=new drs(r);try{var i=Q5f(t,n);return dQI(i,t,n)}catch(a){return ayv(a,t,n)}},r5I="0.16.21",n5I={Span:Yfa,Anchor:_rs,SymbolNode:Vxe,SvgNode:Lqr,PathNode:rWr,LineNode:hrs},U5f={version:r5I,render:iyv,renderToString:kQI,ParseError:wg,SETTINGS_SCHEMA:iLu,__parse:e5I,__renderToDomTree:L5f,__renderToHTMLTree:t5I,__setFontMetrics:N6I,__defineSymbol:Fn,__defineFunction:QO,__defineMacro:Ks,__domTree:n5I};function w2i(e){let{content:t}=(0,oyv.default)(e);return Gfa(t,{extensions:[dka(),ika(),Jfa()],mdastExtensions:[Vua(),xua(),Hfa()]})}function wao(e,t){lie(e,{enter(r){r.type==="JSXElement"&&r.openingElement.attributes.forEach(n=>{n.type==="JSXAttribute"&&n.name.type==="JSXIdentifier"&&t[n.name.name]&&t[n.name.name]?.(n,r)})}})}function Zfa(e,t){let{content:r,data:n}=(0,brs.default)(e,{}),i=r,a=new Set;function o(u){let s=jao(u,t);if(u&&s!=null)return a.add(s),s}fyv(n,["image","og:image","og:logo","twitter:image"],o),dyv(n,o);let c=w2i(r),f=0;return Uv(c,u=>{if(u.position==null)return;let{start:s,length:l}=lyv(r,u.position),m=i.slice(s+f,s+f+l),O=m;if(u.type==="image"){let C=Cnt(u.url),M=jao(C,t);C!=null&&M!=null&&(a.add(M),O=O.replaceAll(C,M))}function P(C){wao(C,{src:M=>{let T=Cnt(pwi(M.value)),z=jao(T,t);T&&z&&(a.add(z),O=O.replaceAll(T,z))}})}if(W5u(u)){let C=u.attributes.filter(_wi).find(T=>T.name==="src"),M=Cnt(v2i(C?.value));if(C&&M){let T=jao(M,t);T!=null&&(a.add(T),O=O.replaceAll(M,T))}u.attributes.forEach(T=>{_wi(T)&&typeof T.value!="string"&&T.value!=null&&T.value.data?.estree?P(T.value.data.estree):H5u(T)&&T.data?.estree&&P(T.data.estree)})}if(G5u(u)&&u.data?.estree&&P(u.data.estree),!(O===m&&a.size===0))return i=i.slice(0,s+f)+O+i.slice(s+f+l),f+=O.length-l,pm}),{filepaths:[...a],markdown:brs.default.stringify(i,n)}}function jao(e,{absolutePathToFernFolder:t,absolutePathToMarkdownFile:r}){return e==null||uyv(e)||cyv(e)?void 0:d1(e.startsWith("/")?t:Mg(r),eu.of(e.replace(/^\//,"")))}function uyv(e){return/^(https?:)?\/\//.test(e)}function cyv(e){return e.startsWith("data:")}function mLu({href:e,metadata:t,markdownFilesToPathName:r}){if(e!=null&&(e.endsWith(".md")||e.endsWith(".mdx"))){let n=jao(e,t);if(n!=null){let i=r[n];return i!=null?{type:"replace",slug:i.startsWith("/")?i:"/"+i,href:e}:{type:"missing-reference",path:n,href:e}}}}function W5f(e,t,r,n,i){let{content:a,data:o}=(0,brs.default)(e,{}),c=a,f=w2i(a),u=0;function s(l){if(l==null||uyv(l)||cyv(l))return;if((0,syv.isAbsolute)(l)){let O=F_.of(l),P=t.get(O);return P?`file:${P}`:void 0}let m=jao(l,n);if(m){let O=t.get(m);return O?`file:${O}`:void 0}}return fyv(o,["image","og:image","og:logo","twitter:image"],s),dyv(o,s),Uv(f,l=>{if(l.position==null)return;let{start:m,length:O}=lyv(a,l.position),P=c.slice(m+u,m+u+O),C=P;function M(U){let q=s(U);U&&q&&(C=C.replace(U,q))}function T(U){let q=mLu({href:U,markdownFilesToPathName:r,metadata:n});U!=null&&q!=null&&q.type==="replace"&&(C=C.replace(U,q.slug))}function z(U){wao(U,{src:q=>M(Cnt(pwi(q.value))),href:q=>T(Cnt(pwi(q.value)))})}if(l.type==="image"){let U=Cnt(l.url);M(Cnt(U))}if(l.type==="link"&&T(Cnt(l.url)),W5u(l)){let U=l.attributes.filter(_wi).find(V=>V.name==="src");M(Cnt(v2i(U?.value)));let q=l.attributes.find(V=>V.type==="mdxJsxAttribute"&&V.name==="href");T(Cnt(v2i(q?.value))),l.attributes.forEach(V=>{_wi(V)&&typeof V.value!="string"&&V.value!=null&&V.value.data?.estree?z(V.value.data.estree):H5u(V)&&V.data?.estree&&z(V.data.estree)})}if(G5u(l)&&l.data?.estree&&z(l.data.estree),C!==P)return c=c.slice(0,m+u)+C+c.slice(m+u+O),u+=C.length-O,pm}),brs.default.stringify(c,o)}function lyv(e,t){let r=e.split(`
|
|
3018
|
-
`),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function Cnt(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function fyv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var i5I=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function V5f(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function dyv(e,t){let r=i5I.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=V5f(n,t):(n.light!=null&&(e.logo.light=V5f(n.light,t)),n.dark!=null&&(e.logo.dark=V5f(n.dark,t)))}var pyv=require("fs/promises");async function a5I(e){return(await(0,pyv.readFile)(e)).toString()}function o5I(e){return e.startsWith("http://")||e.startsWith("https://")}async function G5f({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=a5I}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m
|
|
3018
|
+
`),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function Cnt(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function fyv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var i5I=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function V5f(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function dyv(e,t){let r=i5I.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=V5f(n,t):(n.light!=null&&(e.logo.light=V5f(n.light,t)),n.dark!=null&&(e.logo.dark=V5f(n.dark,t)))}var pyv=require("fs/promises");async function a5I(e){return(await(0,pyv.readFile)(e)).toString()}function o5I(e){return e.startsWith("http://")||e.startsWith("https://")}async function G5f({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=a5I}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m,O;if(o5I(s))try{let q=await fetch(s);if(!q.ok){n.logger.warn(`Failed to fetch code from URL "${s}" (status ${q.status}) referenced in ${r}`);break}l=await q.text();let $=new URL(s).pathname;m=$.split(".").pop(),O=$.split("/").pop()}catch(q){n.logger.warn(`Failed to fetch code from URL "${s}" referenced in ${r}: ${q}`);break}else{let q=d1(s.startsWith("/")?t:Mg(r),eu.of(s.replace(/^\//,"")));l=await i(q),m=q.split(".").pop(),O=q.split("/").pop()}let P=new Map,C=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,M=f?.split("src=")[0]?.trim()??"",T;for(;(T=C.exec(M))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}let z=c[3]?.trim()||"";for(C.lastIndex=0;(T=C.exec(z))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}P.delete("src"),P.has("language")&&(m=P.get("language"),P.delete("language")),P.has("title")&&(O=P.get("title"),P.delete("title"));let U="";m!=null&&(U+=m),O!=null&&(U+=` title={"${O}"}`);for(let[q,V]of P)U+=` ${q}={${V}}`;l=`\`\`\`${U}
|
|
3019
3019
|
${l}
|
|
3020
3020
|
\`\`\``,l=l.split(`
|
|
3021
|
-
`).map(
|
|
3021
|
+
`).map(q=>u+q).join(`
|
|
3022
3022
|
`),l=l+`
|
|
3023
3023
|
`,o=o.replace(f,l)}catch{n.logger.warn(`Failed to read markdown file "${s}" referenced in ${r}`);break}}return o}var _yv=require("fs/promises"),hyv=Hi(Ort(),1);async function s5I(e){let{content:t}=(0,hyv.default)(await(0,_yv.readFile)(e));return t}function u5I(e){let t={},r=/(\w+)=(?:{?['"]([^'"]+)['"]?}?|{([^}]+)})/g,n;for(;(n=r.exec(e))!=null;){let i=n[1],a=n[2]??n[3];i!=null&&a!=null&&(t[i]=a)}return t}function c5I(e){let t=new Set,r=/{{([A-Za-z_][A-Za-z0-9_]*)}}/g,n;for(;(n=r.exec(e))!=null;)n[1]!=null&&t.add(n[1]);return t}function l5I(e,t){return e.slice(0,t).split(`
|
|
3024
3024
|
`).length}function f5I(e,t){let r=e;for(let[n,i]of Object.entries(t)){let a=new RegExp(`\\{{${n}\\}}`,"g");r=r.replace(a,i)}return r}async function H5f({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,markdownLoader:i=s5I}){if(!e.includes("<Markdown"))return e;let a=/([ \t]*)<Markdown\s+([^>]+)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);let l=u5I(s),m=l.src;if(m==null||!m.match(/\.mdx?$/))continue;let O=d1(m.startsWith("/")?t:Mg(r),eu.of(m.replace(/^\//,"")));try{let P=await i(O),{src:C,...M}=l,T=c5I(P),z=new Set(Object.keys(M)),U=[...T].filter(q=>!z.has(q));if(U.length>0){let q=c.index??e.indexOf(f),V=l5I(e,q),$=String(r).split("/").pop()??String(r);for(let re of U)n.logger.warn(`[${r}:${V}] Markdown snippet missing property: \`${re}\``)}P=f5I(P,M),P=P.split(`
|
|
@@ -3036,7 +3036,7 @@ ${l}
|
|
|
3036
3036
|
`)},e.heapify=function(t,r){var n=new e(r);return n.heapArray=t,n.init(),n},e.heappop=function(t,r){var n=new e(r);return n.heapArray=t,n.pop()},e.heappush=function(t,r,n){var i=new e(n);i.heapArray=t,i.push(r)},e.heappushpop=function(t,r,n){var i=new e(n);return i.heapArray=t,i.pushpop(r)},e.heapreplace=function(t,r,n){var i=new e(n);return i.heapArray=t,i.replace(r)},e.heaptop=function(t,r,n){r===void 0&&(r=1);var i=new e(n);return i.heapArray=t,i.top(r)},e.heapbottom=function(t,r,n){r===void 0&&(r=1);var i=new e(n);return i.heapArray=t,i.bottom(r)},e.nlargest=function(t,r,n){var i=new e(n);return i.heapArray=QCe([],WPe(r),!1),i.init(),i.top(t)},e.nsmallest=function(t,r,n){var i=new e(n);return i.heapArray=QCe([],WPe(r),!1),i.init(),i.bottom(t)},e.prototype.add=function(t){return this._sortNodeUp(this.heapArray.push(t)-1),this._applyLimit(),!0},e.prototype.addAll=function(t){var r,n=this.length;(r=this.heapArray).push.apply(r,QCe([],WPe(t),!1));for(var i=this.length;n<i;++n)this._sortNodeUp(n);return this._applyLimit(),!0},e.prototype.bottom=function(t){return t===void 0&&(t=1),this.heapArray.length===0||t<=0?[]:this.heapArray.length===1?[this.heapArray[0]]:t>=this.heapArray.length?QCe([],WPe(this.heapArray),!1):this._bottomN_push(~~t)},e.prototype.check=function(){var t=this;return this.heapArray.find(function(r,n){return!!t.getChildrenOf(n).find(function(i){return t.compare(r,i)>0})})},e.prototype.clear=function(){this.heapArray=[]},e.prototype.clone=function(){var t=new e(this.comparator());return t.heapArray=this.toArray(),t._limit=this._limit,t},e.prototype.comparator=function(){return this.compare},e.prototype.contains=function(t,r){return r===void 0&&(r=e.defaultIsEqual),this.indexOf(t,r)!==-1},e.prototype.init=function(t){t&&(this.heapArray=QCe([],WPe(t),!1));for(var r=e.getParentIndexOf(this.length-1);r>=0;--r)this._sortNodeDown(r);this._applyLimit()},e.prototype.isEmpty=function(){return this.length===0},e.prototype.indexOf=function(t,r){if(r===void 0&&(r=e.defaultIsEqual),this.heapArray.length===0)return-1;for(var n=[],i=0;i<this.heapArray.length;){var a=this.heapArray[i];if(r(a,t))return i;this.compare(a,t)<=0&&n.push.apply(n,QCe([],WPe(e.getChildrenIndexOf(i)),!1)),i=n.shift()||this.heapArray.length}return-1},e.prototype.indexOfEvery=function(t,r){if(r===void 0&&(r=e.defaultIsEqual),this.heapArray.length===0)return[];for(var n=[],i=[],a=0;a<this.heapArray.length;){var o=this.heapArray[a];r(o,t)?(i.push(a),n.push.apply(n,QCe([],WPe(e.getChildrenIndexOf(a)),!1))):this.compare(o,t)<=0&&n.push.apply(n,QCe([],WPe(e.getChildrenIndexOf(a)),!1)),a=n.shift()||this.heapArray.length}return i},e.prototype.leafs=function(){if(this.heapArray.length===0)return[];var t=e.getParentIndexOf(this.heapArray.length-1);return this.heapArray.slice(t+1)},Object.defineProperty(e.prototype,"length",{get:function(){return this.heapArray.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"limit",{get:function(){return this._limit},set:function(t){t<0||isNaN(t)?this._limit=0:this._limit=~~t,this._applyLimit()},enumerable:!1,configurable:!0}),e.prototype.setLimit=function(t){return this.limit=t,t<0||isNaN(t)?NaN:this._limit},e.prototype.peek=function(){return this.heapArray[0]},e.prototype.pop=function(){var t=this.heapArray.pop();return this.length>0&&t!==void 0?this.replace(t):t},e.prototype.push=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.length<1?!1:t.length===1?this.add(t[0]):this.addAll(t)},e.prototype.pushpop=function(t){var r;return this.compare(this.heapArray[0],t)<0&&(r=WPe([this.heapArray[0],t],2),t=r[0],this.heapArray[0]=r[1],this._sortNodeDown(0)),t},e.prototype.remove=function(t,r){var n=this;if(r===void 0&&(r=e.defaultIsEqual),!this.heapArray.length)return!1;if(t===void 0)return this.pop(),!0;for(var i=[0];i.length;){var a=i.shift();if(r(this.heapArray[a],t))return a===0?this.pop():a===this.heapArray.length-1?this.heapArray.pop():(this.heapArray.splice(a,1,this.heapArray.pop()),this._sortNodeUp(a),this._sortNodeDown(a)),!0;if(this.compare(this.heapArray[a],t)<=0){var o=e.getChildrenIndexOf(a).filter(function(c){return c<n.heapArray.length});i.push.apply(i,QCe([],WPe(o),!1))}}return!1},e.prototype.replace=function(t){var r=this.heapArray[0];return this.heapArray[0]=t,this._sortNodeDown(0),r},e.prototype.size=function(){return this.length},e.prototype.top=function(t){return t===void 0&&(t=1),this.heapArray.length===0||t<=0?[]:this.heapArray.length===1||t===1?[this.heapArray[0]]:t>=this.heapArray.length?QCe([],WPe(this.heapArray),!1):this._topN_push(~~t)},e.prototype.toArray=function(){return QCe([],WPe(this.heapArray),!1)},e.prototype.toString=function(){return this.heapArray.toString()},e.prototype.get=function(t){return this.heapArray[t]},e.prototype.getChildrenOf=function(t){var r=this;return e.getChildrenIndexOf(t).map(function(n){return r.heapArray[n]}).filter(function(n){return n!==void 0})},e.prototype.getParentOf=function(t){var r=e.getParentIndexOf(t);return this.heapArray[r]},e.prototype[Symbol.iterator]=function(){return KLI(this,function(t){switch(t.label){case 0:return this.length?[4,this.pop()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})},e.prototype.iterator=function(){return this.toArray()},e.prototype._applyLimit=function(){if(this._limit>0&&this._limit<this.heapArray.length)for(var t=this.heapArray.length-this._limit;t;)this.heapArray.pop(),--t},e.prototype._bottomN_push=function(t){var r=new e(this.compare);r.limit=t,r.heapArray=this.heapArray.slice(-t),r.init();for(var n=this.heapArray.length-1-t,i=e.getParentIndexOf(n),a=[],o=n;o>i;--o)a.push(o);for(var c=this.heapArray;a.length;){var o=a.shift();this.compare(c[o],r.peek())>0&&(r.replace(c[o]),o%2&&a.push(e.getParentIndexOf(o)))}return r.toArray()},e.prototype._moveNode=function(t,r){var n=this.heapArray[t];this.heapArray[t]=this.heapArray[r],this.heapArray[r]=n},e.prototype._sortNodeDown=function(t){for(var r=this.heapArray.length,n=t,i=this.heapArray[t],a=2*t+1;a<r;){var o=a+1,c=o>=r||this.compare(this.heapArray[a],this.heapArray[o])<0?a:o;if(this.compare(this.heapArray[c],i)<0)this.heapArray[t]=this.heapArray[c],t=c,a=2*t+1;else break}t!==n&&(this.heapArray[t]=i)},e.prototype._sortNodeUp=function(t){for(var r=this.heapArray[t],n=t;t>0;){var i=e.getParentIndexOf(t);if(this.compare(r,this.heapArray[i])<0)this.heapArray[t]=this.heapArray[i],t=i;else break}t!==n&&(this.heapArray[t]=r)},e.prototype._topN_push=function(t){var r=new e(this._invertedCompare);r.limit=t;for(var n=[0],i=this.heapArray;n.length;){var a=n.shift();a<i.length&&(r.length<t?(r.push(i[a]),n.push.apply(n,QCe([],WPe(e.getChildrenIndexOf(a)),!1))):this.compare(i[a],r.peek())<0&&(r.replace(i[a]),n.push.apply(n,QCe([],WPe(e.getChildrenIndexOf(a)),!1))))}return r.toArray()},e.prototype._topN_fill=function(t){var r=this.heapArray,n=new e(this._invertedCompare);n.limit=t,n.heapArray=r.slice(0,t),n.init();for(var i=e.getParentIndexOf(t-1)+1,a=[],o=i;o<t;++o)a.push.apply(a,QCe([],WPe(e.getChildrenIndexOf(o).filter(function(c){return c<r.length})),!1));for((t-1)%2&&a.push(t);a.length;){var o=a.shift();o<r.length&&this.compare(r[o],n.peek())<0&&(n.replace(r[o]),a.push.apply(a,QCe([],WPe(e.getChildrenIndexOf(o)),!1)))}return n.toArray()},e.prototype._topN_heap=function(t){for(var r=this.clone(),n=[],i=0;i<t;++i)n.push(r.pop());return n},e.prototype._topIdxOf=function(t){if(!t.length)return-1;for(var r=0,n=t[r],i=1;i<t.length;++i){var a=this.compare(t[i],n);a<0&&(r=i,n=t[i])}return r},e.prototype._topOf=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=new e(this.compare);return n.init(t),n.peek()},e})();function nbv(e,t,r,n,i){if(r<=0)return[];let a=n??(c=>c),o=new tbv($LI);for(let c of t){let f=rbv.default.get(a(e),a(c));i!=null&&f>i||(o.push({neighbor:c,distance:f}),o.size()>r&&o.pop())}return YLI(o).reverse().map(c=>c.neighbor)}function $LI(e,t){return e.distance!==t.distance?t.distance-e.distance:t.neighbor.localeCompare(e.neighbor)}function YLI(e){let t=[];for(;e.size()>0;){let r=e.pop();r&&t.push(r)}return t}var XLI=3,ZLI=5;function ULu(e,t){let r=nbv(e,t,XLI,kLI,ZLI),n=Array.from(t),i=`Failed to locate API section ${e}.`;switch(r.length){case 0:return i=`${i} No similar API sections found. Available API sections:`,n.length===0?`${i} []`:`${i} [
|
|
3037
3037
|
${n.map(a=>` ${a}`).join(`,
|
|
3038
3038
|
`)}
|
|
3039
|
-
]`;case 1:return`${i} Did you mean ${r[0]}?`;case 2:return`${i} Did you mean ${r[0]} or ${r[1]}?`;default:return`${i} Did you mean ${r[0]}, ${r[1]}, or ${r[2]}?`}}function VLu(e){return`API section ${e} is specified multiple times, however will be only rendered once.`}function kLI(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function WLu({children:e,findEndpointById:t,stringifyEndpointPathParts:r,disableEndpointPairs:n,apiDefinitionId:i}){if(n)return e;let a=[],o=new Map;return e.forEach(c=>{if(c.type!=="endpoint"){a.push(c);return}let f=t(c.endpointId);if(f==null)throw new Error(`Endpoint ${c.endpointId} not found`);let u=`${f.method} ${r(f)}`,s=o.get(u);if(o.set(u,c),s==null||s.isResponseStream===c.isResponseStream){a.push(c);return}let l=a.indexOf(s),m=c.isResponseStream?c:s,O=c.isResponseStream?s:c,P={id:fl.V1.NodeId(`${i}:${O.endpointId}+${m.endpointId}`),type:"endpointPair",stream:m,nonStream:O};a[l]=P}),a}function ibv({left:e,right:t,findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}){return WLu({children:[...e,...t],findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}).filter(o=>o.type==="apiPackage"?o.children.length>0:!0)}function Nao(e,t){if(t!=null)return j3(e.absoluteFilePath,t)}function abv({docsWorkspace:e,page:t,parentSlug:r,idgen:n,markdownFilesToFullSlugs:i,markdownFilesToNoIndex:a,hideChildren:o,resolveIconFileId:c}){let f=fl.V1.PageId(Nao(e,t.absolutePath)),u=r.apply({fullSlug:i.get(t.absolutePath)?.split("/"),urlSlug:t.slug??u$(t.title)});return{id:n.get(f),type:"page",pageId:f,title:t.title,slug:u.get(),icon:c?c(t.icon):t.icon,hidden:o||t.hidden,noindex:t.noindex||a.get(t.absolutePath),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,availability:t.availability}}var GLu=class{apiSection;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;markdownFilesToTags;workspace;hideChildren;parentAvailability;apiDefinitionId;#e;#t=new Set;#r=new Set;#n=new Set;#i=new Set;#a=new Set;#o=new Map;#u=[];#s;#c;#f;disableEndpointPairs;collectedFileIds=new Map;constructor(t,r,n,i,a,o,c,f,u,s,l,m,O){this.apiSection=t,this.docsWorkspace=i,this.taskContext=a,this.markdownFilesToFullSlugs=o,this.markdownFilesToNoIndex=c,this.markdownFilesToTags=f,this.workspace=l,this.hideChildren=m,this.parentAvailability=O,this.disableEndpointPairs=i.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=fl.V1.ApiDefinitionId(r.id),this.#e=C2i.create(r,a),this.collectedFileIds=s,this.#f=u,this.#s=this.apiSection.overviewAbsolutePath!=null?fl.V1.PageId(Nao(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let P=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#c=n.apply({fullSlug:P?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??u$(this.apiSection.title)});let C=this.apiSection.availability??this.parentAvailability;this.apiSection.navigation!=null&&(this.#u=this.#d(this.apiSection.navigation,this.#e.api.rootPackage,this.#c,C)),this.#u=this.#g(this.#u.map(M=>this.#m(M,C)),this.#O(this.#e.api.rootPackage,this.#c,C))}get(){let t=fl.V1.followRedirects(this.#u),r=new ada(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.workspace?.changelog?.files.map(n=>n.absoluteFilepath),this.docsWorkspace,this.#f).orUndefined();return{id:this.#f.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#s,paginated:this.apiSection.paginated,slug:this.#c.get(),icon:this.resolveIconFileId(this.apiSection.icon),hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#c,viewers:void 0,hidden:this.hideChildren}),children:this.#u,availability:this.apiSection.availability??this.parentAvailability,pointsTo:t,noindex:void 0,playground:this.#v(this.apiSection.playground),postmanCollectionUrl:this.apiSection.postman,authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#d(t,r,n,i){r=this.#e.resolveSubpackage(r);let a=r!=null?C2i.getSubpackageId(r):void 0;return t.map(o=>lLf(o)._visit({link:c=>({id:this.#f.get(c.url),type:"link",title:c.text,icon:this.resolveIconFileId(c.icon),url:fl.Url(c.url)}),page:c=>this.#p(c,n,i),package:c=>this.#l(c,n,i),section:c=>this.#_(c,n,i),item:({value:c})=>this.#y(c,a,n,i),endpoint:c=>this.#h(c,a,n,i)})).filter(_j)}#p(t,r,n){return abv({page:{...t,availability:t.availability??n},parentSlug:r,docsWorkspace:this.docsWorkspace,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex,idgen:this.#f,hideChildren:this.hideChildren,resolveIconFileId:this.resolveIconFileId.bind(this)})}#l(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(Nao(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.availability??n,c=this.#e.getSubpackageByIdOrLocator(t.package);if(c!=null){let f=C2i.getSubpackageId(c),u=this.#f.get(i??`${this.apiDefinitionId}:${f}`);this.#a.has(f)&&this.taskContext.logger.warn(VLu(t.package)),this.#a.add(f),this.#o.set(u,[f]);let s=t.slug??(sWr(c)?c.urlSlug:this.apiSection.slug??u$(this.apiSection.title)),l=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:s}),m=this.#d(t.contents,c,l,o);return{id:u,type:"apiPackage",children:m,title:t.title??(sWr(c)?c.displayName??qao(c.name):this.apiSection.title),slug:l.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else{this.taskContext.logger.warn(ULu(t.package,this.#e.subpackageLocators));let f=t.slug??u$(t.package),u=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:f}),s=this.#d(t.contents,void 0,u,o);return{id:this.#f.get(i??`${this.apiDefinitionId}:${u$(t.package)}`),type:"apiPackage",children:s,title:t.title??t.package,slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}#_(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(Nao(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(t.overviewAbsolutePath):void 0,c=this.#f.get(i??a??r.get()),f=t.referencedSubpackages.map(O=>{let P=this.#e.getSubpackageByIdOrLocator(O),C=P!=null?C2i.getSubpackageId(P):void 0;if(C===void 0){this.taskContext.logger.error(ULu(O,this.#e.subpackageLocators));return}return{subpackageId:C,locator:O}}).filter(O=>O!=null).filter(_j);this.#o.set(c,f.map(O=>O.subpackageId)),f.forEach(O=>{this.#a.has(O.subpackageId)&&this.taskContext.logger.error(VLu(O.locator)),this.#a.add(O.subpackageId)});let u=t.slug??u$(t.title),s=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),l=t.availability??n,m=this.#d(t.contents,void 0,s,l);return{id:c,type:"apiPackage",children:m,title:t.title,slug:s.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:l,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:o,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}#y(t,r,n,i){t=t.trim();let a=this.#e.getSubpackageByIdOrLocator(t)??this.#e.getSubpackageByIdOrLocator($A(t));if(a!=null){let o=C2i.getSubpackageId(a),c=this.#f.get(`${this.apiDefinitionId}:${o}`);this.#a.has(o)&&this.taskContext.logger.error(VLu(t)),this.#a.add(o),this.#o.set(c,[o]);let f=sWr(a)?a.urlSlug:"",u=n.apply({urlSlug:f});return{id:c,type:"apiPackage",children:[],title:sWr(a)?a.displayName??qao(a.name):this.apiSection.title,slug:u.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:i,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}return this.#h({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,availability:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,n,i)}#h(t,r,n,i){let a=(r!=null?this.#e.subpackages.get(gve.SubpackageId(r))?.endpoints.get(gve.EndpointId(t.endpoint)):void 0)??this.#e.endpointsByLocator.get(t.endpoint);if(a!=null){let f=this.#e.getEndpointId(a);if(f==null)this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${LLu(a.method,a.path.parts)}. Got undefined.`);else{this.#t.has(f)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${f}`),this.#t.add(f);let u=t.slug!=null?n.append(t.slug):n.apply(a);return{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"endpoint",method:a.method,endpointId:f,apiDefinitionId:this.apiDefinitionId,availability:t.availability??fl.V1.convertAvailability(a.availability)??i,isResponseStream:a.response?.type.type==="stream",title:t.title??a.name??VPe(a.path.parts),slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}let o=(r!=null?this.#e.subpackages.get(gve.SubpackageId(r))?.webSockets.get(gve.WebSocketId(t.endpoint)):void 0)??this.#e.webSocketsByLocator.get(t.endpoint);if(o!=null){let f=this.#e.getWebSocketId(o);if(f==null)this.taskContext.logger.error(`Expected WebSocket ID for ${o.id}. Got undefined.`);else return this.#r.has(f)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${f}`),this.#r.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webSocket",webSocketId:f,title:t.title??o.name??VPe(o.path.parts),slug:(t.slug!=null?n.append(t.slug):n.apply(o)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(o.availability)??i,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let c=(r!=null?this.#e.subpackages.get(gve.SubpackageId(r))?.webhooks.get(gve.WebhookId(t.endpoint)):void 0)??this.#e.webhooks.get(fl.V1.WebhookId(t.endpoint));if(c!=null){let f=this.#e.getWebhookId(c);if(f==null)this.taskContext.logger.error(`Expected Webhook ID for ${c.id}. Got undefined.`);else return this.#n.has(f)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${f}`),this.#n.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webhook",webhookId:f,method:c.method,title:t.title??c.name??(0,obv.default)("/",...c.path),slug:(t.slug!=null?n.append(t.slug):n.apply(c)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:i,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#g(t,r){return ibv({left:t,right:r,findEndpointById:n=>this.#e.endpoints.get(n),stringifyEndpointPathParts:n=>VPe(n.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#m(t,r){return pLf({child:t,nodeIdToSubpackageId:this.#o,convertApiDefinitionPackageId:(n,i,a)=>this.#A(n,i,a),mergeAndFilterChildren:this.#g.bind(this)})}#O(t,r,n){let i=[];return t.endpoints.forEach(a=>{if(a.protocol?.type==="grpc"){let o=this.#e.getGrpcId(a);if(o==null){this.taskContext.logger.error(`Expected Grpc ID for ${a.id} at path: ${LLu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#i.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"grpc",grpcId:o,title:a.name??VPe(a.path.parts),method:a.protocol?.methodType??"UNARY",apiDefinitionId:this.apiDefinitionId,availability:n,slug:c.get(),icon:void 0,hidden:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}else{let o=this.#e.getEndpointId(a);if(o==null){this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${LLu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#t.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"endpoint",method:a.method,endpointId:o,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,isResponseStream:a.response?.type.type==="stream",title:a.name??VPe(a.path.parts),slug:c.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}}),t.websockets.forEach(a=>{let o=this.#e.getWebSocketId(a);if(o==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}this.#r.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webSocket",webSocketId:o,title:a.name??VPe(a.path.parts),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.webhooks.forEach(a=>{let o=this.#e.getWebhookId(a);if(o==null){this.taskContext.logger.error(`Expected Webhook ID for ${a.id}. Got undefined.`);return}this.#n.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webhook",webhookId:o,method:a.method,title:a.name??qao(a.id),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:n,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.subpackages.forEach(a=>{if(this.#a.has(a))return;let o=this.#e.getSubpackageByIdOrLocator(a);if(o==null){this.taskContext.logger.error(`Subpackage ${a} not found in ${this.apiDefinitionId}`);return}let c=sWr(o)?r.apply(o):r,f=this.#A(a,c,n);f.length>0&&i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"apiPackage",children:f,title:sWr(o)?o.displayName??qao(o.name):this.apiSection.title,slug:c.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:n,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&(i=i.sort((a,o)=>{let c=a.type==="endpointPair"?a.nonStream.title:a.title,f=o.type==="endpointPair"?o.nonStream.title:o.title;return c.localeCompare(f)})),i}#A(t,r,n){let i=t!=null?this.#e.resolveSubpackage(this.#e.getSubpackageByIdOrLocator(t)):void 0;return i==null?(this.taskContext.logger.debug(ULu(t||"unknown",[])),[]):this.#O(i,r,n)}#v(t){return $vv(t)}mergeEndpointPairs(t){return WLu({children:t,findEndpointById:r=>this.#e.endpoints.get(r),stringifyEndpointPathParts:r=>VPe(r.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}getFileId(t){let r=this.collectedFileIds.get(t);return r??this.taskContext.failAndThrow("Failed to locate file after uploading: "+t)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}};var sbv=Hi(require("crypto"),1);function e9I(e){return sbv.default.createHash("sha256").update(e).digest("hex")}var HLu=class e{static init(){return new e}constructor(){}#e=new Map;#t=new Set;#r(t){let r=this.#e.get(t)??0;return this.#e.set(t,r+1),e9I(r===0?t:`${t}-${r}`)}#n(t){let r=this.#r(t),n=0;for(;this.#t.has(r);)if(r=this.#r(t),n++,n>100)throw new Error(`Infinite loop detected for id: ${t}`);return r}get(t){return fl.V1.NodeId(this.#n(t))}};function ubv(e){return e==null?{}:{pythonSdk:e.python!=null?{package:typeof e.python=="string"?e.python:e.python.package,version:typeof e.python=="string"?void 0:e.python.version}:void 0,typescriptSdk:e.typescript!=null?{package:typeof e.typescript=="string"?e.typescript:e.typescript.package,version:typeof e.typescript=="string"?void 0:e.typescript.version}:void 0,goSdk:e.go!=null?{githubRepo:typeof e.go=="string"?e.go:e.go.package,version:typeof e.go=="string"?void 0:e.go.version}:void 0,javaSdk:e.java!=null?{coordinate:typeof e.java=="string"?e.java:e.java.package,version:typeof e.java=="string"?void 0:e.java.version}:void 0,rubySdk:e.ruby!=null?{gem:typeof e.ruby=="string"?e.ruby:e.ruby.package,version:typeof e.ruby=="string"?void 0:e.ruby.version}:void 0,csharpSdk:e.csharp!=null?{package:typeof e.csharp=="string"?e.csharp:e.csharp.package,version:typeof e.csharp=="string"?void 0:e.csharp.version}:void 0,phpSdk:e.php!=null?{package:typeof e.php=="string"?e.php:e.php.package,version:typeof e.php=="string"?void 0:e.php.version}:void 0,swiftSdk:e.swift!=null?{package:typeof e.swift=="string"?e.swift:e.swift.package,version:typeof e.swift=="string"?void 0:e.swift.version}:void 0,rustSdk:e.rust!=null?{package:typeof e.rust=="string"?e.rust:e.rust.package,version:typeof e.rust=="string"?void 0:e.rust.version}:void 0}}function cbv({auth:e,playgroundConfig:t,context:r}){if(e.schemes.length>0&&e.schemes[0]!=null){let n=e.schemes[0];return lbv({scheme:n,playgroundConfig:t,context:r})}}function lbv({scheme:e,playgroundConfig:t,context:r}){switch(e.type){case"basic":return{type:"basicAuth",passwordName:e.password.originalName,usernameName:e.username.originalName,description:e.docs};case"bearer":return{type:"bearerAuth",tokenName:e.token.originalName,description:e.docs};case"header":return{type:"header",headerWireValue:e.name.wireValue,nameOverride:e.name.name.originalName,prefix:e.prefix,description:e.docs};case"oauth":{let n=e.configuration.tokenEndpoint.responseProperties.accessToken.propertyPath?.map(i=>i.name.originalName).join(".")||"$.body.access_token";return t?.oauth?{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:Xh.EndpointId(e.configuration.tokenEndpoint.endpointReference.endpointId),accessTokenLocator:Xh.JqString(n),headerName:e.configuration.tokenHeader,tokenPrefix:e.configuration.tokenPrefix,description:e.docs}}}:{type:"bearerAuth",tokenName:"token",description:e.docs}}case"inferred":{e.tokenEndpoint.authenticatedRequestHeaders.length>1&&r.logger.warn("Inferred auth scheme has multiple authenticated request headers. Only the `Authentication` or first header will be pushed to FDR.");let n=e.tokenEndpoint.authenticatedRequestHeaders.find(a=>a.headerName.toLowerCase()==="authorization");if(n)return n.responseProperty.propertyPath!=null&&n.responseProperty.propertyPath.length>0&&r.logger.warn("Inferred Authentication header has a property path. The property wirevalue will be pushed to FDR without property path."),{type:"bearerAuth",tokenName:n.responseProperty.property.name.wireValue,description:e.docs};let i=e.tokenEndpoint.authenticatedRequestHeaders[0];return i?{type:"header",headerWireValue:i.headerName,prefix:i.valuePrefix,nameOverride:void 0,description:e.docs}:{type:"bearerAuth",tokenName:"token",description:e.docs}}default:Zu(e)}}function fbv({auth:e,playgroundConfig:t,context:r}){let n={};for(let i of e.schemes){let a=lbv({scheme:i,playgroundConfig:t,context:r});a!=null&&(n[Xh.AuthSchemeId(i.key)]=a)}return n}function pbv(e){return e._visit({alias:t=>({type:"alias",value:u4(t.aliasOf)}),enum:t=>({type:"enum",default:t.default!=null?t.default.name.wireValue:void 0,values:t.values.map(r=>({description:r.docs??void 0,value:r.name.wireValue,availability:die(r.availability)}))}),object:t=>({type:"object",extends:t.extends.map(r=>Xh.TypeId(r.typeId)),properties:t.properties.map(r=>({description:r.docs??void 0,key:Xh.PropertyKey(r.name.wireValue),valueType:u4(r.valueType),availability:die(r.availability),propertyAccess:r.propertyAccess})),extraProperties:n9I(t.extraProperties)}),union:t=>{let r=t.baseProperties.map(n=>({key:Xh.PropertyKey(n.name.wireValue),valueType:u4(n.valueType),availability:die(n.availability),description:n.docs,propertyAccess:n.propertyAccess}));return{type:"discriminatedUnion",discriminant:t.discriminant.wireValue,variants:t.types.map(n=>({description:n.docs??void 0,discriminantValue:n.discriminantValue.wireValue,displayName:n.displayName,availability:n.availability!=null?die(n.availability):void 0,additionalProperties:ip.types.SingleUnionTypeProperties._visit(n.shape,{samePropertiesAsObject:i=>({extends:[Xh.TypeId(i.typeId)],properties:r,extraProperties:void 0}),singleProperty:i=>({extends:[],properties:[{key:Xh.PropertyKey(i.name.wireValue),valueType:u4(i.type),description:void 0,availability:void 0,propertyAccess:void 0},...r],extraProperties:void 0}),noProperties:()=>({extends:[],properties:r,extraProperties:void 0}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+n.shape.propertiesType)}})}))}},undiscriminatedUnion:t=>({type:"undiscriminatedUnion",variants:t.members.map(r=>({typeName:r.type.type==="named"?r.type.name.originalName:void 0,description:r.docs??void 0,type:u4(r.type),availability:void 0,displayName:r.type.type==="named"?r.type.displayName:void 0}))}),_other:()=>{throw new Error("Unknown Type shape: "+e.type)}})}function u4(e){return e._visit({container:t=>ip.types.ContainerType._visit(t,{list:r=>({type:"list",itemType:u4(r)}),map:({keyType:r,valueType:n})=>({type:"map",keyType:u4(r),valueType:u4(n)}),optional:r=>({type:"optional",itemType:u4(r),defaultValue:void 0}),nullable:r=>({type:"nullable",itemType:u4(r)}),set:r=>({type:"set",itemType:u4(r)}),literal:r=>ip.types.Literal._visit(r,{boolean:n=>({type:"literal",value:{type:"booleanLiteral",value:n}}),string:n=>({type:"literal",value:{type:"stringLiteral",value:n}}),_other:()=>{throw new Error("Unknown literal type: "+r.type)}}),_other:()=>{throw new Error("Unknown container reference: "+t.type)}}),named:t=>({type:"id",value:Xh.TypeId(t.typeId),default:void 0}),primitive:t=>({type:"primitive",value:ip.types.PrimitiveTypeV1._visit(t.v1,{integer:()=>r9I(t.v2),float:()=>dbv(t.v2),double:()=>dbv(t.v2),string:()=>t9I(t.v2),long:()=>({type:"long",default:t.v2?.type==="long"?t.v2.default:void 0,minimum:void 0,maximum:void 0}),boolean:()=>({type:"boolean",default:t.v2?.type==="boolean"?t.v2.default:void 0}),dateTime:()=>({type:"datetime",default:void 0}),date:()=>({type:"date",default:void 0}),uuid:()=>({type:"uuid",default:void 0}),base64:()=>({type:"base64",mimeType:void 0,default:void 0}),bigInteger:()=>({type:"bigInteger",default:t.v2?.type==="bigInteger"?t.v2.default:void 0}),uint:()=>({type:"uint"}),uint64:()=>({type:"uint64"}),_other:()=>{throw new Error("Unknown primitive: "+t.v1)}})}),unknown:()=>({type:"unknown"}),_other:()=>{throw new Error("Unknown Type reference: "+e.type)}})}function t9I(e){let t=e!=null&&e.type==="string"?e.validation:void 0;return{type:"string",format:t?.format,regex:t?.pattern,minLength:t?.minLength,maxLength:t?.maxLength,default:e!=null&&e.type==="string"?e.default:void 0}}function r9I(e){let t=e!=null&&e.type==="integer"?e.validation:void 0;return{type:"integer",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="integer"?e.default:void 0}}function dbv(e){let t=e!=null&&e.type==="double"?e.validation:void 0;return{type:"double",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="double"?e.default:void 0}}function n9I(e){return typeof e=="boolean"?e?Bh.unknown():void 0:typeof e=="string"?{type:"id",value:Xh.TypeId(e),default:void 0}:u4(e)}function yLf(e,t){let r=e.service!=null?t.services[e.service]:void 0,n=e.webhooks!=null?t.webhookGroups[e.webhooks]:void 0,i=e.websocket!=null&&t.websocketChannels!=null?t.websocketChannels[e.websocket]:void 0;return{endpoints:r!=null?a9I(r,t):[],webhooks:n!=null?i9I(n):[],websockets:i!=null?[o9I(i,t)]:[],types:e.types.map(a=>Xh.TypeId(a)),subpackages:e.subpackages.map(a=>Xh.api.v1.SubpackageId(a)),pointsTo:e.navigationConfig!=null?Xh.api.v1.SubpackageId(e.navigationConfig.pointsTo):void 0}}function i9I(e){return e.map(t=>{let r=[];return t.v2Examples!=null?(r.push(...Object.values(t.v2Examples.userSpecifiedExamples)),r.push(...Object.values(t.v2Examples.autogeneratedExamples))):r.push(...t.examples?.map(n=>({payload:n.payload.jsonExample}))??[]),{description:t.docs??void 0,id:Xh.WebhookId(t.name.originalName),path:[],method:t.method,name:t.displayName??Vna(t.name.originalName),headers:t.headers.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:u4(n.valueType),availability:die(n.availability)})),payload:h9I(t.payload),examples:r}})}function a9I(e,t){let r=[];for(let n of e.endpoints){let i=n.autogeneratedExamples[0],a=[];if(n.v2Examples!=null){let c,f=n.v2Examples.userSpecifiedExamples,u=n.v2Examples.autogeneratedExamples,s=Object.values(f).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(f))c=ybv({shouldUseExampleName:s,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c);let l=Object.values(u).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(u))c=ybv({shouldUseExampleName:l,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c)}else if(n.userSpecifiedExamples.length>0)a.push(...n.userSpecifiedExamples.map(c=>hLf({userSpecifiedExample:c,...i!=null&&{autogeneratedExample:i},irEndpoint:n,ir:t})).filter(_j));else if(i!=null){let c=hLf({autogeneratedExample:i,irEndpoint:n,ir:t});c!=null&&a.push(c)}else if(n.response?.body?.type==="fileDownload"){let c=Vto({ir:t,service:e,endpoint:{...n,response:void 0},typeDeclarations:t.types,skipOptionalRequestProperties:!0,generationResponse:{type:"success"}});if(c.type==="success"){let f=hLf({autogeneratedExample:c,irEndpoint:n,ir:t});if(f!=null){let u={...f,responseBodyV3:{type:"filename",value:"<bytes>"}};a.push(u)}}}let o={slug:void 0,availability:die(n.availability??e.availability),auth:n.auth,authV2:s9I(n.security),multiAuth:u9I(n.security),description:n.docs??void 0,method:d9I(n.method),defaultEnvironment:t.environments?.defaultEnvironment!=null?Xh.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?c9I({environmentsConfig:t.environments,endpoint:n}):void 0,id:Xh.EndpointId(n.name.originalName),originalEndpointId:n.id,name:n.displayName??Vna(n.name.originalName),path:n.basePath!=null?{pathParameters:n.pathParameters.map(c=>({description:c.docs??void 0,key:Xh.PropertyKey(c.name.originalName),type:u4(c.valueType),availability:void 0,explode:void 0})),parts:[...Fao(n.basePath),...Fao(n.path)]}:{pathParameters:[...t.pathParameters,...e.pathParameters,...n.pathParameters].map(c=>({description:c.docs??void 0,key:Xh.PropertyKey(c.name.originalName),type:u4(c.valueType),availability:void 0,explode:void 0})),parts:[...t.basePath!=null?Fao(t.basePath):[],...Fao(e.basePath),...Fao(n.path)]},queryParameters:n.queryParameters.map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:u4(c.valueType),availability:die(c.availability),explode:void 0})),headers:[...e.headers,...n.headers].map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:u4(c.valueType),availability:die(c.availability)})),request:n.requestBody!=null?_bv(n.requestBody):void 0,requestsV2:{requests:n.v2RequestBodies?.requestBodies?.map(_bv).filter(_j)},response:n.response!=null?hbv(n.response):void 0,responsesV2:{responses:n.v2Responses?.responses?.map(hbv).filter(_j)},errors:void 0,errorsV2:p9I(n.errors,t),examples:a,protocol:n.source?._visit({openapi:()=>({type:"rest"}),openrpc:()=>({type:"openrpc",methodName:n.id}),proto:c=>({type:"grpc",methodName:n.id,methodType:c.methodType}),_other:()=>{}}),includeInApiExplorer:void 0};r.push(o)}return r}function o9I(e,t){let r=[];if(e.v2Examples!=null&&(Object.keys(e.v2Examples.userSpecifiedExamples).length>0||Object.keys(e.v2Examples.autogeneratedExamples).length>0)){let n=Object.values(e.v2Examples.userSpecifiedExamples),i=Object.values(e.v2Examples.autogeneratedExamples),a=n.length>0?n[0]:i[0];a!=null&&r.push({name:"",description:"",path:a.baseUrl??"",pathParameters:a.pathParameters??{},queryParameters:a.queryParameters??{},headers:a.headers??{},messages:a.messages?.map(o=>({type:Xh.api.v1.WebSocketMessageId(o.type),body:o.body}))??[]})}else r=e.examples.map(n=>({name:n.name?.originalName,description:n.docs,path:n.url,pathParameters:n.pathParameters.reduce((i,a)=>(i[Xh.PropertyKey(a.name.originalName)]=a.value.jsonExample,i),{}),queryParameters:n.queryParameters.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),headers:n.headers.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),messages:n.messages.map(i=>({type:Xh.api.v1.WebSocketMessageId(i.type),body:i.body.jsonExample}))}));return{auth:e.auth,availability:die(e.availability),description:e.docs??void 0,defaultEnvironment:t.environments?.defaultEnvironment!=null?Xh.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?l9I({environmentsConfig:t.environments,channel:e}):[],id:Xh.WebSocketId(e.name.originalName),name:e.displayName??Vna(e.name.originalName),path:{pathParameters:e.pathParameters.map(n=>({description:n.docs??void 0,key:Xh.PropertyKey(n.name.originalName),type:u4(n.valueType),availability:void 0,explode:void 0})),parts:Fao(e.path)},headers:e.headers.map(n=>({key:n.name.wireValue,type:u4(n.valueType),description:n.docs,availability:die(n.availability)})),queryParameters:e.queryParameters.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:u4(n.valueType),availability:die(n.availability),explode:void 0})),messages:e.messages.map(n=>({type:Xh.api.v1.WebSocketMessageId(n.type),displayName:n.displayName,origin:n.origin,body:y9I(n.body),description:n.docs,availability:die(n.availability)})),examples:r}}function s9I(e){if(e==null)return;if(e.length===0)return[];let t=new Set(e.flatMap(r=>Object.keys(r)));return Array.from(t).map(r=>Xh.AuthSchemeId(r))}function u9I(e){if(e!=null)return e.length===0?[]:e.map(t=>({schemes:Object.keys(t).map(r=>Xh.AuthSchemeId(r))}))}function die(e){if(e!=null)switch(e.status){case"DEPRECATED":return Xh.Availability.Deprecated;case"PRE_RELEASE":return Xh.Availability.Beta;case"GENERAL_AVAILABILITY":return Xh.Availability.GenerallyAvailable;case"IN_DEVELOPMENT":return Xh.Availability.Beta;default:Zu(e.status)}}function c9I({environmentsConfig:e,endpoint:t}){let r=e.environments,n=t.baseUrl,i=t.v2BaseUrls;switch(r.type){case"singleBaseUrl":return r.environments.map(a=>({id:Xh.EnvironmentId(a.id),baseUrl:a.url}));case"multipleBaseUrls":if(i!=null)return i.flatMap(o=>r.environments.map(c=>{let f=c.urls[o];if(f==null)throw new Error(`Encountered undefined server name "${o}" at endpoint ${t.method.toUpperCase()} ${t.path}. Expected environment ${c.id} to contain url for ${o}`);return{id:Xh.EnvironmentId(o),baseUrl:f}})).filter((o,c,f)=>c===f.findIndex(u=>u.id===o.id&&u.baseUrl===o.baseUrl));if(n==null)throw new Error(`Expected endpoint ${t.name.originalName} to have base url.`);return r.environments.map(a=>{let o=a.urls[n];if(o==null)throw new Error(`Encountered undefined server name "${n}" at endpoint ${t.method.toUpperCase()} ${t.path.head}. Expected environment ${a.id} to contain url for ${n}`);return{id:Xh.EnvironmentId(a.id),baseUrl:o}});default:Zu(r)}}function l9I({environmentsConfig:e,channel:t}){let r=e.environments,n=t.baseUrl;switch(r.type){case"singleBaseUrl":return r.environments.map(i=>({id:Xh.EnvironmentId(i.id),baseUrl:f9I(i.url,"wss")}));case"multipleBaseUrls":if(n==null)throw new Error(`Expected channel ${t.name.originalName} to have base url.`);return r.environments.map(i=>{let a=i.urls[n];if(a==null)throw new Error(`Encountered undefined server name ${a} at channel ${t.name.originalName} ${t.path.head}. Expected environment ${i.id} to contain url for ${n}`);return{id:Xh.EnvironmentId(i.id),baseUrl:a}});default:Zu(r)}}function f9I(e,t){return e.replace(/^[^:]+/,t)}function d9I(e){return ip.http.HttpMethod._visit(e,{get:()=>Xh.HttpMethod.Get,post:()=>Xh.HttpMethod.Post,put:()=>Xh.HttpMethod.Put,patch:()=>Xh.HttpMethod.Patch,delete:()=>Xh.HttpMethod.Delete,head:()=>Xh.HttpMethod.Head,_other:()=>{throw new Error("Unknown http method: "+e)}})}function Fao(e){let t=e.parts.flatMap(r=>[{type:"pathParameter",value:Xh.PropertyKey(r.pathParameter)},{type:"literal",value:r.tail}]);return[{type:"literal",value:e.head},...t]}function _bv(e){let t=ip.http.HttpRequestBody._visit(e,{inlinedRequestBody:r=>({type:"json",contentType:r.contentType??R2.APPLICATION_JSON,shape:{type:"object",extends:r.extends.map(n=>Xh.TypeId(n.typeId)),properties:r.properties.map(n=>({description:n.docs??void 0,key:Xh.PropertyKey(n.name.wireValue),valueType:u4(n.valueType),availability:die(n.availability),propertyAccess:n.propertyAccess})),extraProperties:r.extraProperties?{type:"unknown"}:void 0}}),reference:r=>({type:"json",contentType:r.contentType??R2.APPLICATION_JSON,shape:{type:"reference",value:u4(r.requestBodyType)},description:r.docs??void 0}),fileUpload:r=>({type:"fileUpload",value:{name:r.name.originalName,description:void 0,availability:void 0,properties:r.properties.map(n=>n._visit({file:i=>{let a=i._visit({file:o=>({type:"file",key:Xh.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),fileArray:o=>({type:"fileArray",key:Xh.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),_other:()=>{}});if(a!=null)return{type:"file",value:a}},bodyProperty:i=>({type:"bodyProperty",key:Xh.PropertyKey(i.name.wireValue),valueType:u4(i.valueType),contentType:i.contentType,description:i.docs??void 0,availability:die(i.availability),exploded:i.style==="exploded",propertyAccess:void 0}),_other:()=>{}})).filter(_j)},contentType:r.contentType,description:r.docs??void 0}),bytes:r=>({type:"bytes",description:r.docs??void 0,availability:void 0,isOptional:r.isOptional,contentType:r.contentType}),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}});return t!=null?{type:t,description:e.docs}:void 0}function hbv(e){if(e.body==null)return;let t,r=ip.http.HttpResponseBody._visit(e.body,{fileDownload:n=>(t=n.docs,{type:"fileDownload",contentType:void 0}),json:n=>(t=n.docs,{type:"reference",value:u4(n.responseBodyType)}),text:()=>{},bytes:()=>{},streamParameter:()=>{},streaming:n=>{if(n.type==="text")return t=n.docs,{type:"streamingText"};if(n.type==="json")return t=n.docs,{type:"stream",shape:{type:"reference",value:u4(n.payload)},terminator:n.terminator};if(n.type==="sse")return t=n.docs,{type:"stream",shape:{type:"reference",value:u4(n.payload)},terminator:n.terminator}},_other:()=>{throw new Error("Unknown HttpResponse: "+e.body)}});return r!=null?{type:r,statusCode:e.statusCode,description:t}:e.statusCode!=null?{statusCode:e.statusCode,description:t,type:{type:"object",extends:[],properties:[],extraProperties:void 0}}:void 0}function p9I(e,t){let r=[];if(t.errorDiscriminationStrategy.type==="statusCode")for(let n of e){let i=t.errors[n.error.errorId];i&&r.push({type:i.type==null?void 0:{type:"alias",value:u4(i.type)},statusCode:i.statusCode,description:i.docs??void 0,name:i.displayName??i.name.name.originalName,availability:void 0,examples:v9I(i)})}else for(let n of e){let i=t.errors[n.error.errorId];if(i){let a=[{key:Xh.PropertyKey(t.errorDiscriminationStrategy.discriminant.wireValue),valueType:{type:"literal",value:{type:"stringLiteral",value:i.discriminantValue.name.originalName}},description:i.docs,availability:void 0,propertyAccess:void 0}];i.type!=null&&a.push({key:Xh.PropertyKey(t.errorDiscriminationStrategy.contentProperty.wireValue),valueType:u4(i.type),description:i.docs,availability:void 0,propertyAccess:void 0}),r.push({type:i.type==null?void 0:{type:"object",extends:[],properties:a,extraProperties:void 0},statusCode:i.statusCode,description:i.docs??void 0,availability:void 0,name:i.displayName??i.name.name.originalName,examples:i.examples.map(o=>({name:o.name?.originalName,responseBody:{type:"json",value:o.jsonExample},description:o.docs}))})}}return r}function ybv({shouldUseExampleName:e,exampleName:t,example:r,irEndpoint:n,irService:i,ir:a}){if(r==null)return;let o=u=>{if(u.valueType.type==="container"&&u.valueType.container.type==="literal")return u.valueType.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}});if(u.valueType.type==="container"&&u.valueType.container.type==="optional"&&u.valueType.container.optional.type==="container"&&u.valueType.container.optional.container.type==="literal")return u.valueType.container.optional.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}})},c={};a.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),i.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),n.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)});let f=r.response?.body!=null?r.response.body.value:void 0;return{name:e?t:void 0,description:"",path:r.request?.endpoint.path??"",pathParameters:r.request?.pathParameters??{},queryParameters:r.request?.queryParameters??{},headers:(()=>{let s={...r.request?.headers??{}};for(let[l,m]of Object.entries(c))(s[l]===null||s[l]===void 0)&&(s[l]=m);return s})(),requestBody:r.request?.requestBody,requestBodyV3:n.requestBody?._visit({inlinedRequestBody:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,reference:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,fileUpload:u=>{if(r.request==null)return;let s={};if(QD(r.request.requestBody)){let l=r.request.requestBody;for(let m of u.properties)m._visit({file:O=>{let P=l[O.key.wireValue];if(O.type==="file")s[O.key.wireValue]={type:"filename",value:typeof P=="string"?P:"<file1>"};else if(O.type==="fileArray"){let C=(Array.isArray(P)?P:[P]).filter(M=>typeof M=="string");s[O.key.wireValue]={type:"filenames",value:C}}},bodyProperty:O=>{if(O.style==="exploded"){let P=l[O.name.wireValue];s[O.name.wireValue]={type:"exploded",value:Array.isArray(P)?P:[P]}}else s[O.name.wireValue]={type:"json",value:l[O.name.wireValue]}},_other:Pdt})}return{type:"form",value:s}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??n.response?.statusCode??200,responseBody:f??void 0,responseBodyV3:f!=null?r.response?.body?._visit({json:u=>({type:"json",value:u}),stream:u=>Array.isArray(u)&&u.length>0&&u.every(_9I)?{type:"sse",value:u}:{type:"stream",value:u},error:()=>{},_other:()=>{throw new Error("Unknown ExampleResponseBody: "+r.response?.body?.type)}}):void 0,codeSamples:r.codeSamples?.map(u=>({name:u.name,description:u.docs??void 0,install:void 0,language:u.language,code:u.code})).filter(_j)}}function _9I(e){return typeof e=="object"&&e!==null&&"event"in e&&typeof e?.event=="string"&&"data"in e}function hLf({userSpecifiedExample:e,autogeneratedExample:t,irEndpoint:r,ir:n}){let i=n.headers.map(c=>{let f;if(c.valueType.type==="container"&&c.valueType.container.type==="literal"?f=c.valueType.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}}):c.valueType.type==="container"&&c.valueType.container.type==="optional"&&c.valueType.container.optional.type==="container"&&c.valueType.container.optional.container.type==="literal"&&(f=c.valueType.container.optional.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}})),f!=null)return{name:c.name,value:{jsonExample:f,shape:ip.ExampleTypeReferenceShape.primitive(ip.ExamplePrimitive.string({original:f}))}}}).filter(_j),a=e?.example??t?.example;if(a==null)return;let{codeSamples:o}=e??{codeSamples:[]};return{name:a.name?.originalName,description:a.docs,path:a.url,pathParameters:[...a.rootPathParameters,...a.servicePathParameters,...a.endpointPathParameters].reduce((c,f)=>(c[Xh.PropertyKey(f.name.originalName)]=f.value.jsonExample,c),{}),queryParameters:a.queryParameters.reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),headers:[...i,...a.serviceHeaders,...a.endpointHeaders].reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),requestBody:a.request?.jsonExample,requestBodyV3:r.requestBody?._visit({inlinedRequestBody:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,reference:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,fileUpload:c=>{if(a.request==null)return;let f={};if(QD(a.request.jsonExample)){let u=a.request.jsonExample;for(let s of c.properties)s._visit({file:l=>{let m=u[l.key.wireValue];if(l.type==="file")f[l.key.wireValue]={type:"filename",value:typeof m=="string"?m:"<file1>"};else if(l.type==="fileArray"){let O=(Array.isArray(m)?m:[m]).filter(P=>typeof P=="string");f[l.key.wireValue]={type:"filenames",value:O}}},bodyProperty:l=>{if(l.style==="exploded"){let m=u[l.name.wireValue];f[l.name.wireValue]={type:"exploded",value:Array.isArray(m)?m:[m]}}else f[l.name.wireValue]={type:"json",value:u[l.name.wireValue]}},_other:Pdt})}return{type:"form",value:f}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??ip.http.ExampleResponse._visit(a.response,{ok:c=>c._visit({body:f=>f!=null?200:204,stream:f=>f.length>0?200:204,sse:f=>f.length>0?200:204,_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:({error:c})=>{let f=n.errors[c.errorId];if(f==null)throw new Error("Cannot find error "+c.errorId);return f.statusCode},_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),responseBody:a.response._visit({ok:c=>c._visit({body:f=>f?.jsonExample,stream:()=>{},sse:()=>{},_other:()=>{}}),error:c=>c.body?.jsonExample,_other:()=>{}}),responseBodyV3:a.response._visit({ok:c=>c._visit({body:f=>f!=null?{type:"json",value:f.jsonExample}:void 0,stream:f=>({type:"stream",value:f.map(u=>u.jsonExample)}),sse:f=>({type:"sse",value:f.map(({event:u,data:s})=>({event:u,data:s.jsonExample}))}),_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:c=>c.body!=null?{type:"json",value:c.body.jsonExample}:void 0,_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),codeSamples:o?.map(c=>Prt._visit(c,{language:f=>({language:f.language,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:f.install}),sdk:f=>({language:f.sdk,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:void 0}),_other:()=>{}})).filter(_j)}}function h9I(e){switch(e.type){case"inlinedPayload":return{type:{type:"object",extends:e.extends.map(t=>Xh.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:Xh.PropertyKey(t.name.wireValue),valueType:u4(t.valueType),availability:die(t.availability),propertyAccess:void 0})),extraProperties:void 0},description:void 0};case"reference":return{type:{type:"reference",value:u4(e.payloadType)},description:e.docs};default:Zu(e)}}function y9I(e){switch(e.type){case"inlinedBody":return{type:"object",extends:e.extends.map(t=>Xh.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:Xh.PropertyKey(t.name.wireValue),valueType:u4(t.valueType),availability:die(t.availability),propertyAccess:void 0})),extraProperties:void 0};case"reference":return{type:"reference",value:u4(e.bodyType)};default:Zu(e)}}function v9I(e){let t=e.v2Examples?.userSpecifiedExamples,r=e.v2Examples?.autogeneratedExamples,n=e.examples;return t!=null&&Object.keys(t).length>0?Object.entries(t).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):r!=null&&Object.keys(r).length>0?Object.entries(r).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):n.length>0?n.map(i=>({name:i.name?.originalName,responseBody:{type:"json",value:i.jsonExample},description:i.docs})):[]}function LCe({ir:e,snippetsConfig:t,playgroundConfig:r,context:n}){let i={types:{},subpackages:{},rootPackage:yLf(e.rootPackage,e),auth:cbv({auth:e.auth,playgroundConfig:r,context:n}),authSchemes:fbv({auth:e.auth,playgroundConfig:r,context:n}),snippetsConfiguration:t,globalHeaders:e.headers.map(a=>({availability:die(a.availability),description:a.docs??void 0,key:a.name.wireValue,type:u4(a.valueType)})),navigation:void 0};for(let[a,o]of Object.entries(e.types))i.types[Xh.TypeId(a)]={description:o.docs??void 0,name:o.name.name.originalName,shape:pbv(o.shape),availability:die(o.availability),displayName:o.name.displayName};for(let[a,o]of Object.entries(e.subpackages)){let c=o.service!=null?e.services[o.service]:void 0;i.subpackages[Xh.api.v1.SubpackageId(a)]={subpackageId:Xh.api.v1.SubpackageId(a),displayName:c?.displayName??o.displayName,name:o.name.originalName,description:o.docs??void 0,...yLf(o,e)}}return i}async function vLf({organization:e,workspace:t,context:r,token:n,audiences:i,snippetsConfig:a,playgroundConfig:o}){let c=zG({workspace:t,audiences:i,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:r,sourceResolver:new xG(r,t)}),f=Ssa({token:n.value}),u=LCe({ir:c,snippetsConfig:a,playgroundConfig:o,context:r}),s=await f.api.v1.register.registerApiDefinition({orgId:Xh.OrgId(e),apiId:Xh.ApiId(c.apiName.originalName),definition:u});if(s.ok)return r.logger.debug(`Registered API Definition ${s.body.apiDefinitionId}`),{id:s.body.apiDefinitionId,ir:c};switch(s.error.error){case"UnauthorizedError":case"UserNotInOrgError":return r.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return r.failAndThrow("Failed to register API",s.error)}}var b9I=new ilu({snippetsBySdkId:{},snippetsConfigWithSdkId:{},snippetTemplatesByEndpoint:{},snippetsBySdkIdAndEndpointId:{},snippetTemplatesByEndpointId:{}});function Mrs({ir:e,apiDefinitionId:t,playgroundConfig:r,context:n}){return alu(rlu(LCe({ir:e,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:r,context:n}),gve.ApiDefinitionId(t),b9I))}var vbv=Hi(require("path"),1);async function eyt({iconPath:e,filepaths:t}){e!=null&&typeof e=="string"&&vbv.default.isAbsolute(e)&&t.add(e)}async function bbv({parsedDocsConfig:e}){let t=new Set;return e.logo?.dark!=null&&t.add(e.logo.dark),e.logo?.light!=null&&t.add(e.logo.light),e.favicon!=null&&t.add(e.favicon),e.backgroundImage?.dark!=null&&t.add(e.backgroundImage.dark),e.backgroundImage?.light!=null&&t.add(e.backgroundImage.light),e.metadata?.["og:image"]!=null&&e.metadata["og:image"].type==="filepath"&&t.add(e.metadata["og:image"].value),e.metadata?.["og:logo"]!=null&&e.metadata["og:logo"].type==="filepath"&&t.add(e.metadata["og:logo"].value),e.metadata?.["twitter:image"]!=null&&e.metadata["twitter:image"].type==="filepath"&&t.add(e.metadata["twitter:image"].value),e.typography?.bodyFont!=null&&e.typography.bodyFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.headingsFont!=null&&e.typography.headingsFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.codeFont!=null&&e.typography.codeFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.navigation.type==="productgroup"&&e.navigation.products.forEach(n=>{n.image!=null&&t.add(n.image)}),(await bLf({navigation:e.navigation})).forEach(n=>{t.add(n)}),e.navbarLinks&&await Promise.all(e.navbarLinks.map(async n=>{n.type==="dropdown"&&n.links.map(async i=>{i.icon&&await eyt({iconPath:i.icon,filepaths:t}),i.rightIcon&&await eyt({iconPath:i.rightIcon,filepaths:t})}),n.type!=="github"&&(n.icon&&await eyt({iconPath:n.icon,filepaths:t}),n.rightIcon&&await eyt({iconPath:n.rightIcon,filepaths:t}))})),e.js!=null&&e.js.files.forEach(n=>{t.add(n.absolutePath)}),t}async function bLf({navigation:e}){let t=new Set;switch(e.type){case"untabbed":await Promise.all(e.items.map(r=>xao({item:r,filepaths:t})));break;case"tabbed":await Promise.all(e.items.map(async r=>{r.icon!=null&&await eyt({iconPath:r.icon,filepaths:t}),r.child.type==="layout"&&r.child.layout!=null?await Promise.all(r.child.layout.map(n=>xao({item:n,filepaths:t}))):r.child.type==="variants"&&r.child.variants!=null&&await Promise.all(r.child.variants.flatMap(n=>{let i=[];return n.icon!=null&&i.push(eyt({iconPath:n.icon,filepaths:t})),i.push(...n.layout.map(a=>xao({item:a,filepaths:t}))),i}))}));break;case"versioned":await Promise.all(e.versions.map(async r=>{r.landingPage!=null&&await xao({item:r.landingPage,filepaths:t}),(await bLf({navigation:r.navigation})).forEach(i=>t.add(i))}));break;case"productgroup":await Promise.all(e.products.map(async r=>{r.icon!=null&&await eyt({iconPath:r.icon,filepaths:t}),r.type==="internal"&&(r.landingPage!=null&&await xao({item:r.landingPage,filepaths:t}),(await bLf({navigation:r.navigation})).forEach(i=>t.add(i)))}));break}return t}async function xao({item:e,filepaths:t}){switch(e.type){case"page":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break;case"section":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t}),await Promise.all(e.contents.map(r=>xao({item:r,filepaths:t})));break;case"apiSection":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break;case"link":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break;case"changelog":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break}}async function gbv({navigation:e,apiWorkspaces:t,visitor:r,context:n}){m9I(e)?await Promise.all(e.map(async i=>{O9I(i)?await Promise.all(i.layout.map(async a=>{await JLu({navigationItem:a,visitor:r,apiWorkspaces:t,context:n})})):A9I(i)&&await Promise.all(i.variants.flatMap(a=>a.layout.map(async o=>{await JLu({navigationItem:o,visitor:r,apiWorkspaces:t,context:n})})))})):await Promise.all(e.map(async i=>{await JLu({navigationItem:i,visitor:r,apiWorkspaces:t,context:n})}))}async function JLu({navigationItem:e,visitor:t,apiWorkspaces:r,context:n}){if(await P6r(e,{alphabetized:Tc,api:Tc,apiName:Tc,audiences:Tc,displayErrors:Tc,snippets:Tc,summary:Tc,title:Tc,layout:Tc,collapsed:Tc,icon:Tc,slug:Tc,hidden:Tc,skipSlug:Tc,paginated:Tc,playground:Tc,flattened:Tc,path:Tc,page:Tc,featureFlag:Tc,openrpc:Tc,postman:Tc,contents:async i=>{i!=null&&await Promise.all(i.map(async a=>{await JLu({navigationItem:a,visitor:t,apiWorkspaces:r,context:n})}))},viewers:Tc,orphaned:Tc,availability:Tc}),g9I(e)){let i=r.find(a=>a.workspaceName===e.apiName);i!=null&&await t.apiSection?.({config:e,workspace:i,context:n})}}function g9I(e){return e.api!=null}function m9I(e){return e[0]?.tab!=null}function O9I(e){return"layout"in e&&Array.isArray(e.layout)}function A9I(e){return"variants"in e&&Array.isArray(e.variants)}function Use(e){return e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`}Obv.default.extend(Abv.default);var P9I=e=>e.map(t=>({...t,fileId:String(t.relativeFilePath)})),mbv=0,w9I=async({ir:e})=>(mbv++,`${e.apiName.snakeCase.unsafeName}-${mbv}`),Hqr=class{domain;docsWorkspace;ossWorkspaces;apiWorkspaces;taskContext;editThisPage;uploadFiles;registerApi;targetAudiences;constructor({domain:t,docsWorkspace:r,ossWorkspaces:n,apiWorkspaces:i,taskContext:a,editThisPage:o,uploadFiles:c=P9I,registerApi:f=w9I,targetAudiences:u}){this.domain=t,this.docsWorkspace=r,this.ossWorkspaces=n,this.apiWorkspaces=i,this.taskContext=a,this.editThisPage=o,this.uploadFiles=c,this.registerApi=f,this.targetAudiences=u}#e=HLu.init();shouldIncludeByAudience(t){return!t||t.length===0||!this.targetAudiences||this.targetAudiences.length===0?!0:t.some(r=>this.targetAudiences?.includes(r))}applyAudienceFiltering(t){let r=this.filterNavigationByAudience(t.navigation);return{...t,navigation:r}}filterNavigationByAudience(t){return t.type==="untabbed"||t.type==="tabbed"?t:t.type==="versioned"?{...t,versions:t.versions.filter(r=>this.shouldIncludeByAudience(this.getRawVersionAudiences(r.version)))}:t.type==="productgroup"?{...t,products:t.products.filter(r=>{let n=this.getRawProductAudiences(r.product);return this.shouldIncludeByAudience(n)})}:t}getRawProductAudiences(t){let n=this.docsWorkspace.config.products?.find(i=>i.displayName===t);return mGo(n?.audiences)}getRawVersionAudiences(t){let n=this.docsWorkspace.config.versions?.find(i=>i.displayName===t);return mGo(n?.audiences)}_parsedDocsConfig;get parsedDocsConfig(){if(this._parsedDocsConfig==null)throw new Error("parsedDocsConfig is not set");return this._parsedDocsConfig}collectedFileIds=new Map;markdownFilesToFullSlugs=new Map;markdownFilesToNoIndex=new Map;markdownFilesToTags=new Map;rawMarkdownFiles={};async resolve(){this._parsedDocsConfig=await Qof({rawDocsConfiguration:this.docsWorkspace.config,context:this.taskContext,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absoluteFilepathToDocsConfig:this.docsWorkspace.absoluteFilepathToDocsConfig}),this.targetAudiences&&this.targetAudiences.length>0&&(this._parsedDocsConfig=this.applyAudienceFiltering(this._parsedDocsConfig));for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.rawMarkdownFiles[eu.of(l)]=m;let t=this.parsedDocsConfig.experimental?.openapiParserV3,r=t!=null&&!t;this.docsWorkspace.config.navigation!=null&&r&&await gbv({navigation:this.docsWorkspace.config.navigation,visitor:{apiSection:async({workspace:l})=>{(await l.toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,preserveSchemaIds:!0,objectQueryParameters:!0,respectReadonlySchemas:!0})).changelog?.files.forEach(O=>{let P=j3(this.docsWorkspace.absoluteFilePath,O.absoluteFilepath);this.parsedDocsConfig.pages[P]=O.contents,this.rawMarkdownFiles[eu.of(P)]=O.contents})}},apiWorkspaces:this.apiWorkspaces,context:this.taskContext}),this.markdownFilesToFullSlugs=await this.getMarkdownFilesToFullSlugs(this.parsedDocsConfig.pages),this.markdownFilesToNoIndex=await this.getMarkdownFilesToNoIndex(this.parsedDocsConfig.pages),this.markdownFilesToTags=await this.getMarkdownFilesToTags(this.parsedDocsConfig.pages);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[eu.of(l)]=await H5f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[eu.of(l)]=await G5f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});let n=await bbv({parsedDocsConfig:this.parsedDocsConfig});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))try{let{filepaths:O,markdown:P}=Zfa(m,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath});this.parsedDocsConfig.pages[eu.of(l)]=P;for(let C of O)n.add(C)}catch(O){throw this.taskContext.logger.error(`Failed to parse ${l}: ${O instanceof Error?O.message:String(O)}`),O}let i=Array.from(n).map(l=>({absoluteFilePath:l,relativeFilePath:this.toRelativeFilepath(l)}));(await this.uploadFiles(i)).forEach(l=>{this.collectedFileIds.set(l.absoluteFilePath,l.fileId)});let o=await this.toRootNode(),c=await this.getMarkdownFilesToFullyQualifiedPathNames(o);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[eu.of(l)]=W5f(m,this.collectedFileIds,c,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath},this.taskContext);let f={};Object.entries(this.parsedDocsConfig.pages).forEach(([l,m])=>{let O=j9I(this.editThisPage,l),P=this.rawMarkdownFiles[eu.of(l)];f[UDe.PageId(l)]={markdown:m,editThisPageUrl:O?UDe.Url(O):void 0,rawMarkdown:P}});let u=await this.convertDocsConfiguration(o),s={};if(this._parsedDocsConfig.experimental?.mdxComponents!=null){let l=new Set;await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async m=>{let O=d1(this.docsWorkspace.absoluteFilePath,m);(await(0,$Lu.stat)(O)).isDirectory()?(await sve(O,"{js,ts,jsx,tsx,md,mdx}")).forEach(M=>{l.add(M)}):O.match(/\.(js|ts|jsx|tsx|md|mdx)$/)!=null&&l.add(O)})),s=Object.fromEntries(await Promise.all([...l].map(async m=>{let O=this.toRelativeFilepath(m),P=(await(0,$Lu.readFile)(m)).toString();return[O,P]})))}return{config:u,pages:f,jsFiles:s}}resolveFilepath(t){if(t!=null)return d1(this.docsWorkspace.absoluteFilePath,t)}toRelativeFilepath(t){if(t!=null)return j3(this.docsWorkspace.absoluteFilePath,t)}async getMarkdownFilesToFullSlugs(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,KLu.default)(i).data.slug;typeof o=="string"&&o.trim().length>0&&r.set(this.resolveFilepath(n),o.trim())}return r}async getMarkdownFilesToNoIndex(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,KLu.default)(i).data.noindex;typeof o=="boolean"&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToTags(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,KLu.default)(i).data.tags;typeof o=="string"?r.set(this.resolveFilepath(n),o.split(",").map(c=>c.trim()).filter(c=>c.length>0)):Array.isArray(o)&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToFullyQualifiedPathNames(t){let r={},n=fl.migrate.FernNavigationV1ToLatest.create().root(t);return fl.NodeCollector.collect(n).slugMap.forEach((a,o)=>{if(a==null||!fl.isPage(a))return;let c=fl.getPageId(a);if(c==null)return;let f=Ql(this.docsWorkspace.absoluteFilePath,eu.of(c));r[f]=o}),r}getDocsBasePath(){return new URL(Use(this.domain)).pathname}async convertDocsConfiguration(t){return{aiChatConfig:this.parsedDocsConfig.aiChatConfig!=null?{model:this.parsedDocsConfig.aiChatConfig.model,systemPrompt:this.parsedDocsConfig.aiChatConfig.systemPrompt,location:this.parsedDocsConfig.aiChatConfig.location,datasources:this.parsedDocsConfig.aiChatConfig.datasources?.map(n=>({url:n.url,title:n.title}))}:void 0,hideNavLinks:void 0,title:this.parsedDocsConfig.title,logoHeight:this.parsedDocsConfig.logo?.height,logoHref:this.parsedDocsConfig.logo?.href?UDe.Url(this.parsedDocsConfig.logo?.href):void 0,favicon:this.getFileId(this.parsedDocsConfig.favicon),navigation:void 0,root:t,colorsV3:this.convertColorConfigImageReferences(),navbarLinks:this.parsedDocsConfig.navbarLinks?.map(n=>n.type==="dropdown"?{...n,links:n.links?.map(i=>({...i,url:UDe.Url(i.url),icon:this.resolveIconFileId(i.icon),rightIcon:this.resolveIconFileId(i.rightIcon)})),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}:n.type==="github"?{...n,url:UDe.Url(n.url)}:{...n,url:UDe.Url(n.url),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}),typographyV2:this.convertDocsTypographyConfiguration(),layout:this.parsedDocsConfig.layout,settings:this.parsedDocsConfig.settings,css:this.parsedDocsConfig.css,js:this.convertJavascriptConfiguration(),metadata:this.convertMetadata(),redirects:this.parsedDocsConfig.redirects,integrations:this.parsedDocsConfig.integrations,footerLinks:this.parsedDocsConfig.footerLinks?.map(n=>({...n,value:UDe.Url(n.value)})),defaultLanguage:this.parsedDocsConfig.defaultLanguage,languages:this.parsedDocsConfig.languages,analyticsConfig:{...this.parsedDocsConfig.analyticsConfig,segment:this.parsedDocsConfig.analyticsConfig?.segment,fullstory:this.parsedDocsConfig.analyticsConfig?.fullstory,intercom:this.parsedDocsConfig.analyticsConfig?.intercom?{appId:this.parsedDocsConfig.analyticsConfig.intercom.appId,apiBase:this.parsedDocsConfig.analyticsConfig.intercom.apiBase}:void 0,posthog:this.parsedDocsConfig.analyticsConfig?.posthog?{apiKey:this.parsedDocsConfig.analyticsConfig.posthog.apiKey,endpoint:this.parsedDocsConfig.analyticsConfig.posthog.endpoint}:void 0,gtm:this.parsedDocsConfig.analyticsConfig?.gtm?{containerId:this.parsedDocsConfig.analyticsConfig.gtm.containerId}:void 0,ga4:this.parsedDocsConfig.analyticsConfig?.ga4?{measurementId:this.parsedDocsConfig.analyticsConfig.ga4.measurementId}:void 0,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},announcement:this.parsedDocsConfig.announcement!=null?{text:this.parsedDocsConfig.announcement.message}:void 0,pageActions:this.parsedDocsConfig.pageActions,theme:this.parsedDocsConfig.theme!=null?{sidebar:this.parsedDocsConfig.theme.sidebar,body:this.parsedDocsConfig.theme.body,tabs:this.parsedDocsConfig.theme.tabs,"page-actions":this.parsedDocsConfig.theme.pageActions,footerNav:this.parsedDocsConfig.theme.footerNav}:void 0,logo:void 0,logoV2:void 0,colors:void 0,colorsV2:void 0,typography:void 0,backgroundImage:void 0}}getFernWorkspaceForApiSection(t){if(t.apiName!=null){let n=this.apiWorkspaces.find(i=>i.workspaceName===t.apiName);if(n!=null)return n}else if(this.apiWorkspaces.length===1&&this.apiWorkspaces[0]!=null)return this.apiWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs.
|
|
3039
|
+
]`;case 1:return`${i} Did you mean ${r[0]}?`;case 2:return`${i} Did you mean ${r[0]} or ${r[1]}?`;default:return`${i} Did you mean ${r[0]}, ${r[1]}, or ${r[2]}?`}}function VLu(e){return`API section ${e} is specified multiple times, however will be only rendered once.`}function kLI(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function WLu({children:e,findEndpointById:t,stringifyEndpointPathParts:r,disableEndpointPairs:n,apiDefinitionId:i}){if(n)return e;let a=[],o=new Map;return e.forEach(c=>{if(c.type!=="endpoint"){a.push(c);return}let f=t(c.endpointId);if(f==null)throw new Error(`Endpoint ${c.endpointId} not found`);let u=`${f.method} ${r(f)}`,s=o.get(u);if(o.set(u,c),s==null||s.isResponseStream===c.isResponseStream){a.push(c);return}let l=a.indexOf(s),m=c.isResponseStream?c:s,O=c.isResponseStream?s:c,P={id:fl.V1.NodeId(`${i}:${O.endpointId}+${m.endpointId}`),type:"endpointPair",stream:m,nonStream:O};a[l]=P}),a}function ibv({left:e,right:t,findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}){return WLu({children:[...e,...t],findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}).filter(o=>o.type==="apiPackage"?o.children.length>0:!0)}function Nao(e,t){if(t!=null)return j3(e.absoluteFilePath,t)}function abv({docsWorkspace:e,page:t,parentSlug:r,idgen:n,markdownFilesToFullSlugs:i,markdownFilesToNoIndex:a,hideChildren:o,resolveIconFileId:c}){let f=fl.V1.PageId(Nao(e,t.absolutePath)),u=r.apply({fullSlug:i.get(t.absolutePath)?.split("/"),urlSlug:t.slug??u$(t.title)});return{id:n.get(f),type:"page",pageId:f,title:t.title,slug:u.get(),icon:c?c(t.icon):t.icon,hidden:o||t.hidden,noindex:t.noindex||a.get(t.absolutePath),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,availability:t.availability}}var GLu=class{apiSection;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;markdownFilesToTags;workspace;hideChildren;parentAvailability;apiDefinitionId;#e;#t=new Set;#r=new Set;#n=new Set;#i=new Set;#a=new Set;#o=new Map;#u=[];#s;#c;#f;disableEndpointPairs;collectedFileIds=new Map;constructor(t,r,n,i,a,o,c,f,u,s,l,m,O){this.apiSection=t,this.docsWorkspace=i,this.taskContext=a,this.markdownFilesToFullSlugs=o,this.markdownFilesToNoIndex=c,this.markdownFilesToTags=f,this.workspace=l,this.hideChildren=m,this.parentAvailability=O,this.disableEndpointPairs=i.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=fl.V1.ApiDefinitionId(r.id),this.#e=C2i.create(r,a),this.collectedFileIds=s,this.#f=u,this.#s=this.apiSection.overviewAbsolutePath!=null?fl.V1.PageId(Nao(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let P=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#c=n.apply({fullSlug:P?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??u$(this.apiSection.title)});let C=this.apiSection.availability??this.parentAvailability;this.apiSection.navigation!=null&&(this.#u=this.#d(this.apiSection.navigation,this.#e.api.rootPackage,this.#c,C)),this.#u=this.#g(this.#u.map(M=>this.#m(M,C)),this.#O(this.#e.api.rootPackage,this.#c,C))}get(){let t=fl.V1.followRedirects(this.#u),r=new ada(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.workspace?.changelog?.files.map(n=>n.absoluteFilepath),this.docsWorkspace,this.#f).orUndefined();return{id:this.#f.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#s,paginated:this.apiSection.paginated,slug:this.#c.get(),icon:this.resolveIconFileId(this.apiSection.icon),hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#c,viewers:void 0,hidden:this.hideChildren}),children:this.#u,availability:this.apiSection.availability??this.parentAvailability,pointsTo:t,noindex:void 0,playground:this.#v(this.apiSection.playground),postmanCollectionUrl:this.apiSection.postman,authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#d(t,r,n,i){r=this.#e.resolveSubpackage(r);let a=r!=null?C2i.getSubpackageId(r):void 0;return t.map(o=>lLf(o)._visit({link:c=>({id:this.#f.get(c.url),type:"link",title:c.text,icon:this.resolveIconFileId(c.icon),url:fl.Url(c.url)}),page:c=>this.#p(c,n,i),package:c=>this.#l(c,n,i),section:c=>this.#_(c,n,i),item:({value:c})=>this.#y(c,a,n,i),endpoint:c=>this.#h(c,a,n,i)})).filter(_j)}#p(t,r,n){return abv({page:{...t,availability:t.availability??n},parentSlug:r,docsWorkspace:this.docsWorkspace,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex,idgen:this.#f,hideChildren:this.hideChildren,resolveIconFileId:this.resolveIconFileId.bind(this)})}#l(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(Nao(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.availability??n,c=this.#e.getSubpackageByIdOrLocator(t.package);if(c!=null){let f=C2i.getSubpackageId(c),u=this.#f.get(i??`${this.apiDefinitionId}:${f}`);this.#a.has(f)&&this.taskContext.logger.warn(VLu(t.package)),this.#a.add(f),this.#o.set(u,[f]);let s=t.slug??(sWr(c)?c.urlSlug:this.apiSection.slug??u$(this.apiSection.title)),l=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:s}),m=this.#d(t.contents,c,l,o);return{id:u,type:"apiPackage",children:m,title:t.title??(sWr(c)?c.displayName??qao(c.name):this.apiSection.title),slug:l.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else{this.taskContext.logger.warn(ULu(t.package,this.#e.subpackageLocators));let f=t.slug??u$(t.package),u=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:f}),s=this.#d(t.contents,void 0,u,o);return{id:this.#f.get(i??`${this.apiDefinitionId}:${u$(t.package)}`),type:"apiPackage",children:s,title:t.title??t.package,slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}#_(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(Nao(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(t.overviewAbsolutePath):void 0,c=this.#f.get(i??a??r.get()),f=t.referencedSubpackages.map(O=>{let P=this.#e.getSubpackageByIdOrLocator(O),C=P!=null?C2i.getSubpackageId(P):void 0;if(C===void 0){this.taskContext.logger.error(ULu(O,this.#e.subpackageLocators));return}return{subpackageId:C,locator:O}}).filter(O=>O!=null).filter(_j);this.#o.set(c,f.map(O=>O.subpackageId)),f.forEach(O=>{this.#a.has(O.subpackageId)&&this.taskContext.logger.error(VLu(O.locator)),this.#a.add(O.subpackageId)});let u=t.slug??u$(t.title),s=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),l=t.availability??n,m=this.#d(t.contents,void 0,s,l);return{id:c,type:"apiPackage",children:m,title:t.title,slug:s.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:l,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:o,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}#y(t,r,n,i){t=t.trim();let a=this.#e.getSubpackageByIdOrLocator(t)??this.#e.getSubpackageByIdOrLocator($A(t));if(a!=null){let o=C2i.getSubpackageId(a),c=this.#f.get(`${this.apiDefinitionId}:${o}`);this.#a.has(o)&&this.taskContext.logger.error(VLu(t)),this.#a.add(o),this.#o.set(c,[o]);let f=sWr(a)?a.urlSlug:"",u=n.apply({urlSlug:f});return{id:c,type:"apiPackage",children:[],title:sWr(a)?a.displayName??qao(a.name):this.apiSection.title,slug:u.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:i,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}return this.#h({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,availability:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,n,i)}#h(t,r,n,i){let a=(r!=null?this.#e.subpackages.get(gve.SubpackageId(r))?.endpoints.get(gve.EndpointId(t.endpoint)):void 0)??this.#e.endpointsByLocator.get(t.endpoint);if(a!=null){let f=this.#e.getEndpointId(a);if(f==null)this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${LLu(a.method,a.path.parts)}. Got undefined.`);else{this.#t.has(f)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${f}`),this.#t.add(f);let u=t.slug!=null?n.append(t.slug):n.apply(a);return{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"endpoint",method:a.method,endpointId:f,apiDefinitionId:this.apiDefinitionId,availability:t.availability??fl.V1.convertAvailability(a.availability)??i,isResponseStream:a.response?.type.type==="stream",title:t.title??a.name??VPe(a.path.parts),slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}let o=(r!=null?this.#e.subpackages.get(gve.SubpackageId(r))?.webSockets.get(gve.WebSocketId(t.endpoint)):void 0)??this.#e.webSocketsByLocator.get(t.endpoint);if(o!=null){let f=this.#e.getWebSocketId(o);if(f==null)this.taskContext.logger.error(`Expected WebSocket ID for ${o.id}. Got undefined.`);else return this.#r.has(f)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${f}`),this.#r.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webSocket",webSocketId:f,title:t.title??o.name??VPe(o.path.parts),slug:(t.slug!=null?n.append(t.slug):n.apply(o)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(o.availability)??i,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let c=(r!=null?this.#e.subpackages.get(gve.SubpackageId(r))?.webhooks.get(gve.WebhookId(t.endpoint)):void 0)??this.#e.webhooks.get(fl.V1.WebhookId(t.endpoint));if(c!=null){let f=this.#e.getWebhookId(c);if(f==null)this.taskContext.logger.error(`Expected Webhook ID for ${c.id}. Got undefined.`);else return this.#n.has(f)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${f}`),this.#n.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webhook",webhookId:f,method:c.method,title:t.title??c.name??(0,obv.default)("/",...c.path),slug:(t.slug!=null?n.append(t.slug):n.apply(c)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:i,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#g(t,r){return ibv({left:t,right:r,findEndpointById:n=>this.#e.endpoints.get(n),stringifyEndpointPathParts:n=>VPe(n.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#m(t,r){return pLf({child:t,nodeIdToSubpackageId:this.#o,convertApiDefinitionPackageId:(n,i,a)=>this.#A(n,i,a),mergeAndFilterChildren:this.#g.bind(this)})}#O(t,r,n){let i=[];return t.endpoints.forEach(a=>{if(a.protocol?.type==="grpc"){let o=this.#e.getGrpcId(a);if(o==null){this.taskContext.logger.error(`Expected Grpc ID for ${a.id} at path: ${LLu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#i.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"grpc",grpcId:o,title:a.name??VPe(a.path.parts),method:a.protocol?.methodType??"UNARY",apiDefinitionId:this.apiDefinitionId,availability:n,slug:c.get(),icon:void 0,hidden:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}else{let o=this.#e.getEndpointId(a);if(o==null){this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${LLu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#t.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"endpoint",method:a.method,endpointId:o,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,isResponseStream:a.response?.type.type==="stream",title:a.name??VPe(a.path.parts),slug:c.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}}),t.websockets.forEach(a=>{let o=this.#e.getWebSocketId(a);if(o==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}this.#r.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webSocket",webSocketId:o,title:a.name??VPe(a.path.parts),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.webhooks.forEach(a=>{let o=this.#e.getWebhookId(a);if(o==null){this.taskContext.logger.error(`Expected Webhook ID for ${a.id}. Got undefined.`);return}this.#n.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webhook",webhookId:o,method:a.method,title:a.name??qao(a.id),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:n,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.subpackages.forEach(a=>{if(this.#a.has(a))return;let o=this.#e.getSubpackageByIdOrLocator(a);if(o==null){this.taskContext.logger.error(`Subpackage ${a} not found in ${this.apiDefinitionId}`);return}let c=sWr(o)?r.apply(o):r,f=this.#A(a,c,n);f.length>0&&i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"apiPackage",children:f,title:sWr(o)?o.displayName??qao(o.name):this.apiSection.title,slug:c.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:n,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&(i=i.sort((a,o)=>{let c=a.type==="endpointPair"?a.nonStream.title:a.title,f=o.type==="endpointPair"?o.nonStream.title:o.title;return c.localeCompare(f)})),i}#A(t,r,n){let i=t!=null?this.#e.resolveSubpackage(this.#e.getSubpackageByIdOrLocator(t)):void 0;return i==null?(this.taskContext.logger.debug(ULu(t||"unknown",[])),[]):this.#O(i,r,n)}#v(t){return $vv(t)}mergeEndpointPairs(t){return WLu({children:t,findEndpointById:r=>this.#e.endpoints.get(r),stringifyEndpointPathParts:r=>VPe(r.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}getFileId(t){let r=this.collectedFileIds.get(t);return r??this.taskContext.failAndThrow("Failed to locate file after uploading: "+t)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}};var sbv=Hi(require("crypto"),1);function e9I(e){return sbv.default.createHash("sha256").update(e).digest("hex")}var HLu=class e{static init(){return new e}constructor(){}#e=new Map;#t=new Set;#r(t){let r=this.#e.get(t)??0;return this.#e.set(t,r+1),e9I(r===0?t:`${t}-${r}`)}#n(t){let r=this.#r(t),n=0;for(;this.#t.has(r);)if(r=this.#r(t),n++,n>100)throw new Error(`Infinite loop detected for id: ${t}`);return r}get(t){return fl.V1.NodeId(this.#n(t))}};function ubv(e){return e==null?{}:{pythonSdk:e.python!=null?{package:typeof e.python=="string"?e.python:e.python.package,version:typeof e.python=="string"?void 0:e.python.version}:void 0,typescriptSdk:e.typescript!=null?{package:typeof e.typescript=="string"?e.typescript:e.typescript.package,version:typeof e.typescript=="string"?void 0:e.typescript.version}:void 0,goSdk:e.go!=null?{githubRepo:typeof e.go=="string"?e.go:e.go.package,version:typeof e.go=="string"?void 0:e.go.version}:void 0,javaSdk:e.java!=null?{coordinate:typeof e.java=="string"?e.java:e.java.package,version:typeof e.java=="string"?void 0:e.java.version}:void 0,rubySdk:e.ruby!=null?{gem:typeof e.ruby=="string"?e.ruby:e.ruby.package,version:typeof e.ruby=="string"?void 0:e.ruby.version}:void 0,csharpSdk:e.csharp!=null?{package:typeof e.csharp=="string"?e.csharp:e.csharp.package,version:typeof e.csharp=="string"?void 0:e.csharp.version}:void 0,phpSdk:e.php!=null?{package:typeof e.php=="string"?e.php:e.php.package,version:typeof e.php=="string"?void 0:e.php.version}:void 0,swiftSdk:e.swift!=null?{package:typeof e.swift=="string"?e.swift:e.swift.package,version:typeof e.swift=="string"?void 0:e.swift.version}:void 0,rustSdk:e.rust!=null?{package:typeof e.rust=="string"?e.rust:e.rust.package,version:typeof e.rust=="string"?void 0:e.rust.version}:void 0}}function cbv({auth:e,playgroundConfig:t,context:r}){if(e.schemes.length>0&&e.schemes[0]!=null){let n=e.schemes[0];return lbv({scheme:n,playgroundConfig:t,context:r})}}function lbv({scheme:e,playgroundConfig:t,context:r}){switch(e.type){case"basic":return{type:"basicAuth",passwordName:e.password.originalName,usernameName:e.username.originalName,description:e.docs};case"bearer":return{type:"bearerAuth",tokenName:e.token.originalName,description:e.docs};case"header":return{type:"header",headerWireValue:e.name.wireValue,nameOverride:e.name.name.originalName,prefix:e.prefix,description:e.docs};case"oauth":{let n=e.configuration.tokenEndpoint.responseProperties.accessToken.propertyPath?.map(i=>i.name.originalName).join(".")||"$.body.access_token";return t?.oauth?{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:Xh.EndpointId(e.configuration.tokenEndpoint.endpointReference.endpointId),accessTokenLocator:Xh.JqString(n),headerName:e.configuration.tokenHeader,tokenPrefix:e.configuration.tokenPrefix,description:e.docs}}}:{type:"bearerAuth",tokenName:"token",description:e.docs}}case"inferred":{e.tokenEndpoint.authenticatedRequestHeaders.length>1&&r.logger.warn("Inferred auth scheme has multiple authenticated request headers. Only the `Authentication` or first header will be pushed to FDR.");let n=e.tokenEndpoint.authenticatedRequestHeaders.find(a=>a.headerName.toLowerCase()==="authorization");if(n)return n.responseProperty.propertyPath!=null&&n.responseProperty.propertyPath.length>0&&r.logger.warn("Inferred Authentication header has a property path. The property wirevalue will be pushed to FDR without property path."),{type:"bearerAuth",tokenName:n.responseProperty.property.name.wireValue,description:e.docs};let i=e.tokenEndpoint.authenticatedRequestHeaders[0];return i?{type:"header",headerWireValue:i.headerName,prefix:i.valuePrefix,nameOverride:void 0,description:e.docs}:{type:"bearerAuth",tokenName:"token",description:e.docs}}default:Zu(e)}}function fbv({auth:e,playgroundConfig:t,context:r}){let n={};for(let i of e.schemes){let a=lbv({scheme:i,playgroundConfig:t,context:r});a!=null&&(n[Xh.AuthSchemeId(i.key)]=a)}return n}function pbv(e){return e._visit({alias:t=>({type:"alias",value:u4(t.aliasOf)}),enum:t=>({type:"enum",default:t.default!=null?t.default.name.wireValue:void 0,values:t.values.map(r=>({description:r.docs??void 0,value:r.name.wireValue,availability:die(r.availability)}))}),object:t=>({type:"object",extends:t.extends.map(r=>Xh.TypeId(r.typeId)),properties:t.properties.map(r=>({description:r.docs??void 0,key:Xh.PropertyKey(r.name.wireValue),valueType:u4(r.valueType),availability:die(r.availability),propertyAccess:r.propertyAccess})),extraProperties:n9I(t.extraProperties)}),union:t=>{let r=t.baseProperties.map(n=>({key:Xh.PropertyKey(n.name.wireValue),valueType:u4(n.valueType),availability:die(n.availability),description:n.docs,propertyAccess:n.propertyAccess}));return{type:"discriminatedUnion",discriminant:t.discriminant.wireValue,variants:t.types.map(n=>({description:n.docs??void 0,discriminantValue:n.discriminantValue.wireValue,displayName:n.displayName,availability:n.availability!=null?die(n.availability):void 0,additionalProperties:ip.types.SingleUnionTypeProperties._visit(n.shape,{samePropertiesAsObject:i=>({extends:[Xh.TypeId(i.typeId)],properties:r,extraProperties:void 0}),singleProperty:i=>({extends:[],properties:[{key:Xh.PropertyKey(i.name.wireValue),valueType:u4(i.type),description:void 0,availability:void 0,propertyAccess:void 0},...r],extraProperties:void 0}),noProperties:()=>({extends:[],properties:r,extraProperties:void 0}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+n.shape.propertiesType)}})}))}},undiscriminatedUnion:t=>({type:"undiscriminatedUnion",variants:t.members.map(r=>({typeName:r.type.type==="named"?r.type.name.originalName:void 0,description:r.docs??void 0,type:u4(r.type),availability:void 0,displayName:r.type.type==="named"?r.type.displayName:void 0}))}),_other:()=>{throw new Error("Unknown Type shape: "+e.type)}})}function u4(e){return e._visit({container:t=>ip.types.ContainerType._visit(t,{list:r=>({type:"list",itemType:u4(r)}),map:({keyType:r,valueType:n})=>({type:"map",keyType:u4(r),valueType:u4(n)}),optional:r=>({type:"optional",itemType:u4(r),defaultValue:void 0}),nullable:r=>({type:"nullable",itemType:u4(r)}),set:r=>({type:"set",itemType:u4(r)}),literal:r=>ip.types.Literal._visit(r,{boolean:n=>({type:"literal",value:{type:"booleanLiteral",value:n}}),string:n=>({type:"literal",value:{type:"stringLiteral",value:n}}),_other:()=>{throw new Error("Unknown literal type: "+r.type)}}),_other:()=>{throw new Error("Unknown container reference: "+t.type)}}),named:t=>({type:"id",value:Xh.TypeId(t.typeId),default:void 0}),primitive:t=>({type:"primitive",value:ip.types.PrimitiveTypeV1._visit(t.v1,{integer:()=>r9I(t.v2),float:()=>dbv(t.v2),double:()=>dbv(t.v2),string:()=>t9I(t.v2),long:()=>({type:"long",default:t.v2?.type==="long"?t.v2.default:void 0,minimum:void 0,maximum:void 0}),boolean:()=>({type:"boolean",default:t.v2?.type==="boolean"?t.v2.default:void 0}),dateTime:()=>({type:"datetime",default:void 0}),date:()=>({type:"date",default:void 0}),uuid:()=>({type:"uuid",default:void 0}),base64:()=>({type:"base64",mimeType:void 0,default:void 0}),bigInteger:()=>({type:"bigInteger",default:t.v2?.type==="bigInteger"?t.v2.default:void 0}),uint:()=>({type:"uint"}),uint64:()=>({type:"uint64"}),_other:()=>{throw new Error("Unknown primitive: "+t.v1)}})}),unknown:()=>({type:"unknown"}),_other:()=>{throw new Error("Unknown Type reference: "+e.type)}})}function t9I(e){let t=e!=null&&e.type==="string"?e.validation:void 0;return{type:"string",format:t?.format,regex:t?.pattern,minLength:t?.minLength,maxLength:t?.maxLength,default:e!=null&&e.type==="string"?e.default:void 0}}function r9I(e){let t=e!=null&&e.type==="integer"?e.validation:void 0;return{type:"integer",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="integer"?e.default:void 0}}function dbv(e){let t=e!=null&&e.type==="double"?e.validation:void 0;return{type:"double",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="double"?e.default:void 0}}function n9I(e){return typeof e=="boolean"?e?Bh.unknown():void 0:typeof e=="string"?{type:"id",value:Xh.TypeId(e),default:void 0}:u4(e)}function yLf(e,t){let r=e.service!=null?t.services[e.service]:void 0,n=e.webhooks!=null?t.webhookGroups[e.webhooks]:void 0,i=e.websocket!=null&&t.websocketChannels!=null?t.websocketChannels[e.websocket]:void 0;return{endpoints:r!=null?a9I(r,t):[],webhooks:n!=null?i9I(n):[],websockets:i!=null?[o9I(i,t)]:[],types:e.types.map(a=>Xh.TypeId(a)),subpackages:e.subpackages.map(a=>Xh.api.v1.SubpackageId(a)),pointsTo:e.navigationConfig!=null?Xh.api.v1.SubpackageId(e.navigationConfig.pointsTo):void 0}}function i9I(e){return e.map(t=>{let r=[];return t.v2Examples!=null?(r.push(...Object.values(t.v2Examples.userSpecifiedExamples)),r.push(...Object.values(t.v2Examples.autogeneratedExamples))):r.push(...t.examples?.map(n=>({payload:n.payload.jsonExample}))??[]),{description:t.docs??void 0,id:Xh.WebhookId(t.name.originalName),path:[],method:t.method,name:t.displayName??Vna(t.name.originalName),headers:t.headers.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:u4(n.valueType),availability:die(n.availability)})),payload:h9I(t.payload),examples:r}})}function a9I(e,t){let r=[];for(let n of e.endpoints){let i=n.autogeneratedExamples[0],a=[];if(n.v2Examples!=null){let c,f=n.v2Examples.userSpecifiedExamples,u=n.v2Examples.autogeneratedExamples,s=Object.values(f).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(f))c=ybv({shouldUseExampleName:s,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c);let l=Object.values(u).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(u))c=ybv({shouldUseExampleName:l,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c)}else if(n.userSpecifiedExamples.length>0)a.push(...n.userSpecifiedExamples.map(c=>hLf({userSpecifiedExample:c,...i!=null&&{autogeneratedExample:i},irEndpoint:n,ir:t})).filter(_j));else if(i!=null){let c=hLf({autogeneratedExample:i,irEndpoint:n,ir:t});c!=null&&a.push(c)}else if(n.response?.body?.type==="fileDownload"){let c=Vto({ir:t,service:e,endpoint:{...n,response:void 0},typeDeclarations:t.types,skipOptionalRequestProperties:!0,generationResponse:{type:"success"}});if(c.type==="success"){let f=hLf({autogeneratedExample:c,irEndpoint:n,ir:t});if(f!=null){let u={...f,responseBodyV3:{type:"filename",value:"<bytes>"}};a.push(u)}}}let o={slug:void 0,availability:die(n.availability??e.availability),auth:n.auth,authV2:s9I(n.security),multiAuth:u9I(n.security),description:n.docs??void 0,method:d9I(n.method),defaultEnvironment:t.environments?.defaultEnvironment!=null?Xh.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?c9I({environmentsConfig:t.environments,endpoint:n}):void 0,id:Xh.EndpointId(n.name.originalName),originalEndpointId:n.id,name:n.displayName??Vna(n.name.originalName),path:n.basePath!=null?{pathParameters:n.pathParameters.map(c=>({description:c.docs??void 0,key:Xh.PropertyKey(c.name.originalName),type:u4(c.valueType),availability:void 0,explode:void 0})),parts:[...Fao(n.basePath),...Fao(n.path)]}:{pathParameters:[...t.pathParameters,...e.pathParameters,...n.pathParameters].map(c=>({description:c.docs??void 0,key:Xh.PropertyKey(c.name.originalName),type:u4(c.valueType),availability:void 0,explode:void 0})),parts:[...t.basePath!=null?Fao(t.basePath):[],...Fao(e.basePath),...Fao(n.path)]},queryParameters:n.queryParameters.map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:u4(c.valueType),availability:die(c.availability),explode:void 0})),headers:[...e.headers,...n.headers].map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:u4(c.valueType),availability:die(c.availability)})),request:n.requestBody!=null?_bv(n.requestBody):void 0,requestsV2:{requests:n.v2RequestBodies?.requestBodies?.map(_bv).filter(_j)},response:n.response!=null?hbv(n.response):void 0,responsesV2:{responses:n.v2Responses?.responses?.map(hbv).filter(_j)},errors:void 0,errorsV2:p9I(n.errors,t),examples:a,protocol:n.source?._visit({openapi:()=>({type:"rest"}),openrpc:()=>({type:"openrpc",methodName:n.id}),proto:c=>({type:"grpc",methodName:n.id,methodType:c.methodType}),_other:()=>{}}),includeInApiExplorer:n.apiPlayground};r.push(o)}return r}function o9I(e,t){let r=[];if(e.v2Examples!=null&&(Object.keys(e.v2Examples.userSpecifiedExamples).length>0||Object.keys(e.v2Examples.autogeneratedExamples).length>0)){let n=Object.values(e.v2Examples.userSpecifiedExamples),i=Object.values(e.v2Examples.autogeneratedExamples),a=n.length>0?n[0]:i[0];a!=null&&r.push({name:"",description:"",path:a.baseUrl??"",pathParameters:a.pathParameters??{},queryParameters:a.queryParameters??{},headers:a.headers??{},messages:a.messages?.map(o=>({type:Xh.api.v1.WebSocketMessageId(o.type),body:o.body}))??[]})}else r=e.examples.map(n=>({name:n.name?.originalName,description:n.docs,path:n.url,pathParameters:n.pathParameters.reduce((i,a)=>(i[Xh.PropertyKey(a.name.originalName)]=a.value.jsonExample,i),{}),queryParameters:n.queryParameters.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),headers:n.headers.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),messages:n.messages.map(i=>({type:Xh.api.v1.WebSocketMessageId(i.type),body:i.body.jsonExample}))}));return{auth:e.auth,availability:die(e.availability),description:e.docs??void 0,defaultEnvironment:t.environments?.defaultEnvironment!=null?Xh.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?l9I({environmentsConfig:t.environments,channel:e}):[],id:Xh.WebSocketId(e.name.originalName),name:e.displayName??Vna(e.name.originalName),path:{pathParameters:e.pathParameters.map(n=>({description:n.docs??void 0,key:Xh.PropertyKey(n.name.originalName),type:u4(n.valueType),availability:void 0,explode:void 0})),parts:Fao(e.path)},headers:e.headers.map(n=>({key:n.name.wireValue,type:u4(n.valueType),description:n.docs,availability:die(n.availability)})),queryParameters:e.queryParameters.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:u4(n.valueType),availability:die(n.availability),explode:void 0})),messages:e.messages.map(n=>({type:Xh.api.v1.WebSocketMessageId(n.type),displayName:n.displayName,origin:n.origin,body:y9I(n.body),description:n.docs,availability:die(n.availability)})),examples:r}}function s9I(e){if(e==null)return;if(e.length===0)return[];let t=new Set(e.flatMap(r=>Object.keys(r)));return Array.from(t).map(r=>Xh.AuthSchemeId(r))}function u9I(e){if(e!=null)return e.length===0?[]:e.map(t=>({schemes:Object.keys(t).map(r=>Xh.AuthSchemeId(r))}))}function die(e){if(e!=null)switch(e.status){case"DEPRECATED":return Xh.Availability.Deprecated;case"PRE_RELEASE":return Xh.Availability.Beta;case"GENERAL_AVAILABILITY":return Xh.Availability.GenerallyAvailable;case"IN_DEVELOPMENT":return Xh.Availability.Beta;default:Zu(e.status)}}function c9I({environmentsConfig:e,endpoint:t}){let r=e.environments,n=t.baseUrl,i=t.v2BaseUrls;switch(r.type){case"singleBaseUrl":return r.environments.map(a=>({id:Xh.EnvironmentId(a.id),baseUrl:a.url}));case"multipleBaseUrls":if(i!=null)return i.flatMap(o=>r.environments.map(c=>{let f=c.urls[o];if(f==null)throw new Error(`Encountered undefined server name "${o}" at endpoint ${t.method.toUpperCase()} ${t.path}. Expected environment ${c.id} to contain url for ${o}`);return{id:Xh.EnvironmentId(o),baseUrl:f}})).filter((o,c,f)=>c===f.findIndex(u=>u.id===o.id&&u.baseUrl===o.baseUrl));if(n==null)throw new Error(`Expected endpoint ${t.name.originalName} to have base url.`);return r.environments.map(a=>{let o=a.urls[n];if(o==null)throw new Error(`Encountered undefined server name "${n}" at endpoint ${t.method.toUpperCase()} ${t.path.head}. Expected environment ${a.id} to contain url for ${n}`);return{id:Xh.EnvironmentId(a.id),baseUrl:o}});default:Zu(r)}}function l9I({environmentsConfig:e,channel:t}){let r=e.environments,n=t.baseUrl;switch(r.type){case"singleBaseUrl":return r.environments.map(i=>({id:Xh.EnvironmentId(i.id),baseUrl:f9I(i.url,"wss")}));case"multipleBaseUrls":if(n==null)throw new Error(`Expected channel ${t.name.originalName} to have base url.`);return r.environments.map(i=>{let a=i.urls[n];if(a==null)throw new Error(`Encountered undefined server name ${a} at channel ${t.name.originalName} ${t.path.head}. Expected environment ${i.id} to contain url for ${n}`);return{id:Xh.EnvironmentId(i.id),baseUrl:a}});default:Zu(r)}}function f9I(e,t){return e.replace(/^[^:]+/,t)}function d9I(e){return ip.http.HttpMethod._visit(e,{get:()=>Xh.HttpMethod.Get,post:()=>Xh.HttpMethod.Post,put:()=>Xh.HttpMethod.Put,patch:()=>Xh.HttpMethod.Patch,delete:()=>Xh.HttpMethod.Delete,head:()=>Xh.HttpMethod.Head,_other:()=>{throw new Error("Unknown http method: "+e)}})}function Fao(e){let t=e.parts.flatMap(r=>[{type:"pathParameter",value:Xh.PropertyKey(r.pathParameter)},{type:"literal",value:r.tail}]);return[{type:"literal",value:e.head},...t]}function _bv(e){let t=ip.http.HttpRequestBody._visit(e,{inlinedRequestBody:r=>({type:"json",contentType:r.contentType??R2.APPLICATION_JSON,shape:{type:"object",extends:r.extends.map(n=>Xh.TypeId(n.typeId)),properties:r.properties.map(n=>({description:n.docs??void 0,key:Xh.PropertyKey(n.name.wireValue),valueType:u4(n.valueType),availability:die(n.availability),propertyAccess:n.propertyAccess})),extraProperties:r.extraProperties?{type:"unknown"}:void 0}}),reference:r=>({type:"json",contentType:r.contentType??R2.APPLICATION_JSON,shape:{type:"reference",value:u4(r.requestBodyType)},description:r.docs??void 0}),fileUpload:r=>({type:"fileUpload",value:{name:r.name.originalName,description:void 0,availability:void 0,properties:r.properties.map(n=>n._visit({file:i=>{let a=i._visit({file:o=>({type:"file",key:Xh.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),fileArray:o=>({type:"fileArray",key:Xh.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),_other:()=>{}});if(a!=null)return{type:"file",value:a}},bodyProperty:i=>({type:"bodyProperty",key:Xh.PropertyKey(i.name.wireValue),valueType:u4(i.valueType),contentType:i.contentType,description:i.docs??void 0,availability:die(i.availability),exploded:i.style==="exploded",propertyAccess:void 0}),_other:()=>{}})).filter(_j)},contentType:r.contentType,description:r.docs??void 0}),bytes:r=>({type:"bytes",description:r.docs??void 0,availability:void 0,isOptional:r.isOptional,contentType:r.contentType}),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}});return t!=null?{type:t,description:e.docs}:void 0}function hbv(e){if(e.body==null)return;let t,r=ip.http.HttpResponseBody._visit(e.body,{fileDownload:n=>(t=n.docs,{type:"fileDownload",contentType:void 0}),json:n=>(t=n.docs,{type:"reference",value:u4(n.responseBodyType)}),text:()=>{},bytes:()=>{},streamParameter:()=>{},streaming:n=>{if(n.type==="text")return t=n.docs,{type:"streamingText"};if(n.type==="json")return t=n.docs,{type:"stream",shape:{type:"reference",value:u4(n.payload)},terminator:n.terminator};if(n.type==="sse")return t=n.docs,{type:"stream",shape:{type:"reference",value:u4(n.payload)},terminator:n.terminator}},_other:()=>{throw new Error("Unknown HttpResponse: "+e.body)}});return r!=null?{type:r,statusCode:e.statusCode,description:t}:e.statusCode!=null?{statusCode:e.statusCode,description:t,type:{type:"object",extends:[],properties:[],extraProperties:void 0}}:void 0}function p9I(e,t){let r=[];if(t.errorDiscriminationStrategy.type==="statusCode")for(let n of e){let i=t.errors[n.error.errorId];i&&r.push({type:i.type==null?void 0:{type:"alias",value:u4(i.type)},statusCode:i.statusCode,description:i.docs??void 0,name:i.displayName??i.name.name.originalName,availability:void 0,examples:v9I(i)})}else for(let n of e){let i=t.errors[n.error.errorId];if(i){let a=[{key:Xh.PropertyKey(t.errorDiscriminationStrategy.discriminant.wireValue),valueType:{type:"literal",value:{type:"stringLiteral",value:i.discriminantValue.name.originalName}},description:i.docs,availability:void 0,propertyAccess:void 0}];i.type!=null&&a.push({key:Xh.PropertyKey(t.errorDiscriminationStrategy.contentProperty.wireValue),valueType:u4(i.type),description:i.docs,availability:void 0,propertyAccess:void 0}),r.push({type:i.type==null?void 0:{type:"object",extends:[],properties:a,extraProperties:void 0},statusCode:i.statusCode,description:i.docs??void 0,availability:void 0,name:i.displayName??i.name.name.originalName,examples:i.examples.map(o=>({name:o.name?.originalName,responseBody:{type:"json",value:o.jsonExample},description:o.docs}))})}}return r}function ybv({shouldUseExampleName:e,exampleName:t,example:r,irEndpoint:n,irService:i,ir:a}){if(r==null)return;let o=u=>{if(u.valueType.type==="container"&&u.valueType.container.type==="literal")return u.valueType.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}});if(u.valueType.type==="container"&&u.valueType.container.type==="optional"&&u.valueType.container.optional.type==="container"&&u.valueType.container.optional.container.type==="literal")return u.valueType.container.optional.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}})},c={};a.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),i.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),n.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)});let f=r.response?.body!=null?r.response.body.value:void 0;return{name:e?t:void 0,description:"",path:r.request?.endpoint.path??"",pathParameters:r.request?.pathParameters??{},queryParameters:r.request?.queryParameters??{},headers:(()=>{let s={...r.request?.headers??{}};for(let[l,m]of Object.entries(c))(s[l]===null||s[l]===void 0)&&(s[l]=m);return s})(),requestBody:r.request?.requestBody,requestBodyV3:n.requestBody?._visit({inlinedRequestBody:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,reference:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,fileUpload:u=>{if(r.request==null)return;let s={};if(QD(r.request.requestBody)){let l=r.request.requestBody;for(let m of u.properties)m._visit({file:O=>{let P=l[O.key.wireValue];if(O.type==="file")s[O.key.wireValue]={type:"filename",value:typeof P=="string"?P:"<file1>"};else if(O.type==="fileArray"){let C=(Array.isArray(P)?P:[P]).filter(M=>typeof M=="string");s[O.key.wireValue]={type:"filenames",value:C}}},bodyProperty:O=>{if(O.style==="exploded"){let P=l[O.name.wireValue];s[O.name.wireValue]={type:"exploded",value:Array.isArray(P)?P:[P]}}else s[O.name.wireValue]={type:"json",value:l[O.name.wireValue]}},_other:Pdt})}return{type:"form",value:s}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??n.response?.statusCode??200,responseBody:f??void 0,responseBodyV3:f!=null?r.response?.body?._visit({json:u=>({type:"json",value:u}),stream:u=>Array.isArray(u)&&u.length>0&&u.every(_9I)?{type:"sse",value:u}:{type:"stream",value:u},error:()=>{},_other:()=>{throw new Error("Unknown ExampleResponseBody: "+r.response?.body?.type)}}):void 0,codeSamples:r.codeSamples?.map(u=>({name:u.name,description:u.docs??void 0,install:void 0,language:u.language,code:u.code})).filter(_j)}}function _9I(e){return typeof e=="object"&&e!==null&&"event"in e&&typeof e?.event=="string"&&"data"in e}function hLf({userSpecifiedExample:e,autogeneratedExample:t,irEndpoint:r,ir:n}){let i=n.headers.map(c=>{let f;if(c.valueType.type==="container"&&c.valueType.container.type==="literal"?f=c.valueType.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}}):c.valueType.type==="container"&&c.valueType.container.type==="optional"&&c.valueType.container.optional.type==="container"&&c.valueType.container.optional.container.type==="literal"&&(f=c.valueType.container.optional.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}})),f!=null)return{name:c.name,value:{jsonExample:f,shape:ip.ExampleTypeReferenceShape.primitive(ip.ExamplePrimitive.string({original:f}))}}}).filter(_j),a=e?.example??t?.example;if(a==null)return;let{codeSamples:o}=e??{codeSamples:[]};return{name:a.name?.originalName,description:a.docs,path:a.url,pathParameters:[...a.rootPathParameters,...a.servicePathParameters,...a.endpointPathParameters].reduce((c,f)=>(c[Xh.PropertyKey(f.name.originalName)]=f.value.jsonExample,c),{}),queryParameters:a.queryParameters.reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),headers:[...i,...a.serviceHeaders,...a.endpointHeaders].reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),requestBody:a.request?.jsonExample,requestBodyV3:r.requestBody?._visit({inlinedRequestBody:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,reference:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,fileUpload:c=>{if(a.request==null)return;let f={};if(QD(a.request.jsonExample)){let u=a.request.jsonExample;for(let s of c.properties)s._visit({file:l=>{let m=u[l.key.wireValue];if(l.type==="file")f[l.key.wireValue]={type:"filename",value:typeof m=="string"?m:"<file1>"};else if(l.type==="fileArray"){let O=(Array.isArray(m)?m:[m]).filter(P=>typeof P=="string");f[l.key.wireValue]={type:"filenames",value:O}}},bodyProperty:l=>{if(l.style==="exploded"){let m=u[l.name.wireValue];f[l.name.wireValue]={type:"exploded",value:Array.isArray(m)?m:[m]}}else f[l.name.wireValue]={type:"json",value:u[l.name.wireValue]}},_other:Pdt})}return{type:"form",value:f}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??ip.http.ExampleResponse._visit(a.response,{ok:c=>c._visit({body:f=>f!=null?200:204,stream:f=>f.length>0?200:204,sse:f=>f.length>0?200:204,_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:({error:c})=>{let f=n.errors[c.errorId];if(f==null)throw new Error("Cannot find error "+c.errorId);return f.statusCode},_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),responseBody:a.response._visit({ok:c=>c._visit({body:f=>f?.jsonExample,stream:()=>{},sse:()=>{},_other:()=>{}}),error:c=>c.body?.jsonExample,_other:()=>{}}),responseBodyV3:a.response._visit({ok:c=>c._visit({body:f=>f!=null?{type:"json",value:f.jsonExample}:void 0,stream:f=>({type:"stream",value:f.map(u=>u.jsonExample)}),sse:f=>({type:"sse",value:f.map(({event:u,data:s})=>({event:u,data:s.jsonExample}))}),_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:c=>c.body!=null?{type:"json",value:c.body.jsonExample}:void 0,_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),codeSamples:o?.map(c=>Prt._visit(c,{language:f=>({language:f.language,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:f.install}),sdk:f=>({language:f.sdk,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:void 0}),_other:()=>{}})).filter(_j)}}function h9I(e){switch(e.type){case"inlinedPayload":return{type:{type:"object",extends:e.extends.map(t=>Xh.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:Xh.PropertyKey(t.name.wireValue),valueType:u4(t.valueType),availability:die(t.availability),propertyAccess:void 0})),extraProperties:void 0},description:void 0};case"reference":return{type:{type:"reference",value:u4(e.payloadType)},description:e.docs};default:Zu(e)}}function y9I(e){switch(e.type){case"inlinedBody":return{type:"object",extends:e.extends.map(t=>Xh.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:Xh.PropertyKey(t.name.wireValue),valueType:u4(t.valueType),availability:die(t.availability),propertyAccess:void 0})),extraProperties:void 0};case"reference":return{type:"reference",value:u4(e.bodyType)};default:Zu(e)}}function v9I(e){let t=e.v2Examples?.userSpecifiedExamples,r=e.v2Examples?.autogeneratedExamples,n=e.examples;return t!=null&&Object.keys(t).length>0?Object.entries(t).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):r!=null&&Object.keys(r).length>0?Object.entries(r).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):n.length>0?n.map(i=>({name:i.name?.originalName,responseBody:{type:"json",value:i.jsonExample},description:i.docs})):[]}function LCe({ir:e,snippetsConfig:t,playgroundConfig:r,context:n}){let i={types:{},subpackages:{},rootPackage:yLf(e.rootPackage,e),auth:cbv({auth:e.auth,playgroundConfig:r,context:n}),authSchemes:fbv({auth:e.auth,playgroundConfig:r,context:n}),snippetsConfiguration:t,globalHeaders:e.headers.map(a=>({availability:die(a.availability),description:a.docs??void 0,key:a.name.wireValue,type:u4(a.valueType)})),navigation:void 0};for(let[a,o]of Object.entries(e.types))i.types[Xh.TypeId(a)]={description:o.docs??void 0,name:o.name.name.originalName,shape:pbv(o.shape),availability:die(o.availability),displayName:o.name.displayName};for(let[a,o]of Object.entries(e.subpackages)){let c=o.service!=null?e.services[o.service]:void 0;i.subpackages[Xh.api.v1.SubpackageId(a)]={subpackageId:Xh.api.v1.SubpackageId(a),displayName:c?.displayName??o.displayName,name:o.name.originalName,description:o.docs??void 0,...yLf(o,e)}}return i}async function vLf({organization:e,workspace:t,context:r,token:n,audiences:i,snippetsConfig:a,playgroundConfig:o}){let c=zG({workspace:t,audiences:i,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:r,sourceResolver:new xG(r,t)}),f=Ssa({token:n.value}),u=LCe({ir:c,snippetsConfig:a,playgroundConfig:o,context:r}),s=await f.api.v1.register.registerApiDefinition({orgId:Xh.OrgId(e),apiId:Xh.ApiId(c.apiName.originalName),definition:u});if(s.ok)return r.logger.debug(`Registered API Definition ${s.body.apiDefinitionId}`),{id:s.body.apiDefinitionId,ir:c};switch(s.error.error){case"UnauthorizedError":case"UserNotInOrgError":return r.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return r.failAndThrow("Failed to register API",s.error)}}var b9I=new ilu({snippetsBySdkId:{},snippetsConfigWithSdkId:{},snippetTemplatesByEndpoint:{},snippetsBySdkIdAndEndpointId:{},snippetTemplatesByEndpointId:{}});function Mrs({ir:e,apiDefinitionId:t,playgroundConfig:r,context:n}){return alu(rlu(LCe({ir:e,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:r,context:n}),gve.ApiDefinitionId(t),b9I))}var vbv=Hi(require("path"),1);async function eyt({iconPath:e,filepaths:t}){e!=null&&typeof e=="string"&&vbv.default.isAbsolute(e)&&t.add(e)}async function bbv({parsedDocsConfig:e}){let t=new Set;return e.logo?.dark!=null&&t.add(e.logo.dark),e.logo?.light!=null&&t.add(e.logo.light),e.favicon!=null&&t.add(e.favicon),e.backgroundImage?.dark!=null&&t.add(e.backgroundImage.dark),e.backgroundImage?.light!=null&&t.add(e.backgroundImage.light),e.metadata?.["og:image"]!=null&&e.metadata["og:image"].type==="filepath"&&t.add(e.metadata["og:image"].value),e.metadata?.["og:logo"]!=null&&e.metadata["og:logo"].type==="filepath"&&t.add(e.metadata["og:logo"].value),e.metadata?.["twitter:image"]!=null&&e.metadata["twitter:image"].type==="filepath"&&t.add(e.metadata["twitter:image"].value),e.typography?.bodyFont!=null&&e.typography.bodyFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.headingsFont!=null&&e.typography.headingsFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.codeFont!=null&&e.typography.codeFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.navigation.type==="productgroup"&&e.navigation.products.forEach(n=>{n.image!=null&&t.add(n.image)}),(await bLf({navigation:e.navigation})).forEach(n=>{t.add(n)}),e.navbarLinks&&await Promise.all(e.navbarLinks.map(async n=>{n.type==="dropdown"&&n.links.map(async i=>{i.icon&&await eyt({iconPath:i.icon,filepaths:t}),i.rightIcon&&await eyt({iconPath:i.rightIcon,filepaths:t})}),n.type!=="github"&&(n.icon&&await eyt({iconPath:n.icon,filepaths:t}),n.rightIcon&&await eyt({iconPath:n.rightIcon,filepaths:t}))})),e.js!=null&&e.js.files.forEach(n=>{t.add(n.absolutePath)}),t}async function bLf({navigation:e}){let t=new Set;switch(e.type){case"untabbed":await Promise.all(e.items.map(r=>xao({item:r,filepaths:t})));break;case"tabbed":await Promise.all(e.items.map(async r=>{r.icon!=null&&await eyt({iconPath:r.icon,filepaths:t}),r.child.type==="layout"&&r.child.layout!=null?await Promise.all(r.child.layout.map(n=>xao({item:n,filepaths:t}))):r.child.type==="variants"&&r.child.variants!=null&&await Promise.all(r.child.variants.flatMap(n=>{let i=[];return n.icon!=null&&i.push(eyt({iconPath:n.icon,filepaths:t})),i.push(...n.layout.map(a=>xao({item:a,filepaths:t}))),i}))}));break;case"versioned":await Promise.all(e.versions.map(async r=>{r.landingPage!=null&&await xao({item:r.landingPage,filepaths:t}),(await bLf({navigation:r.navigation})).forEach(i=>t.add(i))}));break;case"productgroup":await Promise.all(e.products.map(async r=>{r.icon!=null&&await eyt({iconPath:r.icon,filepaths:t}),r.type==="internal"&&(r.landingPage!=null&&await xao({item:r.landingPage,filepaths:t}),(await bLf({navigation:r.navigation})).forEach(i=>t.add(i)))}));break}return t}async function xao({item:e,filepaths:t}){switch(e.type){case"page":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break;case"section":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t}),await Promise.all(e.contents.map(r=>xao({item:r,filepaths:t})));break;case"apiSection":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break;case"link":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break;case"changelog":e.icon!=null&&await eyt({iconPath:e.icon,filepaths:t});break}}async function gbv({navigation:e,apiWorkspaces:t,visitor:r,context:n}){m9I(e)?await Promise.all(e.map(async i=>{O9I(i)?await Promise.all(i.layout.map(async a=>{await JLu({navigationItem:a,visitor:r,apiWorkspaces:t,context:n})})):A9I(i)&&await Promise.all(i.variants.flatMap(a=>a.layout.map(async o=>{await JLu({navigationItem:o,visitor:r,apiWorkspaces:t,context:n})})))})):await Promise.all(e.map(async i=>{await JLu({navigationItem:i,visitor:r,apiWorkspaces:t,context:n})}))}async function JLu({navigationItem:e,visitor:t,apiWorkspaces:r,context:n}){if(await P6r(e,{alphabetized:Tc,api:Tc,apiName:Tc,audiences:Tc,displayErrors:Tc,snippets:Tc,summary:Tc,title:Tc,layout:Tc,collapsed:Tc,icon:Tc,slug:Tc,hidden:Tc,skipSlug:Tc,paginated:Tc,playground:Tc,flattened:Tc,path:Tc,page:Tc,featureFlag:Tc,openrpc:Tc,postman:Tc,contents:async i=>{i!=null&&await Promise.all(i.map(async a=>{await JLu({navigationItem:a,visitor:t,apiWorkspaces:r,context:n})}))},viewers:Tc,orphaned:Tc,availability:Tc}),g9I(e)){let i=r.find(a=>a.workspaceName===e.apiName);i!=null&&await t.apiSection?.({config:e,workspace:i,context:n})}}function g9I(e){return e.api!=null}function m9I(e){return e[0]?.tab!=null}function O9I(e){return"layout"in e&&Array.isArray(e.layout)}function A9I(e){return"variants"in e&&Array.isArray(e.variants)}function Use(e){return e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`}Obv.default.extend(Abv.default);var P9I=e=>e.map(t=>({...t,fileId:String(t.relativeFilePath)})),mbv=0,w9I=async({ir:e})=>(mbv++,`${e.apiName.snakeCase.unsafeName}-${mbv}`),Hqr=class{domain;docsWorkspace;ossWorkspaces;apiWorkspaces;taskContext;editThisPage;uploadFiles;registerApi;targetAudiences;constructor({domain:t,docsWorkspace:r,ossWorkspaces:n,apiWorkspaces:i,taskContext:a,editThisPage:o,uploadFiles:c=P9I,registerApi:f=w9I,targetAudiences:u}){this.domain=t,this.docsWorkspace=r,this.ossWorkspaces=n,this.apiWorkspaces=i,this.taskContext=a,this.editThisPage=o,this.uploadFiles=c,this.registerApi=f,this.targetAudiences=u}#e=HLu.init();shouldIncludeByAudience(t){return!t||t.length===0||!this.targetAudiences||this.targetAudiences.length===0?!0:t.some(r=>this.targetAudiences?.includes(r))}applyAudienceFiltering(t){let r=this.filterNavigationByAudience(t.navigation);return{...t,navigation:r}}filterNavigationByAudience(t){return t.type==="untabbed"||t.type==="tabbed"?t:t.type==="versioned"?{...t,versions:t.versions.filter(r=>this.shouldIncludeByAudience(this.getRawVersionAudiences(r.version)))}:t.type==="productgroup"?{...t,products:t.products.filter(r=>{let n=this.getRawProductAudiences(r.product);return this.shouldIncludeByAudience(n)})}:t}getRawProductAudiences(t){let n=this.docsWorkspace.config.products?.find(i=>i.displayName===t);return mGo(n?.audiences)}getRawVersionAudiences(t){let n=this.docsWorkspace.config.versions?.find(i=>i.displayName===t);return mGo(n?.audiences)}_parsedDocsConfig;get parsedDocsConfig(){if(this._parsedDocsConfig==null)throw new Error("parsedDocsConfig is not set");return this._parsedDocsConfig}collectedFileIds=new Map;markdownFilesToFullSlugs=new Map;markdownFilesToNoIndex=new Map;markdownFilesToTags=new Map;rawMarkdownFiles={};async resolve(){this._parsedDocsConfig=await Qof({rawDocsConfiguration:this.docsWorkspace.config,context:this.taskContext,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absoluteFilepathToDocsConfig:this.docsWorkspace.absoluteFilepathToDocsConfig}),this.targetAudiences&&this.targetAudiences.length>0&&(this._parsedDocsConfig=this.applyAudienceFiltering(this._parsedDocsConfig));for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.rawMarkdownFiles[eu.of(l)]=m;let t=this.parsedDocsConfig.experimental?.openapiParserV3,r=t!=null&&!t;this.docsWorkspace.config.navigation!=null&&r&&await gbv({navigation:this.docsWorkspace.config.navigation,visitor:{apiSection:async({workspace:l})=>{(await l.toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,preserveSchemaIds:!0,objectQueryParameters:!0,respectReadonlySchemas:!0})).changelog?.files.forEach(O=>{let P=j3(this.docsWorkspace.absoluteFilePath,O.absoluteFilepath);this.parsedDocsConfig.pages[P]=O.contents,this.rawMarkdownFiles[eu.of(P)]=O.contents})}},apiWorkspaces:this.apiWorkspaces,context:this.taskContext}),this.markdownFilesToFullSlugs=await this.getMarkdownFilesToFullSlugs(this.parsedDocsConfig.pages),this.markdownFilesToNoIndex=await this.getMarkdownFilesToNoIndex(this.parsedDocsConfig.pages),this.markdownFilesToTags=await this.getMarkdownFilesToTags(this.parsedDocsConfig.pages);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[eu.of(l)]=await H5f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[eu.of(l)]=await G5f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});let n=await bbv({parsedDocsConfig:this.parsedDocsConfig});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))try{let{filepaths:O,markdown:P}=Zfa(m,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath});this.parsedDocsConfig.pages[eu.of(l)]=P;for(let C of O)n.add(C)}catch(O){throw this.taskContext.logger.error(`Failed to parse ${l}: ${O instanceof Error?O.message:String(O)}`),O}let i=Array.from(n).map(l=>({absoluteFilePath:l,relativeFilePath:this.toRelativeFilepath(l)}));(await this.uploadFiles(i)).forEach(l=>{this.collectedFileIds.set(l.absoluteFilePath,l.fileId)});let o=await this.toRootNode(),c=await this.getMarkdownFilesToFullyQualifiedPathNames(o);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[eu.of(l)]=W5f(m,this.collectedFileIds,c,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath},this.taskContext);let f={};Object.entries(this.parsedDocsConfig.pages).forEach(([l,m])=>{let O=j9I(this.editThisPage,l),P=this.rawMarkdownFiles[eu.of(l)];f[UDe.PageId(l)]={markdown:m,editThisPageUrl:O?UDe.Url(O):void 0,rawMarkdown:P}});let u=await this.convertDocsConfiguration(o),s={};if(this._parsedDocsConfig.experimental?.mdxComponents!=null){let l=new Set;await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async m=>{let O=d1(this.docsWorkspace.absoluteFilePath,m);(await(0,$Lu.stat)(O)).isDirectory()?(await sve(O,"{js,ts,jsx,tsx,md,mdx}")).forEach(M=>{l.add(M)}):O.match(/\.(js|ts|jsx|tsx|md|mdx)$/)!=null&&l.add(O)})),s=Object.fromEntries(await Promise.all([...l].map(async m=>{let O=this.toRelativeFilepath(m),P=(await(0,$Lu.readFile)(m)).toString();return[O,P]})))}return{config:u,pages:f,jsFiles:s}}resolveFilepath(t){if(t!=null)return d1(this.docsWorkspace.absoluteFilePath,t)}toRelativeFilepath(t){if(t!=null)return j3(this.docsWorkspace.absoluteFilePath,t)}async getMarkdownFilesToFullSlugs(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,KLu.default)(i).data.slug;typeof o=="string"&&o.trim().length>0&&r.set(this.resolveFilepath(n),o.trim())}return r}async getMarkdownFilesToNoIndex(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,KLu.default)(i).data.noindex;typeof o=="boolean"&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToTags(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,KLu.default)(i).data.tags;typeof o=="string"?r.set(this.resolveFilepath(n),o.split(",").map(c=>c.trim()).filter(c=>c.length>0)):Array.isArray(o)&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToFullyQualifiedPathNames(t){let r={},n=fl.migrate.FernNavigationV1ToLatest.create().root(t);return fl.NodeCollector.collect(n).slugMap.forEach((a,o)=>{if(a==null||!fl.isPage(a))return;let c=fl.getPageId(a);if(c==null)return;let f=Ql(this.docsWorkspace.absoluteFilePath,eu.of(c));r[f]=o}),r}getDocsBasePath(){return new URL(Use(this.domain)).pathname}async convertDocsConfiguration(t){return{aiChatConfig:this.parsedDocsConfig.aiChatConfig!=null?{model:this.parsedDocsConfig.aiChatConfig.model,systemPrompt:this.parsedDocsConfig.aiChatConfig.systemPrompt,location:this.parsedDocsConfig.aiChatConfig.location,datasources:this.parsedDocsConfig.aiChatConfig.datasources?.map(n=>({url:n.url,title:n.title}))}:void 0,hideNavLinks:void 0,title:this.parsedDocsConfig.title,logoHeight:this.parsedDocsConfig.logo?.height,logoHref:this.parsedDocsConfig.logo?.href?UDe.Url(this.parsedDocsConfig.logo?.href):void 0,favicon:this.getFileId(this.parsedDocsConfig.favicon),navigation:void 0,root:t,colorsV3:this.convertColorConfigImageReferences(),navbarLinks:this.parsedDocsConfig.navbarLinks?.map(n=>n.type==="dropdown"?{...n,links:n.links?.map(i=>({...i,url:UDe.Url(i.url),icon:this.resolveIconFileId(i.icon),rightIcon:this.resolveIconFileId(i.rightIcon)})),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}:n.type==="github"?{...n,url:UDe.Url(n.url)}:{...n,url:UDe.Url(n.url),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}),typographyV2:this.convertDocsTypographyConfiguration(),layout:this.parsedDocsConfig.layout,settings:this.parsedDocsConfig.settings,css:this.parsedDocsConfig.css,js:this.convertJavascriptConfiguration(),metadata:this.convertMetadata(),redirects:this.parsedDocsConfig.redirects,integrations:this.parsedDocsConfig.integrations,footerLinks:this.parsedDocsConfig.footerLinks?.map(n=>({...n,value:UDe.Url(n.value)})),defaultLanguage:this.parsedDocsConfig.defaultLanguage,languages:this.parsedDocsConfig.languages,analyticsConfig:{...this.parsedDocsConfig.analyticsConfig,segment:this.parsedDocsConfig.analyticsConfig?.segment,fullstory:this.parsedDocsConfig.analyticsConfig?.fullstory,intercom:this.parsedDocsConfig.analyticsConfig?.intercom?{appId:this.parsedDocsConfig.analyticsConfig.intercom.appId,apiBase:this.parsedDocsConfig.analyticsConfig.intercom.apiBase}:void 0,posthog:this.parsedDocsConfig.analyticsConfig?.posthog?{apiKey:this.parsedDocsConfig.analyticsConfig.posthog.apiKey,endpoint:this.parsedDocsConfig.analyticsConfig.posthog.endpoint}:void 0,gtm:this.parsedDocsConfig.analyticsConfig?.gtm?{containerId:this.parsedDocsConfig.analyticsConfig.gtm.containerId}:void 0,ga4:this.parsedDocsConfig.analyticsConfig?.ga4?{measurementId:this.parsedDocsConfig.analyticsConfig.ga4.measurementId}:void 0,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},announcement:this.parsedDocsConfig.announcement!=null?{text:this.parsedDocsConfig.announcement.message}:void 0,pageActions:this.parsedDocsConfig.pageActions,theme:this.parsedDocsConfig.theme!=null?{sidebar:this.parsedDocsConfig.theme.sidebar,body:this.parsedDocsConfig.theme.body,tabs:this.parsedDocsConfig.theme.tabs,"page-actions":this.parsedDocsConfig.theme.pageActions,footerNav:this.parsedDocsConfig.theme.footerNav}:void 0,logo:void 0,logoV2:void 0,colors:void 0,colorsV2:void 0,typography:void 0,backgroundImage:void 0}}getFernWorkspaceForApiSection(t){if(t.apiName!=null){let n=this.apiWorkspaces.find(i=>i.workspaceName===t.apiName);if(n!=null)return n}else if(this.apiWorkspaces.length===1&&this.apiWorkspaces[0]!=null)return this.apiWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs.
|
|
3040
3040
|
A valid API configuration was not found at the path: fern/apis/${t.apiName}.
|
|
3041
3041
|
Learn more about project structure:
|
|
3042
3042
|
https://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions`:`Failed to load API Definition referenced in docs.
|
|
@@ -3066,10 +3066,10 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
3066
3066
|
`,zkI=`@fern-fern:registry=https://npm.buildwithfern.com
|
|
3067
3067
|
`;async function Rns({bucketUrl:e,logger:t,preferCached:r,app:n=!1,tryTar:i=!1}){t.debug("Setting up docs preview bundle...");let a=await fetch(e);if(!a.ok)return{type:"failure"};let o=await a.text(),f=await new YCv.default.Parser().parseStringPromise(o),u=f?.ListBucketResult?.Contents?.[0]?.ETag?.[0],s=f?.ListBucketResult?.Contents?.[0]?.Key?.[0],l=FkI({app:n});if(r){let C=await Vv(l),M;if(C&&(t.debug("Reading existing ETag"),M=(await(0,Zxe.readFile)(l)).toString()),M!=null&&M===u)return t.debug("ETag matches. Using already downloaded bundle"),{type:"success"};t.debug("ETag is different. Downloading latest preview bundle"),n&&t.info(`Setting up docs preview bundle...
|
|
3068
3068
|
Please wait while the installation completes. This may take a few minutes depending on your connection speed.`)}t.debug("Creating tmp directory to download docs preview bundle");let m=await $Cv.default.dir({prefix:"fern"}),O=F_.of(m.path),P=new URL(s,e).href;t.debug(`Downloading docs preview bundle from ${P}`);try{let C=await fetch(P);if(!C.ok)throw new Error(`Failed to download docs preview bundle. Status code: ${C.status}`);let M=Ql(O,eu.of(i?"output.tar.gz":"output.zip"));if(C.body==null)throw Pda("Docs bundle has empty response body");let T=Buffer.from(await C.arrayBuffer());await(0,Zxe.writeFile)(M,new Uint8Array(T)),t.debug(`Wrote ${i?"output.tar.gz":"output.zip"} to ${M}`);let z=rWu({app:n});await Vv(z)&&(t.debug(`Removing previously cached bundle at: ${z}`),await(0,Zxe.rm)(z,{recursive:!0})),await(0,Zxe.mkdir)(z,{recursive:!0});let U=r6i({app:n});if(await(0,Zxe.mkdir)(U,{recursive:!0}),t.debug(`Decompressing bundle from ${M} to ${U}`),await(0,JCv.default)(M,U,{filter:q=>!(tWu&&q.type==="symlink")}),await(0,Zxe.writeFile)(l,u),t.debug(`Downloaded bundle to ${U}`),n){t.debug("Checking if pnpm is installed");try{await FG(t,tWu?"where":"which",["pnpm"],{cwd:U,doNotPipeOutput:!0})}catch{t.debug("pnpm not found, installing pnpm"),await FG(t,"npm",["install","-g","pnpm"],{doNotPipeOutput:!0})}try{await FG(t,tWu?"where":"which",["pnpm"],{cwd:U,doNotPipeOutput:!0})}catch{throw new Error("Requires [pnpm] to run local development. Please run: npm install -g pnpm, and then: fern docs dev")}try{t.debug("Installing esbuild"),await FG(t,"pnpm",["i","esbuild"],{cwd:U,doNotPipeOutput:!0})}catch(q){if(q instanceof Error)if(typeof q?.message=="string"&&q.message.includes(MkI)){t.debug("Detected corepack missing keyid error. Attempting to upgrade corepack");try{await FG(t,"npm",["install","-g","corepack@latest"],{doNotPipeOutput:!0})}catch(V){throw Pda(`Failed to update corepack due to error: ${V}`)}try{t.debug("Installing esbuild after upgrading corepack"),await FG(t,"pnpm",["i","esbuild"],{cwd:U,doNotPipeOutput:!0})}catch(V){throw Pda(`Failed to install required package after updating corepack due to error: ${V}`)}}else throw Pda(`Failed to install required package due to error: ${q}.`);else throw Pda(`Failed to install required package due to error: ${q}.`)}try{t.debug("Resolve esbuild imports"),await FG(t,"node",["install-esbuild.js"],{cwd:U,doNotPipeOutput:!0})}catch(q){throw Pda(`Failed to resolve imports due to error: ${q}`)}if(tWu){let q=qns({app:n}),V=TkI({app:n}),$=qkI({app:n}),re=RkI({app:n}),Y=NkI({app:n}),[k,ne,Oe,ye]=await Promise.all([Vv($),Vv(re),Vv(Y),Vv(V)]);k||t.warn(`Expected pnpm-workspace.yaml at ${$} but it does not exist. If you are experiencing issues, please contact support@buildwithfern.com.`),ne||(t.debug(`Writing pnpmfile.cjs at ${re}`),await(0,Zxe.writeFile)(re,xkI)),Oe||(t.debug(`Writing .npmrc at ${Y}`),await(0,Zxe.writeFile)(Y,zkI)),ye&&(t.debug(`Removing instrumentation.js at ${V}`),await(0,Zxe.rm)(V));try{t.debug("Running pnpm install within standalone"),await FG(t,"pnpm",["install"],{cwd:q,doNotPipeOutput:!0})}catch(ge){throw Pda(`Failed to install required package due to error: ${ge}`)}}}return{type:"success"}}catch(C){t.error(`Error: ${C}`);let M=rWu({app:n});return await Vv(M)&&await(0,Zxe.rm)(M,{recursive:!0}),t.debug(`Removing incomplete bundle: rm -rf ${M}`),{type:"failure"}}}var cIv=require("fs/promises"),lIv=Hi(Ort(),1);function Nns(e){if(e==null)return;let t=[],r=!1;if(lie(e,{enter(n){(n.type==="FunctionDeclaration"||n.type==="ArrowFunctionExpression"||n.type==="JSXOpeningElement"||n.type==="JSXOpeningFragment"||n.type==="Identifier")&&(r=!0,this.skip()),n.type==="Literal"&&t.push(n.value)}}),!r)return t.length===1?t[0]:void 0}function nWu(e){if(typeof e=="string")return e;if(e?.type==="mdxJsxAttributeValueExpression")return Nns(e.data?.estree)}function nWf(e){return e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"}function iWf(e){return e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"}function Fns(e){return e.type==="mdxJsxAttribute"}function aWf(e){return e.type==="mdxJsxExpressionAttribute"}var xns=Hi(Ort(),1),ZCv=require("path");var XCv=Hi(Ort(),1);function oWf(e){let{content:t}=(0,XCv.default)(e);return Gfa(t,{extensions:[dka(),ika(),Jfa()],mdastExtensions:[Vua(),xua(),Hfa()]})}function sWf(e,t){lie(e,{enter(r){r.type==="JSXElement"&&r.openingElement.attributes.forEach(n=>{n.type==="JSXAttribute"&&n.name.type==="JSXIdentifier"&&t[n.name.name]&&t[n.name.name]?.(n,r)})}})}function cWf(e,t){let{content:r,data:n}=(0,xns.default)(e,{}),i=r,a=new Set;function o(u){let s=joo(u,t);if(u&&s!=null)return a.add(s),s}nIv(n,["image","og:image","og:logo","twitter:image"],o),iIv(n,o);let c=oWf(r),f=0;return Uv(c,u=>{if(u.position==null)return;let{start:s,length:l}=rIv(r,u.position),m=i.slice(s+f,s+f+l),O=m;if(u.type==="image"){let C=kqr(u.url),M=joo(C,t);C!=null&&M!=null&&(a.add(M),O=O.replaceAll(C,M))}function P(C){sWf(C,{src:M=>{let T=kqr(Nns(M.value)),z=joo(T,t);T&&z&&(a.add(z),O=O.replaceAll(T,z))}})}if(nWf(u)){let C=u.attributes.filter(Fns).find(T=>T.name==="src"),M=kqr(nWu(C?.value));if(C&&M){let T=joo(M,t);T!=null&&(a.add(T),O=O.replaceAll(M,T))}u.attributes.forEach(T=>{Fns(T)&&typeof T.value!="string"&&T.value!=null&&T.value.data?.estree?P(T.value.data.estree):aWf(T)&&T.data?.estree&&P(T.data.estree)})}if(iWf(u)&&u.data?.estree&&P(u.data.estree),!(O===m&&a.size===0))return i=i.slice(0,s+f)+O+i.slice(s+f+l),f+=O.length-l,pm}),{filepaths:[...a],markdown:xns.default.stringify(i,n)}}function joo(e,{absolutePathToFernFolder:t,absolutePathToMarkdownFile:r}){return e==null||kCv(e)||eIv(e)?void 0:d1(e.startsWith("/")?t:Mg(r),eu.of(e.replace(/^\//,"")))}function kCv(e){return/^(https?:)?\/\//.test(e)}function eIv(e){return e.startsWith("data:")}function tIv({href:e,metadata:t,markdownFilesToPathName:r}){if(e!=null&&(e.endsWith(".md")||e.endsWith(".mdx"))){let n=joo(e,t);if(n!=null){let i=r[n];return i!=null?{type:"replace",slug:i.startsWith("/")?i:"/"+i,href:e}:{type:"missing-reference",path:n,href:e}}}}function lWf(e,t,r,n,i){let{content:a,data:o}=(0,xns.default)(e,{}),c=a,f=oWf(a),u=0;function s(l){if(l==null||kCv(l)||eIv(l))return;if((0,ZCv.isAbsolute)(l)){let O=F_.of(l),P=t.get(O);return P?`file:${P}`:void 0}let m=joo(l,n);if(m){let O=t.get(m);return O?`file:${O}`:void 0}}return nIv(o,["image","og:image","og:logo","twitter:image"],s),iIv(o,s),Uv(f,l=>{if(l.position==null)return;let{start:m,length:O}=rIv(a,l.position),P=c.slice(m+u,m+u+O),C=P;function M(U){let q=s(U);U&&q&&(C=C.replace(U,q))}function T(U){let q=tIv({href:U,markdownFilesToPathName:r,metadata:n});U!=null&&q!=null&&q.type==="replace"&&(C=C.replace(U,q.slug))}function z(U){sWf(U,{src:q=>M(kqr(Nns(q.value))),href:q=>T(kqr(Nns(q.value)))})}if(l.type==="image"){let U=kqr(l.url);M(kqr(U))}if(l.type==="link"&&T(kqr(l.url)),nWf(l)){let U=l.attributes.filter(Fns).find(V=>V.name==="src");M(kqr(nWu(U?.value)));let q=l.attributes.find(V=>V.type==="mdxJsxAttribute"&&V.name==="href");T(kqr(nWu(q?.value))),l.attributes.forEach(V=>{Fns(V)&&typeof V.value!="string"&&V.value!=null&&V.value.data?.estree?z(V.value.data.estree):aWf(V)&&V.data?.estree&&z(V.data.estree)})}if(iWf(l)&&l.data?.estree&&z(l.data.estree),C!==P)return c=c.slice(0,m+u)+C+c.slice(m+u+O),u+=C.length-O,pm}),xns.default.stringify(c,o)}function rIv(e,t){let r=e.split(`
|
|
3069
|
-
`),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function kqr(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function nIv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var QkI=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function uWf(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function iIv(e,t){let r=QkI.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=uWf(n,t):(n.light!=null&&(e.logo.light=uWf(n.light,t)),n.dark!=null&&(e.logo.dark=uWf(n.dark,t)))}var aIv=require("fs/promises");async function LkI(e){return(await(0,aIv.readFile)(e)).toString()}function UkI(e){return e.startsWith("http://")||e.startsWith("https://")}async function fWf({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=LkI}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m
|
|
3069
|
+
`),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function kqr(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function nIv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var QkI=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function uWf(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function iIv(e,t){let r=QkI.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=uWf(n,t):(n.light!=null&&(e.logo.light=uWf(n.light,t)),n.dark!=null&&(e.logo.dark=uWf(n.dark,t)))}var aIv=require("fs/promises");async function LkI(e){return(await(0,aIv.readFile)(e)).toString()}function UkI(e){return e.startsWith("http://")||e.startsWith("https://")}async function fWf({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=LkI}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m,O;if(UkI(s))try{let q=await fetch(s);if(!q.ok){n.logger.warn(`Failed to fetch code from URL "${s}" (status ${q.status}) referenced in ${r}`);break}l=await q.text();let $=new URL(s).pathname;m=$.split(".").pop(),O=$.split("/").pop()}catch(q){n.logger.warn(`Failed to fetch code from URL "${s}" referenced in ${r}: ${q}`);break}else{let q=d1(s.startsWith("/")?t:Mg(r),eu.of(s.replace(/^\//,"")));l=await i(q),m=q.split(".").pop(),O=q.split("/").pop()}let P=new Map,C=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,M=f?.split("src=")[0]?.trim()??"",T;for(;(T=C.exec(M))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}let z=c[3]?.trim()||"";for(C.lastIndex=0;(T=C.exec(z))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}P.delete("src"),P.has("language")&&(m=P.get("language"),P.delete("language")),P.has("title")&&(O=P.get("title"),P.delete("title"));let U="";m!=null&&(U+=m),O!=null&&(U+=` title={"${O}"}`);for(let[q,V]of P)U+=` ${q}={${V}}`;l=`\`\`\`${U}
|
|
3070
3070
|
${l}
|
|
3071
3071
|
\`\`\``,l=l.split(`
|
|
3072
|
-
`).map(
|
|
3072
|
+
`).map(q=>u+q).join(`
|
|
3073
3073
|
`),l=l+`
|
|
3074
3074
|
`,o=o.replace(f,l)}catch{n.logger.warn(`Failed to read markdown file "${s}" referenced in ${r}`);break}}return o}var oIv=require("fs/promises"),sIv=Hi(Ort(),1);async function VkI(e){let{content:t}=(0,sIv.default)(await(0,oIv.readFile)(e));return t}function WkI(e){let t={},r=/(\w+)=(?:{?['"]([^'"]+)['"]?}?|{([^}]+)})/g,n;for(;(n=r.exec(e))!=null;){let i=n[1],a=n[2]??n[3];i!=null&&a!=null&&(t[i]=a)}return t}function GkI(e){let t=new Set,r=/{{([A-Za-z_][A-Za-z0-9_]*)}}/g,n;for(;(n=r.exec(e))!=null;)n[1]!=null&&t.add(n[1]);return t}function HkI(e,t){return e.slice(0,t).split(`
|
|
3075
3075
|
`).length}function JkI(e,t){let r=e;for(let[n,i]of Object.entries(t)){let a=new RegExp(`\\{{${n}\\}}`,"g");r=r.replace(a,i)}return r}async function dWf({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,markdownLoader:i=VkI}){if(!e.includes("<Markdown"))return e;let a=/([ \t]*)<Markdown\s+([^>]+)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);let l=WkI(s),m=l.src;if(m==null||!m.match(/\.mdx?$/))continue;let O=d1(m.startsWith("/")?t:Mg(r),eu.of(m.replace(/^\//,"")));try{let P=await i(O),{src:C,...M}=l,T=GkI(P),z=new Set(Object.keys(M)),U=[...T].filter(q=>!z.has(q));if(U.length>0){let q=c.index??e.indexOf(f),V=HkI(e,q),$=String(r).split("/").pop()??String(r);for(let re of U)n.logger.warn(`[${r}:${V}] Markdown snippet missing property: \`${re}\``)}P=JkI(P,M),P=P.split(`
|