fern-api 0.78.5 → 0.78.6
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 +3 -3
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -2159,7 +2159,7 @@ ${gzh.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&aLl(th
|
|
|
2159
2159
|
`+pGi.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?pGi.default.cyan(Dzh(t,this.opt.mask)):pGi.default.italic(pGi.default.dim("[hidden]")):this.opt.mask?Dzh(t,this.opt.mask):pGi.default.italic(pGi.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 Ens=ea(Yae(),1);var D6h=ea(QLl(),1),wns=require("child_process"),u6a=require("fs"),Pns=ea(require("path"),1),C6h=ea(require("os"),1),I6h=require("crypto"),wUl=ea(E6h(),1);var mns=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var lNo=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var Ons=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var Ans=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function jns(e="",t,r){let n=new jUl(e,r);n.runAsync((i,a)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,a)}catch(u){setImmediate(t,u,void 0)}})}function S6h(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function v6S(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 jUl=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=v6S(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??C6h.default.tmpdir(),r=(0,I6h.randomUUID)(),n=S6h(this.fileOptions.prefix),i=S6h(this.fileOptions.postfix),a=`${n}${r}${i}`,u=Pns.default.resolve(t,a),c=Pns.default.resolve(t)+Pns.default.sep;if(!u.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=u;let p={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(p.mode=this.fileOptions.mode),(0,u6a.writeFileSync)(this.tempFile,this.text,p)}catch(t){throw new mns(t)}}readTemporaryFile(){try{let t=(0,u6a.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,D6h.detect)(t)??"utf8";wUl.default.encodingExists(r)||(r="utf8"),this.text=wUl.default.decode(t,r)}}catch(t){throw new Ons(t)}}removeTemporaryFile(){try{(0,u6a.unlinkSync)(this.tempFile)}catch(t){throw new Ans(t)}}launchEditor(){try{let t=(0,wns.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new lNo(t)}}launchEditorAsync(t){try{(0,wns.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new lNo(r)}}};var M6h=ea(aet(),1);var fNo=class extends Xae{_run(t){this.done=t,this.editorResult=new M6h.Subject;let r=uye(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"?Ens.default.dim("Received"):Ens.default.dim("Press <enter> to launch your preferred editor."),t&&(r=Ens.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),jns(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 R6h=require("stream");var q6h=ea(require("readline"),1),N6h=ea(T6h(),1),vGi=class{constructor(t){this.rl||=q6h.default.createInterface(g6S(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 g6S(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 N6h.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var dNo=class extends vGi{constructor(t={}){super(t),this.log=new R6h.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return $qo(this.rl,this.bottomBar.split(`
|
|
2160
2160
|
`).length),this}updateBottomBar(t){return $qo(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+`
|
|
2161
2161
|
`}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&&Krs(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var O4=ea(aet(),1),z6h=ea(yqo(),1);var Sns=ea(aet(),1),x6h=ea(yqo(),1),Dns=function(e,t,r){return typeof e[t]!="function"?(0,Sns.of)(e):(0,Sns.from)((0,x6h.default)(e[t])(r).then(n=>(e[t]=n,e)))};var F6h={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,a,u)=>{i==="__proto__"||i==="constructor"||(a===u.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((u,c)=>u!=null?u[c]:u,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},s6a=class extends vGi{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,O4.from)(t):(0,O4.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,O4.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,O4.from)([t]),this.process=n.pipe((0,O4.concatMap)(this.processQuestion.bind(this)),(0,O4.publish)()),this.process.connect(),this.process.pipe((0,O4.reduce)((i,a)=>(F6h.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,O4.defer)(()=>(0,O4.of)(t).pipe((0,O4.concatMap)(this.setDefaultType.bind(this)),(0,O4.concatMap)(this.filterIfRunnable.bind(this)),(0,O4.concatMap)(()=>Dns(t,"message",this.answers)),(0,O4.concatMap)(()=>Dns(t,"default",this.answers)),(0,O4.concatMap)(()=>Dns(t,"choices",this.answers)),(0,O4.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,O4.defer)(()=>(0,O4.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,O4.defer)(()=>(0,O4.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&F6h.get(this.answers,t.name)!==void 0)return O4.EMPTY;if(t.when===!1)return O4.EMPTY;if(typeof t.when!="function")return(0,O4.of)(t);let{answers:r}=this;return(0,O4.defer)(()=>(0,O4.from)((0,z6h.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,O4.filter)(n=>n!=null)))}};function Q6h(e){let t=function(r,n){let i;try{i=new s6a(t.prompts,e)}catch(u){return Promise.reject(u)}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",Xqo),this.registerPrompt("input",dGi),this.registerPrompt("number",Zqo),this.registerPrompt("confirm",kqo),this.registerPrompt("rawlist",eNo),this.registerPrompt("expand",tNo),this.registerPrompt("checkbox",rNo),this.registerPrompt("password",nNo),this.registerPrompt("editor",fNo)},t.restoreDefaultPrompts(),t}var SUl=Q6h();function O6S(e,t){SUl.registerPrompt(e,t)}function A6S(){SUl.restoreDefaultPrompts()}var P6S={prompt:SUl,ui:{BottomBar:dNo,Prompt:s6a},createPromptModule:Q6h,registerPrompt:O6S,restoreDefaultPrompts:A6S,Separator:RNe},Cns=P6S;var O6a=require("path"),E2h=require("fs"),S2h=require("readline"),X7h="posthog-node";function l8S(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[Zns.POSTHOG_ID_TAG];if(c===void 0)return a;let p=e.options.host??"https://us.i.posthog.com",s=new URL(`/project/${e.apiKey}/person/${c}`,p).toString();a.tags["PostHog Person URL"]=s;let o=a.exception?.values||[],l=o.map(A=>({...A,stacktrace:A.stacktrace?{...A.stacktrace,type:"raw",frames:(A.stacktrace.frames||[]).map(E=>({...E,platform:"node:javascript"}))}:void 0})),O={$exception_message:o[0]?.value||a.message,$exception_type:o[0]?.type,$exception_personURL:s,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:o[0]?.value||a.message,$sentry_exception_type:o[0]?.type,$sentry_tags:a.tags};return t&&r&&(O.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:O}),a}}var Zns=class{constructor(t,r,n,i){this.name=X7h,this.name=X7h,this.setupOnce=function(a,u){let c=u()?.getClient()?.getDsn()?.projectId;a(l8S(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};Zns.POSTHOG_ID_TAG="posthog_distinct_id";var Jns="0123456789abcdef",kns=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+=Jns.charAt(this.bytes[r]>>>4),t+=Jns.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+=Jns.charAt(this.bytes[r]>>>4),t+=Jns.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}},hVl=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??f8S()}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 kns.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,kns.ofInner(t)}},f8S=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),Z7h,yVl=()=>d8S().toString(),d8S=()=>(Z7h||(Z7h=new hVl)).generate();function p8S(e,t){let r=!1;return Object.assign(n=>{let a=global.process.listeners("uncaughtException").filter(u=>u.name!=="domainUncaughtExceptionClear"&&u._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function _8S(e,t){global.process.on("uncaughtException",p8S(e,t))}function h8S(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var Kns,k7h,$ns;function y8S(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return $ns&&r.length===k7h||(k7h=r.length,$ns=r.reduce((n,i)=>{Kns||(Kns={});let a=Kns[i];if(a)n[a[0]]=a[1];else{let u=e(i);for(let c=u.length-1;c>=0;c--){let s=u[c]?.filename,o=t[i];if(s&&o){n[s]=o,Kns[i]=[s,o];break}}}return n},{})),$ns}function v8S(e){return typeof Event<"u"&&D2h(e,Event)}function b8S(e){return C2h(e,"Object")}function wVl(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return D2h(e,Error)}}function D2h(e,t){try{return e instanceof t}catch{return!1}}function g8S(e){return C2h(e,"ErrorEvent")}function C2h(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function m8S(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},u=I2h(a,r,n);return{$exception_list:await Promise.all(u.map(async s=>{let o=await S8S(e,t,s);return o.value=o.value||"",o.type=o.type||"Error",o.mechanism=a,o}))}}function I2h(e,t,r){let n=O8S(e,t,r);return n.cause?[n,...I2h(e,n.cause,r)]:[n]}function O8S(e,t,r){if(wVl(t))return t;if(e.synthetic=!0,b8S(t)){let i=A8S(t);if(i)return i;let a=P8S(t),u=r?.syntheticException||new Error(a);return u.message=a,u}let n=r?.syntheticException||new Error(t);return n.message=`${t}`,n}function A8S(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(wVl(r))return r}}function P8S(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=j8S(e);if(g8S(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=w8S(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function w8S(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function j8S(e,t=40){let r=Object.keys(E8S(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return e2h(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:e2h(a,t)}return""}function e2h(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function E8S(e){return wVl(e)?{message:e.message,name:e.name,stack:e.stack,...t2h(e)}:v8S(e)?{type:e.type,target:r2h(e.target),currentTarget:r2h(e.currentTarget),...t2h(e)}:e}function t2h(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 r2h(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function S8S(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=D8S(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function D8S(e,t){return C8S(e(t.stack||"",1),e)}function C8S(e,t){let r=y8S(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var I8S=2e3,b6a=class e{static async captureException(t,r,n,i,a){let u={...a};i||(u.$process_person_profile=!1);let c=await m8S(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||yVl(),properties:{...c,...u}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(_8S(this.onException.bind(this),this.onFatalError.bind(this)),h8S(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(I8S)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function M8S(e=process.argv[1]?(0,O6a.dirname)(process.argv[1]):process.cwd(),t=O6a.sep==="\\"){let r=t?n2h(e):e;return n=>{if(!n)return;let i=t?n2h(n):n,{dir:a,base:u,ext:c}=O6a.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(u=u.slice(0,c.length*-1));let p=decodeURIComponent(u);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${p}`;if(a.startsWith(r)){let o=a.slice(r.length+1).replace(/\//g,".");return o?`${o}:${p}`:p}return p}}function n2h(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var eis=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)}}},Xns=new eis(25),M2h=new eis(20),jVl=7,B8S=1e3,T8S=1e4;async function q8S(e){let t={};for(let i=e.length-1;i>=0;i--){let a=e[i],u=a?.filename;if(!a||typeof u!="string"||typeof a.lineno!="number"||F8S(u)||z8S(a))continue;t[u]||(t[u]=[]),t[u].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(M2h.get(i))continue;let a=t[i];if(!a)continue;a.sort((p,s)=>p-s);let u=L8S(a);if(u.every(p=>Q8S(i,p)))continue;let c=U8S(Xns,i,{});n.push(N8S(i,u,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&R8S(e,Xns),Xns.reduce(),e}function N8S(e,t,r){return new Promise(n=>{let i=(0,E2h.createReadStream)(e),a=(0,S2h.createInterface)({input:i});function u(){i.destroy(),n()}let c=0,p=0,s=t[p];if(s===void 0){u();return}let o=s[0],l=s[1];function O(){M2h.set(e,1),a.close(),a.removeAllListeners(),u()}i.on("error",O),a.on("error",O),a.on("close",u),a.on("line",A=>{if(c++,!(c<o)&&(r[c]=V8S(A,0),c>=l)){if(p===t.length-1){a.close(),a.removeAllListeners();return}p++;let E=t[p];if(E===void 0){a.close(),a.removeAllListeners();return}o=E[0],l=E[1]}})})}function R8S(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;x8S(r.lineno,r,n)}}function x8S(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=B2h(e);i<e;i++){let a=r[i];if(a===void 0){i2h(t);return}t.pre_context.push(a)}if(r[e]===void 0){i2h(t);return}t.context_line=r[e];let n=T2h(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 i2h(e){delete e.pre_context,delete e.context_line,delete e.post_context}function F8S(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function z8S(e){return e.lineno!==void 0&&e.lineno>T8S||e.colno!==void 0&&e.colno>B8S}function Q8S(e,t){let r=Xns.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 L8S(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=a2h(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+jVl:(i.push(n),n=a2h(a)),t++}return i}function a2h(e){return[B2h(e),T2h(e)]}function B2h(e){return Math.max(1,e-jVl)}function T2h(e){return e+jVl}function U8S(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function V8S(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 W8S="4.18.0",LNe;(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"})(LNe||(LNe={}));var o2h;(function(e){e.Left="left",e.Right="right",e.Center="center"})(o2h||(o2h={}));var u2h;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(u2h||(u2h={}));var s2h;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(s2h||(s2h={}));var c2h;(function(e){e.Html="html",e.Text="text"})(c2h||(c2h={}));var l2h;(function(e){e.Number="number",e.Emoji="emoji"})(l2h||(l2h={}));var f2h;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(f2h||(f2h={}));var d2h;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(d2h||(d2h={}));var p2h;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(p2h||(p2h={}));var _2h;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(_2h||(_2h={}));var H8S=e=>{if("flags"in e){let t=J8S(e.flags),r=K8S(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,q2h(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,G8S(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function G8S(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 J8S=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,EVl(r)]).filter(([,t])=>t!==void 0)),K8S=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?q2h(n):void 0]}))},EVl=e=>e===void 0?void 0:e.variant??e.enabled,q2h=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},$8S=1,Y8S=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"]),X8S="utf8";function Z8S(e,t){if(!e||typeof e!="string"||k8S(e))throw new Error(t)}function k8S(e){return e.trim().length===0}function e5S(e){return e?.replace(/\/+$/,"")}async function t5S(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 h2h(){return new Date().getTime()}function pVl(){return new Date().toISOString()}function tis(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function r5S(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function n5S(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 i5S(e,t=0,r){let n=n5S(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function y2h(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var ANo=String.fromCharCode,v2h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Yns={};function a5S(e,t){if(!Yns[e]){Yns[e]={};for(let r=0;r<e.length;r++)Yns[e][e.charAt(r)]=r}return Yns[e][t]}var y6a={compressToBase64:function(e){if(e==null)return"";let t=y6a._compress(e,6,function(r){return v2h.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:y6a._decompress(e.length,32,function(t){return a5S(v2h,e.charAt(t))})},compress:function(e){return y6a._compress(e,16,function(t){return ANo(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],u,c,p="",s="",o="",l=2,O=3,A=2,E=0,C=0,M;for(M=0;M<e.length;M+=1)if(p=e.charAt(M),Object.prototype.hasOwnProperty.call(n,p)||(n[p]=O++,i[p]=!0),s=o+p,Object.prototype.hasOwnProperty.call(n,s))o=s;else{if(Object.prototype.hasOwnProperty.call(i,o)){if(o.charCodeAt(0)<256){for(u=0;u<A;u++)E=E<<1,C==t-1?(C=0,a.push(r(E)),E=0):C++;for(c=o.charCodeAt(0),u=0;u<8;u++)E=E<<1|c&1,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=c>>1}else{for(c=1,u=0;u<A;u++)E=E<<1|c,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=0;for(c=o.charCodeAt(0),u=0;u<16;u++)E=E<<1|c&1,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[o]}else for(c=n[o],u=0;u<A;u++)E=E<<1|c&1,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,A),A++),n[s]=O++,o=String(p)}if(o!==""){if(Object.prototype.hasOwnProperty.call(i,o)){if(o.charCodeAt(0)<256){for(u=0;u<A;u++)E=E<<1,C==t-1?(C=0,a.push(r(E)),E=0):C++;for(c=o.charCodeAt(0),u=0;u<8;u++)E=E<<1|c&1,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=c>>1}else{for(c=1,u=0;u<A;u++)E=E<<1|c,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=0;for(c=o.charCodeAt(0),u=0;u<16;u++)E=E<<1|c&1,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[o]}else for(c=n[o],u=0;u<A;u++)E=E<<1|c&1,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,A),A++)}for(c=2,u=0;u<A;u++)E=E<<1|c&1,C==t-1?(C=0,a.push(r(E)),E=0):C++,c=c>>1;for(;;)if(E=E<<1,C==t-1){a.push(r(E));break}else C++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:y6a._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},u=4,c=4,p=3,s="",o,l,O,A,E,C,M;for(o=0;o<3;o+=1)n[o]=o;for(O=0,E=Math.pow(2,2),C=1;C!=E;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),O|=(A>0?1:0)*C,C<<=1;switch(O){case 0:for(O=0,E=Math.pow(2,8),C=1;C!=E;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),O|=(A>0?1:0)*C,C<<=1;M=ANo(O);break;case 1:for(O=0,E=Math.pow(2,16),C=1;C!=E;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),O|=(A>0?1:0)*C,C<<=1;M=ANo(O);break;case 2:return""}for(n[3]=M,l=M,i.push(M);;){if(a.index>e)return"";for(O=0,E=Math.pow(2,p),C=1;C!=E;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),O|=(A>0?1:0)*C,C<<=1;switch(M=O){case 0:for(O=0,E=Math.pow(2,8),C=1;C!=E;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),O|=(A>0?1:0)*C,C<<=1;n[c++]=ANo(O),M=c-1,u--;break;case 1:for(O=0,E=Math.pow(2,16),C=1;C!=E;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),O|=(A>0?1:0)*C,C<<=1;n[c++]=ANo(O),M=c-1,u--;break;case 2:return i.join("")}if(u==0&&(u=Math.pow(2,p),p++),n[M])s=n[M];else if(M===c)s=l+l.charAt(0);else return null;i.push(s),n[c++]=l+s.charAt(0),u--,l=s,u==0&&(u=Math.pow(2,p),p++)}}},vVl=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)}},g6a=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()}},PNo=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function b2h(e){if(e instanceof g6a){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 _Vl(e){return typeof e=="object"&&(e instanceof g6a||e instanceof PNo)}function g2h(e){return typeof e=="object"&&e instanceof g6a&&e.status===413}var bVl;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(bVl||(bVl={}));var gVl=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new vVl,this._isInitialized=!1,Z8S(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=e5S(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:_Vl},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(LNe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(LNe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(LNe.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=yVl();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,u){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...u||{}}});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=i5S(this.apiKey,$8S,Y8S)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,p={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,p,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(s=>s.json()).then(s=>H8S(s)).catch(s=>{this._events.emit("error",s)})}async getFeatureFlagStateless(t,r,n={},i={},a={},u){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,n,i,a,u);if(c===void 0)return{response:void 0,requestId:void 0};let p=EVl(c.response);return p===void 0&&(p=!1),{response:p,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},a={},u){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,n,i,a,u,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,n={},i={},a={},u){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,n,i,a,u,[t]);if(!c)return;let p=c[t];return p===void 0?null:p}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},a,u){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,u)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},a,u){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,u)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},a,u){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,n,i,a,u);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,u){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),u&&(c.flag_keys_to_evaluate=u);let p=await this.getDecide(t,r,n,i,c);if(p!==void 0)return p.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"),p.quotaLimited?.includes(bVl.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:p?.requestId}):p}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 u=`Surveys API could not be loaded: ${a.status}`,c=new Error(u);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(u));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(LNe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(LNe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(LNe.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(LNe.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(LNe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=tis(()=>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:pVl()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${h2h()}&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(y6a.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(u,c)}catch(p){this._events.emit("error",p)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:pVl(),uuid:n?.uuid?n.uuid:yVl()};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 b2h(t)})}async flush(){let t=y2h([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),y2h([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(LNe.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(O=>O.message),u=()=>{let A=(this.getPersistedProperty(LNe.Queue)||[]).slice(i.length);this.setPersistedProperty(LNe.Queue,A),t=A},c={api_key:this.apiKey,batch:a,sent_at:pVl()};this.historicalMigration&&(c.historical_migration=!0);let p=JSON.stringify(c),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${h2h()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,o=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(y6a.compressToBase64(p))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:p},l={retryCheck:O=>g2h(O)?!1:_Vl(O)};try{await this.fetchWithRetry(s,o,l)}catch(O){if(g2h(O)&&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 O instanceof PNo||u(),this._events.emit("error",O),O}u(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){var a;(a=AbortSignal).timeout??(a.timeout=function(s){let o=new AbortController;return setTimeout(()=>o.abort(),s),o.signal});let u=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(u,X8S)}catch{c=new TextEncoder().encode(u).length}return await t5S(async()=>{let p=null;try{p=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(o){throw new PNo(o)}if(!(r.mode==="no-cors")&&(p.status<200||p.status>=400))throw new g6a(p,c);return p},{...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(LNe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!_Vl(i))throw i;await b2h(i)}};return Promise.race([new Promise((i,a)=>{tis(()=>{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}},mVl=r5S();if(!mVl){let e=Y7h();mVl=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 N2h=mVl,ris=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()}},R2h=new ris(async()=>{try{return await import("crypto")}catch{return}});async function o5S(){return await R2h.getValue()}var u5S=new ris(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await R2h.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function s5S(){return await u5S.getValue()}async function c5S(e){let t=await o5S();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await s5S();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 l5S=60*1e3,f5S=1152921504606847e3,d5S=["is_not"],v6a=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Zae=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},OVl=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:a,customHeaders:u,...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||N2h,this.onError=c.onError,this.customHeaders=u,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 u,c;if(!this.loadedSuccessfullyOnce)return u;for(let p of this.featureFlags)if(t===p.key){c=p;break}if(c!==void 0)try{u=await this.computeFlagLocally(c,r,n,i,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(p){p instanceof Zae?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${p}`)):p instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${p}`))}return u}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={},u={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async p=>{try{let s=await this.computeFlagLocally(p,t,r,n,i);a[p.key]=s;let o=await this.computeFeatureFlagPayloadLocally(p.key,s);o&&(u[p.key]=o)}catch(s){s instanceof Zae||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${p.key}: ${s}`)),c=!0}})),{response:a,payloads:u,fallbackToDecide:c}}async computeFlagLocally(t,r,n={},i={},a={}){if(t.ensure_experience_continuity)throw new Zae("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let p=this.groupTypeMapping[String(c)];if(!p)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new Zae("Flag has unknown group type index");if(!(p in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[p];return await this.matchFeatureFlagProperties(t,n[p],s)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],u=!1,c,p=[...a].sort((s,o)=>{let l=!!s.variant,O=!!o.variant;return l&&O?0:l?-1:O?1:0});for(let s of p)try{if(await this.isConditionMatch(t,r,s,n)){let o=s.variant,l=i.multivariate?.variants||[];o&&l.some(O=>O.key===o)?c=o:c=await this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof Zae)u=!0;else throw o}if(c!==void 0)return c;if(u)throw new Zae("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,u=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let p=c.type,s=!1;if(p==="cohort"?s=F2h(c,i,this.cohorts,this.debugMode):s=x2h(c,i,u),!s)return!1}if(a==null)return!0}return!(a!=null&&await m2h(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await m2h(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(l5S,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 v6a(`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 v6a(`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 v6a(`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 v6a&&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=tis(()=>{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=tis(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function m2h(e,t,r=""){let n=await c5S(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/f5S}function x2h(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 Zae("Operator is_not_set is not supported")}else throw new Zae(`Property ${n} not found in propertyValues`);let u=t[n];if(u==null&&!d5S.includes(a))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${a} operator`),!1;function c(s,o){return Array.isArray(s)?s.map(l=>String(l).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function p(s,o,l){if(l==="gt")return s>o;if(l==="gte")return s>=o;if(l==="lt")return s<o;if(l==="lte")return s<=o;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(i,u);case"is_not":return!c(i,u);case"is_set":return n in t;case"icontains":return String(u).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(i).toLowerCase());case"regex":return O2h(String(i))&&String(u).match(String(i))!==null;case"not_regex":return O2h(String(i))&&String(u).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof i=="number"?i:null;if(typeof i=="string")try{s=parseFloat(i)}catch{}return s!=null&&u!=null?typeof u=="string"?p(u,String(i),a):p(u,s,a):p(String(u),String(i),a)}case"is_date_after":case"is_date_before":{let s=p5S(String(i));if(s==null&&(s=A2h(i)),s==null)throw new Zae(`Invalid date: ${i}`);let o=A2h(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new Zae(`Unknown operator: ${a}`)}}function F2h(e,t,r,n=!1){let i=String(e.value);if(!(i in r))throw new Zae("can't match cohort without a given cohort property value");let a=r[i];return z2h(a,t,r,n)}function z2h(e,t,r,n=!1){if(!e)return!0;let i=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let c of a)try{let p=z2h(c,t,r,n);if(i==="AND"){if(!p)return!1}else if(p)return!0}catch(p){if(p instanceof Zae)n&&console.debug(`Failed to compute property ${c} locally: ${p}`),u=!0;else throw p}if(u)throw new Zae("Can't match cohort without a given cohort property value");return i==="AND"}else{for(let c of a)try{let p;c.type==="cohort"?p=F2h(c,t,r,n):p=x2h(c,t);let s=c.negation||!1;if(i==="AND"){if(!p&&!s||p&&s)return!1}else if(p&&!s||!p&&s)return!0}catch(p){if(p instanceof Zae)n&&console.debug(`Failed to compute property ${c} locally: ${p}`),u=!0;else throw p}if(u)throw new Zae("can't match cohort without a given cohort property value");return i==="AND"}}function O2h(e){try{return new RegExp(e),!0}catch{return!1}}function A2h(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 Zae(`${e} is in an invalid date format`)}else throw new Zae(`The date provided ${e} must be a string, number, or date object`)}function p5S(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 AVl=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},_5S=100,P2h=30*1e3,h5S=50*1e3,PVl=class extends gVl{constructor(t,r={}){if(super(t,r),this._memoryStorage=new AVl,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,_5S):P2h,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 OVl({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 b6a(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||h5S}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):N2h(t,r)}getLibraryVersion(){return W8S}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:u,timestamp:c,disableGeoip:p,uuid:s}=t,o=A=>{super.captureStateless(r,n,A,{timestamp:c,disableGeoip:p,uuid:s})},l=async(A,E,C)=>(await super.getFeatureFlagsStateless(A,E,void 0,void 0,C)).flags,O=Promise.resolve().then(async()=>{if(u)return await l(r,a,p);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[E,C]of Object.entries(a||{}))A[E]=String(C);return await this.getAllFlags(r,{groups:A,disableGeoip:p,onlyEvaluateLocally:!0})}return{}}).then(A=>{let E={};if(A)for(let[M,q]of Object.entries(A))E[`$feature/${M}`]=q;let C=Object.keys(A||{}).filter(M=>A?.[M]!==!1).sort();return C.length>0&&(E.$active_feature_flags=C),E}).catch(()=>({})).then(A=>{o({...A,...i,$groups:a})});this.addPendingPromise(O)}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:u,timestamp:c,disableGeoip:p,uuid:s}=t,o=A=>super.captureStatelessImmediate(r,n,A,{timestamp:c,disableGeoip:p,uuid:s}),l=async(A,E,C)=>(await super.getFeatureFlagsStateless(A,E,void 0,void 0,C)).flags;await Promise.resolve().then(async()=>{if(u)return await l(r,a,p);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[E,C]of Object.entries(a||{}))A[E]=String(C);return await this.getAllFlags(r,{groups:A,disableGeoip:p,onlyEvaluateLocally:!0})}return{}}).then(A=>{let E={};if(A)for(let[M,q]of Object.entries(A))E[`$feature/${M}`]=q;let C=Object.keys(A||{}).filter(M=>A?.[M]!==!1).sort();return C.length>0&&(E.$active_feature_flags=C),E}).catch(()=>({})).then(A=>{o({...A,...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=P2h){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:u,sendFeatureFlagEvents:c,personProperties:p,groupProperties:s}=n||{},o=this.addLocalPersonAndGroupProperties(r,i,p,s);p=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,p,s),O=l!==void 0,A,E;if(!O&&!u){let M=await super.getFeatureFlagDetailStateless(t,r,i,p,s,a);if(M===void 0)return;E=M.response,l=EVl(E),A=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:E?.metadata?.id,$feature_flag_version:E?.metadata?.version,$feature_flag_reason:E?.reason?.description??E?.reason?.code,locally_evaluated:O,[`$feature/${t}`]:l,$feature_flag_request_id:A},groups:i,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,n,i){let{groups:a,disableGeoip:u}=i||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:p,personProperties:s,groupProperties:o}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,s,o);s=l.allPersonProperties,o=l.allGroupProperties;let O;return this.featureFlagsPoller!==void 0&&(n||(n=await this.getFeatureFlag(t,r,{...i,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),n&&(O=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,n))),c==null&&(c=!1),p==null&&(p=!0),c==null&&(c=!1),!(O!==void 0)&&!c&&(O=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),O}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:u,groupProperties:c}=r||{},p=this.addLocalPersonAndGroupProperties(t,n,u,c);u=p.allPersonProperties,c=p.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,u,c),o={},l={},O=!0;if(s&&(o=s.response,l=s.payloads,O=s.fallbackToDecide),O&&!a){let A=await super.getFeatureFlagsAndPayloadsStateless(t,n,u,c,i);o={...o,...A.flags||{}},l={...l,...A.payloads||{}}}return{featureFlags:o,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||{}},u={};if(r)for(let c of Object.keys(r))u[c]={$group_key:r[c],...i?.[c]||{}};return{allPersonProperties:a,allGroupProperties:u}}captureException(t,r,n){let i=new Error("PostHog syntheticException");b6a.captureException(this,t,{syntheticException:i},r,n)}},w2h=/\(error: (.*)\)/,Q2h=50,L2h="?";function y5S(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,u,c,p,s;if(i[1]){c=i[1];let O=c.lastIndexOf(".");if(c[O-1]==="."&&O--,O>0){a=c.slice(0,O),u=c.slice(O+1);let A=a.indexOf(".Module");A>0&&(c=c.slice(A+1),a=a.slice(0,A))}p=void 0}u&&(p=a,s=u),u==="<anonymous>"&&(s=void 0,c=void 0),c===void 0&&(s=s||L2h,c=p?`${p}.${s}`:s);let o=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),!o&&i[5]&&!l&&(o=i[5]),{filename:o?decodeURI(o):void 0,module:e?e(o):void 0,function:c,lineno:j2h(i[3]),colno:j2h(i[4]),in_app:v5S(o||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function v5S(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 j2h(e){return parseInt(e||"",10)||void 0}function b5S(e){return[90,y5S(e)]}function g5S(e){let r=[b5S(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],u=n.split(`
|
|
2162
|
-
`);for(let c=i;c<u.length;c++){let p=u[c];if(p.length>1024)continue;let s=w2h.test(p)?p.replace(w2h,"$1"):p;if(!s.match(/\S*Error: /)){for(let o of r){let l=o(s);if(l){a.push(l);break}}if(a.length>=Q2h)break}}return m5S(a)}}function m5S(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,Q2h).map(r=>({...r,filename:r.filename||O5S(t).filename,function:r.function||L2h}))}function O5S(e){return e[e.length-1]||{}}b6a.stackParser=g5S(M8S());b6a.frameModifiers=[q8S];var m6a=class extends PVl{getLibraryId(){return"posthog-node"}};var nis=class{posthog;constructor({posthogApiKey:t}){this.posthog=new m6a(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.78.5",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var wNo=class{async sendEvent(){}async identify(){}async flush(){}};var A6a=require("fs/promises"),H2h=require("os"),G2h=require("path");var U2h=ea(require("crypto")),ais=new Uint8Array(256),iis=ais.length;function SVl(){return iis>ais.length-16&&(U2h.default.randomFillSync(ais),iis=0),ais.slice(iis,iis+=16)}var cye=[];for(let e=0;e<256;++e)cye.push((e+256).toString(16).slice(1));function V2h(e,t=0){return cye[e[t+0]]+cye[e[t+1]]+cye[e[t+2]]+cye[e[t+3]]+"-"+cye[e[t+4]]+cye[e[t+5]]+"-"+cye[e[t+6]]+cye[e[t+7]]+"-"+cye[e[t+8]]+cye[e[t+9]]+"-"+cye[e[t+10]]+cye[e[t+11]]+cye[e[t+12]]+cye[e[t+13]]+cye[e[t+14]]+cye[e[t+15]]}var W2h=ea(require("crypto")),DVl={randomUUID:W2h.default.randomUUID};function A5S(e,t,r){if(DVl.randomUUID&&!t&&!e)return DVl.randomUUID();e=e||{};let n=e.random||(e.rng||SVl)();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 V2h(n)}var qft=A5S;var P5S="id",w5S=".fern",jNo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new m6a(r),this.userId=t==null?void 0:U7l(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.78.5",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Jl(D_.of((0,H2h.homedir)()),hs.of(w5S),hs.of(P5S));await _v(t)||(await(0,A6a.mkdir)((0,G2h.dirname)(t),{recursive:!0}),await(0,A6a.writeFile)(t,qft())),this.persistedDistinctId=(await(0,A6a.readFile)(t)).toString()}return this.persistedDistinctId}};var CVl;async function P6a(){return CVl==null&&(CVl=await j5S()),CVl}async function j5S(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new wNo;let r=await _Xu();return r!=null?new jNo({token:r,posthogApiKey:e}):await P4a()!=null?new nis({posthogApiKey:e}):new jNo({token:void 0,posthogApiKey:e})}catch{return new wNo}}function ENo(e,t){return function(){return e.apply(t,arguments)}}var{toString:E5S}=Object.prototype,{getPrototypeOf:MVl}=Object,{iterator:uis,toStringTag:K2h}=Symbol,sis=(e=>t=>{let r=E5S.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),LDr=e=>(e=e.toLowerCase(),t=>sis(t)===e),cis=e=>t=>typeof t===e,{isArray:j6a}=Array,w6a=cis("undefined");function SNo(e){return e!==null&&!w6a(e)&&e.constructor!==null&&!w6a(e.constructor)&&UNe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var $2h=LDr("ArrayBuffer");function S5S(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$2h(e.buffer),t}var D5S=cis("string"),UNe=cis("function"),Y2h=cis("number"),DNo=e=>e!==null&&typeof e=="object",C5S=e=>e===!0||e===!1,ois=e=>{if(sis(e)!=="object")return!1;let t=MVl(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(K2h in e)&&!(uis in e)},I5S=e=>{if(!DNo(e)||SNo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},M5S=LDr("Date"),B5S=LDr("File"),T5S=LDr("Blob"),q5S=LDr("FileList"),N5S=e=>DNo(e)&&UNe(e.pipe),R5S=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||UNe(e.append)&&((t=sis(e))==="formdata"||t==="object"&&UNe(e.toString)&&e.toString()==="[object FormData]"))},x5S=LDr("URLSearchParams"),[F5S,z5S,Q5S,L5S]=["ReadableStream","Request","Response","Headers"].map(LDr),U5S=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function CNo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),j6a(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(SNo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,c;for(n=0;n<u;n++)c=a[n],t.call(null,e[c],c,e)}}function X2h(e,t){if(SNo(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 PGi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Z2h=e=>!w6a(e)&&e!==PGi;function IVl(){let{caseless:e,skipUndefined:t}=Z2h(this)&&this||{},r={},n=(i,a)=>{let u=e&&X2h(r,a)||a;ois(r[u])&&ois(i)?r[u]=IVl(r[u],i):ois(i)?r[u]=IVl({},i):j6a(i)?r[u]=i.slice():(!t||!w6a(i))&&(r[u]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&CNo(arguments[i],n);return r}var V5S=(e,t,r,{allOwnKeys:n}={})=>(CNo(t,(i,a)=>{r&&UNe(i)?e[a]=ENo(i,r):e[a]=i},{allOwnKeys:n}),e),W5S=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),H5S=(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)},G5S=(e,t,r,n)=>{let i,a,u,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)u=i[a],(!n||n(u,e,t))&&!c[u]&&(t[u]=e[u],c[u]=!0);e=r!==!1&&MVl(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},J5S=(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},K5S=e=>{if(!e)return null;if(j6a(e))return e;let t=e.length;if(!Y2h(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},$5S=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&MVl(Uint8Array)),Y5S=(e,t)=>{let n=(e&&e[uis]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},X5S=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Z5S=LDr("HTMLFormElement"),k5S=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),J2h=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),eQS=LDr("RegExp"),k2h=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};CNo(r,(i,a)=>{let u;(u=t(i,a,e))!==!1&&(n[a]=u||i)}),Object.defineProperties(e,n)},tQS=e=>{k2h(e,(t,r)=>{if(UNe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(UNe(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+"'")})}})},rQS=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return j6a(e)?n(e):n(String(e).split(t)),r},nQS=()=>{},iQS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function aQS(e){return!!(e&&UNe(e.append)&&e[K2h]==="FormData"&&e[uis])}var oQS=e=>{let t=new Array(10),r=(n,i)=>{if(DNo(n)){if(t.indexOf(n)>=0)return;if(SNo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=j6a(n)?[]:{};return CNo(n,(u,c)=>{let p=r(u,i+1);!w6a(p)&&(a[c]=p)}),t[i]=void 0,a}}return n};return r(e,0)},uQS=LDr("AsyncFunction"),sQS=e=>e&&(DNo(e)||UNe(e))&&UNe(e.then)&&UNe(e.catch),e8h=((e,t)=>e?setImmediate:t?((r,n)=>(PGi.addEventListener("message",({source:i,data:a})=>{i===PGi&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),PGi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",UNe(PGi.postMessage)),cQS=typeof queueMicrotask<"u"?queueMicrotask.bind(PGi):typeof process<"u"&&process.nextTick||e8h,lQS=e=>e!=null&&UNe(e[uis]),Hf={isArray:j6a,isArrayBuffer:$2h,isBuffer:SNo,isFormData:R5S,isArrayBufferView:S5S,isString:D5S,isNumber:Y2h,isBoolean:C5S,isObject:DNo,isPlainObject:ois,isEmptyObject:I5S,isReadableStream:F5S,isRequest:z5S,isResponse:Q5S,isHeaders:L5S,isUndefined:w6a,isDate:M5S,isFile:B5S,isBlob:T5S,isRegExp:eQS,isFunction:UNe,isStream:N5S,isURLSearchParams:x5S,isTypedArray:$5S,isFileList:q5S,forEach:CNo,merge:IVl,extend:V5S,trim:U5S,stripBOM:W5S,inherits:H5S,toFlatObject:G5S,kindOf:sis,kindOfTest:LDr,endsWith:J5S,toArray:K5S,forEachEntry:Y5S,matchAll:X5S,isHTMLForm:Z5S,hasOwnProperty:J2h,hasOwnProp:J2h,reduceDescriptors:k2h,freezeMethods:tQS,toObjectSet:rQS,toCamelCase:k5S,noop:nQS,toFiniteNumber:iQS,findKey:X2h,global:PGi,isContextDefined:Z2h,isSpecCompliantForm:aQS,toJSONObject:oQS,isAsyncFn:uQS,isThenable:sQS,setImmediate:e8h,asap:cQS,isIterable:lQS};function E6a(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)}Hf.inherits(E6a,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:Hf.toJSONObject(this.config),code:this.code,status:this.status}}});var t8h=E6a.prototype,r8h={};["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=>{r8h[e]={value:e}});Object.defineProperties(E6a,r8h);Object.defineProperty(t8h,"isAxiosError",{value:!0});E6a.from=(e,t,r,n,i,a)=>{let u=Object.create(t8h);Hf.toFlatObject(e,u,function(o){return o!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return E6a.call(u,c,p,r,n,i),e&&u.cause==null&&Object.defineProperty(u,"cause",{value:e,configurable:!0}),u.name=e&&e.name||"Error",a&&Object.assign(u,a),u};var B0=E6a;var n8h=ea(Bns(),1),lis=n8h.default;function BVl(e){return Hf.isPlainObject(e)||Hf.isArray(e)}function a8h(e){return Hf.endsWith(e,"[]")?e.slice(0,-2):e}function i8h(e,t,r){return e?e.concat(t).map(function(i,a){return i=a8h(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function fQS(e){return Hf.isArray(e)&&!e.some(BVl)}var dQS=Hf.toFlatObject(Hf,{},null,function(t){return/^is[A-Z]/.test(t)});function pQS(e,t,r){if(!Hf.isObject(e))throw new TypeError("target must be an object");t=t||new(lis||FormData),r=Hf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Hf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||o,a=r.dots,u=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&Hf.isSpecCompliantForm(t);if(!Hf.isFunction(i))throw new TypeError("visitor must be a function");function s(E){if(E===null)return"";if(Hf.isDate(E))return E.toISOString();if(Hf.isBoolean(E))return E.toString();if(!p&&Hf.isBlob(E))throw new B0("Blob is not supported. Use a Buffer instead.");return Hf.isArrayBuffer(E)||Hf.isTypedArray(E)?p&&typeof Blob=="function"?new Blob([E]):Buffer.from(E):E}function o(E,C,M){let q=E;if(E&&!M&&typeof E=="object"){if(Hf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),E=JSON.stringify(E);else if(Hf.isArray(E)&&fQS(E)||(Hf.isFileList(E)||Hf.endsWith(C,"[]"))&&(q=Hf.toArray(E)))return C=a8h(C),q.forEach(function(U,Q){!(Hf.isUndefined(U)||U===null)&&t.append(u===!0?i8h([C],Q,a):u===null?C:C+"[]",s(U))}),!1}return BVl(E)?!0:(t.append(i8h(M,C,a),s(E)),!1)}let l=[],O=Object.assign(dQS,{defaultVisitor:o,convertValue:s,isVisitable:BVl});function A(E,C){if(!Hf.isUndefined(E)){if(l.indexOf(E)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(E),Hf.forEach(E,function(q,L){(!(Hf.isUndefined(q)||q===null)&&i.call(t,q,Hf.isString(L)?L.trim():L,C,O))===!0&&A(q,C?C.concat(L):[L])}),l.pop()}}if(!Hf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var REi=pQS;function o8h(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function u8h(e,t){this._pairs=[],e&&REi(e,this,t)}var s8h=u8h.prototype;s8h.append=function(t,r){this._pairs.push([t,r])};s8h.toString=function(t){let r=t?function(n){return t.call(this,n,o8h)}:o8h;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var c8h=u8h;function _QS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function wGi(e,t,r){if(!t)return e;let n=r&&r.encode||_QS;Hf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Hf.isURLSearchParams(t)?t.toString():new c8h(t,r).toString(n),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var TVl=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){Hf.forEach(this.handlers,function(n){n!==null&&t(n)})}},qVl=TVl;var S6a={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var p8h=ea(require("crypto"),1);var l8h=ea(require("url"),1),f8h=l8h.default.URLSearchParams;var NVl="abcdefghijklmnopqrstuvwxyz",d8h="0123456789",_8h={DIGIT:d8h,ALPHA:NVl,ALPHA_DIGIT:NVl+NVl.toUpperCase()+d8h},hQS=(e=16,t=_8h.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);p8h.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},h8h={isNode:!0,classes:{URLSearchParams:f8h,FormData:lis,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:_8h,generateString:hQS,protocols:["http","https","file","data"]};var FVl={};ds(FVl,{hasBrowserEnv:()=>xVl,hasStandardBrowserEnv:()=>yQS,hasStandardBrowserWebWorkerEnv:()=>vQS,navigator:()=>RVl,origin:()=>bQS});var xVl=typeof window<"u"&&typeof document<"u",RVl=typeof navigator=="object"&&navigator||void 0,yQS=xVl&&(!RVl||["ReactNative","NativeScript","NS"].indexOf(RVl.product)<0),vQS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bQS=xVl&&window.location.href||"http://localhost";var g6={...FVl,...h8h};function zVl(e,t){return REi(e,new g6.classes.URLSearchParams,{visitor:function(r,n,i,a){return g6.isNode&&Hf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function gQS(e){return Hf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function mQS(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 OQS(e){function t(r,n,i,a){let u=r[a++];if(u==="__proto__")return!0;let c=Number.isFinite(+u),p=a>=r.length;return u=!u&&Hf.isArray(i)?i.length:u,p?(Hf.hasOwnProp(i,u)?i[u]=[i[u],n]:i[u]=n,!c):((!i[u]||!Hf.isObject(i[u]))&&(i[u]=[]),t(r,n,i[u],a)&&Hf.isArray(i[u])&&(i[u]=mQS(i[u])),!c)}if(Hf.isFormData(e)&&Hf.isFunction(e.entries)){let r={};return Hf.forEachEntry(e,(n,i)=>{t(gQS(n),i,r,0)}),r}return null}var fis=OQS;function AQS(e,t,r){if(Hf.isString(e))try{return(t||JSON.parse)(e),Hf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var QVl={transitional:S6a,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Hf.isObject(t);if(a&&Hf.isHTMLForm(t)&&(t=new FormData(t)),Hf.isFormData(t))return i?JSON.stringify(fis(t)):t;if(Hf.isArrayBuffer(t)||Hf.isBuffer(t)||Hf.isStream(t)||Hf.isFile(t)||Hf.isBlob(t)||Hf.isReadableStream(t))return t;if(Hf.isArrayBufferView(t))return t.buffer;if(Hf.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 zVl(t,this.formSerializer).toString();if((c=Hf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let p=this.env&&this.env.FormData;return REi(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),AQS(t)):t}],transformResponse:[function(t){let r=this.transitional||QVl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Hf.isResponse(t)||Hf.isReadableStream(t))return t;if(t&&Hf.isString(t)&&(n&&!this.responseType||i)){let u=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(u)throw c.name==="SyntaxError"?B0.from(c,B0.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:g6.classes.FormData,Blob:g6.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Hf.forEach(["delete","get","head","post","put","patch"],e=>{QVl.headers[e]={}});var D6a=QVl;var PQS=Hf.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"]),y8h=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2162
|
+
`);for(let c=i;c<u.length;c++){let p=u[c];if(p.length>1024)continue;let s=w2h.test(p)?p.replace(w2h,"$1"):p;if(!s.match(/\S*Error: /)){for(let o of r){let l=o(s);if(l){a.push(l);break}}if(a.length>=Q2h)break}}return m5S(a)}}function m5S(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,Q2h).map(r=>({...r,filename:r.filename||O5S(t).filename,function:r.function||L2h}))}function O5S(e){return e[e.length-1]||{}}b6a.stackParser=g5S(M8S());b6a.frameModifiers=[q8S];var m6a=class extends PVl{getLibraryId(){return"posthog-node"}};var nis=class{posthog;constructor({posthogApiKey:t}){this.posthog=new m6a(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.78.6",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var wNo=class{async sendEvent(){}async identify(){}async flush(){}};var A6a=require("fs/promises"),H2h=require("os"),G2h=require("path");var U2h=ea(require("crypto")),ais=new Uint8Array(256),iis=ais.length;function SVl(){return iis>ais.length-16&&(U2h.default.randomFillSync(ais),iis=0),ais.slice(iis,iis+=16)}var cye=[];for(let e=0;e<256;++e)cye.push((e+256).toString(16).slice(1));function V2h(e,t=0){return cye[e[t+0]]+cye[e[t+1]]+cye[e[t+2]]+cye[e[t+3]]+"-"+cye[e[t+4]]+cye[e[t+5]]+"-"+cye[e[t+6]]+cye[e[t+7]]+"-"+cye[e[t+8]]+cye[e[t+9]]+"-"+cye[e[t+10]]+cye[e[t+11]]+cye[e[t+12]]+cye[e[t+13]]+cye[e[t+14]]+cye[e[t+15]]}var W2h=ea(require("crypto")),DVl={randomUUID:W2h.default.randomUUID};function A5S(e,t,r){if(DVl.randomUUID&&!t&&!e)return DVl.randomUUID();e=e||{};let n=e.random||(e.rng||SVl)();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 V2h(n)}var qft=A5S;var P5S="id",w5S=".fern",jNo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new m6a(r),this.userId=t==null?void 0:U7l(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.78.6",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Jl(D_.of((0,H2h.homedir)()),hs.of(w5S),hs.of(P5S));await _v(t)||(await(0,A6a.mkdir)((0,G2h.dirname)(t),{recursive:!0}),await(0,A6a.writeFile)(t,qft())),this.persistedDistinctId=(await(0,A6a.readFile)(t)).toString()}return this.persistedDistinctId}};var CVl;async function P6a(){return CVl==null&&(CVl=await j5S()),CVl}async function j5S(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new wNo;let r=await _Xu();return r!=null?new jNo({token:r,posthogApiKey:e}):await P4a()!=null?new nis({posthogApiKey:e}):new jNo({token:void 0,posthogApiKey:e})}catch{return new wNo}}function ENo(e,t){return function(){return e.apply(t,arguments)}}var{toString:E5S}=Object.prototype,{getPrototypeOf:MVl}=Object,{iterator:uis,toStringTag:K2h}=Symbol,sis=(e=>t=>{let r=E5S.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),LDr=e=>(e=e.toLowerCase(),t=>sis(t)===e),cis=e=>t=>typeof t===e,{isArray:j6a}=Array,w6a=cis("undefined");function SNo(e){return e!==null&&!w6a(e)&&e.constructor!==null&&!w6a(e.constructor)&&UNe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var $2h=LDr("ArrayBuffer");function S5S(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$2h(e.buffer),t}var D5S=cis("string"),UNe=cis("function"),Y2h=cis("number"),DNo=e=>e!==null&&typeof e=="object",C5S=e=>e===!0||e===!1,ois=e=>{if(sis(e)!=="object")return!1;let t=MVl(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(K2h in e)&&!(uis in e)},I5S=e=>{if(!DNo(e)||SNo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},M5S=LDr("Date"),B5S=LDr("File"),T5S=LDr("Blob"),q5S=LDr("FileList"),N5S=e=>DNo(e)&&UNe(e.pipe),R5S=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||UNe(e.append)&&((t=sis(e))==="formdata"||t==="object"&&UNe(e.toString)&&e.toString()==="[object FormData]"))},x5S=LDr("URLSearchParams"),[F5S,z5S,Q5S,L5S]=["ReadableStream","Request","Response","Headers"].map(LDr),U5S=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function CNo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),j6a(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(SNo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,c;for(n=0;n<u;n++)c=a[n],t.call(null,e[c],c,e)}}function X2h(e,t){if(SNo(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 PGi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Z2h=e=>!w6a(e)&&e!==PGi;function IVl(){let{caseless:e,skipUndefined:t}=Z2h(this)&&this||{},r={},n=(i,a)=>{let u=e&&X2h(r,a)||a;ois(r[u])&&ois(i)?r[u]=IVl(r[u],i):ois(i)?r[u]=IVl({},i):j6a(i)?r[u]=i.slice():(!t||!w6a(i))&&(r[u]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&CNo(arguments[i],n);return r}var V5S=(e,t,r,{allOwnKeys:n}={})=>(CNo(t,(i,a)=>{r&&UNe(i)?e[a]=ENo(i,r):e[a]=i},{allOwnKeys:n}),e),W5S=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),H5S=(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)},G5S=(e,t,r,n)=>{let i,a,u,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)u=i[a],(!n||n(u,e,t))&&!c[u]&&(t[u]=e[u],c[u]=!0);e=r!==!1&&MVl(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},J5S=(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},K5S=e=>{if(!e)return null;if(j6a(e))return e;let t=e.length;if(!Y2h(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},$5S=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&MVl(Uint8Array)),Y5S=(e,t)=>{let n=(e&&e[uis]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},X5S=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Z5S=LDr("HTMLFormElement"),k5S=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),J2h=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),eQS=LDr("RegExp"),k2h=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};CNo(r,(i,a)=>{let u;(u=t(i,a,e))!==!1&&(n[a]=u||i)}),Object.defineProperties(e,n)},tQS=e=>{k2h(e,(t,r)=>{if(UNe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(UNe(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+"'")})}})},rQS=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return j6a(e)?n(e):n(String(e).split(t)),r},nQS=()=>{},iQS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function aQS(e){return!!(e&&UNe(e.append)&&e[K2h]==="FormData"&&e[uis])}var oQS=e=>{let t=new Array(10),r=(n,i)=>{if(DNo(n)){if(t.indexOf(n)>=0)return;if(SNo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=j6a(n)?[]:{};return CNo(n,(u,c)=>{let p=r(u,i+1);!w6a(p)&&(a[c]=p)}),t[i]=void 0,a}}return n};return r(e,0)},uQS=LDr("AsyncFunction"),sQS=e=>e&&(DNo(e)||UNe(e))&&UNe(e.then)&&UNe(e.catch),e8h=((e,t)=>e?setImmediate:t?((r,n)=>(PGi.addEventListener("message",({source:i,data:a})=>{i===PGi&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),PGi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",UNe(PGi.postMessage)),cQS=typeof queueMicrotask<"u"?queueMicrotask.bind(PGi):typeof process<"u"&&process.nextTick||e8h,lQS=e=>e!=null&&UNe(e[uis]),Hf={isArray:j6a,isArrayBuffer:$2h,isBuffer:SNo,isFormData:R5S,isArrayBufferView:S5S,isString:D5S,isNumber:Y2h,isBoolean:C5S,isObject:DNo,isPlainObject:ois,isEmptyObject:I5S,isReadableStream:F5S,isRequest:z5S,isResponse:Q5S,isHeaders:L5S,isUndefined:w6a,isDate:M5S,isFile:B5S,isBlob:T5S,isRegExp:eQS,isFunction:UNe,isStream:N5S,isURLSearchParams:x5S,isTypedArray:$5S,isFileList:q5S,forEach:CNo,merge:IVl,extend:V5S,trim:U5S,stripBOM:W5S,inherits:H5S,toFlatObject:G5S,kindOf:sis,kindOfTest:LDr,endsWith:J5S,toArray:K5S,forEachEntry:Y5S,matchAll:X5S,isHTMLForm:Z5S,hasOwnProperty:J2h,hasOwnProp:J2h,reduceDescriptors:k2h,freezeMethods:tQS,toObjectSet:rQS,toCamelCase:k5S,noop:nQS,toFiniteNumber:iQS,findKey:X2h,global:PGi,isContextDefined:Z2h,isSpecCompliantForm:aQS,toJSONObject:oQS,isAsyncFn:uQS,isThenable:sQS,setImmediate:e8h,asap:cQS,isIterable:lQS};function E6a(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)}Hf.inherits(E6a,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:Hf.toJSONObject(this.config),code:this.code,status:this.status}}});var t8h=E6a.prototype,r8h={};["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=>{r8h[e]={value:e}});Object.defineProperties(E6a,r8h);Object.defineProperty(t8h,"isAxiosError",{value:!0});E6a.from=(e,t,r,n,i,a)=>{let u=Object.create(t8h);Hf.toFlatObject(e,u,function(o){return o!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return E6a.call(u,c,p,r,n,i),e&&u.cause==null&&Object.defineProperty(u,"cause",{value:e,configurable:!0}),u.name=e&&e.name||"Error",a&&Object.assign(u,a),u};var B0=E6a;var n8h=ea(Bns(),1),lis=n8h.default;function BVl(e){return Hf.isPlainObject(e)||Hf.isArray(e)}function a8h(e){return Hf.endsWith(e,"[]")?e.slice(0,-2):e}function i8h(e,t,r){return e?e.concat(t).map(function(i,a){return i=a8h(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function fQS(e){return Hf.isArray(e)&&!e.some(BVl)}var dQS=Hf.toFlatObject(Hf,{},null,function(t){return/^is[A-Z]/.test(t)});function pQS(e,t,r){if(!Hf.isObject(e))throw new TypeError("target must be an object");t=t||new(lis||FormData),r=Hf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Hf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||o,a=r.dots,u=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&Hf.isSpecCompliantForm(t);if(!Hf.isFunction(i))throw new TypeError("visitor must be a function");function s(E){if(E===null)return"";if(Hf.isDate(E))return E.toISOString();if(Hf.isBoolean(E))return E.toString();if(!p&&Hf.isBlob(E))throw new B0("Blob is not supported. Use a Buffer instead.");return Hf.isArrayBuffer(E)||Hf.isTypedArray(E)?p&&typeof Blob=="function"?new Blob([E]):Buffer.from(E):E}function o(E,C,M){let q=E;if(E&&!M&&typeof E=="object"){if(Hf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),E=JSON.stringify(E);else if(Hf.isArray(E)&&fQS(E)||(Hf.isFileList(E)||Hf.endsWith(C,"[]"))&&(q=Hf.toArray(E)))return C=a8h(C),q.forEach(function(U,Q){!(Hf.isUndefined(U)||U===null)&&t.append(u===!0?i8h([C],Q,a):u===null?C:C+"[]",s(U))}),!1}return BVl(E)?!0:(t.append(i8h(M,C,a),s(E)),!1)}let l=[],O=Object.assign(dQS,{defaultVisitor:o,convertValue:s,isVisitable:BVl});function A(E,C){if(!Hf.isUndefined(E)){if(l.indexOf(E)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(E),Hf.forEach(E,function(q,L){(!(Hf.isUndefined(q)||q===null)&&i.call(t,q,Hf.isString(L)?L.trim():L,C,O))===!0&&A(q,C?C.concat(L):[L])}),l.pop()}}if(!Hf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var REi=pQS;function o8h(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function u8h(e,t){this._pairs=[],e&&REi(e,this,t)}var s8h=u8h.prototype;s8h.append=function(t,r){this._pairs.push([t,r])};s8h.toString=function(t){let r=t?function(n){return t.call(this,n,o8h)}:o8h;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var c8h=u8h;function _QS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function wGi(e,t,r){if(!t)return e;let n=r&&r.encode||_QS;Hf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Hf.isURLSearchParams(t)?t.toString():new c8h(t,r).toString(n),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var TVl=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){Hf.forEach(this.handlers,function(n){n!==null&&t(n)})}},qVl=TVl;var S6a={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var p8h=ea(require("crypto"),1);var l8h=ea(require("url"),1),f8h=l8h.default.URLSearchParams;var NVl="abcdefghijklmnopqrstuvwxyz",d8h="0123456789",_8h={DIGIT:d8h,ALPHA:NVl,ALPHA_DIGIT:NVl+NVl.toUpperCase()+d8h},hQS=(e=16,t=_8h.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);p8h.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},h8h={isNode:!0,classes:{URLSearchParams:f8h,FormData:lis,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:_8h,generateString:hQS,protocols:["http","https","file","data"]};var FVl={};ds(FVl,{hasBrowserEnv:()=>xVl,hasStandardBrowserEnv:()=>yQS,hasStandardBrowserWebWorkerEnv:()=>vQS,navigator:()=>RVl,origin:()=>bQS});var xVl=typeof window<"u"&&typeof document<"u",RVl=typeof navigator=="object"&&navigator||void 0,yQS=xVl&&(!RVl||["ReactNative","NativeScript","NS"].indexOf(RVl.product)<0),vQS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bQS=xVl&&window.location.href||"http://localhost";var g6={...FVl,...h8h};function zVl(e,t){return REi(e,new g6.classes.URLSearchParams,{visitor:function(r,n,i,a){return g6.isNode&&Hf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function gQS(e){return Hf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function mQS(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 OQS(e){function t(r,n,i,a){let u=r[a++];if(u==="__proto__")return!0;let c=Number.isFinite(+u),p=a>=r.length;return u=!u&&Hf.isArray(i)?i.length:u,p?(Hf.hasOwnProp(i,u)?i[u]=[i[u],n]:i[u]=n,!c):((!i[u]||!Hf.isObject(i[u]))&&(i[u]=[]),t(r,n,i[u],a)&&Hf.isArray(i[u])&&(i[u]=mQS(i[u])),!c)}if(Hf.isFormData(e)&&Hf.isFunction(e.entries)){let r={};return Hf.forEachEntry(e,(n,i)=>{t(gQS(n),i,r,0)}),r}return null}var fis=OQS;function AQS(e,t,r){if(Hf.isString(e))try{return(t||JSON.parse)(e),Hf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var QVl={transitional:S6a,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Hf.isObject(t);if(a&&Hf.isHTMLForm(t)&&(t=new FormData(t)),Hf.isFormData(t))return i?JSON.stringify(fis(t)):t;if(Hf.isArrayBuffer(t)||Hf.isBuffer(t)||Hf.isStream(t)||Hf.isFile(t)||Hf.isBlob(t)||Hf.isReadableStream(t))return t;if(Hf.isArrayBufferView(t))return t.buffer;if(Hf.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 zVl(t,this.formSerializer).toString();if((c=Hf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let p=this.env&&this.env.FormData;return REi(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),AQS(t)):t}],transformResponse:[function(t){let r=this.transitional||QVl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Hf.isResponse(t)||Hf.isReadableStream(t))return t;if(t&&Hf.isString(t)&&(n&&!this.responseType||i)){let u=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(u)throw c.name==="SyntaxError"?B0.from(c,B0.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:g6.classes.FormData,Blob:g6.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Hf.forEach(["delete","get","head","post","put","patch"],e=>{QVl.headers[e]={}});var D6a=QVl;var PQS=Hf.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"]),y8h=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2163
2163
|
`).forEach(function(u){i=u.indexOf(":"),r=u.substring(0,i).trim().toLowerCase(),n=u.substring(i+1).trim(),!(!r||t[r]&&PQS[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var v8h=Symbol("internals");function INo(e){return e&&String(e).trim().toLowerCase()}function dis(e){return e===!1||e==null?e:Hf.isArray(e)?e.map(dis):String(e)}function wQS(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 jQS=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function LVl(e,t,r,n,i){if(Hf.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Hf.isString(t)){if(Hf.isString(n))return t.indexOf(n)!==-1;if(Hf.isRegExp(n))return n.test(t)}}function EQS(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function SQS(e,t){let r=Hf.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,a,u){return this[n].call(this,t,i,a,u)},configurable:!0})})}var C6a=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,p,s){let o=INo(p);if(!o)throw new Error("header name must be a non-empty string");let l=Hf.findKey(i,o);(!l||i[l]===void 0||s===!0||s===void 0&&i[l]!==!1)&&(i[l||p]=dis(c))}let u=(c,p)=>Hf.forEach(c,(s,o)=>a(s,o,p));if(Hf.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(Hf.isString(t)&&(t=t.trim())&&!jQS(t))u(y8h(t),r);else if(Hf.isObject(t)&&Hf.isIterable(t)){let c={},p,s;for(let o of t){if(!Hf.isArray(o))throw TypeError("Object iterator must return a key-value pair");c[s=o[0]]=(p=c[s])?Hf.isArray(p)?[...p,o[1]]:[p,o[1]]:o[1]}u(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=INo(t),t){let n=Hf.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return wQS(i);if(Hf.isFunction(r))return r.call(this,i,n);if(Hf.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=INo(t),t){let n=Hf.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||LVl(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(u){if(u=INo(u),u){let c=Hf.findKey(n,u);c&&(!r||LVl(n,n[c],c,r))&&(delete n[c],i=!0)}}return Hf.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||LVl(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Hf.forEach(this,(i,a)=>{let u=Hf.findKey(n,a);if(u){r[u]=dis(i),delete r[a];return}let c=t?EQS(a):String(a).trim();c!==a&&delete r[a],r[c]=dis(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Hf.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Hf.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(`
|
|
2164
2164
|
`)}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[v8h]=this[v8h]={accessors:{}}).accessors,i=this.prototype;function a(u){let c=INo(u);n[c]||(SQS(i,u),n[c]=!0)}return Hf.isArray(t)?t.forEach(a):a(t),this}};C6a.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Hf.reduceDescriptors(C6a.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Hf.freezeMethods(C6a);var jJ=C6a;function MNo(e,t){let r=this||D6a,n=t||r,i=jJ.from(n.headers),a=n.data;return Hf.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function BNo(e){return!!(e&&e.__CANCEL__)}function b8h(e,t,r){B0.call(this,e??"canceled",B0.ERR_CANCELED,t,r),this.name="CanceledError"}Hf.inherits(b8h,B0,{__CANCEL__:!0});var uet=b8h;function E2r(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new B0("Request failed with status code "+r.status,[B0.ERR_BAD_REQUEST,B0.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function UVl(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function VVl(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function jGi(e,t,r){let n=!UVl(t);return e&&(n||r==!1)?VVl(e,t):t}var q8h=ea(Tns(),1),N8h=ea(require("http"),1),R8h=ea(require("https"),1),x8h=ea(require("util"),1),F8h=ea(WUl(),1),Lsi=ea(require("zlib"),1);var EGi="1.12.2";function TNo(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var DQS=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function WVl(e,t,r){let n=r&&r.Blob||g6.classes.Blob,i=TNo(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=DQS.exec(e);if(!a)throw new B0("Invalid URL",B0.ERR_INVALID_URL);let u=a[1],c=a[2],p=a[3],s=Buffer.from(decodeURIComponent(p),c?"base64":"utf8");if(t){if(!n)throw new B0("Blob is not supported",B0.ERR_NOT_SUPPORT);return new n([s],{type:u})}return s}throw new B0("Unsupported protocol "+i,B0.ERR_NOT_SUPPORT)}var DGi=ea(require("stream"),1);var g8h=ea(require("stream"),1);var HVl=Symbol("internals"),GVl=class extends g8h.default.Transform{constructor(t){t=Hf.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Hf.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[HVl]={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[HVl];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[HVl],a=i.maxRate,u=this.readableHighWaterMark,c=i.timeWindow,p=1e3/c,s=a/p,o=i.minChunkSize!==!1?Math.max(i.minChunkSize,s*.01):0,l=(A,E)=>{let C=Buffer.byteLength(A);i.bytesSeen+=C,i.bytes+=C,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(A)?process.nextTick(E):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(E)}},O=(A,E)=>{let C=Buffer.byteLength(A),M=null,q=u,L,U=0;if(a){let Q=Date.now();(!i.ts||(U=Q-i.ts)>=c)&&(i.ts=Q,L=s-i.bytes,i.bytes=L<0?-L:0,U=0),L=s-i.bytes}if(a){if(L<=0)return setTimeout(()=>{E(null,A)},c-U);L<q&&(q=L)}q&&C>q&&C-q>o&&(M=A.subarray(q),A=A.subarray(0,q)),l(A,M?()=>{process.nextTick(E,null,M)}:E)};O(t,function A(E,C){if(E)return n(E);C?O(C,A):n(null)})}},JVl=GVl;var z8h=require("events");var O8h=ea(require("util"),1),A8h=require("stream");var{asyncIterator:m8h}=Symbol,CQS=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[m8h]?yield*e[m8h]():yield e},pis=CQS;var IQS=g6.ALPHABET.ALPHA_DIGIT+"-_",qNo=typeof TextEncoder=="function"?new TextEncoder:new O8h.default.TextEncoder,SGi=`\r
|
|
2165
2165
|
`,MQS=qNo.encode(SGi),BQS=2,KVl=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Hf.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${SGi}`;i?r=qNo.encode(String(r).replace(/\r?\n|\r\n?/g,SGi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${SGi}`,this.headers=qNo.encode(a+SGi),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+BQS,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Hf.isTypedArray(t)?yield t:yield*pis(t),yield MQS}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},TQS=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+g6.generateString(i,IQS)}=r||{};if(!Hf.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=qNo.encode("--"+a+SGi),c=qNo.encode("--"+a+"--"+SGi),p=c.byteLength,s=Array.from(e.entries()).map(([l,O])=>{let A=new KVl(l,O);return p+=A.size,A});p+=u.byteLength*s.length,p=Hf.toFiniteNumber(p);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(p)&&(o["Content-Length"]=p),t&&t(o),A8h.Readable.from((async function*(){for(let l of s)yield u,yield*l.encode();yield c})())},P8h=TQS;var w8h=ea(require("stream"),1),$Vl=class extends w8h.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)}},j8h=$Vl;var qQS=(e,t)=>Hf.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,E8h=qQS;function NQS(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,u;return t=t!==void 0?t:1e3,function(p){let s=Date.now(),o=n[a];u||(u=s),r[i]=p,n[i]=s;let l=a,O=0;for(;l!==i;)O+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),s-u<t)return;let A=o&&s-o;return A?Math.round(O*1e3/A):void 0}}var S8h=NQS;function RQS(e,t){let r=0,n=1e3/t,i,a,u=(s,o=Date.now())=>{r=o,i=null,a&&(clearTimeout(a),a=null),e(...s)};return[(...s)=>{let o=Date.now(),l=o-r;l>=n?u(s,o):(i=s,a||(a=setTimeout(()=>{a=null,u(i)},n-l)))},()=>i&&u(i)]}var D8h=RQS;var Qsi=(e,t,r=3)=>{let n=0,i=S8h(50,250);return D8h(a=>{let u=a.loaded,c=a.lengthComputable?a.total:void 0,p=u-n,s=i(p),o=u<=c;n=u;let l={loaded:u,total:c,progress:c?u/c:void 0,bytes:p,rate:s||void 0,estimated:s&&c&&o?(c-u)/s:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},I6a=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},M6a=e=>(...t)=>Hf.asap(()=>e(...t));function YVl(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,u=n.length;for(let O=0;O<u;O++)if(n.charCodeAt(O)===37&&O+2<u){let A=n.charCodeAt(O+1),E=n.charCodeAt(O+2);(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102)&&(E>=48&&E<=57||E>=65&&E<=70||E>=97&&E<=102)&&(a-=2,O+=2)}let c=0,p=u-1,s=O=>O>=2&&n.charCodeAt(O-2)===37&&n.charCodeAt(O-1)===51&&(n.charCodeAt(O)===68||n.charCodeAt(O)===100);p>=0&&(n.charCodeAt(p)===61?(c++,p--):s(p)&&(c++,p-=3)),c===1&&p>=0&&(n.charCodeAt(p)===61||s(p))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var C8h={flush:Lsi.default.constants.Z_SYNC_FLUSH,finishFlush:Lsi.default.constants.Z_SYNC_FLUSH},xQS={flush:Lsi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Lsi.default.constants.BROTLI_OPERATION_FLUSH},I8h=Hf.isFunction(Lsi.default.createBrotliDecompress),{http:FQS,https:zQS}=F8h.default,QQS=/https:?/,M8h=g6.protocols.map(e=>e+":"),B8h=(e,[t,r])=>(e.on("end",r).on("error",r),t);function LQS(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function Q8h(e,t,r){let n=t;if(!n&&n!==!1){let i=q8h.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){Q8h(a,t,a.href)}}var UQS=typeof process<"u"&&Hf.kindOf(process)==="process",VQS=e=>new Promise((t,r)=>{let n,i,a=(p,s)=>{i||(i=!0,n&&n(p,s))},u=p=>{a(p),t(p)},c=p=>{a(p,!0),r(p)};e(u,c,p=>n=p).catch(c)}),WQS=({address:e,family:t})=>{if(!Hf.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},T8h=(e,t)=>WQS(Hf.isObject(e)?e:{address:e,family:t}),L8h=UQS&&function(t){return VQS(async function(n,i,a){let{data:u,lookup:c,family:p}=t,{responseType:s,responseEncoding:o}=t,l=t.method.toUpperCase(),O,A=!1,E;if(c){let Be=E8h(c,Mt=>Hf.isArray(Mt)?Mt:[Mt]);c=(Mt,zt,Ye)=>{Be(Mt,zt,(ze,Dr,ut)=>{if(ze)return Ye(ze);let vr=Hf.isArray(Dr)?Dr.map(Yt=>T8h(Yt)):[T8h(Dr,ut)];zt.all?Ye(ze,vr):Ye(ze,vr[0].address,vr[0].family)})}}let C=new z8h.EventEmitter,M=()=>{t.cancelToken&&t.cancelToken.unsubscribe(q),t.signal&&t.signal.removeEventListener("abort",q),C.removeAllListeners()};a((Be,Mt)=>{O=!0,Mt&&(A=!0,M())});function q(Be){C.emit("abort",!Be||Be.type?new uet(null,t,E):Be)}C.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(q),t.signal&&(t.signal.aborted?q():t.signal.addEventListener("abort",q)));let L=jGi(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(L,g6.hasBrowserEnv?g6.origin:void 0),Q=U.protocol||M8h[0];if(Q==="data:"){if(t.maxContentLength>-1){let Mt=String(t.url||L||"");if(YVl(Mt)>t.maxContentLength)return i(new B0("maxContentLength size of "+t.maxContentLength+" exceeded",B0.ERR_BAD_RESPONSE,t))}let Be;if(l!=="GET")return E2r(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Be=WVl(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Mt){throw B0.from(Mt,B0.ERR_BAD_REQUEST,t)}return s==="text"?(Be=Be.toString(o),(!o||o==="utf8")&&(Be=Hf.stripBOM(Be))):s==="stream"&&(Be=DGi.default.Readable.from(Be)),E2r(n,i,{data:Be,status:200,statusText:"OK",headers:new jJ,config:t})}if(M8h.indexOf(Q)===-1)return i(new B0("Unsupported protocol "+Q,B0.ERR_BAD_REQUEST,t));let K=jJ.from(t.headers).normalize();K.set("User-Agent","axios/"+EGi,!1);let{onUploadProgress:X,onDownloadProgress:te}=t,ee=t.maxRate,re,ue;if(Hf.isSpecCompliantForm(u)){let Be=K.getContentType(/boundary=([-_\w\d]{10,70})/i);u=P8h(u,Mt=>{K.set(Mt)},{tag:`axios-${EGi}-boundary`,boundary:Be&&Be[1]||void 0})}else if(Hf.isFormData(u)&&Hf.isFunction(u.getHeaders)){if(K.set(u.getHeaders()),!K.hasContentLength())try{let Be=await x8h.default.promisify(u.getLength).call(u);Number.isFinite(Be)&&Be>=0&&K.setContentLength(Be)}catch{}}else if(Hf.isBlob(u)||Hf.isFile(u))u.size&&K.setContentType(u.type||"application/octet-stream"),K.setContentLength(u.size||0),u=DGi.default.Readable.from(pis(u));else if(u&&!Hf.isStream(u)){if(!Buffer.isBuffer(u))if(Hf.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(Hf.isString(u))u=Buffer.from(u,"utf-8");else return i(new B0("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",B0.ERR_BAD_REQUEST,t));if(K.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return i(new B0("Request body larger than maxBodyLength limit",B0.ERR_BAD_REQUEST,t))}let me=Hf.toFiniteNumber(K.getContentLength());Hf.isArray(ee)?(re=ee[0],ue=ee[1]):re=ue=ee,u&&(X||re)&&(Hf.isStream(u)||(u=DGi.default.Readable.from(u,{objectMode:!1})),u=DGi.default.pipeline([u,new JVl({maxRate:Hf.toFiniteNumber(re)})],Hf.noop),X&&u.on("progress",B8h(u,I6a(me,Qsi(M6a(X),!1,3)))));let Oe;if(t.auth){let Be=t.auth.username||"",Mt=t.auth.password||"";Oe=Be+":"+Mt}if(!Oe&&U.username){let Be=U.username,Mt=U.password;Oe=Be+":"+Mt}Oe&&K.delete("authorization");let Ee;try{Ee=wGi(U.pathname+U.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Be){let Mt=new Error(Be.message);return Mt.config=t,Mt.url=t.url,Mt.exists=!0,i(Mt)}K.set("Accept-Encoding","gzip, compress, deflate"+(I8h?", br":""),!1);let Ae={path:Ee,method:l,headers:K.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:Oe,protocol:Q,family:p,beforeRedirect:LQS,beforeRedirects:{}};!Hf.isUndefined(c)&&(Ae.lookup=c),t.socketPath?Ae.socketPath=t.socketPath:(Ae.hostname=U.hostname.startsWith("[")?U.hostname.slice(1,-1):U.hostname,Ae.port=U.port,Q8h(Ae,t.proxy,Q+"//"+U.hostname+(U.port?":"+U.port:"")+Ae.path));let Me,Qe=QQS.test(Ae.protocol);if(Ae.agent=Qe?t.httpsAgent:t.httpAgent,t.transport?Me=t.transport:t.maxRedirects===0?Me=Qe?R8h.default:N8h.default:(t.maxRedirects&&(Ae.maxRedirects=t.maxRedirects),t.beforeRedirect&&(Ae.beforeRedirects.config=t.beforeRedirect),Me=Qe?zQS:FQS),t.maxBodyLength>-1?Ae.maxBodyLength=t.maxBodyLength:Ae.maxBodyLength=1/0,t.insecureHTTPParser&&(Ae.insecureHTTPParser=t.insecureHTTPParser),E=Me.request(Ae,function(Mt){if(E.destroyed)return;let zt=[Mt],Ye=+Mt.headers["content-length"];if(te||ue){let Yt=new JVl({maxRate:Hf.toFiniteNumber(ue)});te&&Yt.on("progress",B8h(Yt,I6a(Ye,Qsi(M6a(te),!0,3)))),zt.push(Yt)}let ze=Mt,Dr=Mt.req||E;if(t.decompress!==!1&&Mt.headers["content-encoding"])switch((l==="HEAD"||Mt.statusCode===204)&&delete Mt.headers["content-encoding"],(Mt.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":zt.push(Lsi.default.createUnzip(C8h)),delete Mt.headers["content-encoding"];break;case"deflate":zt.push(new j8h),zt.push(Lsi.default.createUnzip(C8h)),delete Mt.headers["content-encoding"];break;case"br":I8h&&(zt.push(Lsi.default.createBrotliDecompress(xQS)),delete Mt.headers["content-encoding"])}ze=zt.length>1?DGi.default.pipeline(zt,Hf.noop):zt[0];let ut=DGi.default.finished(ze,()=>{ut(),M()}),vr={status:Mt.statusCode,statusText:Mt.statusMessage,headers:new jJ(Mt.headers),config:t,request:Dr};if(s==="stream")vr.data=ze,E2r(n,i,vr);else{let Yt=[],Ze=0;ze.on("data",function(wr){Yt.push(wr),Ze+=wr.length,t.maxContentLength>-1&&Ze>t.maxContentLength&&(A=!0,ze.destroy(),i(new B0("maxContentLength size of "+t.maxContentLength+" exceeded",B0.ERR_BAD_RESPONSE,t,Dr)))}),ze.on("aborted",function(){if(A)return;let wr=new B0("stream has been aborted",B0.ERR_BAD_RESPONSE,t,Dr);ze.destroy(wr),i(wr)}),ze.on("error",function(wr){E.destroyed||i(B0.from(wr,null,t,Dr))}),ze.on("end",function(){try{let wr=Yt.length===1?Yt[0]:Buffer.concat(Yt);s!=="arraybuffer"&&(wr=wr.toString(o),(!o||o==="utf8")&&(wr=Hf.stripBOM(wr))),vr.data=wr}catch(wr){return i(B0.from(wr,null,t,vr.request,vr))}E2r(n,i,vr)})}C.once("abort",Yt=>{ze.destroyed||(ze.emit("error",Yt),ze.destroy())})}),C.once("abort",Be=>{i(Be),E.destroy(Be)}),E.on("error",function(Mt){i(B0.from(Mt,null,t,E))}),E.on("socket",function(Mt){Mt.setKeepAlive(!0,1e3*60)}),t.timeout){let Be=parseInt(t.timeout,10);if(Number.isNaN(Be)){i(new B0("error trying to parse `config.timeout` to int",B0.ERR_BAD_OPTION_VALUE,t,E));return}E.setTimeout(Be,function(){if(O)return;let zt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Ye=t.transitional||S6a;t.timeoutErrorMessage&&(zt=t.timeoutErrorMessage),i(new B0(zt,Ye.clarifyTimeoutError?B0.ETIMEDOUT:B0.ECONNABORTED,t,E)),q()})}if(Hf.isStream(u)){let Be=!1,Mt=!1;u.on("end",()=>{Be=!0}),u.once("error",zt=>{Mt=!0,E.destroy(zt)}),u.on("close",()=>{!Be&&!Mt&&q(new uet("Request stream has been aborted",t,E))}),u.pipe(E)}else E.end(u)})};var U8h=g6.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,g6.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(g6.origin),g6.navigator&&/(msie|trident)/i.test(g6.navigator.userAgent)):()=>!0;var V8h=g6.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let u=[e+"="+encodeURIComponent(t)];Hf.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),Hf.isString(n)&&u.push("path="+n),Hf.isString(i)&&u.push("domain="+i),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var W8h=e=>e instanceof jJ?{...e}:e;function UDr(e,t){t=t||{};let r={};function n(s,o,l,O){return Hf.isPlainObject(s)&&Hf.isPlainObject(o)?Hf.merge.call({caseless:O},s,o):Hf.isPlainObject(o)?Hf.merge({},o):Hf.isArray(o)?o.slice():o}function i(s,o,l,O){if(Hf.isUndefined(o)){if(!Hf.isUndefined(s))return n(void 0,s,l,O)}else return n(s,o,l,O)}function a(s,o){if(!Hf.isUndefined(o))return n(void 0,o)}function u(s,o){if(Hf.isUndefined(o)){if(!Hf.isUndefined(s))return n(void 0,s)}else return n(void 0,o)}function c(s,o,l){if(l in t)return n(s,o);if(l in e)return n(void 0,s)}let p={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c,headers:(s,o,l)=>i(W8h(s),W8h(o),l,!0)};return Hf.forEach(Object.keys({...e,...t}),function(o){let l=p[o]||i,O=l(e[o],t[o],o);Hf.isUndefined(O)&&l!==c||(r[o]=O)}),r}var _is=e=>{let t=UDr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:u,auth:c}=t;if(t.headers=u=jJ.from(u),t.url=wGi(jGi(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&u.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Hf.isFormData(r)){if(g6.hasStandardBrowserEnv||g6.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(Hf.isFunction(r.getHeaders)){let p=r.getHeaders(),s=["content-type","content-length"];Object.entries(p).forEach(([o,l])=>{s.includes(o.toLowerCase())&&u.set(o,l)})}}if(g6.hasStandardBrowserEnv&&(n&&Hf.isFunction(n)&&(n=n(t)),n||n!==!1&&U8h(t.url))){let p=i&&a&&V8h.read(a);p&&u.set(i,p)}return t};var HQS=typeof XMLHttpRequest<"u",H8h=HQS&&function(e){return new Promise(function(r,n){let i=_is(e),a=i.data,u=jJ.from(i.headers).normalize(),{responseType:c,onUploadProgress:p,onDownloadProgress:s}=i,o,l,O,A,E;function C(){A&&A(),E&&E(),i.cancelToken&&i.cancelToken.unsubscribe(o),i.signal&&i.signal.removeEventListener("abort",o)}let M=new XMLHttpRequest;M.open(i.method.toUpperCase(),i.url,!0),M.timeout=i.timeout;function q(){if(!M)return;let U=jJ.from("getAllResponseHeaders"in M&&M.getAllResponseHeaders()),K={data:!c||c==="text"||c==="json"?M.responseText:M.response,status:M.status,statusText:M.statusText,headers:U,config:e,request:M};E2r(function(te){r(te),C()},function(te){n(te),C()},K),M=null}"onloadend"in M?M.onloadend=q:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(q)},M.onabort=function(){M&&(n(new B0("Request aborted",B0.ECONNABORTED,e,M)),M=null)},M.onerror=function(Q){let K=Q&&Q.message?Q.message:"Network Error",X=new B0(K,B0.ERR_NETWORK,e,M);X.event=Q||null,n(X),M=null},M.ontimeout=function(){let Q=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",K=i.transitional||S6a;i.timeoutErrorMessage&&(Q=i.timeoutErrorMessage),n(new B0(Q,K.clarifyTimeoutError?B0.ETIMEDOUT:B0.ECONNABORTED,e,M)),M=null},a===void 0&&u.setContentType(null),"setRequestHeader"in M&&Hf.forEach(u.toJSON(),function(Q,K){M.setRequestHeader(K,Q)}),Hf.isUndefined(i.withCredentials)||(M.withCredentials=!!i.withCredentials),c&&c!=="json"&&(M.responseType=i.responseType),s&&([O,E]=Qsi(s,!0),M.addEventListener("progress",O)),p&&M.upload&&([l,A]=Qsi(p),M.upload.addEventListener("progress",l),M.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(o=U=>{M&&(n(!U||U.type?new uet(null,e,M):U),M.abort(),M=null)},i.cancelToken&&i.cancelToken.subscribe(o),i.signal&&(i.signal.aborted?o():i.signal.addEventListener("abort",o)));let L=TNo(i.url);if(L&&g6.protocols.indexOf(L)===-1){n(new B0("Unsupported protocol "+L+":",B0.ERR_BAD_REQUEST,e));return}M.send(a||null)})};var GQS=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(s){if(!i){i=!0,c();let o=s instanceof Error?s:this.reason;n.abort(o instanceof B0?o:new uet(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new B0(`timeout ${t} of ms exceeded`,B0.ETIMEDOUT))},t),c=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:p}=n;return p.unsubscribe=()=>Hf.asap(c),p}},G8h=GQS;var JQS=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},KQS=async function*(e,t){for await(let r of $QS(e))yield*JQS(r,t)},$QS=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()}},XVl=(e,t,r,n)=>{let i=KQS(e,t),a=0,u,c=p=>{u||(u=!0,n&&n(p))};return new ReadableStream({async pull(p){try{let{done:s,value:o}=await i.next();if(s){c(),p.close();return}let l=o.byteLength;if(r){let O=a+=l;r(O)}p.enqueue(new Uint8Array(o))}catch(s){throw c(s),s}},cancel(p){return c(p),i.return()}},{highWaterMark:2})};var J8h=64*1024,{isFunction:his}=Hf,YQS=(({Request:e,Response:t})=>({Request:e,Response:t}))(Hf.global),{ReadableStream:K8h,TextEncoder:$8h}=Hf.global,Y8h=(e,...t)=>{try{return!!e(...t)}catch{return!1}},XQS=e=>{e=Hf.merge.call({skipUndefined:!0},YQS,e);let{fetch:t,Request:r,Response:n}=e,i=t?his(t):typeof fetch=="function",a=his(r),u=his(n);if(!i)return!1;let c=i&&his(K8h),p=i&&(typeof $8h=="function"?(E=>C=>E.encode(C))(new $8h):async E=>new Uint8Array(await new r(E).arrayBuffer())),s=a&&c&&Y8h(()=>{let E=!1,C=new r(g6.origin,{body:new K8h,method:"POST",get duplex(){return E=!0,"half"}}).headers.has("Content-Type");return E&&!C}),o=u&&c&&Y8h(()=>Hf.isReadableStream(new n("").body)),l={stream:o&&(E=>E.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(E=>{!l[E]&&(l[E]=(C,M)=>{let q=C&&C[E];if(q)return q.call(C);throw new B0(`Response type '${E}' is not supported`,B0.ERR_NOT_SUPPORT,M)})});let O=async E=>{if(E==null)return 0;if(Hf.isBlob(E))return E.size;if(Hf.isSpecCompliantForm(E))return(await new r(g6.origin,{method:"POST",body:E}).arrayBuffer()).byteLength;if(Hf.isArrayBufferView(E)||Hf.isArrayBuffer(E))return E.byteLength;if(Hf.isURLSearchParams(E)&&(E=E+""),Hf.isString(E))return(await p(E)).byteLength},A=async(E,C)=>{let M=Hf.toFiniteNumber(E.getContentLength());return M??O(C)};return async E=>{let{url:C,method:M,data:q,signal:L,cancelToken:U,timeout:Q,onDownloadProgress:K,onUploadProgress:X,responseType:te,headers:ee,withCredentials:re="same-origin",fetchOptions:ue}=_is(E),me=t||fetch;te=te?(te+"").toLowerCase():"text";let Oe=G8h([L,U&&U.toAbortSignal()],Q),Ee=null,Ae=Oe&&Oe.unsubscribe&&(()=>{Oe.unsubscribe()}),Me;try{if(X&&s&&M!=="get"&&M!=="head"&&(Me=await A(ee,q))!==0){let ze=new r(C,{method:"POST",body:q,duplex:"half"}),Dr;if(Hf.isFormData(q)&&(Dr=ze.headers.get("content-type"))&&ee.setContentType(Dr),ze.body){let[ut,vr]=I6a(Me,Qsi(M6a(X)));q=XVl(ze.body,J8h,ut,vr)}}Hf.isString(re)||(re=re?"include":"omit");let Qe=a&&"credentials"in r.prototype,Be={...ue,signal:Oe,method:M.toUpperCase(),headers:ee.normalize().toJSON(),body:q,duplex:"half",credentials:Qe?re:void 0};Ee=a&&new r(C,Be);let Mt=await(a?me(Ee,ue):me(C,Be)),zt=o&&(te==="stream"||te==="response");if(o&&(K||zt&&Ae)){let ze={};["status","statusText","headers"].forEach(Yt=>{ze[Yt]=Mt[Yt]});let Dr=Hf.toFiniteNumber(Mt.headers.get("content-length")),[ut,vr]=K&&I6a(Dr,Qsi(M6a(K),!0))||[];Mt=new n(XVl(Mt.body,J8h,ut,()=>{vr&&vr(),Ae&&Ae()}),ze)}te=te||"text";let Ye=await l[Hf.findKey(l,te)||"text"](Mt,E);return!zt&&Ae&&Ae(),await new Promise((ze,Dr)=>{E2r(ze,Dr,{data:Ye,headers:jJ.from(Mt.headers),status:Mt.status,statusText:Mt.statusText,config:E,request:Ee})})}catch(Qe){throw Ae&&Ae(),Qe&&Qe.name==="TypeError"&&/Load failed|fetch/i.test(Qe.message)?Object.assign(new B0("Network Error",B0.ERR_NETWORK,E,Ee),{cause:Qe.cause||Qe}):B0.from(Qe,Qe&&Qe.code,E,Ee)}}},ZQS=new Map,ZVl=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],u=a.length,c=u,p,s,o=ZQS;for(;c--;)p=a[c],s=o.get(p),s===void 0&&o.set(p,s=c?new Map:XQS(t)),o=s;return s},T8Q=ZVl();var kVl={http:L8h,xhr:H8h,fetch:{get:ZVl}};Hf.forEach(kVl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var X8h=e=>`- ${e}`,e9S=e=>Hf.isFunction(e)||e===null||e===!1,yis={getAdapter:(e,t)=>{e=Hf.isArray(e)?e:[e];let{length:r}=e,n,i,a={};for(let u=0;u<r;u++){n=e[u];let c;if(i=n,!e9S(n)&&(i=kVl[(c=String(n)).toLowerCase()],i===void 0))throw new B0(`Unknown adapter '${c}'`);if(i&&(Hf.isFunction(i)||(i=i.get(t))))break;a[c||"#"+u]=i}if(!i){let u=Object.entries(a).map(([p,s])=>`adapter ${p} `+(s===!1?"is not supported by the environment":"is not available in the build")),c=r?u.length>1?`since :
|
|
@@ -2400,10 +2400,10 @@ ${Q}${L}${K}${m5a}`});function Rps({message:e,error:t,logger:r,logLevel:n=zj.Err
|
|
|
2400
2400
|
Run ${yd.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
2401
2401
|
Run ${yd.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),T6a(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function faf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!opy(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((c,p)=>c.generatorName.localeCompare(p.generatorName)||c.currentVersion.localeCompare(p.currentVersion));for(let c of u)i+=`
|
|
2402
2402
|
${await vSD(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+yd.dim(c.currentVersion)+yd.reset(" \u2192 ")+yd.green(c.latestVersion);return i+=`
|
|
2403
|
-
`,n?T6a(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function vSD(e){let r=await new apy.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 bSD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await spy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(p,s,o,l)=>{c.versions[s]==null&&(c.versions[s]={});let O=Dji(o.name,l),A=await O6r({generatorName:O,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[s][o.name]={previousVersion:o.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let u={type:"multiApi",versions:{}};return await spy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,p,s,o)=>{if(c==null)return;u.versions[c]==null&&(u.versions[c]={}),u.versions[c][p]==null&&(u.versions[c][p]={});let l=Dji(s.name,o),O=await O6r({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:o});O!=null&&(u.versions[c][p][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),u}async function spy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let c=await gDr({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(c==null||c.groups==null)){for(let p of c.groups)if(!(i!=null&&p.groupName!==i))for(let s of p.generators)n!=null&&s.name!==n||await r(a.workspaceName,p.groupName,s,u)}})}))}function cpy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,c]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let p=aRe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(p?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:p,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function Qps({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let c=await bSD({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[p,s]of Object.entries(c.versions))u.push(...cpy(s,p,t.logger));else u.push(...cpy(c.versions,void 0,t.logger))}return u}var w3o=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),c=u?`status code ${u}`:"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 w5a=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var daf=(()=>{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})(),lpy=typeof globalThis.AbortController=="function",fpy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",dpy=typeof globalThis.ReadableStream=="function",ppy=typeof globalThis.FormData=="function",Lps=["get","post","put","patch","head","delete"],gSD=()=>{};gSD();var _py={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Ups=2147483647,hpy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Vps=Symbol("stop"),ypy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},vpy={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 mSD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=hpy,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},bpy=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,n=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:n},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(i){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:c,value:p}=await a.read();if(c){i.close();return}if(t){n+=p.byteLength;let s=r===0?0:n/r;t({percent:s,transferredBytes:n,totalBytes:r},p)}i.enqueue(p),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},gpy=(e,t,r)=>{let n=mSD(r??e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let u=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:p,value:s}=await u.read();if(p){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(n,i)},new Uint8Array),a.close();return}i+=s.byteLength;let o=n===0?0:i/n;(n<i||o===1)&&(o=.99),t&&t({percent:Number(o.toFixed(2)),transferredBytes:i,totalBytes:n},s),a.enqueue(s),await c()}await c()}})})};var j5a=e=>e!==null&&typeof e=="object";var j3o=(...e)=>{for(let t of e)if((!j5a(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return haf({},...e)},paf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function Wps(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:haf(e[r]??[],t[r]??[])}var _af=(e={},t={})=>({beforeRequest:Wps(e,t,"beforeRequest"),beforeRetry:Wps(e,t,"beforeRetry"),afterResponse:Wps(e,t,"afterResponse"),beforeError:Wps(e,t,"beforeError")}),haf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(j5a(i)){for(let[a,u]of Object.entries(i))j5a(u)&&a in t&&(u=haf(t[a],u)),t={...t,[a]:u};j5a(i.hooks)&&(n=_af(n,i.hooks),t.hooks=n),j5a(i.headers)&&(r=paf(r,i.headers),t.headers=r)}return t};var Opy=e=>Lps.includes(e)?e.toUpperCase():e,OSD=["get","put","head","delete","options","trace"],ASD=[408,413,429,500,502,503,504],PSD=[413,429,503],mpy={limit:2,methods:OSD,statusCodes:ASD,afterStatusCodes:PSD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Apy=(e={})=>{if(typeof e=="number")return{...mpy,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{...mpy,...e}};async function yaf(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new w5a(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function vaf(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 Ppy=(e,t)=>{let r={};for(let n in t)!(n in vpy)&&!(n in ypy)&&!(n in e)&&(r[n]=t[n]);return r},wpy=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 E3o=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>Ups)throw new RangeError(`The \`timeout\` option cannot be greater than ${Ups}`);await Promise.resolve();let c=await n._fetch();for(let p of n._options.hooks.afterResponse){let s=await p(n.request,n._options,n._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let p=new w3o(c,n.request,n._options);for(let s of n._options.hooks.beforeError)p=await s(p);throw p}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!dpy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return bpy(c.clone(),n._options.onDownloadProgress)}return c},u=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{n.request.bodyUsed||await n.request.body?.cancel()});for(let[c,p]of Object.entries(_py))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(u[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||p);let s=await u;if(c==="json"){if(s.status===204)return"";let o=await s.text();return o===""?"":r.parseJson?r.parseJson(o):JSON.parse(o)}return s[c]()});return u}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;constructor(t,r={}){if(this._input=t,this._options={...r,headers:paf(this._input.headers,r.headers),hooks:_af({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Opy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Apy(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(lpy&&fpy){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(daf&&(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),wpy(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);(ppy&&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(!daf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=gpy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof w5a)throw t;if(t instanceof w3o){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),Ups);if(this._retryCount<1)throw r;await vaf(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})===Vps)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Ppy(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):yaf(r,t,this.abortController,this._options)}};var baf=e=>{let t=(r,n)=>E3o.create(r,j3o(e,n));for(let r of Lps)t[r]=(n,i)=>E3o.create(n,j3o(e,i,{method:r}));return t.create=r=>baf(j3o(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),baf(j3o(e,r))),t.stop=Vps,t},wSD=baf(),jpy=wSD;var Kpy=ea(Jpy(),1);function Paf(e){let t=(0,Kpy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var U_y=ea(L_y(),1),V_y=ea(b4r(),1),Raf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},xaf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Faf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??Paf(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,U_y.default)(a.toString(),{recursive:!0}),p={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete p.accept,c&&(p.authorization=`${c.type} ${c.token}`);let s;try{s=await jpy(u,{headers:p,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Raf(e):l}if(t.allVersions)return s;let o=new xaf(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(n&&!l)for(let[A,E]of Object.entries(s.versions))E.deprecated&&delete s.versions[A];if(!l){let A=Object.keys(s.versions);if(r=V_y.default.maxSatisfying(A,r),!r)throw o}let{time:O}=s;if(s=s.versions[r],s.time=O,!s)throw o}return s}async function B3o(e,t){let{version:r}=await Faf(e.toLowerCase(),t);return r}async function uDi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:B3o(e.packageName,{version:t?"prerelease":"latest"})}var W_y=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],r_s=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=zj.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new zps(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(i==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.78.5"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${yd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Tae}failWithoutThrowing(t,r){this.didSucceed=!1,Rps({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await P6a()).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 upy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2403
|
+
`,n?T6a(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function vSD(e){let r=await new apy.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 bSD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await spy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(p,s,o,l)=>{c.versions[s]==null&&(c.versions[s]={});let O=Dji(o.name,l),A=await O6r({generatorName:O,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[s][o.name]={previousVersion:o.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let u={type:"multiApi",versions:{}};return await spy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,p,s,o)=>{if(c==null)return;u.versions[c]==null&&(u.versions[c]={}),u.versions[c][p]==null&&(u.versions[c][p]={});let l=Dji(s.name,o),O=await O6r({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:o});O!=null&&(u.versions[c][p][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),u}async function spy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let c=await gDr({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(c==null||c.groups==null)){for(let p of c.groups)if(!(i!=null&&p.groupName!==i))for(let s of p.generators)n!=null&&s.name!==n||await r(a.workspaceName,p.groupName,s,u)}})}))}function cpy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,c]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let p=aRe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(p?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:p,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function Qps({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let c=await bSD({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[p,s]of Object.entries(c.versions))u.push(...cpy(s,p,t.logger));else u.push(...cpy(c.versions,void 0,t.logger))}return u}var w3o=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),c=u?`status code ${u}`:"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 w5a=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var daf=(()=>{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})(),lpy=typeof globalThis.AbortController=="function",fpy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",dpy=typeof globalThis.ReadableStream=="function",ppy=typeof globalThis.FormData=="function",Lps=["get","post","put","patch","head","delete"],gSD=()=>{};gSD();var _py={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Ups=2147483647,hpy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Vps=Symbol("stop"),ypy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},vpy={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 mSD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=hpy,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},bpy=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,n=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:n},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(i){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:c,value:p}=await a.read();if(c){i.close();return}if(t){n+=p.byteLength;let s=r===0?0:n/r;t({percent:s,transferredBytes:n,totalBytes:r},p)}i.enqueue(p),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},gpy=(e,t,r)=>{let n=mSD(r??e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let u=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:p,value:s}=await u.read();if(p){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(n,i)},new Uint8Array),a.close();return}i+=s.byteLength;let o=n===0?0:i/n;(n<i||o===1)&&(o=.99),t&&t({percent:Number(o.toFixed(2)),transferredBytes:i,totalBytes:n},s),a.enqueue(s),await c()}await c()}})})};var j5a=e=>e!==null&&typeof e=="object";var j3o=(...e)=>{for(let t of e)if((!j5a(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return haf({},...e)},paf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function Wps(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:haf(e[r]??[],t[r]??[])}var _af=(e={},t={})=>({beforeRequest:Wps(e,t,"beforeRequest"),beforeRetry:Wps(e,t,"beforeRetry"),afterResponse:Wps(e,t,"afterResponse"),beforeError:Wps(e,t,"beforeError")}),haf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(j5a(i)){for(let[a,u]of Object.entries(i))j5a(u)&&a in t&&(u=haf(t[a],u)),t={...t,[a]:u};j5a(i.hooks)&&(n=_af(n,i.hooks),t.hooks=n),j5a(i.headers)&&(r=paf(r,i.headers),t.headers=r)}return t};var Opy=e=>Lps.includes(e)?e.toUpperCase():e,OSD=["get","put","head","delete","options","trace"],ASD=[408,413,429,500,502,503,504],PSD=[413,429,503],mpy={limit:2,methods:OSD,statusCodes:ASD,afterStatusCodes:PSD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Apy=(e={})=>{if(typeof e=="number")return{...mpy,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{...mpy,...e}};async function yaf(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new w5a(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function vaf(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 Ppy=(e,t)=>{let r={};for(let n in t)!(n in vpy)&&!(n in ypy)&&!(n in e)&&(r[n]=t[n]);return r},wpy=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 E3o=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>Ups)throw new RangeError(`The \`timeout\` option cannot be greater than ${Ups}`);await Promise.resolve();let c=await n._fetch();for(let p of n._options.hooks.afterResponse){let s=await p(n.request,n._options,n._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let p=new w3o(c,n.request,n._options);for(let s of n._options.hooks.beforeError)p=await s(p);throw p}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!dpy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return bpy(c.clone(),n._options.onDownloadProgress)}return c},u=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{n.request.bodyUsed||await n.request.body?.cancel()});for(let[c,p]of Object.entries(_py))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(u[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||p);let s=await u;if(c==="json"){if(s.status===204)return"";let o=await s.text();return o===""?"":r.parseJson?r.parseJson(o):JSON.parse(o)}return s[c]()});return u}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;constructor(t,r={}){if(this._input=t,this._options={...r,headers:paf(this._input.headers,r.headers),hooks:_af({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Opy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Apy(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(lpy&&fpy){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(daf&&(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),wpy(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);(ppy&&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(!daf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=gpy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof w5a)throw t;if(t instanceof w3o){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),Ups);if(this._retryCount<1)throw r;await vaf(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})===Vps)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Ppy(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):yaf(r,t,this.abortController,this._options)}};var baf=e=>{let t=(r,n)=>E3o.create(r,j3o(e,n));for(let r of Lps)t[r]=(n,i)=>E3o.create(n,j3o(e,i,{method:r}));return t.create=r=>baf(j3o(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),baf(j3o(e,r))),t.stop=Vps,t},wSD=baf(),jpy=wSD;var Kpy=ea(Jpy(),1);function Paf(e){let t=(0,Kpy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var U_y=ea(L_y(),1),V_y=ea(b4r(),1),Raf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},xaf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Faf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??Paf(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,U_y.default)(a.toString(),{recursive:!0}),p={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete p.accept,c&&(p.authorization=`${c.type} ${c.token}`);let s;try{s=await jpy(u,{headers:p,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Raf(e):l}if(t.allVersions)return s;let o=new xaf(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(n&&!l)for(let[A,E]of Object.entries(s.versions))E.deprecated&&delete s.versions[A];if(!l){let A=Object.keys(s.versions);if(r=V_y.default.maxSatisfying(A,r),!r)throw o}let{time:O}=s;if(s=s.versions[r],s.time=O,!s)throw o}return s}async function B3o(e,t){let{version:r}=await Faf(e.toLowerCase(),t);return r}async function uDi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:B3o(e.packageName,{version:t?"prerelease":"latest"})}var W_y=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],r_s=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=zj.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new zps(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(i==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.78.6"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${yd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Tae}failWithoutThrowing(t,r){this.didSucceed=!1,Rps({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await P6a()).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 upy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2404
2404
|
`)||(r+=`
|
|
2405
2405
|
`),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=gDl(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 b3o(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 Tae}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await P6a()).sendEvent(t)}logger=R4r((t,...r)=>this.log(t,...r));stderr=R4r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=H_y(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?H_y(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=W_y[this.numTasks++%W_y.length],u=yd.hex(a)(i);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===CL.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=>Qwi.indexOf(i.level)>=Qwi.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===zj.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 uDi({cliEnvironment:this.environment,includePreReleases:t}),n=aRe(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await Qps({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await Yif({message:t,default:r})}async getInput(t){return await Xif({message:t.message,default:t.default})}};function H_y(e){return`[${e}]:`}var pCr=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}};var Ret=class extends pCr{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 Qci={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1};function T3o({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??Qci.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??Qci.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??Qci.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??Qci.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??Qci.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??Qci.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??Qci.inlinePathParameters,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??Qci.useBytesForBinaryResponse,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??Qci.respectForwardCompatibleEnums}}var UOe={openapi:e=>({...e,type:"openapi",_visit:function(t){return UOe._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return UOe._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 B5a={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return B5a._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Ule={basic:e=>({...e,type:"basic",_visit:function(t){return Ule._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return Ule._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Ule._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return Ule._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Ule._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 xS={primitive:e=>({value:e,type:"primitive",_visit:function(t){return xS._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return xS._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return xS._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return xS._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return xS._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return xS._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return xS._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return xS._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var Im={int:e=>({value:e,type:"int",_visit:function(t){return Im._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return Im._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return Im._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return Im._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return Im._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return Im._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Im._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return Im._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return Im._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return Im._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return Im._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 sDi={boolean:e=>({value:e,type:"boolean",_visit:function(t){return sDi._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return sDi._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 cDi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return cDi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return cDi._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 n_s={};ds(n_s,{Availability:()=>Vle,CustomCodeSample:()=>A8r,EndpointExample:()=>wdt,EndpointResponseExample:()=>jdt,HttpMethod:()=>Hle,LiteralSchemaValue:()=>JL,MultipartRequestPropertyEncoding:()=>Laf,MultipartSchema:()=>P8r,OneOfSchema:()=>w8r,Pagination:()=>xet,PrimitiveSchemaValue:()=>iT,Request:()=>_Cr,Response:()=>yye,RetriesConfiguration:()=>q3o,Schema:()=>$P,SupportedSdkLanguage:()=>Wle,WebhookHttpMethod:()=>Qaf,WebsocketMessageOrigin:()=>zaf});var zaf={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case zaf.Client:return t.client();case zaf.Server:return t.server();default:return t._other()}}};var Qaf={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case Qaf.Get:return t.get();case Qaf.Post:return t.post();default:return t._other()}}};var Vle={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case Vle.GenerallyAvailable:return t.generallyAvailable();case Vle.Beta:return t.beta();case Vle.Deprecated:return t.deprecated();default:return t._other()}}};var q3o={disabled:e=>({value:e,type:"disabled",_visit:function(t){return q3o._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"disabled":return t.disabled(e.value);default:return t._other(e)}}};var xet={cursor:e=>({...e,type:"cursor",_visit:function(t){return xet._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return xet._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return xet._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 A8r={language:e=>({...e,type:"language",_visit:function(t){return A8r._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return A8r._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 Wle={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 Wle.Curl:return t.curl();case Wle.Python:return t.python();case Wle.Javascript:return t.javascript();case Wle.Typescript:return t.typescript();case Wle.Go:return t.go();case Wle.Ruby:return t.ruby();case Wle.Csharp:return t.csharp();case Wle.Java:return t.java();case Wle.Js:return t.js();case Wle.Node:return t.node();case Wle.Ts:return t.ts();case Wle.Nodets:return t.nodets();case Wle.Golang:return t.golang();case Wle.Dotnet:return t.dotnet();case Wle.Jvm:return t.jvm();default:return t._other()}}};var wdt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return wdt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return wdt._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 jdt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return jdt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return jdt._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 Hle={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case Hle.Get:return t.get();case Hle.Post:return t.post();case Hle.Put:return t.put();case Hle.Patch:return t.patch();case Hle.Delete:return t.delete();case Hle.Head:return t.head();case Hle.Options:return t.options();case Hle.Trace:return t.trace();default:return t._other()}}};var _Cr={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return _Cr._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return _Cr._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return _Cr._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return _Cr._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 Laf={Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case Laf.Json:return t.json();case Laf.Form:return t.form();default:return t._other()}}};var P8r={file:e=>({...e,type:"file",_visit:function(t){return P8r._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return P8r._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 yye={file:e=>({...e,type:"file",_visit:function(t){return yye._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return yye._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return yye._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return yye._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return yye._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return yye._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return yye._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 $P={primitive:e=>({...e,type:"primitive",_visit:function(t){return $P._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return $P._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return $P._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return $P._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return $P._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return $P._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return $P._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return $P._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return $P._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return $P._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return $P._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 iT={int:e=>({...e,type:"int",_visit:function(t){return iT._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return iT._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return iT._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return iT._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return iT._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return iT._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return iT._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return iT._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return iT._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return iT._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return iT._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 JL={boolean:e=>({value:e,type:"boolean",_visit:function(t){return JL._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return JL._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 w8r={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return w8r._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return w8r._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 bSe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return bSe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return bSe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return bSe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return bSe._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 _Q={file:e=>({...e,type:"file",_visit:function(t){return _Q._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return _Q._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return _Q._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return _Q._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return _Q._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return _Q._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return _Q._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 Uh={primitive:e=>({...e,type:"primitive",_visit:function(t){return Uh._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Uh._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Uh._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Uh._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Uh._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Uh._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Uh._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Uh._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Uh._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Uh._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Uh._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 gSe={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return gSe._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return gSe._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 Zg={int:e=>({...e,type:"int",_visit:function(t){return Zg._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Zg._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Zg._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Zg._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Zg._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Zg._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Zg._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Zg._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Zg._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Zg._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Zg._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 Aw={};ds(Aw,{AllOfPropertyConflict:()=>rQa,ArraySchema:()=>mhs,ArraySchemaWithExample:()=>Xhs,Availability:()=>p_s,Base64WithExample:()=>Ghs,BasicSecurityScheme:()=>y_s,BearerSecurityScheme:()=>v_s,BooleanSchema:()=>_hs,BooleanWithExample:()=>Jhs,BytesResponse:()=>G5a,CasingOverrides:()=>m_s,CommonProperty:()=>Dhs,CommonPropertyWithExample:()=>oys,CursorPagination:()=>X_s,CustomCodeSample:()=>$_s,CustomCodeSampleLanguage:()=>G_s,CustomCodeSampleSdk:()=>K_s,CustomPagination:()=>k_s,DateWithExample:()=>Hhs,DatetimeWithExample:()=>Whs,DiscriminatedOneOfSchema:()=>Ehs,DiscriminatedOneOfSchemaWithExample:()=>iys,DoubleSchema:()=>dhs,DoubleWithExample:()=>Uhs,Encoding:()=>d_s,Endpoint:()=>ehs,EndpointExample:()=>Y5a,EndpointResponseExample:()=>H_s,EndpointSdkName:()=>S8r,EndpointWithExample:()=>Ohy,EnumSchema:()=>R5a,EnumSchemaWithExample:()=>$hs,EnumValue:()=>dDi,ErrorExample:()=>Q_s,FernExample:()=>U_s,FileResponse:()=>W5a,FileSchema:()=>B_s,FloatWithExample:()=>Lhs,FormUrlEncodedRequest:()=>x_s,FullEndpointExample:()=>Y_s,FullExample:()=>z2,FullObjectExample:()=>S_s,FullOneOfExample:()=>C_s,GlobalHeader:()=>yhs,Header:()=>_Di,HeaderExample:()=>$5a,HeaderSecurityScheme:()=>b_s,HeaderWithExample:()=>vDi,HttpEndpointServer:()=>J5a,HttpError:()=>L_s,HttpErrorWithExample:()=>Rhs,HttpMethod:()=>z5a,IdempotencyHeader:()=>vhs,Int64WithExample:()=>Fhs,IntSchema:()=>lhs,IntWithExample:()=>xhs,JsonRequest:()=>R_s,JsonRequestWithExample:()=>Bhs,JsonResponse:()=>H5a,JsonResponseWithExample:()=>aQa,KeyValuePair:()=>D_s,LiteralExample:()=>E_s,LiteralSchema:()=>tQa,LiteralSchemaValue:()=>bhs,LongSchema:()=>fhs,MapSchema:()=>Ohs,MapSchemaWithExample:()=>Zhs,MultipartRequest:()=>V5a,MultipartRequestProperty:()=>N_s,MultipartRequestPropertyEncoding:()=>q_s,MultipartSchema:()=>T_s,NamedFullExample:()=>Sdt,Namespace:()=>O_s,NamespaceId:()=>j_s,NullableSchema:()=>Phs,NullableSchemaWithExample:()=>eys,OauthSecurityScheme:()=>P_s,ObjectProperty:()=>jhs,ObjectPropertyConflictInfo:()=>nQa,ObjectPropertyWithExample:()=>nys,ObjectSchema:()=>ghs,ObjectSchemaWithExample:()=>tys,OctetStreamRequest:()=>U5a,OffsetPagination:()=>Z_s,OneOfSchema:()=>whs,OneOfSchemaWithExample:()=>rys,OpenApiIntermediateRepresentation:()=>ghy,OpenApiSource:()=>s_s,OptionalSchema:()=>Ahs,OptionalSchemaWithExample:()=>khs,Pagination:()=>X5a,ParseFormUrlEncodedRequest:()=>Ths,ParseMultipartRequest:()=>Mhs,ParseOctetStreamRequest:()=>Ihs,PathParameter:()=>Q5a,PathParameterExample:()=>V_s,PathParameterWithExample:()=>Chs,PrimitiveExample:()=>F5a,PrimitiveSchema:()=>yDi,PrimitiveSchemaValue:()=>hhs,PrimitiveSchemaValueWithExample:()=>Khs,PrimitiveSchemaWithExample:()=>oQa,PropertyKey:()=>x5a,ProtobufEncoding:()=>f_s,ProtobufSource:()=>c_s,QueryParameter:()=>L5a,QueryParameterExample:()=>K5a,QueryParameterWithExample:()=>iQa,QuerySecurityScheme:()=>g_s,ReferencedSchema:()=>D8r,Request:()=>F_s,RequestWithExample:()=>qhs,Response:()=>z_s,ResponseWithExample:()=>Nhs,RetriesConfiguration:()=>Z5a,Schema:()=>fC,SchemaId:()=>mSe,SchemaWithExample:()=>j4,Schemas:()=>chs,SdkGroup:()=>A_s,SdkGroupInfo:()=>I_s,SdkGroupName:()=>pDi,SecurityScheme:()=>w_s,SecuritySchemeId:()=>h_s,Server:()=>F3o,Source:()=>l_s,StatusCode:()=>j8r,StreamingResponseExample:()=>W_s,StringSchema:()=>phs,StringSchemaWithExample:()=>Vhs,SupportedSdkLanguage:()=>J_s,Tag:()=>__s,TagId:()=>OSe,Tags:()=>M_s,TextResponse:()=>hDi,Uint64WithExample:()=>Qhs,UintWithExample:()=>zhs,UnDiscriminatedOneOfSchema:()=>Shs,UnDiscriminatedOneOfSchemaWithExample:()=>ays,UnknownSchemaWithExample:()=>Yhs,Webhook:()=>ths,WebhookExampleCall:()=>eQa,WebhookHttpMethod:()=>k5a,WebhookWithExample:()=>Ahy,WebsocketChannel:()=>shs,WebsocketHandshake:()=>rhs,WebsocketHandshakeWithExample:()=>mhy,WebsocketMessageExample:()=>ohs,WebsocketMessageOrigin:()=>nhs,WebsocketMessageSchema:()=>ihs,WebsocketServer:()=>ahs,WebsocketSessionExample:()=>uhs,WithAvailability:()=>qA,WithDescription:()=>By,WithEncoding:()=>uRe,WithInline:()=>w4,WithName:()=>YE,WithNamespace:()=>lE,WithSdkGroupName:()=>oI,WithSdkMethodName:()=>E8r,WithSource:()=>tA,WithStatusCode:()=>Edt,WithTitle:()=>aI,commons:()=>Gaf,example:()=>Jaf,finalIr:()=>Kaf,parseIr:()=>$af});var Gaf={};ds(Gaf,{BasicSecurityScheme:()=>y_s,BearerSecurityScheme:()=>v_s,Encoding:()=>d_s,HeaderSecurityScheme:()=>b_s,Namespace:()=>O_s,NamespaceId:()=>j_s,OauthSecurityScheme:()=>P_s,OpenApiSource:()=>s_s,ProtobufEncoding:()=>f_s,ProtobufSource:()=>c_s,QuerySecurityScheme:()=>g_s,SchemaId:()=>mSe,SdkGroup:()=>A_s,SdkGroupName:()=>pDi,SecurityScheme:()=>w_s,SecuritySchemeId:()=>h_s,Server:()=>F3o,Source:()=>l_s,StatusCode:()=>j8r,Tag:()=>__s,TagId:()=>OSe,WithAvailability:()=>qA,WithDescription:()=>By,WithEncoding:()=>uRe,WithInline:()=>w4,WithName:()=>YE,WithNamespace:()=>lE,WithSdkGroupName:()=>oI,WithSdkMethodName:()=>E8r,WithSource:()=>tA,WithStatusCode:()=>Edt,WithTitle:()=>aI});var Wr={};ds(Wr,{JsonError:()=>T5a,ParseError:()=>q5a,any:()=>ohy,bigint:()=>J_y,boolean:()=>uhy,booleanLiteral:()=>ahy,date:()=>K_y,discriminant:()=>yhy,enum_:()=>a_s,getObjectLikeUtils:()=>hCr,getObjectUtils:()=>UKi,getSchemaUtils:()=>F2,isProperty:()=>fDi,lazy:()=>$_y,lazyObject:()=>rhy,list:()=>u_s,number:()=>shy,object:()=>o_s,objectWithoutOptionalProperties:()=>thy,optional:()=>Uaf,property:()=>X_y,record:()=>dhy,set:()=>phy,string:()=>chy,stringLiteral:()=>ihy,transform:()=>Vaf,undiscriminatedUnion:()=>hhy,union:()=>bhy,unknown:()=>lhy,withParsedProperties:()=>Haf});var aT={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 w6(e,t){return`Expected ${t}. Received ${IDD(e)}.`}function IDD(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 Gle(e){return{...e,json:G_y(e.json),parse:G_y(e.parse)}}function G_y(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(`
|
|
2406
|
-
`)),{ok:!0,value:t}):n}}function i_s(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var T5a=class e extends Error{errors;constructor(t){super(t.map(i_s).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var q5a=class e extends Error{errors;constructor(t){super(t.map(i_s).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function F2(e){return{optional:()=>Uaf(e),transform:t=>Vaf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new q5a(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new T5a(n.errors)}}}function Uaf(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:()=>aT.OPTIONAL};return{...t,...F2(t)}}function Vaf(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,...F2(r)}}function J_y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:w6(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:w6(t,"bigint")}]},getType:()=>aT.BIGINT};return{...Gle(e),...F2(e)}}var MDD=/^([+-]?\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 K_y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:w6(t,"string")}]}:MDD.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:w6(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:w6(t,"Date object")}]},getType:()=>aT.DATE};return{...Gle(e),...F2(e)}}function VOe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Gle(r),...F2(r)}}}function a_s(e){let t=new Set(e);return VOe(aT.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:w6(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:w6(n,"enum")}]}:{ok:!0,value:n})()}function $_y(e){let t=Waf(e);return{...t,...F2(t)}}function Waf(e){return{parse:(t,r)=>N5a(e).parse(t,r),json:(t,r)=>N5a(e).json(t,r),getType:()=>N5a(e).getType()}}function N5a(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function N3o(e){return Object.entries(e)}function R3o(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function lDi(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 x3o(e){return Object.keys(e)}function Y_y(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function hCr(e){return{withParsedProperties:t=>Haf(e,t)}}function Haf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let u=Object.entries(t).reduce((c,[p,s])=>({...c,[p]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(n,i)=>{if(!lDi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:w6(n,"object")}]};let a=new Set(Object.keys(t)),u=R3o(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(u,i)},getType:()=>e.getType()};return{...r,...F2(r),...hCr(r)}}function X_y(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function fDi(e){return e.isProperty}function o_s(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>fDi(n)?n.rawKey:r),_getParsedProperties:()=>x3o(e),parse:(r,n)=>{let i={},a=[];for(let[u,c]of N3o(e)){let p=fDi(c)?c.rawKey:u,s=fDi(c)?c.valueSchema:c,o={rawKey:p,parsedKey:u,valueSchema:s};i[p]=o,ehy(s)&&a.push(p)}return Z_y({value:r,requiredKeys:a,getProperty:u=>{let c=i[u];if(c!=null)return{transformedKey:c.parsedKey,transform:p=>c.valueSchema.parse(p,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,u]of N3o(e)){let c=fDi(u)?u.valueSchema:u;ehy(c)&&i.push(a)}return Z_y({value:r,requiredKeys:i,getProperty:a=>{let u=e[a];if(u!=null)return fDi(u)?{transformedKey:u.rawKey,transform:c=>u.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>u.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>aT.OBJECT};return{...Gle(t),...F2(t),...hCr(t),...UKi(t)}}function Z_y({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!lDi(e))return{ok:!1,errors:[{path:a,message:w6(e,"object")}]};let u=new Set(t),c=[],p={};for(let[s,o]of Object.entries(e)){let l=r(s);if(l!=null){u.delete(s);let O=l.transform(o);O.ok?p[l.transformedKey]=O.value:(p[s]=o,c.push(...O.errors))}else switch(n){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":p[s]=o;break}}return c.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||i?{ok:!0,value:p}:{ok:!1,errors:c}}function UKi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>k_y({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>k_y({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>aT.OBJECT};return{...r,...F2(r),...hCr(r),...UKi(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:()=>aT.OBJECT};return{...t,...F2(t),...hCr(t),...UKi(t)}}}}function k_y({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,u]=Y_y(x3o(t),s=>i.has(s)),c=r(R3o(t,u)),p=n(R3o(t,a));return c.ok&&p.ok?{ok:!0,value:{...c.value,...p.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...p.ok?[]:p.errors]}}function ehy(e){return!BDD(e)}function BDD(e){switch(e.getType()){case aT.ANY:case aT.UNKNOWN:case aT.OPTIONAL:return!0;default:return!1}}function thy(e){return o_s(e)}function rhy(e){let t={...Waf(e),_getRawProperties:()=>N5a(e)._getRawProperties(),_getParsedProperties:()=>N5a(e)._getParsedProperties()};return{...t,...F2(t),...hCr(t),...UKi(t)}}function u_s(e){let t={parse:(r,n)=>nhy(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>nhy(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>aT.LIST};return{...Gle(t),...F2(t)}}function nhy(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:w6(e,"list"),path:[]}]}}function ihy(e){return VOe(aT.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:w6(r,`"${e}"`)}]})()}function ahy(e){return VOe(aT.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:w6(r,`${e.toString()}`)}]})()}var ohy=VOe(aT.ANY,e=>({ok:!0,value:e}));var uhy=VOe(aT.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:w6(e,"boolean")}]});var shy=VOe(aT.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:w6(e,"number")}]});var chy=VOe(aT.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:w6(e,"string")}]});var lhy=VOe(aT.UNKNOWN,e=>({ok:!0,value:e}));function dhy(e,t){let r={parse:(n,i)=>fhy({value:n,isKeyNumeric:e.getType()===aT.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>fhy({value:n,isKeyNumeric:e.getType()===aT.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>aT.RECORD};return{...Gle(r),...F2(r)}}function fhy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return lDi(e)?N3o(e).reduce((a,[u,c])=>{if(c==null)return a;let p=a,s=u;if(t){let A=u.length>0?Number(u):NaN;isNaN(A)||(s=A)}let o=r(s),l=n(c,s);if(p.ok&&o.ok&&l.ok)return{ok:!0,value:{...p.value,[o.value]:l.value}};let O=[];return p.ok||O.push(...p.errors),o.ok||O.push(...o.errors),l.ok||O.push(...l.errors),{ok:!1,errors:O}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:w6(e,"object")}]}}function phy(e){let t=u_s(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:w6(n,"Set")}]},getType:()=>aT.SET};return{...Gle(r),...F2(r)}}function hhy(e){let t={parse:(r,n)=>_hy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>_hy((i,a)=>i.json(r,a),e,n),getType:()=>aT.UNDISCRIMINATED_UNION};return{...Gle(t),...F2(t)}}function _hy(e,t,r){let n=[];for(let[i,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let c of u.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function yhy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function bhy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=a_s(x3o(t)),a={parse:(u,c)=>vhy({value:u,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:p=>i.parse(p,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:p=>t[p],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(p,s)=>s.parse(p,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(u,c)=>vhy({value:u,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:p=>i.json(p,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:p=>t[p],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(p,s)=>s.json(p,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>aT.UNION};return{...Gle(a),...F2(a),...hCr(a)}}function vhy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:c=[]}){if(!lDi(e))return{ok:!1,errors:[{path:c,message:w6(e,"object")}]};let{[t]:p,...s}=e;if(p==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let o=n(p);if(!o.ok)return{ok:!1,errors:o.errors};let l=i(o.value);if(l==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let O=u(s,l);return O.ok?{ok:!0,value:{[r]:p,...O.value}}:O}var aI=Wr.objectWithoutOptionalProperties({title:Wr.string().optional()});var s_s=Wr.objectWithoutOptionalProperties({file:Wr.string()});var c_s=Wr.objectWithoutOptionalProperties({file:Wr.string()});var l_s=Wr.union("type",{openapi:s_s,protobuf:c_s}).transform({transform:e=>{switch(e.type){case"openapi":return UOe.openapi(e);case"protobuf":return UOe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var tA=Wr.objectWithoutOptionalProperties({source:l_s.optional()});var f_s=Wr.objectWithoutOptionalProperties({typeName:Wr.string()});var d_s=Wr.union("type",{protobuf:f_s}).transform({transform:e=>{switch(e.type){case"protobuf":return B5a.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var uRe=Wr.objectWithoutOptionalProperties({encoding:d_s.optional()});var By=Wr.objectWithoutOptionalProperties({description:Wr.string().optional()});var p_s=Wr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var qA=Wr.objectWithoutOptionalProperties({availability:p_s.optional()});var j8r=Wr.number();var Edt=Wr.objectWithoutOptionalProperties({statusCode:j8r.optional()});var YE=Wr.objectWithoutOptionalProperties({nameOverride:Wr.string().optional(),generatedName:Wr.string()});var w4=Wr.objectWithoutOptionalProperties({inline:Wr.boolean().optional()});var mSe=Wr.string();var OSe=Wr.string();var __s=Wr.objectWithoutOptionalProperties({id:OSe}).extend(By);var h_s=Wr.string();var y_s=Wr.objectWithoutOptionalProperties({usernameVariableName:Wr.string().optional(),usernameEnvVar:Wr.string().optional(),passwordVariableName:Wr.string().optional(),passwordEnvVar:Wr.string().optional()});var v_s=Wr.objectWithoutOptionalProperties({tokenVariableName:Wr.string().optional(),tokenEnvVar:Wr.string().optional()});var b_s=Wr.objectWithoutOptionalProperties({headerName:Wr.string(),prefix:Wr.string().optional(),headerVariableName:Wr.string().optional(),headerEnvVar:Wr.string().optional()});var g_s=Wr.objectWithoutOptionalProperties({queryParameterName:Wr.string()});var m_s=Wr.objectWithoutOptionalProperties({snake:Wr.string().optional(),camel:Wr.string().optional(),screamingSnake:Wr.string().optional(),pascal:Wr.string().optional()});var dDi=Wr.objectWithoutOptionalProperties({nameOverride:Wr.string().optional(),generatedName:Wr.string(),value:Wr.string(),casing:m_s.optional()}).extend(By).extend(qA);var O_s=Wr.objectWithoutOptionalProperties({type:Wr.stringLiteral("namespace"),name:Wr.string()});var A_s=Wr.undiscriminatedUnion([Wr.string(),O_s]);var pDi=Wr.list(A_s);var oI=Wr.objectWithoutOptionalProperties({groupName:pDi.optional()});var lE=Wr.objectWithoutOptionalProperties({namespace:Wr.string().optional()});var R5a=Wr.objectWithoutOptionalProperties({default:dDi.optional(),values:Wr.list(dDi)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var P_s=Wr.objectWithoutOptionalProperties({scopesEnum:R5a.optional()});var w_s=Wr.union("type",{basic:y_s,bearer:v_s,header:b_s,query:g_s,oauth:P_s}).transform({transform:e=>{switch(e.type){case"basic":return Ule.basic(e);case"bearer":return Ule.bearer(e);case"header":return Ule.header(e);case"query":return Ule.query(e);case"oauth":return Ule.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var F3o=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),url:Wr.string(),audiences:Wr.list(Wr.string()).optional()}).extend(By);var j_s=Wr.string();var E8r=Wr.objectWithoutOptionalProperties({sdkMethodName:Wr.string().optional()});var Jaf={};ds(Jaf,{FullExample:()=>z2,FullObjectExample:()=>S_s,FullOneOfExample:()=>C_s,KeyValuePair:()=>D_s,LiteralExample:()=>E_s,PrimitiveExample:()=>F5a,PropertyKey:()=>x5a});var x5a=Wr.string();var F5a=Wr.union("type",{int:Wr.object({value:Wr.number()}),int64:Wr.object({value:Wr.number()}),uint:Wr.object({value:Wr.number()}),uint64:Wr.object({value:Wr.number()}),float:Wr.object({value:Wr.number()}),double:Wr.object({value:Wr.number()}),string:Wr.object({value:Wr.string()}),datetime:Wr.object({value:Wr.string()}),date:Wr.object({value:Wr.string()}),base64:Wr.object({value:Wr.string()}),boolean:Wr.object({value:Wr.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return Im.int(e.value);case"int64":return Im.int64(e.value);case"uint":return Im.uint(e.value);case"uint64":return Im.uint64(e.value);case"float":return Im.float(e.value);case"double":return Im.double(e.value);case"string":return Im.string(e.value);case"datetime":return Im.datetime(e.value);case"date":return Im.date(e.value);case"base64":return Im.base64(e.value);case"boolean":return Im.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var E_s=Wr.union("type",{boolean:Wr.object({value:Wr.boolean()}),string:Wr.object({value:Wr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return sDi.boolean(e.value);case"string":return sDi.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var z2=Wr.union("type",{primitive:Wr.object({value:F5a}),object:Wr.lazyObject(()=>S_s),array:Wr.object({value:Wr.list(Wr.lazy(()=>z2))}),map:Wr.object({value:Wr.list(Wr.lazyObject(()=>D_s))}),enum:Wr.object({value:Wr.string()}),literal:Wr.object({value:E_s}),oneOf:Wr.object({value:Wr.lazy(()=>C_s)}),unknown:Wr.object({value:Wr.lazy(()=>z2)})}).transform({transform:e=>{switch(e.type){case"primitive":return xS.primitive(e.value);case"object":return xS.object(e);case"array":return xS.array(e.value);case"map":return xS.map(e.value);case"enum":return xS.enum(e.value);case"literal":return xS.literal(e.value);case"oneOf":return xS.oneOf(e.value);case"unknown":return xS.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var S_s=Wr.objectWithoutOptionalProperties({properties:Wr.record(x5a,Wr.lazy(()=>z2))});var D_s=Wr.objectWithoutOptionalProperties({key:F5a,value:Wr.lazy(()=>z2)});var C_s=Wr.union("type",{discriminated:Wr.object({value:Wr.record(x5a,Wr.lazy(()=>z2))}),undiscriminated:Wr.object({value:Wr.lazy(()=>z2)})}).transform({transform:e=>{switch(e.type){case"discriminated":return cDi.discriminated(e.value);case"undiscriminated":return cDi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Kaf={};ds(Kaf,{AllOfPropertyConflict:()=>rQa,ArraySchema:()=>mhs,Availability:()=>p_s,BooleanSchema:()=>_hs,BytesResponse:()=>G5a,CasingOverrides:()=>m_s,CommonProperty:()=>Dhs,CursorPagination:()=>X_s,CustomCodeSample:()=>$_s,CustomCodeSampleLanguage:()=>G_s,CustomCodeSampleSdk:()=>K_s,CustomPagination:()=>k_s,DiscriminatedOneOfSchema:()=>Ehs,DoubleSchema:()=>dhs,Endpoint:()=>ehs,EndpointExample:()=>Y5a,EndpointResponseExample:()=>H_s,EndpointSdkName:()=>S8r,EnumSchema:()=>R5a,EnumValue:()=>dDi,ErrorExample:()=>Q_s,FernExample:()=>U_s,FileResponse:()=>W5a,FileSchema:()=>B_s,FormUrlEncodedRequest:()=>x_s,FullEndpointExample:()=>Y_s,GlobalHeader:()=>yhs,Header:()=>_Di,HeaderExample:()=>$5a,HttpEndpointServer:()=>J5a,HttpError:()=>L_s,HttpMethod:()=>z5a,IdempotencyHeader:()=>vhs,IntSchema:()=>lhs,JsonRequest:()=>R_s,JsonResponse:()=>H5a,LiteralSchema:()=>tQa,LiteralSchemaValue:()=>bhs,LongSchema:()=>fhs,MapSchema:()=>Ohs,MultipartRequest:()=>V5a,MultipartRequestProperty:()=>N_s,MultipartRequestPropertyEncoding:()=>q_s,MultipartSchema:()=>T_s,NullableSchema:()=>Phs,ObjectProperty:()=>jhs,ObjectPropertyConflictInfo:()=>nQa,ObjectSchema:()=>ghs,OctetStreamRequest:()=>U5a,OffsetPagination:()=>Z_s,OneOfSchema:()=>whs,OpenApiIntermediateRepresentation:()=>ghy,OptionalSchema:()=>Ahs,Pagination:()=>X5a,PathParameter:()=>Q5a,PathParameterExample:()=>V_s,PrimitiveSchema:()=>yDi,PrimitiveSchemaValue:()=>hhs,QueryParameter:()=>L5a,QueryParameterExample:()=>K5a,ReferencedSchema:()=>D8r,Request:()=>F_s,Response:()=>z_s,RetriesConfiguration:()=>Z5a,Schema:()=>fC,Schemas:()=>chs,SdkGroupInfo:()=>I_s,StreamingResponseExample:()=>W_s,StringSchema:()=>phs,SupportedSdkLanguage:()=>J_s,Tags:()=>M_s,TextResponse:()=>hDi,UnDiscriminatedOneOfSchema:()=>Shs,Webhook:()=>ths,WebhookExampleCall:()=>eQa,WebhookHttpMethod:()=>k5a,WebsocketChannel:()=>shs,WebsocketHandshake:()=>rhs,WebsocketMessageExample:()=>ohs,WebsocketMessageOrigin:()=>nhs,WebsocketMessageSchema:()=>ihs,WebsocketServer:()=>ahs,WebsocketSessionExample:()=>uhs});var I_s=Wr.objectWithoutOptionalProperties({summary:Wr.string().optional(),description:Wr.string().optional()});var M_s=Wr.objectWithoutOptionalProperties({tagsById:Wr.record(OSe,__s),orderedTagIds:Wr.list(OSe).optional()});var z5a=Wr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var Q5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>fC),variableReference:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var L5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>fC),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var _Di=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>fC),env:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var S8r=Wr.objectWithoutOptionalProperties({groupName:pDi,methodName:Wr.string()});var U5a=Wr.objectWithoutOptionalProperties({contentType:Wr.string().optional()}).extend(By).extend(tA);var B_s=Wr.objectWithoutOptionalProperties({isOptional:Wr.boolean(),isArray:Wr.boolean()}).extend(By);var T_s=Wr.union("type",{file:B_s,json:Wr.object({value:Wr.lazy(()=>fC)})}).transform({transform:e=>{switch(e.type){case"file":return P8r.file(e);case"json":return P8r.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var q_s=Wr.enum_(["json","form"]);var N_s=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:T_s,contentType:Wr.string().optional(),exploded:Wr.boolean().optional(),encoding:q_s.optional()}).extend(By);var V5a=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),properties:Wr.list(N_s)}).extend(By).extend(tA);var R_s=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC),contentType:Wr.string().optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA);var x_s=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC),contentType:Wr.string().optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA);var F_s=Wr.union("type",{octetStream:U5a,multipart:V5a,json:R_s,formUrlEncoded:x_s}).transform({transform:e=>{switch(e.type){case"octetStream":return _Cr.octetStream(e);case"multipart":return _Cr.multipart(e);case"json":return _Cr.json(e);case"formUrlEncoded":return _Cr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var W5a=Wr.objectWithoutOptionalProperties({}).extend(By).extend(tA).extend(Edt);var H5a=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC),responseProperty:Wr.string().optional()}).extend(By).extend(tA).extend(Edt);var hDi=Wr.objectWithoutOptionalProperties({}).extend(By).extend(tA).extend(Edt);var G5a=Wr.objectWithoutOptionalProperties({}).extend(By).extend(tA).extend(Edt);var z_s=Wr.union("type",{file:W5a,json:H5a,text:hDi,bytes:G5a,streamingSse:H5a,streamingText:hDi,streamingJson:H5a}).transform({transform:e=>{switch(e.type){case"file":return yye.file(e);case"json":return yye.json(e);case"text":return yye.text(e);case"bytes":return yye.bytes(e);case"streamingSse":return yye.streamingSse(e);case"streamingText":return yye.streamingText(e);case"streamingJson":return yye.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Q_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),description:Wr.string().optional(),example:Wr.lazy(()=>z2)});var L_s=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC).optional(),examples:Wr.list(Q_s).optional()}).extend(By).extend(YE).extend(tA);var J5a=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),url:Wr.string().optional(),audiences:Wr.list(Wr.string()).optional()});var U_s=Wr.unknown();var V_s=Wr.objectWithoutOptionalProperties({name:Wr.string(),parameterNameOverride:Wr.string().optional(),value:Wr.lazy(()=>z2)});var K5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),value:Wr.lazy(()=>z2)});var $5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),value:Wr.lazy(()=>z2)});var W_s=Wr.objectWithoutOptionalProperties({sse:Wr.boolean(),events:Wr.list(Wr.lazy(()=>z2))});var H_s=Wr.union("type",{withStreaming:W_s,withoutStreaming:Wr.object({value:Wr.lazy(()=>z2)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return jdt.withStreaming(e);case"withoutStreaming":return jdt.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var G_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),language:Wr.string(),code:Wr.string(),install:Wr.string().optional()}).extend(By);var J_s=Wr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var K_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),sdk:J_s,code:Wr.string()}).extend(By);var $_s=Wr.union("type",{language:G_s,sdk:K_s}).transform({transform:e=>{switch(e.type){case"language":return A8r.language(e);case"sdk":return A8r.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var Y_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),pathParameters:Wr.list(V_s).optional(),queryParameters:Wr.list(K5a).optional(),headers:Wr.list($5a).optional(),request:Wr.lazy(()=>z2).optional(),response:H_s.optional(),codeSamples:Wr.list($_s)}).extend(By);var Y5a=Wr.union("type",{unknown:Wr.object({value:U_s}),full:Y_s}).transform({transform:e=>{switch(e.type){case"unknown":return wdt.unknown(e.value);case"full":return wdt.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var X_s=Wr.objectWithoutOptionalProperties({cursor:Wr.string(),nextCursor:Wr.property("next_cursor",Wr.string()),results:Wr.string()});var Z_s=Wr.objectWithoutOptionalProperties({offset:Wr.string(),results:Wr.string(),step:Wr.string().optional(),hasNextPage:Wr.string().optional()});var k_s=Wr.objectWithoutOptionalProperties({results:Wr.string()});var X5a=Wr.union("type",{cursor:X_s,offset:Z_s,custom:k_s}).transform({transform:e=>{switch(e.type){case"cursor":return xet.cursor(e);case"offset":return xet.offset(e);case"custom":return xet.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var Z5a=Wr.union("type",{disabled:Wr.object({value:Wr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return q3o.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var ehs=Wr.objectWithoutOptionalProperties({authed:Wr.boolean(),internal:Wr.boolean().optional(),idempotent:Wr.boolean().optional(),method:z5a,audiences:Wr.list(Wr.string()),path:Wr.string(),summary:Wr.string().optional(),operationId:Wr.string().optional(),tags:Wr.list(OSe),pathParameters:Wr.list(Q5a),queryParameters:Wr.list(L5a),headers:Wr.list(_Di),sdkName:S8r.optional(),generatedRequestName:Wr.string(),requestNameOverride:Wr.string().optional(),request:F_s.optional(),response:z_s.optional(),errors:Wr.record(j8r,L_s),servers:Wr.list(J5a),examples:Wr.list(Y5a),pagination:X5a.optional(),retries:Z5a.optional()}).extend(By).extend(qA).extend(tA).extend(lE);var k5a=Wr.enum_(["GET","POST"]);var eQa=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),payload:Wr.lazy(()=>z2)}).extend(By);var ths=Wr.objectWithoutOptionalProperties({audiences:Wr.list(Wr.string()),sdkName:S8r.optional(),method:k5a,summary:Wr.string().optional(),operationId:Wr.string(),tags:Wr.list(OSe),headers:Wr.list(_Di),generatedPayloadName:Wr.string(),payload:Wr.lazy(()=>fC),examples:Wr.list(eQa)}).extend(By).extend(tA).extend(lE);var rhs=Wr.objectWithoutOptionalProperties({queryParameters:Wr.list(L5a),headers:Wr.list(_Di),pathParameters:Wr.list(Q5a)});var nhs=Wr.enum_(["client","server"]);var ihs=Wr.objectWithoutOptionalProperties({name:Wr.string(),origin:nhs,body:Wr.lazy(()=>fC)});var ahs=Wr.objectWithoutOptionalProperties({name:Wr.string(),url:Wr.string()});var ohs=Wr.objectWithoutOptionalProperties({messageType:Wr.string(),payload:Wr.lazy(()=>z2)}).extend(By);var uhs=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),queryParameters:Wr.list(K5a).optional(),headers:Wr.list($5a).optional(),messages:Wr.list(ohs)}).extend(By);var shs=Wr.objectWithoutOptionalProperties({audiences:Wr.list(Wr.string()),path:Wr.string(),groupName:pDi,summary:Wr.string().optional(),handshake:rhs,messages:Wr.list(ihs),servers:Wr.list(ahs),examples:Wr.list(uhs)}).extend(By).extend(tA);var chs=Wr.objectWithoutOptionalProperties({rootSchemas:Wr.record(mSe,Wr.lazy(()=>fC)),namespacedSchemas:Wr.record(j_s,Wr.record(mSe,Wr.lazy(()=>fC)))});var lhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional()});var fhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional()});var dhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional()});var phs=Wr.objectWithoutOptionalProperties({default:Wr.string().optional(),pattern:Wr.string().optional(),format:Wr.string().optional(),minLength:Wr.number().optional(),maxLength:Wr.number().optional()});var _hs=Wr.objectWithoutOptionalProperties({default:Wr.boolean().optional()});var hhs=Wr.union("type",{int:lhs,int64:fhs,uint:Wr.object({}),uint64:Wr.object({}),float:Wr.object({}),double:dhs,string:phs,datetime:Wr.object({}),date:Wr.object({}),base64:Wr.object({}),boolean:_hs}).transform({transform:e=>{switch(e.type){case"int":return iT.int(e);case"int64":return iT.int64(e);case"uint":return iT.uint();case"uint64":return iT.uint64();case"float":return iT.float();case"double":return iT.double(e);case"string":return iT.string(e);case"datetime":return iT.datetime();case"date":return iT.date();case"base64":return iT.base64();case"boolean":return iT.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var yDi=Wr.objectWithoutOptionalProperties({schema:hhs}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var yhs=Wr.objectWithoutOptionalProperties({header:Wr.string(),name:Wr.string().optional(),optional:Wr.boolean().optional(),env:Wr.string().optional(),schema:Wr.lazy(()=>fC).optional()});var vhs=Wr.objectWithoutOptionalProperties({header:Wr.string(),name:Wr.string().optional(),env:Wr.string().optional(),schema:Wr.lazy(()=>fC).optional()});var ghy=Wr.objectWithoutOptionalProperties({apiVersion:Wr.unknown().optional(),title:Wr.string().optional(),description:Wr.string().optional(),basePath:Wr.string().optional(),servers:Wr.list(F3o),websocketServers:Wr.list(F3o),groups:Wr.record(Wr.string(),I_s),tags:M_s,hasEndpointsMarkedInternal:Wr.boolean(),endpoints:Wr.list(ehs),webhooks:Wr.list(ths),channels:Wr.record(Wr.string(),shs),groupedSchemas:chs,variables:Wr.record(Wr.string(),yDi),nonRequestReferencedSchemas:Wr.set(mSe),securitySchemes:Wr.record(h_s,w_s),globalHeaders:Wr.list(yhs).optional(),idempotencyHeaders:Wr.list(vhs).optional()});var D8r=Wr.objectWithoutOptionalProperties({schema:mSe}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI);var bhs=Wr.union("type",{boolean:Wr.object({value:Wr.boolean()}),string:Wr.object({value:Wr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return JL.boolean(e.value);case"string":return JL.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var tQa=Wr.objectWithoutOptionalProperties({value:bhs}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var fC=Wr.union("type",{primitive:yDi,object:Wr.lazyObject(()=>ghs),array:Wr.lazyObject(()=>mhs),map:Wr.lazyObject(()=>Ohs),optional:Wr.lazyObject(()=>Ahs),enum:R5a,reference:D8r,literal:tQa,oneOf:Wr.object({value:Wr.lazy(()=>whs)}),nullable:Wr.lazyObject(()=>Phs),unknown:YE}).transform({transform:e=>{switch(e.type){case"primitive":return $P.primitive(e);case"object":return $P.object(e);case"array":return $P.array(e);case"map":return $P.map(e);case"optional":return $P.optional(e);case"enum":return $P.enum(e);case"reference":return $P.reference(e);case"literal":return $P.literal(e);case"oneOf":return $P.oneOf(e.value);case"nullable":return $P.nullable(e);case"unknown":return $P.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var rQa=Wr.objectWithoutOptionalProperties({propertyKey:Wr.string(),allOfSchemaIds:Wr.list(mSe),conflictingTypeSignatures:Wr.boolean()});var ghs=Wr.objectWithoutOptionalProperties({allOf:Wr.list(D8r),properties:Wr.list(Wr.lazyObject(()=>jhs)),allOfPropertyConflicts:Wr.list(rQa),additionalProperties:Wr.boolean()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var nQa=Wr.objectWithoutOptionalProperties({differentSchema:Wr.boolean()});var jhs=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>fC),readonly:Wr.boolean().optional(),writeonly:Wr.boolean().optional(),conflict:Wr.record(mSe,nQa),generatedName:Wr.string(),nameOverride:Wr.string().optional(),audiences:Wr.list(Wr.string())}).extend(qA);var mhs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var Ohs=Wr.objectWithoutOptionalProperties({key:yDi,value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(aI).extend(w4);var Ahs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var Phs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var whs=Wr.union("type",{discriminated:Wr.lazyObject(()=>Ehs),undiscriminated:Wr.lazyObject(()=>Shs)}).transform({transform:e=>{switch(e.type){case"discriminated":return w8r.discriminated(e);case"undiscriminated":return w8r.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ehs=Wr.objectWithoutOptionalProperties({discriminantProperty:Wr.string(),commonProperties:Wr.list(Wr.lazyObject(()=>Dhs)),schemas:Wr.record(Wr.string(),Wr.lazy(()=>fC))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var Dhs=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>fC)});var Shs=Wr.objectWithoutOptionalProperties({schemas:Wr.list(Wr.lazy(()=>fC))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var $af={};ds($af,{ArraySchemaWithExample:()=>Xhs,Base64WithExample:()=>Ghs,BooleanWithExample:()=>Jhs,CommonPropertyWithExample:()=>oys,DateWithExample:()=>Hhs,DatetimeWithExample:()=>Whs,DiscriminatedOneOfSchemaWithExample:()=>iys,DoubleWithExample:()=>Uhs,EndpointWithExample:()=>Ohy,EnumSchemaWithExample:()=>$hs,FloatWithExample:()=>Lhs,HeaderWithExample:()=>vDi,HttpErrorWithExample:()=>Rhs,Int64WithExample:()=>Fhs,IntWithExample:()=>xhs,JsonRequestWithExample:()=>Bhs,JsonResponseWithExample:()=>aQa,MapSchemaWithExample:()=>Zhs,NamedFullExample:()=>Sdt,NullableSchemaWithExample:()=>eys,ObjectPropertyWithExample:()=>nys,ObjectSchemaWithExample:()=>tys,OneOfSchemaWithExample:()=>rys,OptionalSchemaWithExample:()=>khs,ParseFormUrlEncodedRequest:()=>Ths,ParseMultipartRequest:()=>Mhs,ParseOctetStreamRequest:()=>Ihs,PathParameterWithExample:()=>Chs,PrimitiveSchemaValueWithExample:()=>Khs,PrimitiveSchemaWithExample:()=>oQa,QueryParameterWithExample:()=>iQa,RequestWithExample:()=>qhs,ResponseWithExample:()=>Nhs,SchemaWithExample:()=>j4,StringSchemaWithExample:()=>Vhs,Uint64WithExample:()=>Qhs,UintWithExample:()=>zhs,UnDiscriminatedOneOfSchemaWithExample:()=>ays,UnknownSchemaWithExample:()=>Yhs,WebhookWithExample:()=>Ahy,WebsocketHandshakeWithExample:()=>mhy});var Sdt=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),value:Wr.unknown()}).extend(By);var iQa=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>j4),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var vDi=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>j4),env:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var mhy=Wr.objectWithoutOptionalProperties({queryParameters:Wr.list(iQa),headers:Wr.list(vDi)});var Chs=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>j4),variableReference:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var Ihs=Wr.objectWithoutOptionalProperties({}).extend(U5a).extend(E8r);var Mhs=Wr.objectWithoutOptionalProperties({}).extend(V5a).extend(E8r);var Bhs=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>j4),contentType:Wr.string().optional(),fullExamples:Wr.list(Sdt).optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA).extend(E8r);var Ths=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>j4),contentType:Wr.string().optional(),fullExamples:Wr.list(Sdt).optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA).extend(E8r);var qhs=Wr.union("type",{octetStream:Ihs,multipart:Mhs,json:Bhs,formUrlEncoded:Ths}).transform({transform:e=>{switch(e.type){case"octetStream":return bSe.octetStream(e);case"multipart":return bSe.multipart(e);case"json":return bSe.json(e);case"formUrlEncoded":return bSe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var aQa=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>j4),responseProperty:Wr.string().optional(),fullExamples:Wr.list(Sdt).optional()}).extend(By).extend(tA).extend(Edt);var Nhs=Wr.union("type",{file:W5a,json:aQa,text:hDi,bytes:G5a,streamingSse:aQa,streamingText:hDi,streamingJson:aQa}).transform({transform:e=>{switch(e.type){case"file":return _Q.file(e);case"json":return _Q.json(e);case"text":return _Q.text(e);case"bytes":return _Q.bytes(e);case"streamingSse":return _Q.streamingSse(e);case"streamingText":return _Q.streamingText(e);case"streamingJson":return _Q.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Rhs=Wr.objectWithoutOptionalProperties({statusCode:j8r,schema:Wr.lazy(()=>j4),fullExamples:Wr.list(Sdt).optional()}).extend(By).extend(YE).extend(tA);var Ohy=Wr.objectWithoutOptionalProperties({authed:Wr.boolean(),internal:Wr.boolean().optional(),idempotent:Wr.boolean().optional(),method:z5a,audiences:Wr.list(Wr.string()),path:Wr.string(),summary:Wr.string().optional(),operationId:Wr.string().optional(),tags:Wr.list(OSe),pathParameters:Wr.list(Chs),queryParameters:Wr.list(iQa),headers:Wr.list(vDi),sdkName:S8r.optional(),generatedRequestName:Wr.string(),requestNameOverride:Wr.string().optional(),request:qhs.optional(),response:Nhs.optional(),errors:Wr.record(j8r,Rhs),servers:Wr.list(J5a),examples:Wr.list(Y5a),pagination:X5a.optional(),retries:Z5a.optional()}).extend(By).extend(qA).extend(tA).extend(lE);var Ahy=Wr.objectWithoutOptionalProperties({audiences:Wr.list(Wr.string()),sdkName:S8r.optional(),method:k5a,summary:Wr.string().optional(),operationId:Wr.string(),tags:Wr.list(OSe),headers:Wr.list(vDi),generatedPayloadName:Wr.string(),payload:Wr.lazy(()=>j4),examples:Wr.list(eQa)}).extend(By).extend(tA).extend(lE);var xhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional(),example:Wr.number().optional()});var Fhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),example:Wr.number().optional()});var zhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),example:Wr.number().optional()});var Qhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),example:Wr.number().optional()});var Lhs=Wr.objectWithoutOptionalProperties({example:Wr.number().optional()});var Uhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional(),example:Wr.number().optional()});var Vhs=Wr.objectWithoutOptionalProperties({default:Wr.string().optional(),pattern:Wr.string().optional(),format:Wr.string().optional(),minLength:Wr.number().optional(),maxLength:Wr.number().optional(),example:Wr.string().optional()});var Whs=Wr.objectWithoutOptionalProperties({example:Wr.string().optional()});var Hhs=Wr.objectWithoutOptionalProperties({example:Wr.string().optional()});var Ghs=Wr.objectWithoutOptionalProperties({example:Wr.string().optional()});var Jhs=Wr.objectWithoutOptionalProperties({default:Wr.boolean().optional(),example:Wr.boolean().optional()});var Khs=Wr.union("type",{int:xhs,int64:Fhs,uint:zhs,uint64:Qhs,float:Lhs,double:Uhs,string:Vhs,datetime:Whs,date:Hhs,base64:Ghs,boolean:Jhs}).transform({transform:e=>{switch(e.type){case"int":return Zg.int(e);case"int64":return Zg.int64(e);case"uint":return Zg.uint(e);case"uint64":return Zg.uint64(e);case"float":return Zg.float(e);case"double":return Zg.double(e);case"string":return Zg.string(e);case"datetime":return Zg.datetime(e);case"date":return Zg.date(e);case"base64":return Zg.base64(e);case"boolean":return Zg.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var oQa=Wr.objectWithoutOptionalProperties({schema:Khs}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var $hs=Wr.objectWithoutOptionalProperties({default:dDi.optional(),values:Wr.list(dDi),example:Wr.string().optional()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var Yhs=Wr.objectWithoutOptionalProperties({example:Wr.unknown()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var j4=Wr.union("type",{primitive:oQa,object:Wr.lazyObject(()=>tys),array:Wr.lazyObject(()=>Xhs),map:Wr.lazyObject(()=>Zhs),optional:Wr.lazyObject(()=>khs),enum:$hs,reference:D8r,literal:tQa,oneOf:Wr.object({value:Wr.lazy(()=>rys)}),nullable:Wr.lazyObject(()=>eys),unknown:Yhs}).transform({transform:e=>{switch(e.type){case"primitive":return Uh.primitive(e);case"object":return Uh.object(e);case"array":return Uh.array(e);case"map":return Uh.map(e);case"optional":return Uh.optional(e);case"enum":return Uh.enum(e);case"reference":return Uh.reference(e);case"literal":return Uh.literal(e);case"oneOf":return Uh.oneOf(e.value);case"nullable":return Uh.nullable(e);case"unknown":return Uh.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var Xhs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>j4),example:Wr.list(Wr.unknown()).optional()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var Zhs=Wr.objectWithoutOptionalProperties({key:oQa,value:Wr.lazy(()=>j4),example:Wr.unknown().optional()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(aI).extend(w4);var khs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>j4)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var eys=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>j4)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var tys=Wr.objectWithoutOptionalProperties({allOf:Wr.list(D8r),properties:Wr.list(Wr.lazyObject(()=>nys)),allOfPropertyConflicts:Wr.list(rQa),fullExamples:Wr.list(Sdt).optional(),additionalProperties:Wr.boolean()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var nys=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>j4),readonly:Wr.boolean().optional(),writeonly:Wr.boolean().optional(),audiences:Wr.list(Wr.string()),conflict:Wr.record(mSe,nQa),nameOverride:Wr.string().optional(),generatedName:Wr.string()}).extend(qA);var rys=Wr.union("type",{discriminated:Wr.lazyObject(()=>iys),undiscriminated:Wr.lazyObject(()=>ays)}).transform({transform:e=>{switch(e.type){case"discriminated":return gSe.discriminated(e);case"undiscriminated":return gSe.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var iys=Wr.objectWithoutOptionalProperties({discriminantProperty:Wr.string(),commonProperties:Wr.list(Wr.lazyObject(()=>oys)),schemas:Wr.record(Wr.string(),Wr.lazy(()=>j4))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var oys=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>j4)});var ays=Wr.objectWithoutOptionalProperties({schemas:Wr.list(Wr.lazy(()=>j4))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var Phy=/^(\d+)/,uQa=/^[a-zA-Z][a-zA-Z0-9_]*$/,why={"<":"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 bDi(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 u=Math.floor(e/10),c=e%10;return c===0?n[u]:`${n[u]}_${t[c]}`}if(e<1e3){let u=Math.floor(e/100),c=e%100;return c===0?`${t[u]}_hundred`:`${t[u]}_hundred_${bDi(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${bDi(a)}`}function z3o(e){let t=e.match(Phy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=bDi(i);return n.length>0?`${a}_${n}`:a}}}function sQa(e){let t=z3o(e),r=why[e];return t!=null?g9(IO(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":g9(IO(e)))}function sRe(e,t){return e.type==="primitive"&&t.type==="primitive"?jhy(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?TDD(e.values,t.values):e.type==="array"&&t.type==="array"?sRe(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"?sRe(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?qDD(e.value,t.value):e.type==="object"&&t.type==="object"?NDD(e,t):e.type==="map"&&t.type==="map"?jhy(e.key.schema,t.key.schema)&&sRe(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function jhy(e,t){return e.type===t.type}function TDD(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return Bae(r,n)}function qDD(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:sRe(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:sRe(r,i)}):!1}function NDD(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:sRe(a,i.schema)})}function FH(e){switch(e){case Vle.Deprecated:return"deprecated";case Vle.Beta:return"pre-release";case Vle.GenerallyAvailable:return"generally-available";default:return}}function RDD(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 Ehy(e){let t=e?RDD(e):void 0;if(t==null||t.length===0)return _Vi;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push(IO(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push(IO(i.name)):r.push(i.name,_Vi);break}default:cc(i.type)}else cc(i);return r.join("/")}function gDi(e){return iP.of(`${Ehy(e)}.yml`)}function Yaf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?_Vi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,Ehy(r))}function Shy({sdkName:e,namespaceOverride:t}){return iP.of(`${Yaf({sdkName:e,namespaceOverride:t})}.yml`)}function Dhy({location:e,namespaceOverride:t}){return t!=null?Q$(iP.of(t),e):e}function uys(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:cc(e.type)}}function cQa(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:cc(e)}}function E4(e){return typeof e=="string"?e:e.type}function lQa(e){if(typeof e!="string")return e.docs}function Q3o(e){if(typeof e!="string")return e.default}function Xaf(e){if(typeof e!="string")return e.validation}function Ihy(e){let t=E4(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?Chy(e):{...e,type:Chy(e.type)}}function Chy(e){return e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function mDi(e){return E4(e).startsWith("optional<")?e:typeof e=="string"?Mhy(e):{...e,type:Mhy(e.type)}}function Mhy(e){return`optional<${e}>`}var xDD=-2147483648,FDD=2147483647,zDD=-17976931348623157e292,QDD=17976931348623157e292;function FS({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 sys(e);case"array":return eof({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return tof({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return kaf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return nof();case"optional":return cys({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return rof({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return $DD({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,iof(e);case"object":return YDD({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return XDD({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:cc(e)}}function sys(e){switch(e.schema.type){case"string":return VDD({description:e.description,schema:e.schema});case"int":return WDD({description:e.description,schema:e.schema});case"float":return HDD({description:e.description,schema:e.schema});case"double":return GDD({description:e.description,schema:e.schema});case"boolean":return LDD({description:e.description,schema:e.schema});case"int64":return UDD({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:FH(e.availability)}:{}}}function LDD({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 UDD({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 VDD({description:e,schema:t}){let r="string",n=JDD(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 WDD({description:e,schema:t}){let r="integer",n=Bhy(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 HDD({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function GDD({description:e,schema:t}){let r="double",n=Bhy(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 JDD(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=KDD(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function KDD(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 Bhy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:u}=e;if(r=Zaf(r,t),n=Zaf(n,t),i=Zaf(i,t),!(r==null&&n==null&&a==null&&u==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:u,multipleOf:i}}function Zaf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[xDD,FDD]:[zDD,QDD];return e<r||e>n?void 0:e}function kaf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=ZDD(i)??e.schema,u=cQa(i),c=kDD(i),p=lys({context:r,fileContainingReference:t,declarationFile:gDi(u),type:a}),s=i.type==="nullable"?`optional<${p}>`:p;return e.description==null&&c==null?s:{type:i.type==="nullable"?`optional<${p}>`:p,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function eof({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${E4(u)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{},type:c}}function tof({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=sys(e.key),c=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),p=e.encoding!=null?uys(e.encoding):void 0,s=`map<${E4(u)}, ${E4(c)}>`;if(e.description==null&&p==null&&e.title==null)return s;let o={type:s};return e.description!=null&&(o.docs=e.description),e.encoding!=null&&(o.encoding=p),e.availability!=null&&(o.availability=FH(e.availability)),o}function rof({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return cys({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let u=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=E4(u),p=lQa(u),s=Q3o(u),o=Xaf(u),l=Ihy(c);if(e.availability==null&&e.description==null&&p==null&&s==null&&o==null&&e.title==null)return mDi(l);let O=typeof l=="string"?{type:l}:l;return(e.description!=null||p!=null)&&(O.docs=e.description??p),s!=null&&(O.default=s),o!=null&&(O.validation=o),e.availability!=null&&(O.availability=FH(e.availability)),mDi(O)}function cys({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=E4(u),p=lQa(u),s=Q3o(u),o=Xaf(u),l=mDi(c);if(e.availability==null&&e.description==null&&p==null&&s==null&&o==null&&e.title==null)return l;let O=typeof l=="string"?{type:l}:l;return(e.description!=null||p!=null)&&(O.docs=e.description??p),s!=null&&(O.default=s),o!=null&&(O.validation=o),e.availability!=null&&(O.availability=FH(e.availability)),O}function nof(){return"unknown"}function iof(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:cc(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function $DD({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=L3o(e,i),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let c=lys({type:u,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let p={type:c};return e.description!=null&&(p.docs=e.description),e.default!=null&&(p.default=e.default.value),e.availability!=null&&(p.availability=FH(e.availability)),p}function YDD({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=aof({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:u.schema});let p=lys({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?p:{type:p,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function XDD({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=oof({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:u.schema});let p=lys({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?p:{...e.title!=null?{"display-name":e.title}:{},type:p,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function lys({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 ZDD(e){return $P._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 kDD(e){return $P._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 loe;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(loe||(loe={}));function Lci(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:cc(e)}}function qhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=rCD(e);break;case"array":a=eCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=tCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=nCD({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=aCD(e.nameOverride,e.generatedName);break;case"optional":a=Nhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=iCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=L3o(e,i);break;case"literal":a=oCD(e,e.nameOverride,e.generatedName);break;case"object":a=aof({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=oof({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:cc(e)}return a}function aof({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(loe.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),u=!1,c={},p=new Set;for(let A of e.properties){if(A.readonly&&(u=!0),a&&A.readonly)continue;if(Object.keys(A.conflict).length>0){if(Object.entries(A.conflict).every(([Q,K])=>!K.differentSchema))continue;Object.entries(A.conflict).forEach(([Q])=>{uof({property:A.key,schemaId:Q,context:t,namespace:n}).forEach(X=>{p.add(X)})})}let E=FS({schema:A.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=A.audiences,M=A.nameOverride,q=FH(A.availability),L=lCD(A);c[A.key]=cCD({typeReference:E,audiences:C,name:M,availability:q,propertyAccess:L})}let s=new Set;for(let A of e.allOfPropertyConflicts)A.allOfSchemaIds.forEach(E=>p.add(E)),A.conflictingTypeSignatures&&s.add(A.propertyKey);let o=[];for(let A of e.allOf){let E=Rhy({schema:A.schema,context:t,namespace:n});if(E==null||p.has(A.schema)||p.has(E))continue;let C=FS({schema:$P.reference(A),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});o.push(E4(C))}for(let A of p){let E=sof(t,A,n);for(let C of E.properties)c[C.key]==null&&(s.has(C.key)&&(c[C.key]="unknown"),c[C.key]=FS({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of E.allOf){if(p.has(C.schema))continue;let M=FS({schema:$P.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});o.push(E4(M))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([A,E])=>sCD(A)?[A,typeof E=="string"?{type:E,name:`_${A}`}:{...E,name:`_${A}`}]:[A,E]))};o.length>0&&(l.extends=o),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=FH(e.availability)),e.source!=null&&(l.source=Lci(e.source)),l.inline=cof(e,i);let O=e.nameOverride??e.generatedName;return{name:u&&t.respectReadonlySchemas&&!a?`${O}Read`:O,schema:l}}function uof({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return uof({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:u}=sof(r,t,n),c=a.some(s=>s.key===e),p=[...u.flatMap(s=>uof({property:e,context:r,schemaId:s.schema,namespace:n}))];if(c||p.length>0)return[t,...p]}return[]}function sof(e,t,r){let n=e.getSchema(t,r);if(n==null)return{properties:[],allOf:[]};if(n.type==="object")return{properties:n.properties,allOf:n.allOf};if(n.type==="reference")return sof(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function eCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:eof({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function tCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:tof({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function rCD(e){let t=sys(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 Thy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function L3o(e,t){let r={enum:e.values.map(a=>{let u=a.nameOverride??a.generatedName,c=a.value;if(u===c&&a.description==null&&(a.casing==null||Thy(a.casing)))return u;let p={value:a.value};if(u!==c&&(p.name=u),a.description!=null&&(p.docs=a.description),a.casing!=null&&!Thy(a.casing)){let s={},o=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,o=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,o=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,o=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,o=!0),o&&(p.casing=s)}return p})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=cof(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?Lci(e.source):void 0};for(let a of r.enum){let u=typeof a=="string"?a:a.name??a.value;n.has(u.toLowerCase())||(i.enum.push(a),n.add(u.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function nCD({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:kaf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function iCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:rof({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:Nhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function Nhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:cys({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function aCD(e,t){return{name:e??t,schema:nof()}}function oCD(e,t,r){return{name:t??r,schema:iof(e)}}function oof({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?uys(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let s of e.commonProperties)c[s.key]=FS({schema:s.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let p={};for(let[s,o]of Object.entries(e.schemas))p[s]=FS({schema:o,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?FH(e.availability):void 0,union:p,encoding:a,source:e.source!=null?Lci(e.source):void 0}}}let u=[];for(let c of e.schemas)u.push(FS({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:u,encoding:a,source:e.source!=null?Lci(e.source):void 0,inline:cof(e,i)}}}var uCD=/^[0-9]/;function sCD(e){return uCD.test(e)}function Rhy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?Rhy({context:t,schema:n.schema,namespace:r}):e}function cCD({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 cof(e,t){return e.inline===!0||t>0?!0:void 0}function lCD(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return G$.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return G$.ObjectPropertyAccess.WriteOnly}}function xhy(e){let t=e.replace(/^x-|^X-/,"");return IO(t)}var Fhy="BasicAuthScheme",fys="BearerAuthScheme";function zhy(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:Fhy,schema:i}),t||(e.builder.setAuth(Fhy),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:fys,schema:i}),t||(e.builder.setAuth(fys),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??xhy(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:fys,schema:i}),t||(e.builder.setAuth(fys),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(iP.of("__package__.yml"),{name:"OauthScope",schema:L3o(n.scopesEnum,0).schema})}}function C8r({header:e,context:t,fileContainingReference:r,namespace:n}){let i=FS({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=E4(i),u=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:IO(u);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let p={type:a};return c!==e.name&&(p.name=c),e.description!=null&&(p.docs=e.description),e.env!=null&&(p.env=e.env),e.availability!=null&&(p.availability=FH(e.availability)),p}function dys({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=FS({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return E4(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:E4(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=FH(e.availability)),a}function _ys({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=lof({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=E4(i.value),u=Q3o(i.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return u!=null&&(c.default=u),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=FH(e.availability)),fCD(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 lof({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:FS({schema:$P.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:iP.of(JN),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],u=!1;for(let[c,p]of Object.entries(i.value.schemas))p.type==="primitive"&&p.schema.type==="string"&&(u=!0),p.type==="literal"&&p.value.type==="string"&&(uQa.test(p.value.value)?a.push(p.value.value):a.push({value:p.value.value,name:sQa(p.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),u&&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,p]=i.value.schemas;if(c!=null&&p!=null&&pys({array:c,primitive:p}))return{value:FS({schema:$P.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:p,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&&p!=null&&pys({array:c,primitive:p}))return{value:FS({schema:$P.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,p]of Object.entries(i.value.schemas))return lof({schema:p,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let i=t.getSchema(e.value.schema,n);if(i==null)return;if(i.type==="array")return{value:FS({schema:$P.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:e.inline}),context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:FS({schema:$P.optional({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 i=[],a=!1;for(let[u,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(a=!0),c.type==="literal"&&c.value.type==="string"&&(uQa.test(c.value.value)?i.push(c.value.value):i.push({value:c.value.value,name:sQa(c.value.value)}));if(i.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:i}}),a&&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[u,c]=e.value.value.schemas;if(u!=null&&c!=null&&pys({array:u,primitive:c}))return{value:FS({schema:$P.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:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(u!=null&&c!=null&&pys({array:c,primitive:u}))return{value:FS({schema:$P.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,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:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[u,c]of Object.entries(e.value.value.schemas))return lof({schema:$P.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.objectQueryParameters?{value:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:FS({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:FS({schema:$P.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:FS({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function pys({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function fCD(e){return e.type!=null}function Qhy({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"]=dCD(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=pCD({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=ODi(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function dCD(e){let t={};return e.forEach(r=>{let n=ODi(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function pCD({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=ODi(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function ODi(e){switch(e.type){case"primitive":return Lhy(e.value);case"object":return Uhy(e.properties);case"array":return _CD(e.value);case"map":return hCD(e.value);case"oneOf":return yCD(e.value);case"enum":return e.value;case"literal":return vCD(e.value);case"unknown":return ODi(e.value);default:cc(e)}}function Lhy(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:cc(e)}}function Uhy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ODi(r)]))}function _CD(e){return e.map(t=>ODi(t))}function hCD(e){return Object.fromEntries(e.map(t=>[Lhy(t.key),ODi(t.value)]))}function yCD(e){return e.type==="discriminated"?Uhy(e.value):ODi(e.value)}function vCD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:cc(e)}}function Uci(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function hys(e,t){return t??(e?.groupName!=null?Uci(e.groupName):void 0)}function Vhy({channel:e,context:t,declarationFile:r}){let n={path:e.path,url:e.servers[0]?.name,auth:!1};e.audiences!=null&&e.audiences.length>0&&(n.audiences=e.audiences),e.summary!=null&&(n["display-name"]=e.summary),e.description!=null&&(n.docs=e.description);let i=Uci(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let p of e.handshake.pathParameters)a[p.name]=dys({pathParameter:p,context:t,fileContainingReference:r,namespace:i});Object.keys(a).length>0&&(n["path-parameters"]=a);let u={};if(e.handshake.queryParameters.length>0)for(let p of e.handshake.queryParameters){let s=_ys({queryParameter:p,context:t,fileContainingReference:r,namespace:i});s!=null&&(u[p.name]=s)}Object.keys(u).length>0&&(n["query-parameters"]=u);let c={};if(e.handshake.headers.length>0)for(let p of e.handshake.headers){let s=C8r({header:p,context:t,fileContainingReference:r,namespace:i});c[p.name]=s}Object.keys(c).length>0&&(n.headers=c),t.builder.addChannel(r,{channel:n});for(let p of e.messages)t.builder.addChannelMessage(r,{messageId:p.name,message:{origin:p.origin,body:FS({schema:p.body,context:t,fileContainingReference:r,namespace:i,declarationDepth:0})}});for(let p of e.examples){let s=Qhy({context:t,websocketExample:p});t.builder.addChannelExample(r,{example:s})}}function Why(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var Vci="Base",bCD="Default";function VKi(e){return Object.entries(e).reduce((t,[r,n])=>(Xke(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function Hhy(e){if(e.environmentOverrides!=null){for(let[q,L]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:q,schema:L});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(q=>Why(q)),i=e.ir.servers;for(let q of i)if(Why(q)){let L={urls:{}};for(let[U,Q]of Object.entries(q.urls))L.urls[U]=Q.url;q.name&&(t[q.name]=L)}else if("url"in q&&q.url){let L=q.audiences?{url:q.url,audiences:q.audiences}:q.url;if(q.name==null){r.push(L);continue}t[q.name]=L}let a={},u={},c=[];for(let q of e.ir.endpoints)for(let L of q.servers){if(L.url==null&&L.name!=null){a[L.name]||(a[L.name]=[]);continue}if(L.url==null)continue;let U=L.audiences?{url:L.url,audiences:L.audiences}:L.url;if(L.name==null){c.push(U);continue}a[L.name]||(a[L.name]=[]),a[L.name]?.push({url:L.url,audiences:L.audiences}),u[L.name]=U}let p={},s=[];for(let q of e.ir.websocketServers){let L=q.audiences?{url:q.url,audiences:q.audiences}:q.url;if(q.name==null){s.push(L);continue}p[q.name]=L}let o=Object.keys(t).length,l=o>0,O=Object.keys(u).length>0,A=Object.keys(a).some(q=>a[q]?.length===0),E=Object.keys(p).length>0;if(!l&&!O&&E&&e.ir.servers.length===0){for(let[q,L]of Object.entries(p))e.builder.addEnvironment({name:q,schema:L});e.builder.setDefaultEnvironment(Object.keys(p)[0]),e.builder.setDefaultUrl(Vci);return}if(c.length>0&&e.logger.error(`Skipping endpoint level servers ${c.map(q=>typeof q=="string"?q:q.url).join(", ")} because x-fern-server-name was not provided.`),!l){let q=e.ir.servers[0]?.url,L=e.ir.servers[0]?.audiences;if(q!=null){let U=L?{url:q,audiences:L}:q;t[bCD]=U}}let C=Object.values(t).map(q=>typeof q=="string"?q:Xke(q)?Object.values(q.urls)[0]:q.url),M=r.filter(q=>{let L=typeof q=="string"?q:q.url;return!C.includes(L)});if(M.length>0&&e.logger.error(`Skipping top level servers ${M.map(q=>typeof q=="string"?q:q.url).join(", ")} because x-fern-server-name was not provided.`),n){let q=!0;for(let[L,U]of Object.entries(t))if(e.builder.addEnvironment({name:L,schema:U}),q){if(e.builder.setDefaultEnvironment(L),Xke(U)){let Q=Object.keys(U.urls)[0];Q&&e.builder.setDefaultUrl(Q)}q=!1}return}if(!O&&!A){let q=!0;for(let[L,U]of Object.entries(t))if(q){if(E){let Q=typeof U=="string"?U:Xke(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:L,schema:{urls:{[Vci]:Q??"",...VKi(p)}}})}else e.builder.addEnvironment({name:L,schema:U});e.builder.setDefaultEnvironment(L),q=!1}else if(E){let Q=typeof U=="string"?U:Xke(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:L,schema:{urls:{[Vci]:Q??"",...VKi(p)}}})}else e.builder.addEnvironment({name:L,schema:U});E&&e.builder.setDefaultUrl(Vci)}else if(o===1){let q=Object.keys(t)[0],L=Object.values(t)[0],U=typeof L=="string"?L:Xke(L)?Object.values(L.urls)[0]:L.url;e.builder.addEnvironment({name:q,schema:{urls:{[Vci]:U??"",...VKi(u),...VKi(p)}}}),e.builder.setDefaultEnvironment(q),e.builder.setDefaultUrl(Vci)}else{let q=new Map;for(let L of e.ir.endpoints)for(let U of L.servers)if(U.url!=null&&U.name!=null){q.has(U.name)||q.set(U.name,new Map);let Q=U.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",K=q.get(U.name);K&&K.set(Q,U.url)}if(q.size>0){let L=!0;for(let[U,Q]of Object.entries(t)){let K=typeof Q=="string"?Q:Xke(Q)?Object.values(Q.urls)[0]:Q.url;if(!K)continue;let X=K.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",te={[Vci]:K};for(let[ee,re]of q.entries()){let ue=re.get(X)||re.get("production")||re.values().next().value;ue&&(te[ee]=ue)}E&&Object.assign(te,VKi(p)),Object.keys(te).length>1?e.builder.addEnvironment({name:U,schema:{urls:te}}):e.builder.addEnvironment({name:U,schema:K}),L&&(e.builder.setDefaultEnvironment(U),L=!1)}q.size>0&&e.builder.setDefaultUrl(Vci)}else{let L=!0;for(let[U,Q]of Object.entries(t)){if(E||Object.keys(u).length>0){let K=typeof Q=="string"?Q:Xke(Q)?Object.values(Q.urls)[0]:Q.url;e.builder.addEnvironment({name:U,schema:{urls:{[Vci]:K??"",...VKi(u),...VKi(p)}}})}else e.builder.addEnvironment({name:U,schema:Q});L&&(e.builder.setDefaultEnvironment(U),L=!1)}}}}var fof=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},gCD=.75,mCD=new Set("authorization");function Ghy(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?cQa(n.schema):void 0,u=a!=null?Uci(a):void 0,c=iP.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?E4(FS({schema:n.schema,context:e,fileContainingReference:u?Q$(iP.of(IO(u)),c):c,namespace:u,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(mCD.has(a.name.toLowerCase()))continue;let u=r[a.name];if(u==null){let c=t[a.name],p=C8r({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:iP.of(rZ),context:e,namespace:void 0});u=new fof(p),r[a.name]=u}u.increment()}let n=e.ir.endpoints.length*gCD;for(let[i,a]of Object.entries(r)){let u=t[i],c=a.count===e.ir.endpoints.length,p=a.count>=n;u==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):p&&e.builder.addGlobalHeader({name:i,schema:mDi(a.schema)}))}}}function Jhy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?cQa(t.schema):void 0,n=r!=null?Uci(r):void 0,i=C8r({header:{...t,schema:t.schema??$P.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:iT.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:iP.of(rZ),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:mDi(i)})}}function WOe(e){switch(e.type){case"primitive":return $hy(e.value);case"object":return Yhy(e.properties);case"array":return Xhy(e.value);case"map":return ACD(e.value);case"oneOf":return PCD(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return wCD(e.value);case"unknown":return WOe(e.value);default:cc(e)}}function Khy(e){switch(e.type){case"withStreaming":return e.sse?{stream:OCD(e.events)}:{stream:Xhy(e.events)};case"withoutStreaming":return{body:WOe(e.value)};default:cc(e)}}function $hy(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:cc(e)}}function Yhy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,WOe(r)]))}function OCD(e){return e.map(t=>({event:"",data:WOe(t)}))}function Xhy(e){return e.map(t=>WOe(t))}function ACD(e){return Object.fromEntries(e.map(t=>[$hy(t.key),WOe(t.value)]))}function PCD(e){return e.type==="discriminated"?Yhy(e.value):WOe(e.value)}function wCD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:cc(e)}}function Zhy({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"]=jCD(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=ECD(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),a=Object.keys(i).length>0,u=new Set(e.headers?.map(c=>c.name)??[]);if(n||a){let c=[];if(e.headers!=null)for(let p of e.headers)p.name!==t.builder.getAuthHeaderName()&&c.push(p);for(let[p,s]of Object.entries(i))if(!u.has(p))if(s!=null&&typeof s=="object"&&s.type!=null){let o=yZ({type:s.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:Hc}});o!=null&&c.push({name:p,value:xS.literal(sDi.string(o))})}else c.push({name:p,value:xS.primitive(Im.string(p))});r.headers=SCD({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=WOe(e.request)),e.response!=null&&(r.response=Khy(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(GP)),r}function jCD(e){let t={};return e.forEach(r=>{let n=WOe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function ECD(e){let t={};return e.forEach(r=>{let n=WOe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function SCD({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=WOe(n.value);i!=null&&(r[n.name]=i)}),r}function khy(e){return Hle._visit(e,{get:()=>G$.HttpMethodSchema.Get,post:()=>G$.HttpMethodSchema.Post,put:()=>G$.HttpMethodSchema.Put,patch:()=>G$.HttpMethodSchema.Patch,delete:()=>G$.HttpMethodSchema.Delete,head:()=>G$.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 eyy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function tyy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,u=e.path,c=hys(e.sdkName,e.namespace),p={};for(let M of e.pathParameters)M.parameterNameOverride&&(u=u.replace(M.name,M.parameterNameOverride)),p[M.parameterNameOverride??M.name]=dys({pathParameter:M,context:r,fileContainingReference:t,namespace:c}),a.add(M.name);let s={};for(let M of e.queryParameters){let q=_ys({queryParameter:M,context:r,fileContainingReference:t,namespace:c});q!=null&&(s[M.name]=q,a.add(M.name))}let o;if(e.pagination!=null)switch(e.pagination.type){case"cursor":o={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":o={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":o={type:"custom",results:e.pagination.results};break;default:cc(e.pagination)}let l={path:u,method:khy(e.method),auth:e.authed,docs:e.description??void 0,pagination:o,source:e.source!=null?Lci(e.source):void 0};!MCD({context:r,request:e.request})&&Object.keys(p).length>0&&(l["path-parameters"]=p),e.summary!=null&&(l["display-name"]=e.summary);let O={},A=r.builder.getGlobalHeaderNames(),E=r.builder.getAuthHeaderName();E!=null&&A.add(E);let C=e.headers.filter(M=>!A.has(M.name));for(let M of C){let q=C8r({header:M,context:r,fileContainingReference:t,namespace:c});O[M.name]=q,a.add(typeof q=="string"?M.name:q.name??M.name)}if(e.request!=null){r.setInState(loe.Request);let M=ICD({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(p).length>0?p:void 0,queryParameters:Object.keys(s).length>0?s:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(O).length>0?O:void 0,usedNames:a,namespace:c});l.request=M.value,i=[...i,...M.schemaIdsToExclude??[]],r.unsetInState(loe.Request)}else{let M=r.inlinePathParameters&&Object.keys(p).length>0,q=Object.keys(s).length>0,L=Object.keys(O).length>0,U={};(M||q||L)&&(U.name=e.requestNameOverride??e.generatedRequestName),M&&(U["path-parameters"]=p),q&&(U["query-parameters"]=s),L&&(U.headers=O),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:M=>{let q=FS({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:M.description??void 0,type:E4(q)},M.statusCode!=null&&(l.response["status-code"]=M.statusCode),M.responseProperty!=null&&(l.response.property=M.responseProperty)},streamingJson:M=>{let q=FS({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:E4(q),format:"json"}},streamingSse:M=>{let q=FS({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:E4(q),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(),q=e.servers[0];q==null?M!=null&&(l.url=M):l.url=q.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=FH(e.availability)),Object.entries(e.errors).forEach(([M,q])=>{let L=q.generatedName,U=iP.of(JN);r.builder.enableUniqueErrorsPerEndpoint&&(L=`${e.generatedRequestName}${q.generatedName}`,q.schema!=null&&(q.schema.type!=="reference"&&q.schema.type!=="oneOf"?q.schema.generatedName=`${e.generatedRequestName}${q.schema.generatedName}`:q.schema.type==="oneOf"&&(q.schema.value.generatedName=`${e.generatedRequestName}${q.schema.value.generatedName}`)));let Q={"status-code":parseInt(M)},K=Dhy({location:ryy,namespaceOverride:c});if(q.schema!=null){let ee=FS({schema:q.schema,context:r,fileContainingReference:K,declarationFile:K,namespace:c,declarationDepth:0});Q.type=E4(ee),Q.docs=q.description}r.builder.addError(K,{name:L,schema:r.isErrorUnknownSchema(parseInt(M))?{...Q,type:"unknown"}:Q}),l.errors==null&&(l.errors=[]);let X=r.builder.addImport({file:t,fileToImport:K});l.errors.push(X!=null?`${X}.${L}`:L),Q.type!=null&&q.examples?.forEach(ee=>{let re={value:WOe(ee.example),name:ee.name,docs:ee.description};r.builder.addErrorExample(K,{name:L,example:re})})}),e.examples.length>0&&(l.examples=DCD({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=CCD({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[dof,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function DCD({endpointExamples:e,context:t}){return e.map(r=>{try{return Zhy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function CCD({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:cc(e)}}function ICD({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:u,queryParameters:c,nonRequestReferencedSchemas:p,headers:s,usedNames:o,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let O=n.schema.type==="reference"?n.schema.schema:void 0,A=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(A?.type!=="object"||O!=null&&p.includes(O)){let L=FS({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),U={schemaIdsToExclude:[],value:{body:L}},Q=Object.keys(u??{}).length>0,K=Object.keys(c??{}).length>0,X=Object.keys(s??{}).length>0;return Q&&(U.value["path-parameters"]=u),K&&(U.value["query-parameters"]=c),X&&(U.value.headers=s),(Q||K||X)&&(U.value.name=i??a),n.contentType!=null&&(U.value["content-type"]=n.contentType),n.description!=null&&(U.value.docs=n.description),U}let E=Object.fromEntries(A.properties.filter(L=>L.readonly==null?!0:!(eyy(e.method)&&L.readonly)).map(L=>{let U=FS({schema:L.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),Q=L.nameOverride??L.key,K=FH(L.availability);if(!o.has(Q)&&L.audiences.length<=0)return o.add(Q),L.nameOverride!=null?[L.key,{type:E4(U),docs:lQa(U),name:L.nameOverride,availability:K}]:[L.key,K?{...typeof U=="string"?{type:U}:U,availability:K}:U];let X={type:E4(U),docs:lQa(U)};return o.has(Q)&&(X.name=L.generatedName),L.audiences.length>0&&(X.audiences=L.audiences),K!=null&&(X.availability=K),o.add(Q),[L.key,X]})),C=A.allOf.map(L=>{let U=FS({schema:$P.reference(L),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return E4(U)}).filter(L=>L!=="unknown"),M={properties:E};C.length>0&&(M.extends=C),n.additionalProperties&&(M["extra-properties"]=!0);let q={name:i??A.nameOverride??A.generatedName,"path-parameters":u,"query-parameters":c,headers:s,body:M};return n.contentType!=null&&(q["content-type"]=n.contentType),n.description!=null&&(q.docs=n.description),{schemaIdsToExclude:O!=null?[O]:[],value:q}}else if(n.type==="octetStream"){let O={body:"bytes","content-type":n.contentType??l7.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(O.name=i??a),n.description!=null&&(O.docs=n.description),{schemaIdsToExclude:[],value:O}}else if(n.type==="multipart"){let O=Object.fromEntries(n.properties.map(A=>{if(A.schema.type==="file"){let E=A.schema.isArray?"list<file>":"file";if(E=A.schema.isOptional?`optional<${E}>`:E,A.description!=null||A.contentType!=null){let C={type:E};if(A.description!=null&&(C.docs=A.description),A.contentType!=null){let M=A.contentType.split(",")[0];C["content-type"]=M}return[A.key,C]}return[A.key,E]}else{let E=FS({schema:A.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(A.contentType||A.exploded||A.encoding){let C=typeof E=="string"?{type:E}:E;A.contentType!=null&&(C["content-type"]=A.contentType),A.encoding==="form"?C.style="form":A.encoding==="json"?C.style="json":A.exploded&&(C.style="exploded"),E=C}return[A.key,E]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??a,"path-parameters":u,"query-parameters":c,headers:s,body:{properties:O},"content-type":l7.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else cc(n)}function MCD({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:cc(t)}}function BCD({location:e,namespaceOverride:t}){return t!=null?{...e,file:Q$(iP.of(t),e.file)}:e}function TCD(e){let t=e.namespace,r=e.tags.filter(p=>p!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:iP.of(`${IO(r)}.yml`),endpointId:e.summary!=null?IO(e.summary):IO(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:iP.of(JN),endpointId:IO(e.summary)}:{file:iP.of(JN),endpointId:IO(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:iP.of(JN),endpointId:n};let i=U3o(r),a=U3o(n);if(Bae(i,a))return{file:iP.of("__package__.yml"),endpointId:r};let u=RCD({operationId:n,tag:r,path:e.path,method:e.method});if(u!=null)return u;let c=[];for(let p=0;p<i.length;++p){let s=i[p];if(s!=null&&s===a[p])c.push(s);else{let o=IO(r);return{file:iP.of(`${o}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:iP.of(IO(c.join("_"))+".yml"),endpointId:IO(a.slice(c.length).join("_")),tag:r}}function V3o(e){let t=e.tags[0];if(e.sdkName!=null){let r=Yaf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:iP.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return BCD({namespaceOverride:e.namespace,location:TCD(e)})}function U3o(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=Dct(t),t}var qCD=new RegExp("[^a-zA-Z0-9{}]+"),NCD=new RegExp("[{}]","g");function RCD({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(qCD).join("_").replaceAll(NCD,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:iP.of(IO(t)+".yml"),endpointId:IO(e.slice(0,-1*a.length)),tag:t}}function nyy(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:u,file:c,tag:p}=V3o(a),s=c.split(".")[0];s!=null&&t.add(s);let o;if(a.sdkName!=null){let A=e.ir.groups;for(let E of a.sdkName.groupName){let C=typeof E=="string"?E:E.name,M=A[C];if(M==null)break;if(M.summary!=null||M.description!=null){o=A[C];break}}}let l=p==null?void 0:n.tagsById[p];e.setInState(loe.Endpoint),e.setEndpointMethod(a.method);let O=tyy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(loe.Endpoint),i=[...i,...O.schemaIdsToExclude],e.builder.addEndpoint(c,{name:u,schema:O.value,source:a.source!=null?Lci(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":o?.summary??l?.id,docs:o?.description??l?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function iyy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?Uci(r.groupName):void 0,i=FS({schema:$P.primitive(r),context:e,fileContainingReference:iP.of(JN),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:E4(i),docs:r.description??void 0}})}}function ayy(e){for(let t of e.ir.webhooks){let r=zCD({webhook:t,context:e});if(r==null)continue;let n=hys(t.sdkName,t.namespace),i={};for(let u of t.headers)i[u.name]=C8r({header:u,context:e,fileContainingReference:r.file,namespace:n});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:FS({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),examples:t.examples!=null?t.examples.map(u=>({docs:u.description,name:u.name,payload:WOe(u.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function xCD({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:Q$(iP.of(t),e.file)}:e}function FCD({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:iP.of(JN),endpointId:n};let i=U3o(r),a=U3o(n);if(Bae(i,a))return{file:iP.of("__package__.yml"),endpointId:r};let u=[];for(let c=0;c<i.length;++c){let p=i[c];if(p!=null&&p===a[c])u.push(p);else{let s=IO(r);return{file:iP.of(`${s}.yml`),endpointId:n,tag:r}}}if(u.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:iP.of(IO(u.join("_"))+".yml"),endpointId:IO(a.slice(u.length).join("_")),tag:r}}function zCD({webhook:e,context:t}){return e.sdkName!=null?{file:Shy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:xCD({namespaceOverride:e.namespace,location:FCD({webhook:e,context:t})})}var QCD=iP.of(JN);function uyy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return oyy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return oyy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return QCD;default:cc(e)}}function oyy({namespace:e,groupName:t}){return e!=null&&t!=null?gDi([{type:"namespace",name:e},...t]):e!=null?gDi([{type:"namespace",name:e}]):gDi(t)}var dof="external",ryy=iP.of(JN);function syy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let u=uyy(a),c=qhy({schema:a,context:n,declarationFile:u,namespace:r,declarationDepth:0});if(d1i(c.schema)){let p=E4(c.schema);if(p===(c.name??i)||p===`optional<${c.name??i}>`||p===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(u,{name:c.name??i,schema:c.schema})}}function cyy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),Hhy(e),Ghy(e),Jhy(e),zhy(e),iyy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(dof);let t=nyy(e),r=t.sdkGroups;e.setInState(loe.Webhook),ayy(e),e.unsetInState(loe.Webhook),e.setInState(loe.Channel);for(let i of Object.values(e.ir.channels)){let a=gDi(i.groupName);Vhy({channel:i,context:e,declarationFile:a})}e.unsetInState(loe.Channel);let n=LCD({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});syy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))syy({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 LCD({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 W3o=class{context;constructor(t){this.context=t}};var yys=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[u,c]of Object.entries(n.files)){let p=i!=null?iP.of(`${i}${"/"}${u}`):iP.of(u);t[p]=c}let a=Object.keys(n.directories).sort();for(let u of a){let c=i!=null?`${i}${"/"}${u}`:u,p=n.directories[u];r(p,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[iP.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 WKi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new yys,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 u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),n!=null&&(u.service["base-path"]=n),i!=null&&(u.service["display-name"]=i),a!=null&&(u.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return R6r(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"]))lyy(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(lyy(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??IO((Lct(r)+"/"+NVi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===iP.of(rZ))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=h2u(Lct(zRa.of(`/${t}`)),zRa.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=h2u(Lct(zRa.of(`/${t}`)),zRa.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===iP.of(rZ))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=>Bae(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=Q$(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:Q$(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,u])=>[a,{...u,path:Q$(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===JN?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 lyy(e){return e?.header!=null}var vys=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:a,authOverrides:u}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=u,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.builder=new WKi(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let p of r.endpoints)for(let[s,o]of Object.entries(p.errors)){let l=parseInt(s),O=c[l];O==null&&o.schema!=null?c[l]=o.schema:O!=null&&o.schema!=null&&sRe(O,o.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}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(loe.Channel,loe.Endpoint,loe.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:cc(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:cc(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 pof(e){let t=new vys(e);return cyy(t)}var bys=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=pof({taskContext:t,ir:r,options:T3o({overrides:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.args.respectNullableSchemas,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}}),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:lg.dump(a.rootApiFile)},namedDefinitionFiles:{...xb(a.definitionFiles,u=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:lg.dump(u),contents:u})),[iP.of(JN)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:lg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var H3o=class extends pCr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.converter=new bys(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 Ret({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var vye={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 fQa={of(e){return e}};var fyy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},_of={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:fyy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},Gv={SOURCE:fQa.of("source"),SDK_NAMESPACE:fQa.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:fQa.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:fQa.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:fQa.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"};var BJ={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,groupMultiApiEnvironments:!1};function Ddt({options:e,overrides:t}){return{disableExamples:t?.disableExamples??BJ.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??BJ.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??BJ.useTitlesAsName,audiences:t?.audiences??e?.audiences??BJ.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??BJ.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??BJ.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??BJ.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??BJ.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??BJ.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??BJ.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??BJ.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??BJ.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??BJ.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??BJ.objectQueryParameters,filter:t?.filter??e?.filter??BJ.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??BJ.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??BJ.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??BJ.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??BJ.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??BJ.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??BJ.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??BJ.inlineAllOfSchemas,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??BJ.groupMultiApiEnvironments}}var dyy={naming:"v1"};function wy(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function G3o(e,t,r,n,i=[]){try{let a=wy(e,t);if(a!=null)return r.parse(a)}catch{let u=Dct(i).join(" -> ");n.error(`${u.length>0?`${u}: `:""}Failed to parse ${t}`)}}function HKi(e){let t=wy(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 pyy({schema:e,logger:t}){return wy(e,Gv.ENCODING)??void 0}function _yy(e){return wy(e,Gv.FERN_ENUM)}function hyy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let u=wy(n,Gv.SDK_NAMESPACE),c=wy(n,Gv.SDK_GROUP_NAME),p=wy(n,Gv.TYPE_DEFINITION);if(p!=null)return J3o({fernType:p,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:u,groupName:typeof c=="string"?[c]:c})}function J3o({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c}){return yZ({type:e,_default:void 0,validation:void 0,visitor:{primitive:p=>{switch(p.v1){case"BASE_64":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.base64({example:void 0})});case"BOOLEAN":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.boolean({default:void 0,example:void 0})});case"DATE":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.date({example:void 0})});case"DATE_TIME":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.datetime({example:void 0})});case"FLOAT":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.float({example:void 0})});case"DOUBLE":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.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 Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.uint({default:void 0,example:void 0})});case"INTEGER":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.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 Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.uint64({default:void 0,example:void 0})});case"LONG":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:cc(p.v1)}},unknown:()=>Uh.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:u,groupName:c}),map:({keyType:p,valueType:s})=>p?.type==="primitive"&&s!=null?Uh.map({nameOverride:t,generatedName:r,title:n,key:p,value:s,description:i,availability:a,namespace:u,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:p=>p!=null?Uh.array({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,example:void 0,inline:void 0}):void 0,optional:p=>p!=null?Uh.optional({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,inline:void 0}):void 0,nullable:p=>p!=null?Uh.nullable({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,inline:void 0}):void 0,set:p=>p!=null?Uh.array({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,example:void 0,inline:void 0}):void 0,literal:p=>Uh.literal({nameOverride:t,generatedName:r,title:n,value:p._visit({string:s=>JL.string(s),boolean:s=>JL.boolean(s),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:u,groupName:c}),named:p=>Uh.reference({schema:p,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,source:UOe.openapi({file:"<memory>"})})}})}function yyy(e){let t=wy(e,Gv.SOURCE);if(t!=null)return t.endsWith(".proto")?UOe.protobuf({file:t}):UOe.openapi({file:t})}function GKi(e){if(e!=null&&typeof e=="boolean")return e}function Ig(e){return e?.$ref!=null}function vyy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:u,wrapAsNullable:c,context:p,namespace:s,groupName:o,example:l,encoding:O,source:A}){return i===void 0&&(i=p.options.additionalPropertiesDefaultsTo),typeof i=="boolean"||dQa(i,p.options)?gys({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Zg.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:Uh.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0}),namespace:s,groupName:o,example:l,encoding:O}):gys({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Zg.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:byy(E1(i,p.options.optionalAdditionalProperties?c:!1,p,[...n,"Value"],A,s,void 0,void 0,void 0)),namespace:s,groupName:o,example:l,encoding:O})}function byy(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=byy(e.value);break;case"oneOf":e.value.inline=!0;break;default:cc(e)}return e}function gys({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsNullable:a,description:u,availability:c,namespace:p,groupName:s,example:o,encoding:l}){return a?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.map({nameOverride:e,generatedName:t,title:r,description:u,availability:n.availability,key:n,value:i,namespace:p,groupName:s,encoding:l,example:o,inline:void 0}),description:u,availability:c,namespace:p,groupName:s,inline:void 0}):Uh.map({nameOverride:e,generatedName:t,title:r,description:u,availability:c,key:n,value:i,namespace:p,groupName:s,encoding:l,example:o,inline:void 0})}function dQa(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!Ig(e)&&Object.keys(e).length===0}function gyy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:u,wrapAsNullable:c,context:p,namespace:s,groupName:o,example:l,source:O}){let A=i==null?Uh.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:s,groupName:o}):E1(i,!1,p,[...n,"Item"],O,s);return UCD({nameOverride:e,generatedName:t,title:r,namespace:s,groupName:o,itemSchema:A,wrapAsNullable:c,description:a,availability:u,example:l})}function UCD({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsNullable:i,description:a,availability:u,namespace:c,groupName:p,example:s}){return i?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,namespace:c,groupName:p,example:s,inline:void 0}),description:a,availability:u,namespace:c,groupName:p,inline:void 0}):Uh.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,namespace:c,groupName:p,example:s,inline:void 0})}function HOe(e){switch(wy(e,Gv.AVAILABILITY)){case"deprecated":return Vle.Deprecated;case"beta":return Vle.Beta;case"generally-available":return Vle.GenerallyAvailable;default:break}if(!Ig(e)&&e.deprecated)return Vle.Deprecated}function hof({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:c,wrapAsNullable:p,discriminator:s,context:o,namespace:l,groupName:O,encoding:A,source:E}){let C=s.propertyName,M=Object.fromEntries(Object.entries(s.mapping??{}).map(([L,U])=>{let Q=Wci({$ref:U},!1,o,[U],A,E,l);return o.markReferencedByDiscriminatedUnion({$ref:U},C,1),[L,Q]})),q=Object.entries(i).filter(([L])=>L!==C).map(([L,U])=>{let Q=c!=null&&c.includes(L),K=E1(U,!Q,o,[...n,L],E,l);return{key:L,schema:K}});return myy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:p,properties:q,description:a,availability:u,discriminant:C,subtypes:M,namespace:l,groupName:O,source:E})}function yof({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:c,wrapAsNullable:p,discriminant:s,variants:o,context:l,namespace:O,groupName:A,encoding:E,source:C}){let M=Object.fromEntries(Object.entries(o).map(([L,U])=>{if(Ig(U)){let Q=Wci(U,!1,l,[U.$ref],E,C,O);return l.markReferencedByDiscriminatedUnion(U,s,1),[L,Q]}else{let Q=K3o(U,!1,l,[...n,L],E,C,O,new Set([s]));return[L,Q]}})),q=Object.entries(i).filter(([L])=>L!==s).map(([L,U])=>{let Q=c!=null&&c.includes(L),K=E1(U,!Q,l,[...n,L],C,O);return{key:L,schema:K}});return myy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:p,properties:q,description:a,availability:u,discriminant:s,subtypes:M,namespace:O,groupName:A,source:C})}function myy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,availability:u,discriminant:c,subtypes:p,namespace:s,groupName:o,source:l}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.oneOf(gSe.discriminated({description:a,availability:u,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:p,commonProperties:i,namespace:s,groupName:o,encoding:void 0,source:l,inline:void 0})),namespace:s,groupName:o,description:a,availability:u,inline:void 0}):Uh.oneOf(gSe.discriminated({description:a,availability:u,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:p,commonProperties:i,namespace:s,groupName:o,encoding:void 0,source:l,inline:void 0}))}function Oyy(e){if(e.proto!=null)return B5a.protobuf({typeName:e.proto.type})}function ADi({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:u,description:c,availability:p,wrapAsNullable:s,namespace:o,groupName:l,context:O,source:A,inline:E}){let C=WCD(i??[]),M=new Set(a),q=Array.from(M).map((U,Q)=>{let K=n?.[U],X=C[Q],te=uQa.test(U),ee=K?.name??X,re=te?U:sQa(U);return ee!=null&&!uQa.test(ee)&&(O?.logger.warn(`Enum name override ${ee} is not a valid name. Falling back on ${re}.`),ee=void 0),{nameOverride:ee,generatedName:re,value:U,description:K?.description,availability:p,casing:{snake:K?.casing?.snake??void 0,pascal:K?.casing?.pascal??void 0,screamingSnake:K?.casing?.screamingSnake??void 0,camel:K?.casing?.camel??void 0}}}),L=u!=null?q.find(U=>U.value===u):void 0;return VCD({wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:q,_default:L,description:c,availability:p,namespace:o,groupName:l,source:A,inline:E})}function VCD({wrapAsNullable:e,nameOverride:t,generatedName:r,title:n,values:i,_default:a,description:u,availability:c,namespace:p,groupName:s,source:o,inline:l}){return e?Uh.nullable({nameOverride:t,generatedName:r,title:n,value:Uh.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,default:a,availability:c,example:void 0,namespace:p,groupName:s,source:o,inline:l}),description:u,availability:c,namespace:p,groupName:s,inline:l}):Uh.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,availability:c,default:a,example:void 0,namespace:p,groupName:s,source:o,inline:l})}function WCD(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 Ayy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,description:o,availability:l,wrapAsNullable:O,example:A,namespace:E,groupName:C}){return n==="int64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint32"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int({default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C})}function Pyy(e){return typeof e=="string"?JL.string(e):typeof e=="boolean"?JL.boolean(e):JL.string(`${e}`)}function wyy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,value:i,description:a,availability:u,namespace:c,groupName:p}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.literal({nameOverride:e,generatedName:t,title:r,value:Pyy(i),description:a,availability:u,namespace:c,groupName:p}),description:a,availability:u,namespace:c,groupName:p,inline:void 0}):Uh.literal({nameOverride:e,generatedName:t,title:r,value:Pyy(i),description:a,availability:u,namespace:c,groupName:p})}function vof({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,description:o,availability:l,wrapAsNullable:O,example:A,namespace:E,groupName:C}){return n==null||n==="double"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.double({default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="float"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.float({example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="int32"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int({default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="int64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint32"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="time-delta"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.float({example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.float({example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C})}var HCD={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},GCD={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}}},JCD={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}}},KCD={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},$CD={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},YCD={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},XCD={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ZCD={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function mys(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[HCD,GCD,JCD,KCD,$CD,YCD,XCD,ZCD],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:u,newBreadcrumbs:c}=a.applyStrategy(t);t=u,r=[...r,...c]}}while(t.join("")!==i.join(""));return r}function doe(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:g9(IO(i))).join("");return/^\d/.test(n)?z3o(n)??n:n}function bof(e){let t=e.join("_");return IO(t)}function gz(e){switch(e.type){case"object":return $P.object({allOf:e.allOf,properties:e.properties.map(t=>eID(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 $P.array({description:e.description,availability:e.availability,value:gz(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return $P.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 $P.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 $P.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gz(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return $P.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gz(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return $P.primitive({description:e.description,availability:e.availability,schema:jyy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return $P.map({description:e.description,availability:e.availability,key:$P.primitive({description:e.key.description,availability:e.key.availability,schema:jyy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:gz(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 $P.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 $P.oneOf(kCD(e.value));case"unknown":return $P.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:cc(e)}}function kCD(e){switch(e.type){case"discriminated":return w8r.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:gz(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,gz(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return w8r.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>gz(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:cc(e)}}function jyy(e){switch(e.type){case"string":return iT.string(e);case"base64":return iT.base64();case"boolean":return iT.boolean(e);case"date":return iT.date();case"datetime":return iT.datetime();case"double":return iT.double(e);case"float":return iT.float();case"int":return iT.int(e);case"int64":return iT.int64(e);case"uint":return iT.uint();case"uint64":return iT.uint64();default:cc(e)}}function eID(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:gz(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function Oys(e,t){return sRe(gz(e),gz(t))}function Eyy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:u,wrapAsNullable:c,allOf:p,context:s,propertiesToExclude:o,namespace:l,groupName:O,fullExamples:A,additionalProperties:E,availability:C,source:M}){let q=[...u??[]],L={...i},U=[],Q=[];for(let re of p)if(!s.options.inlineAllOfSchemas&&Ig(re)){let ue=s.resolveSchemaReference(re);if(ue.discriminator!=null&&ue.discriminator.mapping!=null)continue;if(ue.oneOf!=null||ue.anyOf!=null){let Oe=ue.oneOf??ue.anyOf;if(Oe!=null){for(let Ee of Oe){let Ae=Ig(Ee)?s.resolveSchemaReference(Ee):Ee,Me=E1(Ae,!1,s.DUMMY,n,M,l);Me.type==="object"&&U.push(...Me.properties.map(Qe=>Qe.schema.type!=="optional"&&Qe.schema.type!=="nullable"?{...Qe,schema:Uh.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Qe.schema,description:void 0,availability:Qe.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Qe))}continue}}let me=PDi(re);if(me==null)continue;Q.push({schemaId:me,convertedSchema:gof(re,[me],M,s.options.preserveSchemaIds),properties:Syy({schema:re,context:s,breadcrumbs:n,source:M,namespace:l})}),s.markSchemaAsReferencedByNonRequest(me)}else if(Ig(re)){let ue=s.resolveSchemaReference(re),me=E1(ue,!1,s,n,M,l);me.type==="object"&&U.push(...me.properties)}else{let ue=re.required??[];U=U.map(Oe=>(Oe.schema.type==="optional"||Oe.schema.type==="nullable")&&ue.includes(Oe.key)?{...Oe,schema:Oe.schema.value}:Oe);let me=E1(re,!1,s,n,M,l);me.type==="object"&&U.push(...me.properties)}let K={};for(let re of Q)for(let[ue,me]of Object.entries(re.properties)){let Oe=K[ue];Oe!=null?(Oe.schemaIds.push(re.schemaId),Oe.schemas.some(Ae=>Oys(Ae,me))||Oe.schemas.push(me)):K[ue]={schemaIds:[re.schemaId],schemas:[me]}}let X=[];for(let[re,ue]of Object.entries(K))ue.schemaIds.length>1&&X.push({propertyKey:re,allOfSchemaIds:ue.schemaIds,conflictingTypeSignatures:ue.schemas.length>1});let te=Object.fromEntries(Object.entries(L).filter(([re,ue])=>!(!Ig(ue)&&ue.type==="null"))),ee=Object.entries(te).map(([re,ue])=>{let me=wy(ue,Gv.AUDIENCES)??[],Oe=HOe(ue),Ee=Ig(ue)?!1:ue.readOnly,Ae=Ig(ue)?!1:ue.writeOnly,Me=q.includes(re)&&!Ee,Qe=wy(ue,Gv.FERN_PROPERTY_NAME),Be=[...n,re],Mt=bof(Be),zt=Me?E1(ue,!1,s,Be,M,l):Uh.optional({nameOverride:e,generatedName:Mt,title:r,description:void 0,availability:Oe,value:E1(ue,!1,s,Be,M,l),namespace:l,groupName:O,inline:void 0}),Ye={};for(let ze of Q){let Dr=ze.properties[re];Dr!=null&&!Oys(zt,Dr)?Ye[ze.schemaId]={differentSchema:!0}:Dr!=null&&(Ye[ze.schemaId]={differentSchema:!1})}return{key:re,schema:zt,nameOverride:Qe,audiences:me,conflict:Ye,generatedName:bof([...n,re]),availability:Oe,readonly:Ee,writeonly:Ae}});return ee.push(...U.map(re=>{let ue=re.conflict;for(let me of Q){let Oe=me.properties[re.key];Oe!=null&&!Oys(re.schema,Oe)?ue[me.schemaId]={differentSchema:!0}:Oe!=null&&(ue[me.schemaId]={differentSchema:!1})}return{...re,conflict:ue}})),tID({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,properties:ee.filter(re=>!o.has(re.key)),description:a,allOf:Q.map(re=>re.convertedSchema),allOfPropertyConflicts:X,namespace:l,groupName:O,fullExamples:A,additionalProperties:E,availability:C,source:M,context:s})}function tID({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,allOf:u,allOfPropertyConflicts:c,namespace:p,groupName:s,fullExamples:o,additionalProperties:l,availability:O,source:A,context:E}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:c,namespace:p,groupName:s,fullExamples:o,additionalProperties:dQa(l,E.options),availability:void 0,source:A,inline:void 0}),description:a,availability:O,namespace:p,groupName:s,inline:void 0}):Uh.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:c,namespace:p,groupName:s,fullExamples:o,additionalProperties:dQa(l,E.options),availability:O,source:A,inline:void 0})}function Syy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[u,c]=Ig(e)?[t.resolveSchemaReference(e),mys(e.$ref)]:[e,r];for(let p of u.allOf??[])a={...a,...Syy({schema:p,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[p,s]of Object.entries(u.properties??{})){let o=E1(s,!1,t,[...c,p],n,i);a[p]=o}return a}function wDi({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsNullable:u,context:c,subtypes:p,namespace:s,groupName:o,encoding:l,source:O,subtypePrefixOverrides:A}){let E=iID({schemas:p}),C=p.flatMap((q,L)=>{if(!Ig(q)&&q.enum!=null&&c.options.coerceEnumsToLiterals&&q.type==="string")return q.enum.map(Q=>Uh.literal({nameOverride:void 0,generatedName:doe([t,Q],c.options.preserveSchemaIds),title:void 0,value:JL.string(String(Q)),namespace:s,groupName:void 0,description:void 0,availability:Q.availability}));let U=E[L];if(A!=null){let Q=A[L];Q!=null&&"name"in Q&&(U=Q.name)}return[E1(q,!1,c,[...n,U??`${L}`],O,s)]}),M=rID(C);return nID({uniqueSubtypes:M,nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:i,availability:a,namespace:s,groupName:o,context:c,encoding:l,source:O})}function rID(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 u=e[a];if(n!=null&&u!=null&&sRe(n,u)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function nID({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:u,namespace:c,groupName:p,context:s,encoding:o,source:l}){if(Object.entries(e).every(([A,E])=>E.type==="literal")){let A={},E=[];return Object.entries(e).forEach(([C,M])=>{M.type==="literal"&&M.value.type==="string"&&(E.push(M.value.value),M.description!=null&&(A[M.value.value]={description:M.description}))}),ADi({nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:u,fernEnum:A,enumVarNames:void 0,enumValues:E,_default:void 0,namespace:c,groupName:p,context:s,source:l,inline:void 0})}return e.length===1&&e[0]!=null&&!s.options.preserveSingleSchemaOneOf?e[0]:Dyy({nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:u,subtypes:e,namespace:c,groupName:p,encoding:o,source:l})}function mof({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsNullable:a,context:u,namespace:c,groupName:p,discriminator:s,encoding:o,source:l}){let O=Object.entries(s.mapping??{}).map(([C,M],q)=>{let L={$ref:M},U=Wci(L,!1,u,[M],o,l,c);return u.markSchemaWithDiscriminantValue(L,s.propertyName,C),U.type==="object"&&(U.properties={[s.propertyName]:Uh.literal({nameOverride:void 0,generatedName:doe([t,C],u.options.preserveSchemaIds),title:void 0,value:JL.string(C),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...U.properties.filter(Q=>Q.key!==s.propertyName)}),U}),A=[];for(let C=0;C<O.length;++C){let M=O[C],q=!1;for(let L=C+1;L<O.length;++L){let U=O[L];if(M!=null&&U!=null&&sRe(M,U)){q=!0;break}}M!=null&&!q&&A.push(M)}if(Object.entries(A).every(([C,M])=>M.type==="literal")){let C={},M=[];return Object.entries(A).forEach(([q,L])=>{L.type==="literal"&&L.value.type==="string"&&(M.push(L.value.value),L.description!=null&&(C[L.value.value]={description:L.description}))}),ADi({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,fernEnum:C,enumVarNames:void 0,enumValues:M,_default:void 0,namespace:c,groupName:p,context:u,source:l,inline:void 0})}return A.length===1&&A[0]!=null&&!u.options.preserveSingleSchemaOneOf?A[0]:Dyy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,subtypes:A,namespace:c,groupName:p,encoding:o,source:l})}function iID({schemas:e}){let t={},r=0;for(let a of e){if(!Ig(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let u=Object.keys(a.properties),c={},p=u;for(let[s,o]of Object.entries(t)){let l=y4u(o,u);p=y4u(p,o),c[s]=l}c[r]=p,t=c}}r++}let n=[],i=0;for(let a of e){let u=t[i];if(u!=null&&u.length>0){let c=u.sort();if(c[0]!=null){n.push(c[0]),++i;continue}}Ig(a)?n.push(bDi(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(bDi(i)??`${i}`),++i}return n}function Dyy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,description:i,availability:a,subtypes:u,namespace:c,groupName:p,encoding:s,source:o}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.oneOf(gSe.undiscriminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,namespace:c,groupName:p,encoding:s,source:o,inline:void 0})),description:i,availability:a,namespace:c,groupName:p,inline:void 0}):Uh.oneOf(gSe.undiscriminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,namespace:c,groupName:p,encoding:s,source:o,inline:void 0}))}function pQa(e){if(e.default!=null&&typeof e.default=="string")return e.default}function Ays({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=HKi(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function Cyy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=HKi(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function I8r({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=HKi(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function Iyy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=HKi(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var JKi="#/components/schemas/";function E1(e,t,r,n,i,a,u=!1,c=new Set,p){let s=yyy(e)??i,o=dID({schema:e,logger:r.logger});if(Ig(e)){let l=PDi(e);return l!=null?(u?r.markSchemaAsReferencedByRequest(l):r.markSchemaAsReferencedByNonRequest(l),Wci(e,t,r,n,o,s,a)):K3o(r.resolveSchemaReference(e),t,r,mys(e.$ref),o,s,a,c,u,p)}return K3o(e,t,r,n,o,s,a,c,u,p)}function Wci(e,t,r,n,i,a,u){let c=e.$ref.includes("properties")?K3o(r.resolveSchemaReference(e),t,r,n,i,a,u,new Set):Uh.reference(gof(e,n,a,r.options.preserveSchemaIds));if(t===!1){let p=r.resolveSchemaReference(e);(p.nullable===!0||Array.isArray(p.type)&&p.type.length>=2&&p.type.includes("null"))&&(t=!0)}return t?Uh.nullable({title:void 0,nameOverride:void 0,generatedName:doe(n,r.options.preserveSchemaIds),value:c,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0}):c}function aID(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function K3o(e,t,r,n,i,a,u,c=new Set,p=!1,s){typeof e=="string"&&(e={type:e});let o=wy(e,Gv.TYPE_NAME)??(r.options.useTitlesAsName?aID(e.title):void 0),l=wy(e,Gv.SDK_GROUP_NAME)??wy(e,vye.TAGS)?.[0],O=(typeof l=="string"?[l]:l)??[];O=r.resolveGroupName(O);let A=doe(n,r.options.preserveSchemaIds),E=e.title,C=e.description,M=HOe(e),q=[];e.example!=null&&q.push({name:void 0,value:e.example,description:void 0});let L=wy(e,vye.EXAMPLES);L!=null&&Object.keys(L).length>0&&q.push(...Object.entries(L).map(([K,X])=>({name:X?.summary??K,value:X.value,description:X.description})));let U=HKi(e);U!=null&&Object.keys(U).length>0&&q.push(...U.map(K=>({name:void 0,value:K,description:void 0})));let Q=hyy({schema:e,description:C,title:E,nameOverride:o,generatedName:A,availability:M});if(Q!=null)return Q;try{if(Array.isArray(e.type)){let X=e.type.indexOf("null"),te=X!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&te)e.type.splice(X,1),e.type=e.type[0],e.nullable=!0;else if(te&&(e.type.splice(X,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let ee=new Set([...e.oneOf,...e.type]);e.oneOf=[...ee]}}if(!t&&e.nullable===!0&&(t=!0),"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(!jys(e.enum))return foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.string({default:pQa(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:I8r({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:O,wrapAsNullable:t,description:C,availability:M});let X=_yy(e);return e.enum.length===1&&e.enum[0]!=null&&X==null?wyy({nameOverride:o,generatedName:A,title:E,wrapAsNullable:t,value:e.enum[0],description:C,availability:M,namespace:u,groupName:O}):ADi({nameOverride:o,generatedName:A,title:E,fernEnum:X,enumVarNames:wy(e,[vye.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:C,availability:M,wrapAsNullable:t,namespace:u,groupName:O,context:r,source:a,inline:void 0})}if(jys(e.type)&&e.type.length>1){let X=e.type.includes("null"),te=e.type.filter(ee=>ee!=="null").map(ee=>({type:ee,nullable:X}));return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:te,namespace:u,groupName:O,encoding:i,source:a})}if(e.type==="boolean"){let X=wy(e,Gv.BOOLEAN_LITERAL);return X!=null?Myy({nameOverride:o,generatedName:A,title:E,literal:JL.boolean(X),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O}):foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.boolean({default:oID(e.default),example:Cyy({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O})}if(e.type==="number")return vof({nameOverride:o,generatedName:A,title:E,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:GKi(e.exclusiveMinimum),exclusiveMaximum:GKi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:Ays({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:O});if(e.type==="integer")return Ayy({nameOverride:o,generatedName:A,title:E,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:GKi(e.exclusiveMinimum),exclusiveMaximum:GKi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:Ays({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:O});if(e.type==="float")return vof({nameOverride:o,generatedName:A,title:E,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:GKi(e.exclusiveMinimum),exclusiveMaximum:GKi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:Ays({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:O});if(e.type==="string"){if(e.format==="date-time")return foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.datetime({example:I8r({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O});if(e.format==="date"&&r.options.typeDatesAsStrings===!1)return foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.date({example:I8r({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O});if(e.format==="json-string")return Uh.unknown({nameOverride:o,generatedName:A,title:E,description:C,availability:M,namespace:u,groupName:O,example:void 0});let X=qyy(e,"const");return X!=null?Myy({nameOverride:o,generatedName:A,title:E,literal:JL.string(X),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O}):foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.string({default:pQa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:I8r({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:O,wrapAsNullable:t,description:C,availability:M})}if(e.type==="array")return gyy({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,item:e.items,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,example:Iyy({schema:e,logger:r.logger,fallback:s}),source:a});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&Pys(e))return vyy({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,additionalProperties:e.additionalProperties,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,encoding:i,example:e.example,source:a});if(e.oneOf!=null&&e.oneOf.length>0&&wy(e,Gv.IS_DISCRIMINATED)===!1)return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:e.oneOf,namespace:u,groupName:O,encoding:i,source:a});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?mof({nameOverride:o,generatedName:A,title:E,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,discriminator:e.discriminator,encoding:i,source:a}):hof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:u,groupName:O,encoding:i,source:a});if(e.oneOf!=null&&e.oneOf.length>0){let X=wy(e,Gv.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||X?mof({nameOverride:o,generatedName:A,title:E,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,discriminator:e.discriminator,encoding:i,source:a}):hof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:u,groupName:O,encoding:i,source:a});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(r.options.preserveSingleSchemaOneOf)return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:e.oneOf.filter(ee=>Ig(ee)||ee.type!=="null"),encoding:i,namespace:u,groupName:O,source:a});let te=E1(e.oneOf[0],t,r,n,a,u,p);return _Qa(te,C,u,O)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let ue=e.oneOf[0],me=e.oneOf[1];if(!Ig(ue)&&ue.type==="null")return E1(me,!0,r,n,a,u);if(!Ig(me)&&me.type==="null")return E1(ue,!0,r,n,a,u)}let te=cID({schemas:e.oneOf});if(te!=null)return ADi({nameOverride:o,generatedName:A,title:E,fernEnum:void 0,enumVarNames:void 0,enumValues:te,_default:e.default,description:C,availability:M,wrapAsNullable:t,namespace:u,groupName:O,context:r,source:a,inline:void 0});let ee=Byy({schemas:e.oneOf,context:r});if(ee!=null&&!r.options.discriminatedUnionV2&&!X)return yof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,properties:e.properties??{},required:e.required,description:C,availability:M,wrapAsNullable:t,discriminant:ee.discriminant,variants:ee.schemas,context:r,namespace:u,groupName:O,encoding:i,source:a});let re=e.oneOf.filter(ue=>!Ig(ue)&&ue.type==="null").length>0;return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t||re,context:r,subtypes:e.oneOf.filter(ue=>Ig(ue)||ue.type!=="null"),encoding:i,namespace:u,groupName:O,source:a})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let ee=E1(e.anyOf[0],t,r,n,a,u,p);return _Qa(ee,C,u,O)}if(e.anyOf.length===2){let[ee,re]=e.anyOf;if(ee!=null&&re!=null){if(!Ig(ee)&&ee.type==="null"){let ue=E1(re,!0,r,n,a,u);return _Qa(ue,C,u,O)}else if(!Ig(re)&&re.type==="null"){let ue=E1(ee,!0,r,n,a,u);return _Qa(ue,C,u,O)}}}let X=Byy({schemas:e.anyOf,context:r});if(X!=null&&!r.options.discriminatedUnionV2)return yof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,properties:e.properties??{},required:e.required,description:C,availability:M,wrapAsNullable:t,discriminant:X.discriminant,variants:X.schemas,context:r,namespace:u,groupName:O,encoding:i,source:a});let te=e.anyOf.filter(ee=>!Ig(ee)&&ee.type==="null").length>0;return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t||te,context:r,subtypes:e.anyOf.filter(ee=>Ig(ee)||ee.type!=="null"),encoding:i,namespace:u,groupName:O,source:a})}if(e.allOf!=null||e.properties!=null){let X=[];for(let ee of e.allOf??[])(Ig(ee)||Object.keys(ee).length>0)&&X.push(ee);if((e.properties==null||Pys(e))&&X.length===1&&X[0]!=null){let ee=E1(X[0],t,r,n,a,u,p);return _Qa(ee,C,u,O)}let te=X.filter(ee=>{let re=wys(ee);return re||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(ee)}`),re});if((e.properties==null||Pys(e))&&te.length===1&&te[0]!=null){let ee=E1(te[0],t,r,n,a,u,p);return _Qa(ee,C,u,O)}return Eyy({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,properties:e.properties??{},description:C,required:e.required,wrapAsNullable:t,allOf:te,context:r,propertiesToExclude:c,namespace:u,groupName:O,fullExamples:q,additionalProperties:e.additionalProperties,availability:M,encoding:i,source:a})}if(e.type==="object"&&uID(e)&&sID(e)&&Pys(e))return gys({nameOverride:o,generatedName:A,title:E,description:C,availability:M,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${A}Key`,title:void 0,description:void 0,availability:void 0,schema:Zg.string({default:pQa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:I8r({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:O},valueSchema:Uh.unknown({nameOverride:void 0,generatedName:`${A}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:O}),namespace:u,groupName:O,encoding:i,example:e.example});e.type!=null&&r.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${n.join("->")}. Coercing to unknown.`);let K=e.example??e.default;return Uh.unknown({nameOverride:o,generatedName:A,title:E,description:C,availability:M,namespace:u,groupName:O,example:K})}catch(K){return r.logger.debug(`Error converting schema: ${K.message}
|
|
2406
|
+
`)),{ok:!0,value:t}):n}}function i_s(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var T5a=class e extends Error{errors;constructor(t){super(t.map(i_s).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var q5a=class e extends Error{errors;constructor(t){super(t.map(i_s).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function F2(e){return{optional:()=>Uaf(e),transform:t=>Vaf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new q5a(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new T5a(n.errors)}}}function Uaf(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:()=>aT.OPTIONAL};return{...t,...F2(t)}}function Vaf(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,...F2(r)}}function J_y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:w6(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:w6(t,"bigint")}]},getType:()=>aT.BIGINT};return{...Gle(e),...F2(e)}}var MDD=/^([+-]?\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 K_y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:w6(t,"string")}]}:MDD.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:w6(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:w6(t,"Date object")}]},getType:()=>aT.DATE};return{...Gle(e),...F2(e)}}function VOe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Gle(r),...F2(r)}}}function a_s(e){let t=new Set(e);return VOe(aT.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:w6(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:w6(n,"enum")}]}:{ok:!0,value:n})()}function $_y(e){let t=Waf(e);return{...t,...F2(t)}}function Waf(e){return{parse:(t,r)=>N5a(e).parse(t,r),json:(t,r)=>N5a(e).json(t,r),getType:()=>N5a(e).getType()}}function N5a(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function N3o(e){return Object.entries(e)}function R3o(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function lDi(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 x3o(e){return Object.keys(e)}function Y_y(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function hCr(e){return{withParsedProperties:t=>Haf(e,t)}}function Haf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let u=Object.entries(t).reduce((c,[p,s])=>({...c,[p]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(n,i)=>{if(!lDi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:w6(n,"object")}]};let a=new Set(Object.keys(t)),u=R3o(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(u,i)},getType:()=>e.getType()};return{...r,...F2(r),...hCr(r)}}function X_y(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function fDi(e){return e.isProperty}function o_s(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>fDi(n)?n.rawKey:r),_getParsedProperties:()=>x3o(e),parse:(r,n)=>{let i={},a=[];for(let[u,c]of N3o(e)){let p=fDi(c)?c.rawKey:u,s=fDi(c)?c.valueSchema:c,o={rawKey:p,parsedKey:u,valueSchema:s};i[p]=o,ehy(s)&&a.push(p)}return Z_y({value:r,requiredKeys:a,getProperty:u=>{let c=i[u];if(c!=null)return{transformedKey:c.parsedKey,transform:p=>c.valueSchema.parse(p,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,u]of N3o(e)){let c=fDi(u)?u.valueSchema:u;ehy(c)&&i.push(a)}return Z_y({value:r,requiredKeys:i,getProperty:a=>{let u=e[a];if(u!=null)return fDi(u)?{transformedKey:u.rawKey,transform:c=>u.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>u.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>aT.OBJECT};return{...Gle(t),...F2(t),...hCr(t),...UKi(t)}}function Z_y({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!lDi(e))return{ok:!1,errors:[{path:a,message:w6(e,"object")}]};let u=new Set(t),c=[],p={};for(let[s,o]of Object.entries(e)){let l=r(s);if(l!=null){u.delete(s);let O=l.transform(o);O.ok?p[l.transformedKey]=O.value:(p[s]=o,c.push(...O.errors))}else switch(n){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":p[s]=o;break}}return c.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||i?{ok:!0,value:p}:{ok:!1,errors:c}}function UKi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>k_y({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>k_y({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>aT.OBJECT};return{...r,...F2(r),...hCr(r),...UKi(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:()=>aT.OBJECT};return{...t,...F2(t),...hCr(t),...UKi(t)}}}}function k_y({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,u]=Y_y(x3o(t),s=>i.has(s)),c=r(R3o(t,u)),p=n(R3o(t,a));return c.ok&&p.ok?{ok:!0,value:{...c.value,...p.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...p.ok?[]:p.errors]}}function ehy(e){return!BDD(e)}function BDD(e){switch(e.getType()){case aT.ANY:case aT.UNKNOWN:case aT.OPTIONAL:return!0;default:return!1}}function thy(e){return o_s(e)}function rhy(e){let t={...Waf(e),_getRawProperties:()=>N5a(e)._getRawProperties(),_getParsedProperties:()=>N5a(e)._getParsedProperties()};return{...t,...F2(t),...hCr(t),...UKi(t)}}function u_s(e){let t={parse:(r,n)=>nhy(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>nhy(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>aT.LIST};return{...Gle(t),...F2(t)}}function nhy(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:w6(e,"list"),path:[]}]}}function ihy(e){return VOe(aT.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:w6(r,`"${e}"`)}]})()}function ahy(e){return VOe(aT.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:w6(r,`${e.toString()}`)}]})()}var ohy=VOe(aT.ANY,e=>({ok:!0,value:e}));var uhy=VOe(aT.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:w6(e,"boolean")}]});var shy=VOe(aT.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:w6(e,"number")}]});var chy=VOe(aT.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:w6(e,"string")}]});var lhy=VOe(aT.UNKNOWN,e=>({ok:!0,value:e}));function dhy(e,t){let r={parse:(n,i)=>fhy({value:n,isKeyNumeric:e.getType()===aT.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>fhy({value:n,isKeyNumeric:e.getType()===aT.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>aT.RECORD};return{...Gle(r),...F2(r)}}function fhy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return lDi(e)?N3o(e).reduce((a,[u,c])=>{if(c==null)return a;let p=a,s=u;if(t){let A=u.length>0?Number(u):NaN;isNaN(A)||(s=A)}let o=r(s),l=n(c,s);if(p.ok&&o.ok&&l.ok)return{ok:!0,value:{...p.value,[o.value]:l.value}};let O=[];return p.ok||O.push(...p.errors),o.ok||O.push(...o.errors),l.ok||O.push(...l.errors),{ok:!1,errors:O}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:w6(e,"object")}]}}function phy(e){let t=u_s(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:w6(n,"Set")}]},getType:()=>aT.SET};return{...Gle(r),...F2(r)}}function hhy(e){let t={parse:(r,n)=>_hy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>_hy((i,a)=>i.json(r,a),e,n),getType:()=>aT.UNDISCRIMINATED_UNION};return{...Gle(t),...F2(t)}}function _hy(e,t,r){let n=[];for(let[i,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let c of u.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function yhy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function bhy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=a_s(x3o(t)),a={parse:(u,c)=>vhy({value:u,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:p=>i.parse(p,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:p=>t[p],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(p,s)=>s.parse(p,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(u,c)=>vhy({value:u,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:p=>i.json(p,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:p=>t[p],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(p,s)=>s.json(p,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>aT.UNION};return{...Gle(a),...F2(a),...hCr(a)}}function vhy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:c=[]}){if(!lDi(e))return{ok:!1,errors:[{path:c,message:w6(e,"object")}]};let{[t]:p,...s}=e;if(p==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let o=n(p);if(!o.ok)return{ok:!1,errors:o.errors};let l=i(o.value);if(l==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let O=u(s,l);return O.ok?{ok:!0,value:{[r]:p,...O.value}}:O}var aI=Wr.objectWithoutOptionalProperties({title:Wr.string().optional()});var s_s=Wr.objectWithoutOptionalProperties({file:Wr.string()});var c_s=Wr.objectWithoutOptionalProperties({file:Wr.string()});var l_s=Wr.union("type",{openapi:s_s,protobuf:c_s}).transform({transform:e=>{switch(e.type){case"openapi":return UOe.openapi(e);case"protobuf":return UOe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var tA=Wr.objectWithoutOptionalProperties({source:l_s.optional()});var f_s=Wr.objectWithoutOptionalProperties({typeName:Wr.string()});var d_s=Wr.union("type",{protobuf:f_s}).transform({transform:e=>{switch(e.type){case"protobuf":return B5a.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var uRe=Wr.objectWithoutOptionalProperties({encoding:d_s.optional()});var By=Wr.objectWithoutOptionalProperties({description:Wr.string().optional()});var p_s=Wr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var qA=Wr.objectWithoutOptionalProperties({availability:p_s.optional()});var j8r=Wr.number();var Edt=Wr.objectWithoutOptionalProperties({statusCode:j8r.optional()});var YE=Wr.objectWithoutOptionalProperties({nameOverride:Wr.string().optional(),generatedName:Wr.string()});var w4=Wr.objectWithoutOptionalProperties({inline:Wr.boolean().optional()});var mSe=Wr.string();var OSe=Wr.string();var __s=Wr.objectWithoutOptionalProperties({id:OSe}).extend(By);var h_s=Wr.string();var y_s=Wr.objectWithoutOptionalProperties({usernameVariableName:Wr.string().optional(),usernameEnvVar:Wr.string().optional(),passwordVariableName:Wr.string().optional(),passwordEnvVar:Wr.string().optional()});var v_s=Wr.objectWithoutOptionalProperties({tokenVariableName:Wr.string().optional(),tokenEnvVar:Wr.string().optional()});var b_s=Wr.objectWithoutOptionalProperties({headerName:Wr.string(),prefix:Wr.string().optional(),headerVariableName:Wr.string().optional(),headerEnvVar:Wr.string().optional()});var g_s=Wr.objectWithoutOptionalProperties({queryParameterName:Wr.string()});var m_s=Wr.objectWithoutOptionalProperties({snake:Wr.string().optional(),camel:Wr.string().optional(),screamingSnake:Wr.string().optional(),pascal:Wr.string().optional()});var dDi=Wr.objectWithoutOptionalProperties({nameOverride:Wr.string().optional(),generatedName:Wr.string(),value:Wr.string(),casing:m_s.optional()}).extend(By).extend(qA);var O_s=Wr.objectWithoutOptionalProperties({type:Wr.stringLiteral("namespace"),name:Wr.string()});var A_s=Wr.undiscriminatedUnion([Wr.string(),O_s]);var pDi=Wr.list(A_s);var oI=Wr.objectWithoutOptionalProperties({groupName:pDi.optional()});var lE=Wr.objectWithoutOptionalProperties({namespace:Wr.string().optional()});var R5a=Wr.objectWithoutOptionalProperties({default:dDi.optional(),values:Wr.list(dDi)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var P_s=Wr.objectWithoutOptionalProperties({scopesEnum:R5a.optional()});var w_s=Wr.union("type",{basic:y_s,bearer:v_s,header:b_s,query:g_s,oauth:P_s}).transform({transform:e=>{switch(e.type){case"basic":return Ule.basic(e);case"bearer":return Ule.bearer(e);case"header":return Ule.header(e);case"query":return Ule.query(e);case"oauth":return Ule.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var F3o=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),url:Wr.string(),audiences:Wr.list(Wr.string()).optional()}).extend(By);var j_s=Wr.string();var E8r=Wr.objectWithoutOptionalProperties({sdkMethodName:Wr.string().optional()});var Jaf={};ds(Jaf,{FullExample:()=>z2,FullObjectExample:()=>S_s,FullOneOfExample:()=>C_s,KeyValuePair:()=>D_s,LiteralExample:()=>E_s,PrimitiveExample:()=>F5a,PropertyKey:()=>x5a});var x5a=Wr.string();var F5a=Wr.union("type",{int:Wr.object({value:Wr.number()}),int64:Wr.object({value:Wr.number()}),uint:Wr.object({value:Wr.number()}),uint64:Wr.object({value:Wr.number()}),float:Wr.object({value:Wr.number()}),double:Wr.object({value:Wr.number()}),string:Wr.object({value:Wr.string()}),datetime:Wr.object({value:Wr.string()}),date:Wr.object({value:Wr.string()}),base64:Wr.object({value:Wr.string()}),boolean:Wr.object({value:Wr.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return Im.int(e.value);case"int64":return Im.int64(e.value);case"uint":return Im.uint(e.value);case"uint64":return Im.uint64(e.value);case"float":return Im.float(e.value);case"double":return Im.double(e.value);case"string":return Im.string(e.value);case"datetime":return Im.datetime(e.value);case"date":return Im.date(e.value);case"base64":return Im.base64(e.value);case"boolean":return Im.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var E_s=Wr.union("type",{boolean:Wr.object({value:Wr.boolean()}),string:Wr.object({value:Wr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return sDi.boolean(e.value);case"string":return sDi.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var z2=Wr.union("type",{primitive:Wr.object({value:F5a}),object:Wr.lazyObject(()=>S_s),array:Wr.object({value:Wr.list(Wr.lazy(()=>z2))}),map:Wr.object({value:Wr.list(Wr.lazyObject(()=>D_s))}),enum:Wr.object({value:Wr.string()}),literal:Wr.object({value:E_s}),oneOf:Wr.object({value:Wr.lazy(()=>C_s)}),unknown:Wr.object({value:Wr.lazy(()=>z2)})}).transform({transform:e=>{switch(e.type){case"primitive":return xS.primitive(e.value);case"object":return xS.object(e);case"array":return xS.array(e.value);case"map":return xS.map(e.value);case"enum":return xS.enum(e.value);case"literal":return xS.literal(e.value);case"oneOf":return xS.oneOf(e.value);case"unknown":return xS.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var S_s=Wr.objectWithoutOptionalProperties({properties:Wr.record(x5a,Wr.lazy(()=>z2))});var D_s=Wr.objectWithoutOptionalProperties({key:F5a,value:Wr.lazy(()=>z2)});var C_s=Wr.union("type",{discriminated:Wr.object({value:Wr.record(x5a,Wr.lazy(()=>z2))}),undiscriminated:Wr.object({value:Wr.lazy(()=>z2)})}).transform({transform:e=>{switch(e.type){case"discriminated":return cDi.discriminated(e.value);case"undiscriminated":return cDi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Kaf={};ds(Kaf,{AllOfPropertyConflict:()=>rQa,ArraySchema:()=>mhs,Availability:()=>p_s,BooleanSchema:()=>_hs,BytesResponse:()=>G5a,CasingOverrides:()=>m_s,CommonProperty:()=>Dhs,CursorPagination:()=>X_s,CustomCodeSample:()=>$_s,CustomCodeSampleLanguage:()=>G_s,CustomCodeSampleSdk:()=>K_s,CustomPagination:()=>k_s,DiscriminatedOneOfSchema:()=>Ehs,DoubleSchema:()=>dhs,Endpoint:()=>ehs,EndpointExample:()=>Y5a,EndpointResponseExample:()=>H_s,EndpointSdkName:()=>S8r,EnumSchema:()=>R5a,EnumValue:()=>dDi,ErrorExample:()=>Q_s,FernExample:()=>U_s,FileResponse:()=>W5a,FileSchema:()=>B_s,FormUrlEncodedRequest:()=>x_s,FullEndpointExample:()=>Y_s,GlobalHeader:()=>yhs,Header:()=>_Di,HeaderExample:()=>$5a,HttpEndpointServer:()=>J5a,HttpError:()=>L_s,HttpMethod:()=>z5a,IdempotencyHeader:()=>vhs,IntSchema:()=>lhs,JsonRequest:()=>R_s,JsonResponse:()=>H5a,LiteralSchema:()=>tQa,LiteralSchemaValue:()=>bhs,LongSchema:()=>fhs,MapSchema:()=>Ohs,MultipartRequest:()=>V5a,MultipartRequestProperty:()=>N_s,MultipartRequestPropertyEncoding:()=>q_s,MultipartSchema:()=>T_s,NullableSchema:()=>Phs,ObjectProperty:()=>jhs,ObjectPropertyConflictInfo:()=>nQa,ObjectSchema:()=>ghs,OctetStreamRequest:()=>U5a,OffsetPagination:()=>Z_s,OneOfSchema:()=>whs,OpenApiIntermediateRepresentation:()=>ghy,OptionalSchema:()=>Ahs,Pagination:()=>X5a,PathParameter:()=>Q5a,PathParameterExample:()=>V_s,PrimitiveSchema:()=>yDi,PrimitiveSchemaValue:()=>hhs,QueryParameter:()=>L5a,QueryParameterExample:()=>K5a,ReferencedSchema:()=>D8r,Request:()=>F_s,Response:()=>z_s,RetriesConfiguration:()=>Z5a,Schema:()=>fC,Schemas:()=>chs,SdkGroupInfo:()=>I_s,StreamingResponseExample:()=>W_s,StringSchema:()=>phs,SupportedSdkLanguage:()=>J_s,Tags:()=>M_s,TextResponse:()=>hDi,UnDiscriminatedOneOfSchema:()=>Shs,Webhook:()=>ths,WebhookExampleCall:()=>eQa,WebhookHttpMethod:()=>k5a,WebsocketChannel:()=>shs,WebsocketHandshake:()=>rhs,WebsocketMessageExample:()=>ohs,WebsocketMessageOrigin:()=>nhs,WebsocketMessageSchema:()=>ihs,WebsocketServer:()=>ahs,WebsocketSessionExample:()=>uhs});var I_s=Wr.objectWithoutOptionalProperties({summary:Wr.string().optional(),description:Wr.string().optional()});var M_s=Wr.objectWithoutOptionalProperties({tagsById:Wr.record(OSe,__s),orderedTagIds:Wr.list(OSe).optional()});var z5a=Wr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var Q5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>fC),variableReference:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var L5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>fC),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var _Di=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>fC),env:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var S8r=Wr.objectWithoutOptionalProperties({groupName:pDi,methodName:Wr.string()});var U5a=Wr.objectWithoutOptionalProperties({contentType:Wr.string().optional()}).extend(By).extend(tA);var B_s=Wr.objectWithoutOptionalProperties({isOptional:Wr.boolean(),isArray:Wr.boolean()}).extend(By);var T_s=Wr.union("type",{file:B_s,json:Wr.object({value:Wr.lazy(()=>fC)})}).transform({transform:e=>{switch(e.type){case"file":return P8r.file(e);case"json":return P8r.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var q_s=Wr.enum_(["json","form"]);var N_s=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:T_s,contentType:Wr.string().optional(),exploded:Wr.boolean().optional(),encoding:q_s.optional()}).extend(By);var V5a=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),properties:Wr.list(N_s)}).extend(By).extend(tA);var R_s=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC),contentType:Wr.string().optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA);var x_s=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC),contentType:Wr.string().optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA);var F_s=Wr.union("type",{octetStream:U5a,multipart:V5a,json:R_s,formUrlEncoded:x_s}).transform({transform:e=>{switch(e.type){case"octetStream":return _Cr.octetStream(e);case"multipart":return _Cr.multipart(e);case"json":return _Cr.json(e);case"formUrlEncoded":return _Cr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var W5a=Wr.objectWithoutOptionalProperties({}).extend(By).extend(tA).extend(Edt);var H5a=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC),responseProperty:Wr.string().optional()}).extend(By).extend(tA).extend(Edt);var hDi=Wr.objectWithoutOptionalProperties({}).extend(By).extend(tA).extend(Edt);var G5a=Wr.objectWithoutOptionalProperties({}).extend(By).extend(tA).extend(Edt);var z_s=Wr.union("type",{file:W5a,json:H5a,text:hDi,bytes:G5a,streamingSse:H5a,streamingText:hDi,streamingJson:H5a}).transform({transform:e=>{switch(e.type){case"file":return yye.file(e);case"json":return yye.json(e);case"text":return yye.text(e);case"bytes":return yye.bytes(e);case"streamingSse":return yye.streamingSse(e);case"streamingText":return yye.streamingText(e);case"streamingJson":return yye.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Q_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),description:Wr.string().optional(),example:Wr.lazy(()=>z2)});var L_s=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>fC).optional(),examples:Wr.list(Q_s).optional()}).extend(By).extend(YE).extend(tA);var J5a=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),url:Wr.string().optional(),audiences:Wr.list(Wr.string()).optional()});var U_s=Wr.unknown();var V_s=Wr.objectWithoutOptionalProperties({name:Wr.string(),parameterNameOverride:Wr.string().optional(),value:Wr.lazy(()=>z2)});var K5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),value:Wr.lazy(()=>z2)});var $5a=Wr.objectWithoutOptionalProperties({name:Wr.string(),value:Wr.lazy(()=>z2)});var W_s=Wr.objectWithoutOptionalProperties({sse:Wr.boolean(),events:Wr.list(Wr.lazy(()=>z2))});var H_s=Wr.union("type",{withStreaming:W_s,withoutStreaming:Wr.object({value:Wr.lazy(()=>z2)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return jdt.withStreaming(e);case"withoutStreaming":return jdt.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var G_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),language:Wr.string(),code:Wr.string(),install:Wr.string().optional()}).extend(By);var J_s=Wr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var K_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),sdk:J_s,code:Wr.string()}).extend(By);var $_s=Wr.union("type",{language:G_s,sdk:K_s}).transform({transform:e=>{switch(e.type){case"language":return A8r.language(e);case"sdk":return A8r.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var Y_s=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),pathParameters:Wr.list(V_s).optional(),queryParameters:Wr.list(K5a).optional(),headers:Wr.list($5a).optional(),request:Wr.lazy(()=>z2).optional(),response:H_s.optional(),codeSamples:Wr.list($_s)}).extend(By);var Y5a=Wr.union("type",{unknown:Wr.object({value:U_s}),full:Y_s}).transform({transform:e=>{switch(e.type){case"unknown":return wdt.unknown(e.value);case"full":return wdt.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var X_s=Wr.objectWithoutOptionalProperties({cursor:Wr.string(),nextCursor:Wr.property("next_cursor",Wr.string()),results:Wr.string()});var Z_s=Wr.objectWithoutOptionalProperties({offset:Wr.string(),results:Wr.string(),step:Wr.string().optional(),hasNextPage:Wr.string().optional()});var k_s=Wr.objectWithoutOptionalProperties({results:Wr.string()});var X5a=Wr.union("type",{cursor:X_s,offset:Z_s,custom:k_s}).transform({transform:e=>{switch(e.type){case"cursor":return xet.cursor(e);case"offset":return xet.offset(e);case"custom":return xet.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var Z5a=Wr.union("type",{disabled:Wr.object({value:Wr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return q3o.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var ehs=Wr.objectWithoutOptionalProperties({authed:Wr.boolean(),internal:Wr.boolean().optional(),idempotent:Wr.boolean().optional(),method:z5a,audiences:Wr.list(Wr.string()),path:Wr.string(),summary:Wr.string().optional(),operationId:Wr.string().optional(),tags:Wr.list(OSe),pathParameters:Wr.list(Q5a),queryParameters:Wr.list(L5a),headers:Wr.list(_Di),sdkName:S8r.optional(),generatedRequestName:Wr.string(),requestNameOverride:Wr.string().optional(),request:F_s.optional(),response:z_s.optional(),errors:Wr.record(j8r,L_s),servers:Wr.list(J5a),examples:Wr.list(Y5a),pagination:X5a.optional(),retries:Z5a.optional()}).extend(By).extend(qA).extend(tA).extend(lE);var k5a=Wr.enum_(["GET","POST"]);var eQa=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),payload:Wr.lazy(()=>z2)}).extend(By);var ths=Wr.objectWithoutOptionalProperties({audiences:Wr.list(Wr.string()),sdkName:S8r.optional(),method:k5a,summary:Wr.string().optional(),operationId:Wr.string(),tags:Wr.list(OSe),headers:Wr.list(_Di),generatedPayloadName:Wr.string(),payload:Wr.lazy(()=>fC),examples:Wr.list(eQa)}).extend(By).extend(tA).extend(lE);var rhs=Wr.objectWithoutOptionalProperties({queryParameters:Wr.list(L5a),headers:Wr.list(_Di),pathParameters:Wr.list(Q5a)});var nhs=Wr.enum_(["client","server"]);var ihs=Wr.objectWithoutOptionalProperties({name:Wr.string(),origin:nhs,body:Wr.lazy(()=>fC)});var ahs=Wr.objectWithoutOptionalProperties({name:Wr.string(),url:Wr.string()});var ohs=Wr.objectWithoutOptionalProperties({messageType:Wr.string(),payload:Wr.lazy(()=>z2)}).extend(By);var uhs=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),queryParameters:Wr.list(K5a).optional(),headers:Wr.list($5a).optional(),messages:Wr.list(ohs)}).extend(By);var shs=Wr.objectWithoutOptionalProperties({audiences:Wr.list(Wr.string()),path:Wr.string(),groupName:pDi,summary:Wr.string().optional(),handshake:rhs,messages:Wr.list(ihs),servers:Wr.list(ahs),examples:Wr.list(uhs)}).extend(By).extend(tA);var chs=Wr.objectWithoutOptionalProperties({rootSchemas:Wr.record(mSe,Wr.lazy(()=>fC)),namespacedSchemas:Wr.record(j_s,Wr.record(mSe,Wr.lazy(()=>fC)))});var lhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional()});var fhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional()});var dhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional()});var phs=Wr.objectWithoutOptionalProperties({default:Wr.string().optional(),pattern:Wr.string().optional(),format:Wr.string().optional(),minLength:Wr.number().optional(),maxLength:Wr.number().optional()});var _hs=Wr.objectWithoutOptionalProperties({default:Wr.boolean().optional()});var hhs=Wr.union("type",{int:lhs,int64:fhs,uint:Wr.object({}),uint64:Wr.object({}),float:Wr.object({}),double:dhs,string:phs,datetime:Wr.object({}),date:Wr.object({}),base64:Wr.object({}),boolean:_hs}).transform({transform:e=>{switch(e.type){case"int":return iT.int(e);case"int64":return iT.int64(e);case"uint":return iT.uint();case"uint64":return iT.uint64();case"float":return iT.float();case"double":return iT.double(e);case"string":return iT.string(e);case"datetime":return iT.datetime();case"date":return iT.date();case"base64":return iT.base64();case"boolean":return iT.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var yDi=Wr.objectWithoutOptionalProperties({schema:hhs}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var yhs=Wr.objectWithoutOptionalProperties({header:Wr.string(),name:Wr.string().optional(),optional:Wr.boolean().optional(),env:Wr.string().optional(),schema:Wr.lazy(()=>fC).optional()});var vhs=Wr.objectWithoutOptionalProperties({header:Wr.string(),name:Wr.string().optional(),env:Wr.string().optional(),schema:Wr.lazy(()=>fC).optional()});var ghy=Wr.objectWithoutOptionalProperties({apiVersion:Wr.unknown().optional(),title:Wr.string().optional(),description:Wr.string().optional(),basePath:Wr.string().optional(),servers:Wr.list(F3o),websocketServers:Wr.list(F3o),groups:Wr.record(Wr.string(),I_s),tags:M_s,hasEndpointsMarkedInternal:Wr.boolean(),endpoints:Wr.list(ehs),webhooks:Wr.list(ths),channels:Wr.record(Wr.string(),shs),groupedSchemas:chs,variables:Wr.record(Wr.string(),yDi),nonRequestReferencedSchemas:Wr.set(mSe),securitySchemes:Wr.record(h_s,w_s),globalHeaders:Wr.list(yhs).optional(),idempotencyHeaders:Wr.list(vhs).optional()});var D8r=Wr.objectWithoutOptionalProperties({schema:mSe}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI);var bhs=Wr.union("type",{boolean:Wr.object({value:Wr.boolean()}),string:Wr.object({value:Wr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return JL.boolean(e.value);case"string":return JL.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var tQa=Wr.objectWithoutOptionalProperties({value:bhs}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var fC=Wr.union("type",{primitive:yDi,object:Wr.lazyObject(()=>ghs),array:Wr.lazyObject(()=>mhs),map:Wr.lazyObject(()=>Ohs),optional:Wr.lazyObject(()=>Ahs),enum:R5a,reference:D8r,literal:tQa,oneOf:Wr.object({value:Wr.lazy(()=>whs)}),nullable:Wr.lazyObject(()=>Phs),unknown:YE}).transform({transform:e=>{switch(e.type){case"primitive":return $P.primitive(e);case"object":return $P.object(e);case"array":return $P.array(e);case"map":return $P.map(e);case"optional":return $P.optional(e);case"enum":return $P.enum(e);case"reference":return $P.reference(e);case"literal":return $P.literal(e);case"oneOf":return $P.oneOf(e.value);case"nullable":return $P.nullable(e);case"unknown":return $P.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var rQa=Wr.objectWithoutOptionalProperties({propertyKey:Wr.string(),allOfSchemaIds:Wr.list(mSe),conflictingTypeSignatures:Wr.boolean()});var ghs=Wr.objectWithoutOptionalProperties({allOf:Wr.list(D8r),properties:Wr.list(Wr.lazyObject(()=>jhs)),allOfPropertyConflicts:Wr.list(rQa),additionalProperties:Wr.boolean()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var nQa=Wr.objectWithoutOptionalProperties({differentSchema:Wr.boolean()});var jhs=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>fC),readonly:Wr.boolean().optional(),writeonly:Wr.boolean().optional(),conflict:Wr.record(mSe,nQa),generatedName:Wr.string(),nameOverride:Wr.string().optional(),audiences:Wr.list(Wr.string())}).extend(qA);var mhs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var Ohs=Wr.objectWithoutOptionalProperties({key:yDi,value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(aI).extend(w4);var Ahs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var Phs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>fC)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var whs=Wr.union("type",{discriminated:Wr.lazyObject(()=>Ehs),undiscriminated:Wr.lazyObject(()=>Shs)}).transform({transform:e=>{switch(e.type){case"discriminated":return w8r.discriminated(e);case"undiscriminated":return w8r.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ehs=Wr.objectWithoutOptionalProperties({discriminantProperty:Wr.string(),commonProperties:Wr.list(Wr.lazyObject(()=>Dhs)),schemas:Wr.record(Wr.string(),Wr.lazy(()=>fC))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var Dhs=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>fC)});var Shs=Wr.objectWithoutOptionalProperties({schemas:Wr.list(Wr.lazy(()=>fC))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var $af={};ds($af,{ArraySchemaWithExample:()=>Xhs,Base64WithExample:()=>Ghs,BooleanWithExample:()=>Jhs,CommonPropertyWithExample:()=>oys,DateWithExample:()=>Hhs,DatetimeWithExample:()=>Whs,DiscriminatedOneOfSchemaWithExample:()=>iys,DoubleWithExample:()=>Uhs,EndpointWithExample:()=>Ohy,EnumSchemaWithExample:()=>$hs,FloatWithExample:()=>Lhs,HeaderWithExample:()=>vDi,HttpErrorWithExample:()=>Rhs,Int64WithExample:()=>Fhs,IntWithExample:()=>xhs,JsonRequestWithExample:()=>Bhs,JsonResponseWithExample:()=>aQa,MapSchemaWithExample:()=>Zhs,NamedFullExample:()=>Sdt,NullableSchemaWithExample:()=>eys,ObjectPropertyWithExample:()=>nys,ObjectSchemaWithExample:()=>tys,OneOfSchemaWithExample:()=>rys,OptionalSchemaWithExample:()=>khs,ParseFormUrlEncodedRequest:()=>Ths,ParseMultipartRequest:()=>Mhs,ParseOctetStreamRequest:()=>Ihs,PathParameterWithExample:()=>Chs,PrimitiveSchemaValueWithExample:()=>Khs,PrimitiveSchemaWithExample:()=>oQa,QueryParameterWithExample:()=>iQa,RequestWithExample:()=>qhs,ResponseWithExample:()=>Nhs,SchemaWithExample:()=>j4,StringSchemaWithExample:()=>Vhs,Uint64WithExample:()=>Qhs,UintWithExample:()=>zhs,UnDiscriminatedOneOfSchemaWithExample:()=>ays,UnknownSchemaWithExample:()=>Yhs,WebhookWithExample:()=>Ahy,WebsocketHandshakeWithExample:()=>mhy});var Sdt=Wr.objectWithoutOptionalProperties({name:Wr.string().optional(),value:Wr.unknown()}).extend(By);var iQa=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>j4),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var vDi=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>j4),env:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var mhy=Wr.objectWithoutOptionalProperties({queryParameters:Wr.list(iQa),headers:Wr.list(vDi)});var Chs=Wr.objectWithoutOptionalProperties({name:Wr.string(),schema:Wr.lazy(()=>j4),variableReference:Wr.string().optional(),parameterNameOverride:Wr.string().optional()}).extend(By).extend(qA).extend(tA);var Ihs=Wr.objectWithoutOptionalProperties({}).extend(U5a).extend(E8r);var Mhs=Wr.objectWithoutOptionalProperties({}).extend(V5a).extend(E8r);var Bhs=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>j4),contentType:Wr.string().optional(),fullExamples:Wr.list(Sdt).optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA).extend(E8r);var Ths=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>j4),contentType:Wr.string().optional(),fullExamples:Wr.list(Sdt).optional(),additionalProperties:Wr.boolean()}).extend(By).extend(tA).extend(E8r);var qhs=Wr.union("type",{octetStream:Ihs,multipart:Mhs,json:Bhs,formUrlEncoded:Ths}).transform({transform:e=>{switch(e.type){case"octetStream":return bSe.octetStream(e);case"multipart":return bSe.multipart(e);case"json":return bSe.json(e);case"formUrlEncoded":return bSe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var aQa=Wr.objectWithoutOptionalProperties({schema:Wr.lazy(()=>j4),responseProperty:Wr.string().optional(),fullExamples:Wr.list(Sdt).optional()}).extend(By).extend(tA).extend(Edt);var Nhs=Wr.union("type",{file:W5a,json:aQa,text:hDi,bytes:G5a,streamingSse:aQa,streamingText:hDi,streamingJson:aQa}).transform({transform:e=>{switch(e.type){case"file":return _Q.file(e);case"json":return _Q.json(e);case"text":return _Q.text(e);case"bytes":return _Q.bytes(e);case"streamingSse":return _Q.streamingSse(e);case"streamingText":return _Q.streamingText(e);case"streamingJson":return _Q.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Rhs=Wr.objectWithoutOptionalProperties({statusCode:j8r,schema:Wr.lazy(()=>j4),fullExamples:Wr.list(Sdt).optional()}).extend(By).extend(YE).extend(tA);var Ohy=Wr.objectWithoutOptionalProperties({authed:Wr.boolean(),internal:Wr.boolean().optional(),idempotent:Wr.boolean().optional(),method:z5a,audiences:Wr.list(Wr.string()),path:Wr.string(),summary:Wr.string().optional(),operationId:Wr.string().optional(),tags:Wr.list(OSe),pathParameters:Wr.list(Chs),queryParameters:Wr.list(iQa),headers:Wr.list(vDi),sdkName:S8r.optional(),generatedRequestName:Wr.string(),requestNameOverride:Wr.string().optional(),request:qhs.optional(),response:Nhs.optional(),errors:Wr.record(j8r,Rhs),servers:Wr.list(J5a),examples:Wr.list(Y5a),pagination:X5a.optional(),retries:Z5a.optional()}).extend(By).extend(qA).extend(tA).extend(lE);var Ahy=Wr.objectWithoutOptionalProperties({audiences:Wr.list(Wr.string()),sdkName:S8r.optional(),method:k5a,summary:Wr.string().optional(),operationId:Wr.string(),tags:Wr.list(OSe),headers:Wr.list(vDi),generatedPayloadName:Wr.string(),payload:Wr.lazy(()=>j4),examples:Wr.list(eQa)}).extend(By).extend(tA).extend(lE);var xhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional(),example:Wr.number().optional()});var Fhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),example:Wr.number().optional()});var zhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),example:Wr.number().optional()});var Qhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),example:Wr.number().optional()});var Lhs=Wr.objectWithoutOptionalProperties({example:Wr.number().optional()});var Uhs=Wr.objectWithoutOptionalProperties({default:Wr.number().optional(),minimum:Wr.number().optional(),maximum:Wr.number().optional(),exclusiveMinimum:Wr.boolean().optional(),exclusiveMaximum:Wr.boolean().optional(),multipleOf:Wr.number().optional(),example:Wr.number().optional()});var Vhs=Wr.objectWithoutOptionalProperties({default:Wr.string().optional(),pattern:Wr.string().optional(),format:Wr.string().optional(),minLength:Wr.number().optional(),maxLength:Wr.number().optional(),example:Wr.string().optional()});var Whs=Wr.objectWithoutOptionalProperties({example:Wr.string().optional()});var Hhs=Wr.objectWithoutOptionalProperties({example:Wr.string().optional()});var Ghs=Wr.objectWithoutOptionalProperties({example:Wr.string().optional()});var Jhs=Wr.objectWithoutOptionalProperties({default:Wr.boolean().optional(),example:Wr.boolean().optional()});var Khs=Wr.union("type",{int:xhs,int64:Fhs,uint:zhs,uint64:Qhs,float:Lhs,double:Uhs,string:Vhs,datetime:Whs,date:Hhs,base64:Ghs,boolean:Jhs}).transform({transform:e=>{switch(e.type){case"int":return Zg.int(e);case"int64":return Zg.int64(e);case"uint":return Zg.uint(e);case"uint64":return Zg.uint64(e);case"float":return Zg.float(e);case"double":return Zg.double(e);case"string":return Zg.string(e);case"datetime":return Zg.datetime(e);case"date":return Zg.date(e);case"base64":return Zg.base64(e);case"boolean":return Zg.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var oQa=Wr.objectWithoutOptionalProperties({schema:Khs}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var $hs=Wr.objectWithoutOptionalProperties({default:dDi.optional(),values:Wr.list(dDi),example:Wr.string().optional()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var Yhs=Wr.objectWithoutOptionalProperties({example:Wr.unknown()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI);var j4=Wr.union("type",{primitive:oQa,object:Wr.lazyObject(()=>tys),array:Wr.lazyObject(()=>Xhs),map:Wr.lazyObject(()=>Zhs),optional:Wr.lazyObject(()=>khs),enum:$hs,reference:D8r,literal:tQa,oneOf:Wr.object({value:Wr.lazy(()=>rys)}),nullable:Wr.lazyObject(()=>eys),unknown:Yhs}).transform({transform:e=>{switch(e.type){case"primitive":return Uh.primitive(e);case"object":return Uh.object(e);case"array":return Uh.array(e);case"map":return Uh.map(e);case"optional":return Uh.optional(e);case"enum":return Uh.enum(e);case"reference":return Uh.reference(e);case"literal":return Uh.literal(e);case"oneOf":return Uh.oneOf(e.value);case"nullable":return Uh.nullable(e);case"unknown":return Uh.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var Xhs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>j4),example:Wr.list(Wr.unknown()).optional()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var Zhs=Wr.objectWithoutOptionalProperties({key:oQa,value:Wr.lazy(()=>j4),example:Wr.unknown().optional()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(aI).extend(w4);var khs=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>j4)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var eys=Wr.objectWithoutOptionalProperties({value:Wr.lazy(()=>j4)}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(aI).extend(w4);var tys=Wr.objectWithoutOptionalProperties({allOf:Wr.list(D8r),properties:Wr.list(Wr.lazyObject(()=>nys)),allOfPropertyConflicts:Wr.list(rQa),fullExamples:Wr.list(Sdt).optional(),additionalProperties:Wr.boolean()}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(tA).extend(aI).extend(w4);var nys=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>j4),readonly:Wr.boolean().optional(),writeonly:Wr.boolean().optional(),audiences:Wr.list(Wr.string()),conflict:Wr.record(mSe,nQa),nameOverride:Wr.string().optional(),generatedName:Wr.string()}).extend(qA);var rys=Wr.union("type",{discriminated:Wr.lazyObject(()=>iys),undiscriminated:Wr.lazyObject(()=>ays)}).transform({transform:e=>{switch(e.type){case"discriminated":return gSe.discriminated(e);case"undiscriminated":return gSe.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var iys=Wr.objectWithoutOptionalProperties({discriminantProperty:Wr.string(),commonProperties:Wr.list(Wr.lazyObject(()=>oys)),schemas:Wr.record(Wr.string(),Wr.lazy(()=>j4))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var oys=Wr.objectWithoutOptionalProperties({key:Wr.string(),schema:Wr.lazy(()=>j4)});var ays=Wr.objectWithoutOptionalProperties({schemas:Wr.list(Wr.lazy(()=>j4))}).extend(oI).extend(lE).extend(YE).extend(By).extend(qA).extend(uRe).extend(tA).extend(aI).extend(w4);var Phy=/^(\d+)/,uQa=/^[a-zA-Z][a-zA-Z0-9_]*$/,why={"<":"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 bDi(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 u=Math.floor(e/10),c=e%10;return c===0?n[u]:`${n[u]}_${t[c]}`}if(e<1e3){let u=Math.floor(e/100),c=e%100;return c===0?`${t[u]}_hundred`:`${t[u]}_hundred_${bDi(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${bDi(a)}`}function z3o(e){let t=e.match(Phy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=bDi(i);return n.length>0?`${a}_${n}`:a}}}function sQa(e){let t=z3o(e),r=why[e];return t!=null?g9(IO(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":g9(IO(e)))}function sRe(e,t){return e.type==="primitive"&&t.type==="primitive"?jhy(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?TDD(e.values,t.values):e.type==="array"&&t.type==="array"?sRe(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"?sRe(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?qDD(e.value,t.value):e.type==="object"&&t.type==="object"?NDD(e,t):e.type==="map"&&t.type==="map"?jhy(e.key.schema,t.key.schema)&&sRe(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function jhy(e,t){return e.type===t.type}function TDD(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return Bae(r,n)}function qDD(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:sRe(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:sRe(r,i)}):!1}function NDD(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:sRe(a,i.schema)})}function FH(e){switch(e){case Vle.Deprecated:return"deprecated";case Vle.Beta:return"pre-release";case Vle.GenerallyAvailable:return"generally-available";default:return}}function RDD(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 Ehy(e){let t=e?RDD(e):void 0;if(t==null||t.length===0)return _Vi;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push(IO(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push(IO(i.name)):r.push(i.name,_Vi);break}default:cc(i.type)}else cc(i);return r.join("/")}function gDi(e){return iP.of(`${Ehy(e)}.yml`)}function Yaf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?_Vi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,Ehy(r))}function Shy({sdkName:e,namespaceOverride:t}){return iP.of(`${Yaf({sdkName:e,namespaceOverride:t})}.yml`)}function Dhy({location:e,namespaceOverride:t}){return t!=null?Q$(iP.of(t),e):e}function uys(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:cc(e.type)}}function cQa(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:cc(e)}}function E4(e){return typeof e=="string"?e:e.type}function lQa(e){if(typeof e!="string")return e.docs}function Q3o(e){if(typeof e!="string")return e.default}function Xaf(e){if(typeof e!="string")return e.validation}function Ihy(e){let t=E4(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?Chy(e):{...e,type:Chy(e.type)}}function Chy(e){return e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function mDi(e){return E4(e).startsWith("optional<")?e:typeof e=="string"?Mhy(e):{...e,type:Mhy(e.type)}}function Mhy(e){return`optional<${e}>`}var xDD=-2147483648,FDD=2147483647,zDD=-17976931348623157e292,QDD=17976931348623157e292;function FS({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 sys(e);case"array":return eof({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return tof({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return kaf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return nof();case"optional":return cys({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return rof({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return $DD({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,iof(e);case"object":return YDD({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return XDD({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:cc(e)}}function sys(e){switch(e.schema.type){case"string":return VDD({description:e.description,schema:e.schema});case"int":return WDD({description:e.description,schema:e.schema});case"float":return HDD({description:e.description,schema:e.schema});case"double":return GDD({description:e.description,schema:e.schema});case"boolean":return LDD({description:e.description,schema:e.schema});case"int64":return UDD({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:FH(e.availability)}:{}}}function LDD({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 UDD({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 VDD({description:e,schema:t}){let r="string",n=JDD(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 WDD({description:e,schema:t}){let r="integer",n=Bhy(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 HDD({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function GDD({description:e,schema:t}){let r="double",n=Bhy(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 JDD(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=KDD(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function KDD(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 Bhy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:u}=e;if(r=Zaf(r,t),n=Zaf(n,t),i=Zaf(i,t),!(r==null&&n==null&&a==null&&u==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:u,multipleOf:i}}function Zaf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[xDD,FDD]:[zDD,QDD];return e<r||e>n?void 0:e}function kaf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=ZDD(i)??e.schema,u=cQa(i),c=kDD(i),p=lys({context:r,fileContainingReference:t,declarationFile:gDi(u),type:a}),s=i.type==="nullable"?`optional<${p}>`:p;return e.description==null&&c==null?s:{type:i.type==="nullable"?`optional<${p}>`:p,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function eof({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${E4(u)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{},type:c}}function tof({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=sys(e.key),c=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),p=e.encoding!=null?uys(e.encoding):void 0,s=`map<${E4(u)}, ${E4(c)}>`;if(e.description==null&&p==null&&e.title==null)return s;let o={type:s};return e.description!=null&&(o.docs=e.description),e.encoding!=null&&(o.encoding=p),e.availability!=null&&(o.availability=FH(e.availability)),o}function rof({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return cys({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let u=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=E4(u),p=lQa(u),s=Q3o(u),o=Xaf(u),l=Ihy(c);if(e.availability==null&&e.description==null&&p==null&&s==null&&o==null&&e.title==null)return mDi(l);let O=typeof l=="string"?{type:l}:l;return(e.description!=null||p!=null)&&(O.docs=e.description??p),s!=null&&(O.default=s),o!=null&&(O.validation=o),e.availability!=null&&(O.availability=FH(e.availability)),mDi(O)}function cys({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=FS({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=E4(u),p=lQa(u),s=Q3o(u),o=Xaf(u),l=mDi(c);if(e.availability==null&&e.description==null&&p==null&&s==null&&o==null&&e.title==null)return l;let O=typeof l=="string"?{type:l}:l;return(e.description!=null||p!=null)&&(O.docs=e.description??p),s!=null&&(O.default=s),o!=null&&(O.validation=o),e.availability!=null&&(O.availability=FH(e.availability)),O}function nof(){return"unknown"}function iof(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:cc(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function $DD({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=L3o(e,i),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let c=lys({type:u,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let p={type:c};return e.description!=null&&(p.docs=e.description),e.default!=null&&(p.default=e.default.value),e.availability!=null&&(p.availability=FH(e.availability)),p}function YDD({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=aof({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:u.schema});let p=lys({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?p:{type:p,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function XDD({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let u=oof({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:u.schema});let p=lys({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?p:{...e.title!=null?{"display-name":e.title}:{},type:p,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:FH(e.availability)}:{}}}function lys({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 ZDD(e){return $P._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 kDD(e){return $P._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 loe;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(loe||(loe={}));function Lci(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:cc(e)}}function qhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=rCD(e);break;case"array":a=eCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=tCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=nCD({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=aCD(e.nameOverride,e.generatedName);break;case"optional":a=Nhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=iCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=L3o(e,i);break;case"literal":a=oCD(e,e.nameOverride,e.generatedName);break;case"object":a=aof({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=oof({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:cc(e)}return a}function aof({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(loe.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),u=!1,c={},p=new Set;for(let A of e.properties){if(A.readonly&&(u=!0),a&&A.readonly)continue;if(Object.keys(A.conflict).length>0){if(Object.entries(A.conflict).every(([Q,K])=>!K.differentSchema))continue;Object.entries(A.conflict).forEach(([Q])=>{uof({property:A.key,schemaId:Q,context:t,namespace:n}).forEach(X=>{p.add(X)})})}let E=FS({schema:A.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=A.audiences,M=A.nameOverride,q=FH(A.availability),L=lCD(A);c[A.key]=cCD({typeReference:E,audiences:C,name:M,availability:q,propertyAccess:L})}let s=new Set;for(let A of e.allOfPropertyConflicts)A.allOfSchemaIds.forEach(E=>p.add(E)),A.conflictingTypeSignatures&&s.add(A.propertyKey);let o=[];for(let A of e.allOf){let E=Rhy({schema:A.schema,context:t,namespace:n});if(E==null||p.has(A.schema)||p.has(E))continue;let C=FS({schema:$P.reference(A),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});o.push(E4(C))}for(let A of p){let E=sof(t,A,n);for(let C of E.properties)c[C.key]==null&&(s.has(C.key)&&(c[C.key]="unknown"),c[C.key]=FS({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of E.allOf){if(p.has(C.schema))continue;let M=FS({schema:$P.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});o.push(E4(M))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([A,E])=>sCD(A)?[A,typeof E=="string"?{type:E,name:`_${A}`}:{...E,name:`_${A}`}]:[A,E]))};o.length>0&&(l.extends=o),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=FH(e.availability)),e.source!=null&&(l.source=Lci(e.source)),l.inline=cof(e,i);let O=e.nameOverride??e.generatedName;return{name:u&&t.respectReadonlySchemas&&!a?`${O}Read`:O,schema:l}}function uof({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return uof({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:u}=sof(r,t,n),c=a.some(s=>s.key===e),p=[...u.flatMap(s=>uof({property:e,context:r,schemaId:s.schema,namespace:n}))];if(c||p.length>0)return[t,...p]}return[]}function sof(e,t,r){let n=e.getSchema(t,r);if(n==null)return{properties:[],allOf:[]};if(n.type==="object")return{properties:n.properties,allOf:n.allOf};if(n.type==="reference")return sof(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function eCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:eof({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function tCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:tof({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function rCD(e){let t=sys(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 Thy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function L3o(e,t){let r={enum:e.values.map(a=>{let u=a.nameOverride??a.generatedName,c=a.value;if(u===c&&a.description==null&&(a.casing==null||Thy(a.casing)))return u;let p={value:a.value};if(u!==c&&(p.name=u),a.description!=null&&(p.docs=a.description),a.casing!=null&&!Thy(a.casing)){let s={},o=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,o=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,o=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,o=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,o=!0),o&&(p.casing=s)}return p})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=cof(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?Lci(e.source):void 0};for(let a of r.enum){let u=typeof a=="string"?a:a.name??a.value;n.has(u.toLowerCase())||(i.enum.push(a),n.add(u.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function nCD({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:kaf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function iCD({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:rof({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:Nhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function Nhy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:cys({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function aCD(e,t){return{name:e??t,schema:nof()}}function oCD(e,t,r){return{name:t??r,schema:iof(e)}}function oof({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?uys(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let s of e.commonProperties)c[s.key]=FS({schema:s.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let p={};for(let[s,o]of Object.entries(e.schemas))p[s]=FS({schema:o,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?FH(e.availability):void 0,union:p,encoding:a,source:e.source!=null?Lci(e.source):void 0}}}let u=[];for(let c of e.schemas)u.push(FS({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:u,encoding:a,source:e.source!=null?Lci(e.source):void 0,inline:cof(e,i)}}}var uCD=/^[0-9]/;function sCD(e){return uCD.test(e)}function Rhy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?Rhy({context:t,schema:n.schema,namespace:r}):e}function cCD({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 cof(e,t){return e.inline===!0||t>0?!0:void 0}function lCD(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return G$.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return G$.ObjectPropertyAccess.WriteOnly}}function xhy(e){let t=e.replace(/^x-|^X-/,"");return IO(t)}var Fhy="BasicAuthScheme",fys="BearerAuthScheme";function zhy(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:Fhy,schema:i}),t||(e.builder.setAuth(Fhy),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:fys,schema:i}),t||(e.builder.setAuth(fys),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??xhy(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:fys,schema:i}),t||(e.builder.setAuth(fys),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(iP.of("__package__.yml"),{name:"OauthScope",schema:L3o(n.scopesEnum,0).schema})}}function C8r({header:e,context:t,fileContainingReference:r,namespace:n}){let i=FS({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=E4(i),u=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:IO(u);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let p={type:a};return c!==e.name&&(p.name=c),e.description!=null&&(p.docs=e.description),e.env!=null&&(p.env=e.env),e.availability!=null&&(p.availability=FH(e.availability)),p}function dys({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=FS({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return E4(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:E4(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=FH(e.availability)),a}function _ys({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=lof({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=E4(i.value),u=Q3o(i.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return u!=null&&(c.default=u),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=FH(e.availability)),fCD(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 lof({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:FS({schema:$P.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:iP.of(JN),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],u=!1;for(let[c,p]of Object.entries(i.value.schemas))p.type==="primitive"&&p.schema.type==="string"&&(u=!0),p.type==="literal"&&p.value.type==="string"&&(uQa.test(p.value.value)?a.push(p.value.value):a.push({value:p.value.value,name:sQa(p.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),u&&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,p]=i.value.schemas;if(c!=null&&p!=null&&pys({array:c,primitive:p}))return{value:FS({schema:$P.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:p,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&&p!=null&&pys({array:c,primitive:p}))return{value:FS({schema:$P.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,p]of Object.entries(i.value.schemas))return lof({schema:p,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let i=t.getSchema(e.value.schema,n);if(i==null)return;if(i.type==="array")return{value:FS({schema:$P.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:e.inline}),context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:FS({schema:$P.optional({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 i=[],a=!1;for(let[u,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(a=!0),c.type==="literal"&&c.value.type==="string"&&(uQa.test(c.value.value)?i.push(c.value.value):i.push({value:c.value.value,name:sQa(c.value.value)}));if(i.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:i}}),a&&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[u,c]=e.value.value.schemas;if(u!=null&&c!=null&&pys({array:u,primitive:c}))return{value:FS({schema:$P.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:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(u!=null&&c!=null&&pys({array:c,primitive:u}))return{value:FS({schema:$P.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,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:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[u,c]of Object.entries(e.value.value.schemas))return lof({schema:$P.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.objectQueryParameters?{value:FS({schema:e,context:t,fileContainingReference:r,declarationFile:iP.of(JN),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:FS({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:FS({schema:$P.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:FS({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function pys({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function fCD(e){return e.type!=null}function Qhy({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"]=dCD(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=pCD({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=ODi(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function dCD(e){let t={};return e.forEach(r=>{let n=ODi(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function pCD({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=ODi(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function ODi(e){switch(e.type){case"primitive":return Lhy(e.value);case"object":return Uhy(e.properties);case"array":return _CD(e.value);case"map":return hCD(e.value);case"oneOf":return yCD(e.value);case"enum":return e.value;case"literal":return vCD(e.value);case"unknown":return ODi(e.value);default:cc(e)}}function Lhy(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:cc(e)}}function Uhy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ODi(r)]))}function _CD(e){return e.map(t=>ODi(t))}function hCD(e){return Object.fromEntries(e.map(t=>[Lhy(t.key),ODi(t.value)]))}function yCD(e){return e.type==="discriminated"?Uhy(e.value):ODi(e.value)}function vCD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:cc(e)}}function Uci(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function hys(e,t){return t??(e?.groupName!=null?Uci(e.groupName):void 0)}function Vhy({channel:e,context:t,declarationFile:r}){let n={path:e.path,url:e.servers[0]?.name,auth:!1};e.audiences!=null&&e.audiences.length>0&&(n.audiences=e.audiences),e.summary!=null&&(n["display-name"]=e.summary),e.description!=null&&(n.docs=e.description);let i=Uci(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let p of e.handshake.pathParameters)a[p.name]=dys({pathParameter:p,context:t,fileContainingReference:r,namespace:i});Object.keys(a).length>0&&(n["path-parameters"]=a);let u={};if(e.handshake.queryParameters.length>0)for(let p of e.handshake.queryParameters){let s=_ys({queryParameter:p,context:t,fileContainingReference:r,namespace:i});s!=null&&(u[p.name]=s)}Object.keys(u).length>0&&(n["query-parameters"]=u);let c={};if(e.handshake.headers.length>0)for(let p of e.handshake.headers){let s=C8r({header:p,context:t,fileContainingReference:r,namespace:i});c[p.name]=s}Object.keys(c).length>0&&(n.headers=c),t.builder.addChannel(r,{channel:n});for(let p of e.messages)t.builder.addChannelMessage(r,{messageId:p.name,message:{origin:p.origin,body:FS({schema:p.body,context:t,fileContainingReference:r,namespace:i,declarationDepth:0})}});for(let p of e.examples){let s=Qhy({context:t,websocketExample:p});t.builder.addChannelExample(r,{example:s})}}function Why(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var Vci="Base",bCD="Default";function VKi(e){return Object.entries(e).reduce((t,[r,n])=>(Xke(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function Hhy(e){if(e.environmentOverrides!=null){for(let[q,L]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:q,schema:L});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(q=>Why(q)),i=e.ir.servers;for(let q of i)if(Why(q)){let L={urls:{}};for(let[U,Q]of Object.entries(q.urls))L.urls[U]=Q.url;q.name&&(t[q.name]=L)}else if("url"in q&&q.url){let L=q.audiences?{url:q.url,audiences:q.audiences}:q.url;if(q.name==null){r.push(L);continue}t[q.name]=L}let a={},u={},c=[];for(let q of e.ir.endpoints)for(let L of q.servers){if(L.url==null&&L.name!=null){a[L.name]||(a[L.name]=[]);continue}if(L.url==null)continue;let U=L.audiences?{url:L.url,audiences:L.audiences}:L.url;if(L.name==null){c.push(U);continue}a[L.name]||(a[L.name]=[]),a[L.name]?.push({url:L.url,audiences:L.audiences}),u[L.name]=U}let p={},s=[];for(let q of e.ir.websocketServers){let L=q.audiences?{url:q.url,audiences:q.audiences}:q.url;if(q.name==null){s.push(L);continue}p[q.name]=L}let o=Object.keys(t).length,l=o>0,O=Object.keys(u).length>0,A=Object.keys(a).some(q=>a[q]?.length===0),E=Object.keys(p).length>0;if(!l&&!O&&E&&e.ir.servers.length===0){for(let[q,L]of Object.entries(p))e.builder.addEnvironment({name:q,schema:L});e.builder.setDefaultEnvironment(Object.keys(p)[0]),e.builder.setDefaultUrl(Vci);return}if(c.length>0&&e.logger.error(`Skipping endpoint level servers ${c.map(q=>typeof q=="string"?q:q.url).join(", ")} because x-fern-server-name was not provided.`),!l){let q=e.ir.servers[0]?.url,L=e.ir.servers[0]?.audiences;if(q!=null){let U=L?{url:q,audiences:L}:q;t[bCD]=U}}let C=Object.values(t).map(q=>typeof q=="string"?q:Xke(q)?Object.values(q.urls)[0]:q.url),M=r.filter(q=>{let L=typeof q=="string"?q:q.url;return!C.includes(L)});if(M.length>0&&e.logger.error(`Skipping top level servers ${M.map(q=>typeof q=="string"?q:q.url).join(", ")} because x-fern-server-name was not provided.`),n){let q=!0;for(let[L,U]of Object.entries(t))if(e.builder.addEnvironment({name:L,schema:U}),q){if(e.builder.setDefaultEnvironment(L),Xke(U)){let Q=Object.keys(U.urls)[0];Q&&e.builder.setDefaultUrl(Q)}q=!1}return}if(!O&&!A){let q=!0;for(let[L,U]of Object.entries(t))if(q){if(E){let Q=typeof U=="string"?U:Xke(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:L,schema:{urls:{[Vci]:Q??"",...VKi(p)}}})}else e.builder.addEnvironment({name:L,schema:U});e.builder.setDefaultEnvironment(L),q=!1}else if(E){let Q=typeof U=="string"?U:Xke(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:L,schema:{urls:{[Vci]:Q??"",...VKi(p)}}})}else e.builder.addEnvironment({name:L,schema:U});E&&e.builder.setDefaultUrl(Vci)}else if(o===1){let q=Object.keys(t)[0],L=Object.values(t)[0],U=typeof L=="string"?L:Xke(L)?Object.values(L.urls)[0]:L.url;e.builder.addEnvironment({name:q,schema:{urls:{[Vci]:U??"",...VKi(u),...VKi(p)}}}),e.builder.setDefaultEnvironment(q),e.builder.setDefaultUrl(Vci)}else{let q=new Map;for(let L of e.ir.endpoints)for(let U of L.servers)if(U.url!=null&&U.name!=null){q.has(U.name)||q.set(U.name,new Map);let Q=U.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",K=q.get(U.name);K&&K.set(Q,U.url)}if(q.size>0){let L=!0;for(let[U,Q]of Object.entries(t)){let K=typeof Q=="string"?Q:Xke(Q)?Object.values(Q.urls)[0]:Q.url;if(!K)continue;let X=K.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",te={[Vci]:K};for(let[ee,re]of q.entries()){let ue=re.get(X)||re.get("production")||re.values().next().value;ue&&(te[ee]=ue)}E&&Object.assign(te,VKi(p)),Object.keys(te).length>1?e.builder.addEnvironment({name:U,schema:{urls:te}}):e.builder.addEnvironment({name:U,schema:K}),L&&(e.builder.setDefaultEnvironment(U),L=!1)}q.size>0&&e.builder.setDefaultUrl(Vci)}else{let L=!0;for(let[U,Q]of Object.entries(t)){if(E||Object.keys(u).length>0){let K=typeof Q=="string"?Q:Xke(Q)?Object.values(Q.urls)[0]:Q.url;e.builder.addEnvironment({name:U,schema:{urls:{[Vci]:K??"",...VKi(u),...VKi(p)}}})}else e.builder.addEnvironment({name:U,schema:Q});L&&(e.builder.setDefaultEnvironment(U),L=!1)}}}}var fof=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},gCD=.75,mCD=new Set("authorization");function Ghy(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?cQa(n.schema):void 0,u=a!=null?Uci(a):void 0,c=iP.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?E4(FS({schema:n.schema,context:e,fileContainingReference:u?Q$(iP.of(IO(u)),c):c,namespace:u,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(mCD.has(a.name.toLowerCase()))continue;let u=r[a.name];if(u==null){let c=t[a.name],p=C8r({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:iP.of(rZ),context:e,namespace:void 0});u=new fof(p),r[a.name]=u}u.increment()}let n=e.ir.endpoints.length*gCD;for(let[i,a]of Object.entries(r)){let u=t[i],c=a.count===e.ir.endpoints.length,p=a.count>=n;u==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):p&&e.builder.addGlobalHeader({name:i,schema:mDi(a.schema)}))}}}function Jhy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?cQa(t.schema):void 0,n=r!=null?Uci(r):void 0,i=C8r({header:{...t,schema:t.schema??$P.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:iT.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:iP.of(rZ),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:mDi(i)})}}function WOe(e){switch(e.type){case"primitive":return $hy(e.value);case"object":return Yhy(e.properties);case"array":return Xhy(e.value);case"map":return ACD(e.value);case"oneOf":return PCD(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return wCD(e.value);case"unknown":return WOe(e.value);default:cc(e)}}function Khy(e){switch(e.type){case"withStreaming":return e.sse?{stream:OCD(e.events)}:{stream:Xhy(e.events)};case"withoutStreaming":return{body:WOe(e.value)};default:cc(e)}}function $hy(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:cc(e)}}function Yhy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,WOe(r)]))}function OCD(e){return e.map(t=>({event:"",data:WOe(t)}))}function Xhy(e){return e.map(t=>WOe(t))}function ACD(e){return Object.fromEntries(e.map(t=>[$hy(t.key),WOe(t.value)]))}function PCD(e){return e.type==="discriminated"?Yhy(e.value):WOe(e.value)}function wCD(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:cc(e)}}function Zhy({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"]=jCD(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=ECD(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),a=Object.keys(i).length>0,u=new Set(e.headers?.map(c=>c.name)??[]);if(n||a){let c=[];if(e.headers!=null)for(let p of e.headers)p.name!==t.builder.getAuthHeaderName()&&c.push(p);for(let[p,s]of Object.entries(i))if(!u.has(p))if(s!=null&&typeof s=="object"&&s.type!=null){let o=yZ({type:s.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:Hc}});o!=null&&c.push({name:p,value:xS.literal(sDi.string(o))})}else c.push({name:p,value:xS.primitive(Im.string(p))});r.headers=SCD({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=WOe(e.request)),e.response!=null&&(r.response=Khy(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(GP)),r}function jCD(e){let t={};return e.forEach(r=>{let n=WOe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function ECD(e){let t={};return e.forEach(r=>{let n=WOe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function SCD({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=WOe(n.value);i!=null&&(r[n.name]=i)}),r}function khy(e){return Hle._visit(e,{get:()=>G$.HttpMethodSchema.Get,post:()=>G$.HttpMethodSchema.Post,put:()=>G$.HttpMethodSchema.Put,patch:()=>G$.HttpMethodSchema.Patch,delete:()=>G$.HttpMethodSchema.Delete,head:()=>G$.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 eyy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function tyy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,u=e.path,c=hys(e.sdkName,e.namespace),p={};for(let M of e.pathParameters)M.parameterNameOverride&&(u=u.replace(M.name,M.parameterNameOverride)),p[M.parameterNameOverride??M.name]=dys({pathParameter:M,context:r,fileContainingReference:t,namespace:c}),a.add(M.name);let s={};for(let M of e.queryParameters){let q=_ys({queryParameter:M,context:r,fileContainingReference:t,namespace:c});q!=null&&(s[M.name]=q,a.add(M.name))}let o;if(e.pagination!=null)switch(e.pagination.type){case"cursor":o={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":o={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":o={type:"custom",results:e.pagination.results};break;default:cc(e.pagination)}let l={path:u,method:khy(e.method),auth:e.authed,docs:e.description??void 0,pagination:o,source:e.source!=null?Lci(e.source):void 0};!MCD({context:r,request:e.request})&&Object.keys(p).length>0&&(l["path-parameters"]=p),e.summary!=null&&(l["display-name"]=e.summary);let O={},A=r.builder.getGlobalHeaderNames(),E=r.builder.getAuthHeaderName();E!=null&&A.add(E);let C=e.headers.filter(M=>!A.has(M.name));for(let M of C){let q=C8r({header:M,context:r,fileContainingReference:t,namespace:c});O[M.name]=q,a.add(typeof q=="string"?M.name:q.name??M.name)}if(e.request!=null){r.setInState(loe.Request);let M=ICD({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(p).length>0?p:void 0,queryParameters:Object.keys(s).length>0?s:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(O).length>0?O:void 0,usedNames:a,namespace:c});l.request=M.value,i=[...i,...M.schemaIdsToExclude??[]],r.unsetInState(loe.Request)}else{let M=r.inlinePathParameters&&Object.keys(p).length>0,q=Object.keys(s).length>0,L=Object.keys(O).length>0,U={};(M||q||L)&&(U.name=e.requestNameOverride??e.generatedRequestName),M&&(U["path-parameters"]=p),q&&(U["query-parameters"]=s),L&&(U.headers=O),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:M=>{let q=FS({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:M.description??void 0,type:E4(q)},M.statusCode!=null&&(l.response["status-code"]=M.statusCode),M.responseProperty!=null&&(l.response.property=M.responseProperty)},streamingJson:M=>{let q=FS({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:E4(q),format:"json"}},streamingSse:M=>{let q=FS({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:E4(q),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(),q=e.servers[0];q==null?M!=null&&(l.url=M):l.url=q.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=FH(e.availability)),Object.entries(e.errors).forEach(([M,q])=>{let L=q.generatedName,U=iP.of(JN);r.builder.enableUniqueErrorsPerEndpoint&&(L=`${e.generatedRequestName}${q.generatedName}`,q.schema!=null&&(q.schema.type!=="reference"&&q.schema.type!=="oneOf"?q.schema.generatedName=`${e.generatedRequestName}${q.schema.generatedName}`:q.schema.type==="oneOf"&&(q.schema.value.generatedName=`${e.generatedRequestName}${q.schema.value.generatedName}`)));let Q={"status-code":parseInt(M)},K=Dhy({location:ryy,namespaceOverride:c});if(q.schema!=null){let ee=FS({schema:q.schema,context:r,fileContainingReference:K,declarationFile:K,namespace:c,declarationDepth:0});Q.type=E4(ee),Q.docs=q.description}r.builder.addError(K,{name:L,schema:r.isErrorUnknownSchema(parseInt(M))?{...Q,type:"unknown"}:Q}),l.errors==null&&(l.errors=[]);let X=r.builder.addImport({file:t,fileToImport:K});l.errors.push(X!=null?`${X}.${L}`:L),Q.type!=null&&q.examples?.forEach(ee=>{let re={value:WOe(ee.example),name:ee.name,docs:ee.description};r.builder.addErrorExample(K,{name:L,example:re})})}),e.examples.length>0&&(l.examples=DCD({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=CCD({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[dof,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function DCD({endpointExamples:e,context:t}){return e.map(r=>{try{return Zhy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function CCD({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:cc(e)}}function ICD({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:u,queryParameters:c,nonRequestReferencedSchemas:p,headers:s,usedNames:o,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let O=n.schema.type==="reference"?n.schema.schema:void 0,A=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(A?.type!=="object"||O!=null&&p.includes(O)){let L=FS({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),U={schemaIdsToExclude:[],value:{body:L}},Q=Object.keys(u??{}).length>0,K=Object.keys(c??{}).length>0,X=Object.keys(s??{}).length>0;return Q&&(U.value["path-parameters"]=u),K&&(U.value["query-parameters"]=c),X&&(U.value.headers=s),(Q||K||X)&&(U.value.name=i??a),n.contentType!=null&&(U.value["content-type"]=n.contentType),n.description!=null&&(U.value.docs=n.description),U}let E=Object.fromEntries(A.properties.filter(L=>L.readonly==null?!0:!(eyy(e.method)&&L.readonly)).map(L=>{let U=FS({schema:L.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),Q=L.nameOverride??L.key,K=FH(L.availability);if(!o.has(Q)&&L.audiences.length<=0)return o.add(Q),L.nameOverride!=null?[L.key,{type:E4(U),docs:lQa(U),name:L.nameOverride,availability:K}]:[L.key,K?{...typeof U=="string"?{type:U}:U,availability:K}:U];let X={type:E4(U),docs:lQa(U)};return o.has(Q)&&(X.name=L.generatedName),L.audiences.length>0&&(X.audiences=L.audiences),K!=null&&(X.availability=K),o.add(Q),[L.key,X]})),C=A.allOf.map(L=>{let U=FS({schema:$P.reference(L),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return E4(U)}).filter(L=>L!=="unknown"),M={properties:E};C.length>0&&(M.extends=C),n.additionalProperties&&(M["extra-properties"]=!0);let q={name:i??A.nameOverride??A.generatedName,"path-parameters":u,"query-parameters":c,headers:s,body:M};return n.contentType!=null&&(q["content-type"]=n.contentType),n.description!=null&&(q.docs=n.description),{schemaIdsToExclude:O!=null?[O]:[],value:q}}else if(n.type==="octetStream"){let O={body:"bytes","content-type":n.contentType??l7.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(O.name=i??a),n.description!=null&&(O.docs=n.description),{schemaIdsToExclude:[],value:O}}else if(n.type==="multipart"){let O=Object.fromEntries(n.properties.map(A=>{if(A.schema.type==="file"){let E=A.schema.isArray?"list<file>":"file";if(E=A.schema.isOptional?`optional<${E}>`:E,A.description!=null||A.contentType!=null){let C={type:E};if(A.description!=null&&(C.docs=A.description),A.contentType!=null){let M=A.contentType.split(",")[0];C["content-type"]=M}return[A.key,C]}return[A.key,E]}else{let E=FS({schema:A.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(A.contentType||A.exploded||A.encoding){let C=typeof E=="string"?{type:E}:E;A.contentType!=null&&(C["content-type"]=A.contentType),A.encoding==="form"?C.style="form":A.encoding==="json"?C.style="json":A.exploded&&(C.style="exploded"),E=C}return[A.key,E]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??a,"path-parameters":u,"query-parameters":c,headers:s,body:{properties:O},"content-type":l7.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else cc(n)}function MCD({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:cc(t)}}function BCD({location:e,namespaceOverride:t}){return t!=null?{...e,file:Q$(iP.of(t),e.file)}:e}function TCD(e){let t=e.namespace,r=e.tags.filter(p=>p!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:iP.of(`${IO(r)}.yml`),endpointId:e.summary!=null?IO(e.summary):IO(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:iP.of(JN),endpointId:IO(e.summary)}:{file:iP.of(JN),endpointId:IO(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:iP.of(JN),endpointId:n};let i=U3o(r),a=U3o(n);if(Bae(i,a))return{file:iP.of("__package__.yml"),endpointId:r};let u=RCD({operationId:n,tag:r,path:e.path,method:e.method});if(u!=null)return u;let c=[];for(let p=0;p<i.length;++p){let s=i[p];if(s!=null&&s===a[p])c.push(s);else{let o=IO(r);return{file:iP.of(`${o}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:iP.of(IO(c.join("_"))+".yml"),endpointId:IO(a.slice(c.length).join("_")),tag:r}}function V3o(e){let t=e.tags[0];if(e.sdkName!=null){let r=Yaf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:iP.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return BCD({namespaceOverride:e.namespace,location:TCD(e)})}function U3o(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=Dct(t),t}var qCD=new RegExp("[^a-zA-Z0-9{}]+"),NCD=new RegExp("[{}]","g");function RCD({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(qCD).join("_").replaceAll(NCD,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:iP.of(IO(t)+".yml"),endpointId:IO(e.slice(0,-1*a.length)),tag:t}}function nyy(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:u,file:c,tag:p}=V3o(a),s=c.split(".")[0];s!=null&&t.add(s);let o;if(a.sdkName!=null){let A=e.ir.groups;for(let E of a.sdkName.groupName){let C=typeof E=="string"?E:E.name,M=A[C];if(M==null)break;if(M.summary!=null||M.description!=null){o=A[C];break}}}let l=p==null?void 0:n.tagsById[p];e.setInState(loe.Endpoint),e.setEndpointMethod(a.method);let O=tyy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(loe.Endpoint),i=[...i,...O.schemaIdsToExclude],e.builder.addEndpoint(c,{name:u,schema:O.value,source:a.source!=null?Lci(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":o?.summary??l?.id,docs:o?.description??l?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function iyy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?Uci(r.groupName):void 0,i=FS({schema:$P.primitive(r),context:e,fileContainingReference:iP.of(JN),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:E4(i),docs:r.description??void 0}})}}function ayy(e){for(let t of e.ir.webhooks){let r=zCD({webhook:t,context:e});if(r==null)continue;let n=hys(t.sdkName,t.namespace),i={};for(let u of t.headers)i[u.name]=C8r({header:u,context:e,fileContainingReference:r.file,namespace:n});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:FS({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),examples:t.examples!=null?t.examples.map(u=>({docs:u.description,name:u.name,payload:WOe(u.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function xCD({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:Q$(iP.of(t),e.file)}:e}function FCD({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:iP.of(JN),endpointId:n};let i=U3o(r),a=U3o(n);if(Bae(i,a))return{file:iP.of("__package__.yml"),endpointId:r};let u=[];for(let c=0;c<i.length;++c){let p=i[c];if(p!=null&&p===a[c])u.push(p);else{let s=IO(r);return{file:iP.of(`${s}.yml`),endpointId:n,tag:r}}}if(u.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:iP.of(IO(u.join("_"))+".yml"),endpointId:IO(a.slice(u.length).join("_")),tag:r}}function zCD({webhook:e,context:t}){return e.sdkName!=null?{file:Shy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:xCD({namespaceOverride:e.namespace,location:FCD({webhook:e,context:t})})}var QCD=iP.of(JN);function uyy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return oyy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return oyy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return QCD;default:cc(e)}}function oyy({namespace:e,groupName:t}){return e!=null&&t!=null?gDi([{type:"namespace",name:e},...t]):e!=null?gDi([{type:"namespace",name:e}]):gDi(t)}var dof="external",ryy=iP.of(JN);function syy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let u=uyy(a),c=qhy({schema:a,context:n,declarationFile:u,namespace:r,declarationDepth:0});if(d1i(c.schema)){let p=E4(c.schema);if(p===(c.name??i)||p===`optional<${c.name??i}>`||p===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(u,{name:c.name??i,schema:c.schema})}}function cyy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),Hhy(e),Ghy(e),Jhy(e),zhy(e),iyy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(dof);let t=nyy(e),r=t.sdkGroups;e.setInState(loe.Webhook),ayy(e),e.unsetInState(loe.Webhook),e.setInState(loe.Channel);for(let i of Object.values(e.ir.channels)){let a=gDi(i.groupName);Vhy({channel:i,context:e,declarationFile:a})}e.unsetInState(loe.Channel);let n=LCD({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});syy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))syy({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 LCD({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 W3o=class{context;constructor(t){this.context=t}};var yys=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[u,c]of Object.entries(n.files)){let p=i!=null?iP.of(`${i}${"/"}${u}`):iP.of(u);t[p]=c}let a=Object.keys(n.directories).sort();for(let u of a){let c=i!=null?`${i}${"/"}${u}`:u,p=n.directories[u];r(p,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[iP.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 WKi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new yys,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 u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),n!=null&&(u.service["base-path"]=n),i!=null&&(u.service["display-name"]=i),a!=null&&(u.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return R6r(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"]))lyy(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(lyy(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??IO((Lct(r)+"/"+NVi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===iP.of(rZ))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=h2u(Lct(zRa.of(`/${t}`)),zRa.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=h2u(Lct(zRa.of(`/${t}`)),zRa.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===iP.of(rZ))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=>Bae(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=Q$(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:Q$(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,u])=>[a,{...u,path:Q$(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===JN?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 lyy(e){return e?.header!=null}var vys=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:a,authOverrides:u}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=u,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.builder=new WKi(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let p of r.endpoints)for(let[s,o]of Object.entries(p.errors)){let l=parseInt(s),O=c[l];O==null&&o.schema!=null?c[l]=o.schema:O!=null&&o.schema!=null&&sRe(O,o.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}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(loe.Channel,loe.Endpoint,loe.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:cc(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:cc(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 pof(e){let t=new vys(e);return cyy(t)}var bys=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=pof({taskContext:t,ir:r,options:T3o({overrides:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.args.respectNullableSchemas,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}}),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:lg.dump(a.rootApiFile)},namedDefinitionFiles:{...xb(a.definitionFiles,u=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:lg.dump(u),contents:u})),[iP.of(JN)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:lg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var H3o=class extends pCr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.converter=new bys(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 Ret({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var vye={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 fQa={of(e){return e}};var fyy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},_of={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:fyy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},Gv={SOURCE:fQa.of("source"),SDK_NAMESPACE:fQa.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:fQa.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:fQa.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:fQa.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"};var BJ={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,groupMultiApiEnvironments:!1};function Ddt({options:e,overrides:t}){return{disableExamples:t?.disableExamples??BJ.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??BJ.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??BJ.useTitlesAsName,audiences:t?.audiences??e?.audiences??BJ.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??BJ.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??BJ.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??BJ.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??BJ.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??BJ.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??BJ.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??BJ.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??BJ.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??BJ.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??BJ.objectQueryParameters,filter:t?.filter??e?.filter??BJ.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??BJ.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??BJ.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??BJ.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??BJ.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??BJ.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??BJ.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??BJ.inlineAllOfSchemas,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??BJ.groupMultiApiEnvironments}}var dyy={naming:"v1"};function wy(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function G3o(e,t,r,n,i=[]){try{let a=wy(e,t);if(a!=null)return r.parse(a)}catch{let u=Dct(i).join(" -> ");n.error(`${u.length>0?`${u}: `:""}Failed to parse ${t}`)}}function HKi(e){let t=wy(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 pyy({schema:e,logger:t}){return wy(e,Gv.ENCODING)??void 0}function _yy(e){return wy(e,Gv.FERN_ENUM)}function hyy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let u=wy(n,Gv.SDK_NAMESPACE),c=wy(n,Gv.SDK_GROUP_NAME),p=wy(n,Gv.TYPE_DEFINITION);if(p!=null)return J3o({fernType:p,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:u,groupName:typeof c=="string"?[c]:c})}function J3o({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c}){return yZ({type:e,_default:void 0,validation:void 0,visitor:{primitive:p=>{switch(p.v1){case"BASE_64":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.base64({example:void 0})});case"BOOLEAN":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.boolean({default:void 0,example:void 0})});case"DATE":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.date({example:void 0})});case"DATE_TIME":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.datetime({example:void 0})});case"FLOAT":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.float({example:void 0})});case"DOUBLE":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.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 Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.uint({default:void 0,example:void 0})});case"INTEGER":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.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 Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.uint64({default:void 0,example:void 0})});case"LONG":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Uh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,schema:Zg.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:cc(p.v1)}},unknown:()=>Uh.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:u,groupName:c}),map:({keyType:p,valueType:s})=>p?.type==="primitive"&&s!=null?Uh.map({nameOverride:t,generatedName:r,title:n,key:p,value:s,description:i,availability:a,namespace:u,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:p=>p!=null?Uh.array({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,example:void 0,inline:void 0}):void 0,optional:p=>p!=null?Uh.optional({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,inline:void 0}):void 0,nullable:p=>p!=null?Uh.nullable({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,inline:void 0}):void 0,set:p=>p!=null?Uh.array({nameOverride:t,generatedName:r,title:n,value:p,description:i,availability:a,namespace:u,groupName:c,example:void 0,inline:void 0}):void 0,literal:p=>Uh.literal({nameOverride:t,generatedName:r,title:n,value:p._visit({string:s=>JL.string(s),boolean:s=>JL.boolean(s),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:u,groupName:c}),named:p=>Uh.reference({schema:p,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:u,groupName:c,source:UOe.openapi({file:"<memory>"})})}})}function yyy(e){let t=wy(e,Gv.SOURCE);if(t!=null)return t.endsWith(".proto")?UOe.protobuf({file:t}):UOe.openapi({file:t})}function GKi(e){if(e!=null&&typeof e=="boolean")return e}function Ig(e){return e?.$ref!=null}function vyy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:u,wrapAsNullable:c,context:p,namespace:s,groupName:o,example:l,encoding:O,source:A}){return i===void 0&&(i=p.options.additionalPropertiesDefaultsTo),typeof i=="boolean"||dQa(i,p.options)?gys({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Zg.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:Uh.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0}),namespace:s,groupName:o,example:l,encoding:O}):gys({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Zg.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:byy(E1(i,p.options.optionalAdditionalProperties?c:!1,p,[...n,"Value"],A,s,void 0,void 0,void 0)),namespace:s,groupName:o,example:l,encoding:O})}function byy(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=byy(e.value);break;case"oneOf":e.value.inline=!0;break;default:cc(e)}return e}function gys({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsNullable:a,description:u,availability:c,namespace:p,groupName:s,example:o,encoding:l}){return a?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.map({nameOverride:e,generatedName:t,title:r,description:u,availability:n.availability,key:n,value:i,namespace:p,groupName:s,encoding:l,example:o,inline:void 0}),description:u,availability:c,namespace:p,groupName:s,inline:void 0}):Uh.map({nameOverride:e,generatedName:t,title:r,description:u,availability:c,key:n,value:i,namespace:p,groupName:s,encoding:l,example:o,inline:void 0})}function dQa(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!Ig(e)&&Object.keys(e).length===0}function gyy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:u,wrapAsNullable:c,context:p,namespace:s,groupName:o,example:l,source:O}){let A=i==null?Uh.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:s,groupName:o}):E1(i,!1,p,[...n,"Item"],O,s);return UCD({nameOverride:e,generatedName:t,title:r,namespace:s,groupName:o,itemSchema:A,wrapAsNullable:c,description:a,availability:u,example:l})}function UCD({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsNullable:i,description:a,availability:u,namespace:c,groupName:p,example:s}){return i?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,namespace:c,groupName:p,example:s,inline:void 0}),description:a,availability:u,namespace:c,groupName:p,inline:void 0}):Uh.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:u,namespace:c,groupName:p,example:s,inline:void 0})}function HOe(e){switch(wy(e,Gv.AVAILABILITY)){case"deprecated":return Vle.Deprecated;case"beta":return Vle.Beta;case"generally-available":return Vle.GenerallyAvailable;default:break}if(!Ig(e)&&e.deprecated)return Vle.Deprecated}function hof({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:c,wrapAsNullable:p,discriminator:s,context:o,namespace:l,groupName:O,encoding:A,source:E}){let C=s.propertyName,M=Object.fromEntries(Object.entries(s.mapping??{}).map(([L,U])=>{let Q=Wci({$ref:U},!1,o,[U],A,E,l);return o.markReferencedByDiscriminatedUnion({$ref:U},C,1),[L,Q]})),q=Object.entries(i).filter(([L])=>L!==C).map(([L,U])=>{let Q=c!=null&&c.includes(L),K=E1(U,!Q,o,[...n,L],E,l);return{key:L,schema:K}});return myy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:p,properties:q,description:a,availability:u,discriminant:C,subtypes:M,namespace:l,groupName:O,source:E})}function yof({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:u,required:c,wrapAsNullable:p,discriminant:s,variants:o,context:l,namespace:O,groupName:A,encoding:E,source:C}){let M=Object.fromEntries(Object.entries(o).map(([L,U])=>{if(Ig(U)){let Q=Wci(U,!1,l,[U.$ref],E,C,O);return l.markReferencedByDiscriminatedUnion(U,s,1),[L,Q]}else{let Q=K3o(U,!1,l,[...n,L],E,C,O,new Set([s]));return[L,Q]}})),q=Object.entries(i).filter(([L])=>L!==s).map(([L,U])=>{let Q=c!=null&&c.includes(L),K=E1(U,!Q,l,[...n,L],C,O);return{key:L,schema:K}});return myy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:p,properties:q,description:a,availability:u,discriminant:s,subtypes:M,namespace:O,groupName:A,source:C})}function myy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,availability:u,discriminant:c,subtypes:p,namespace:s,groupName:o,source:l}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.oneOf(gSe.discriminated({description:a,availability:u,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:p,commonProperties:i,namespace:s,groupName:o,encoding:void 0,source:l,inline:void 0})),namespace:s,groupName:o,description:a,availability:u,inline:void 0}):Uh.oneOf(gSe.discriminated({description:a,availability:u,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:p,commonProperties:i,namespace:s,groupName:o,encoding:void 0,source:l,inline:void 0}))}function Oyy(e){if(e.proto!=null)return B5a.protobuf({typeName:e.proto.type})}function ADi({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:u,description:c,availability:p,wrapAsNullable:s,namespace:o,groupName:l,context:O,source:A,inline:E}){let C=WCD(i??[]),M=new Set(a),q=Array.from(M).map((U,Q)=>{let K=n?.[U],X=C[Q],te=uQa.test(U),ee=K?.name??X,re=te?U:sQa(U);return ee!=null&&!uQa.test(ee)&&(O?.logger.warn(`Enum name override ${ee} is not a valid name. Falling back on ${re}.`),ee=void 0),{nameOverride:ee,generatedName:re,value:U,description:K?.description,availability:p,casing:{snake:K?.casing?.snake??void 0,pascal:K?.casing?.pascal??void 0,screamingSnake:K?.casing?.screamingSnake??void 0,camel:K?.casing?.camel??void 0}}}),L=u!=null?q.find(U=>U.value===u):void 0;return VCD({wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:q,_default:L,description:c,availability:p,namespace:o,groupName:l,source:A,inline:E})}function VCD({wrapAsNullable:e,nameOverride:t,generatedName:r,title:n,values:i,_default:a,description:u,availability:c,namespace:p,groupName:s,source:o,inline:l}){return e?Uh.nullable({nameOverride:t,generatedName:r,title:n,value:Uh.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,default:a,availability:c,example:void 0,namespace:p,groupName:s,source:o,inline:l}),description:u,availability:c,namespace:p,groupName:s,inline:l}):Uh.enum({nameOverride:t,generatedName:r,title:n,values:i,description:u,availability:c,default:a,example:void 0,namespace:p,groupName:s,source:o,inline:l})}function WCD(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 Ayy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,description:o,availability:l,wrapAsNullable:O,example:A,namespace:E,groupName:C}){return n==="int64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint32"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int({default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C})}function Pyy(e){return typeof e=="string"?JL.string(e):typeof e=="boolean"?JL.boolean(e):JL.string(`${e}`)}function wyy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,value:i,description:a,availability:u,namespace:c,groupName:p}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.literal({nameOverride:e,generatedName:t,title:r,value:Pyy(i),description:a,availability:u,namespace:c,groupName:p}),description:a,availability:u,namespace:c,groupName:p,inline:void 0}):Uh.literal({nameOverride:e,generatedName:t,title:r,value:Pyy(i),description:a,availability:u,namespace:c,groupName:p})}function vof({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,description:o,availability:l,wrapAsNullable:O,example:A,namespace:E,groupName:C}){return n==null||n==="double"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.double({default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="float"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.float({example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="int32"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int({default:i,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:p,multipleOf:s,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="int64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.int64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint32"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="uint64"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.uint64({default:i,example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):n==="time-delta"?foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.float({example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C}):foe({nameOverride:e,generatedName:t,title:r,primitive:Zg.float({example:A}),wrapAsNullable:O,description:o,availability:l,namespace:E,groupName:C})}var HCD={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},GCD={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}}},JCD={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}}},KCD={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},$CD={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},YCD={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},XCD={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ZCD={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function mys(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[HCD,GCD,JCD,KCD,$CD,YCD,XCD,ZCD],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:u,newBreadcrumbs:c}=a.applyStrategy(t);t=u,r=[...r,...c]}}while(t.join("")!==i.join(""));return r}function doe(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:g9(IO(i))).join("");return/^\d/.test(n)?z3o(n)??n:n}function bof(e){let t=e.join("_");return IO(t)}function gz(e){switch(e.type){case"object":return $P.object({allOf:e.allOf,properties:e.properties.map(t=>eID(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 $P.array({description:e.description,availability:e.availability,value:gz(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return $P.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 $P.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 $P.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gz(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return $P.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:gz(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return $P.primitive({description:e.description,availability:e.availability,schema:jyy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return $P.map({description:e.description,availability:e.availability,key:$P.primitive({description:e.key.description,availability:e.key.availability,schema:jyy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:gz(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 $P.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 $P.oneOf(kCD(e.value));case"unknown":return $P.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:cc(e)}}function kCD(e){switch(e.type){case"discriminated":return w8r.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:gz(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,gz(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return w8r.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>gz(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:cc(e)}}function jyy(e){switch(e.type){case"string":return iT.string(e);case"base64":return iT.base64();case"boolean":return iT.boolean(e);case"date":return iT.date();case"datetime":return iT.datetime();case"double":return iT.double(e);case"float":return iT.float();case"int":return iT.int(e);case"int64":return iT.int64(e);case"uint":return iT.uint();case"uint64":return iT.uint64();default:cc(e)}}function eID(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:gz(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function Oys(e,t){return sRe(gz(e),gz(t))}function Eyy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:u,wrapAsNullable:c,allOf:p,context:s,propertiesToExclude:o,namespace:l,groupName:O,fullExamples:A,additionalProperties:E,availability:C,source:M}){let q=[...u??[]],L={...i},U=[],Q=[];for(let re of p)if(!s.options.inlineAllOfSchemas&&Ig(re)){let ue=s.resolveSchemaReference(re);if(ue.discriminator!=null&&ue.discriminator.mapping!=null)continue;if(ue.oneOf!=null||ue.anyOf!=null){let Oe=ue.oneOf??ue.anyOf;if(Oe!=null){for(let Ee of Oe){let Ae=Ig(Ee)?s.resolveSchemaReference(Ee):Ee,Me=E1(Ae,!1,s.DUMMY,n,M,l);Me.type==="object"&&U.push(...Me.properties.map(Qe=>Qe.schema.type!=="optional"&&Qe.schema.type!=="nullable"?{...Qe,schema:Uh.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Qe.schema,description:void 0,availability:Qe.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Qe))}continue}}let me=PDi(re);if(me==null)continue;Q.push({schemaId:me,convertedSchema:gof(re,[me],M,s.options.preserveSchemaIds),properties:Syy({schema:re,context:s,breadcrumbs:n,source:M,namespace:l})}),s.markSchemaAsReferencedByNonRequest(me)}else if(Ig(re)){let ue=s.resolveSchemaReference(re),me=E1(ue,!1,s,n,M,l);me.type==="object"&&U.push(...me.properties)}else{let ue=re.required??[];U=U.map(Oe=>(Oe.schema.type==="optional"||Oe.schema.type==="nullable")&&ue.includes(Oe.key)?{...Oe,schema:Oe.schema.value}:Oe);let me=E1(re,!1,s,n,M,l);me.type==="object"&&U.push(...me.properties)}let K={};for(let re of Q)for(let[ue,me]of Object.entries(re.properties)){let Oe=K[ue];Oe!=null?(Oe.schemaIds.push(re.schemaId),Oe.schemas.some(Ae=>Oys(Ae,me))||Oe.schemas.push(me)):K[ue]={schemaIds:[re.schemaId],schemas:[me]}}let X=[];for(let[re,ue]of Object.entries(K))ue.schemaIds.length>1&&X.push({propertyKey:re,allOfSchemaIds:ue.schemaIds,conflictingTypeSignatures:ue.schemas.length>1});let te=Object.fromEntries(Object.entries(L).filter(([re,ue])=>!(!Ig(ue)&&ue.type==="null"))),ee=Object.entries(te).map(([re,ue])=>{let me=wy(ue,Gv.AUDIENCES)??[],Oe=HOe(ue),Ee=Ig(ue)?!1:ue.readOnly,Ae=Ig(ue)?!1:ue.writeOnly,Me=q.includes(re)&&!Ee,Qe=wy(ue,Gv.FERN_PROPERTY_NAME),Be=[...n,re],Mt=bof(Be),zt=Me?E1(ue,!1,s,Be,M,l):Uh.optional({nameOverride:e,generatedName:Mt,title:r,description:void 0,availability:Oe,value:E1(ue,!1,s,Be,M,l),namespace:l,groupName:O,inline:void 0}),Ye={};for(let ze of Q){let Dr=ze.properties[re];Dr!=null&&!Oys(zt,Dr)?Ye[ze.schemaId]={differentSchema:!0}:Dr!=null&&(Ye[ze.schemaId]={differentSchema:!1})}return{key:re,schema:zt,nameOverride:Qe,audiences:me,conflict:Ye,generatedName:bof([...n,re]),availability:Oe,readonly:Ee,writeonly:Ae}});return ee.push(...U.map(re=>{let ue=re.conflict;for(let me of Q){let Oe=me.properties[re.key];Oe!=null&&!Oys(re.schema,Oe)?ue[me.schemaId]={differentSchema:!0}:Oe!=null&&(ue[me.schemaId]={differentSchema:!1})}return{...re,conflict:ue}})),tID({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,properties:ee.filter(re=>!o.has(re.key)),description:a,allOf:Q.map(re=>re.convertedSchema),allOfPropertyConflicts:X,namespace:l,groupName:O,fullExamples:A,additionalProperties:E,availability:C,source:M,context:s})}function tID({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,allOf:u,allOfPropertyConflicts:c,namespace:p,groupName:s,fullExamples:o,additionalProperties:l,availability:O,source:A,context:E}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:c,namespace:p,groupName:s,fullExamples:o,additionalProperties:dQa(l,E.options),availability:void 0,source:A,inline:void 0}),description:a,availability:O,namespace:p,groupName:s,inline:void 0}):Uh.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:c,namespace:p,groupName:s,fullExamples:o,additionalProperties:dQa(l,E.options),availability:O,source:A,inline:void 0})}function Syy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[u,c]=Ig(e)?[t.resolveSchemaReference(e),mys(e.$ref)]:[e,r];for(let p of u.allOf??[])a={...a,...Syy({schema:p,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[p,s]of Object.entries(u.properties??{})){let o=E1(s,!1,t,[...c,p],n,i);a[p]=o}return a}function wDi({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsNullable:u,context:c,subtypes:p,namespace:s,groupName:o,encoding:l,source:O,subtypePrefixOverrides:A}){let E=iID({schemas:p}),C=p.flatMap((q,L)=>{if(!Ig(q)&&q.enum!=null&&c.options.coerceEnumsToLiterals&&q.type==="string")return q.enum.map(Q=>Uh.literal({nameOverride:void 0,generatedName:doe([t,Q],c.options.preserveSchemaIds),title:void 0,value:JL.string(String(Q)),namespace:s,groupName:void 0,description:void 0,availability:Q.availability}));let U=E[L];if(A!=null){let Q=A[L];Q!=null&&"name"in Q&&(U=Q.name)}return[E1(q,!1,c,[...n,U??`${L}`],O,s)]}),M=rID(C);return nID({uniqueSubtypes:M,nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:i,availability:a,namespace:s,groupName:o,context:c,encoding:l,source:O})}function rID(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 u=e[a];if(n!=null&&u!=null&&sRe(n,u)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function nID({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:u,namespace:c,groupName:p,context:s,encoding:o,source:l}){if(Object.entries(e).every(([A,E])=>E.type==="literal")){let A={},E=[];return Object.entries(e).forEach(([C,M])=>{M.type==="literal"&&M.value.type==="string"&&(E.push(M.value.value),M.description!=null&&(A[M.value.value]={description:M.description}))}),ADi({nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:u,fernEnum:A,enumVarNames:void 0,enumValues:E,_default:void 0,namespace:c,groupName:p,context:s,source:l,inline:void 0})}return e.length===1&&e[0]!=null&&!s.options.preserveSingleSchemaOneOf?e[0]:Dyy({nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:u,subtypes:e,namespace:c,groupName:p,encoding:o,source:l})}function mof({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsNullable:a,context:u,namespace:c,groupName:p,discriminator:s,encoding:o,source:l}){let O=Object.entries(s.mapping??{}).map(([C,M],q)=>{let L={$ref:M},U=Wci(L,!1,u,[M],o,l,c);return u.markSchemaWithDiscriminantValue(L,s.propertyName,C),U.type==="object"&&(U.properties={[s.propertyName]:Uh.literal({nameOverride:void 0,generatedName:doe([t,C],u.options.preserveSchemaIds),title:void 0,value:JL.string(C),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...U.properties.filter(Q=>Q.key!==s.propertyName)}),U}),A=[];for(let C=0;C<O.length;++C){let M=O[C],q=!1;for(let L=C+1;L<O.length;++L){let U=O[L];if(M!=null&&U!=null&&sRe(M,U)){q=!0;break}}M!=null&&!q&&A.push(M)}if(Object.entries(A).every(([C,M])=>M.type==="literal")){let C={},M=[];return Object.entries(A).forEach(([q,L])=>{L.type==="literal"&&L.value.type==="string"&&(M.push(L.value.value),L.description!=null&&(C[L.value.value]={description:L.description}))}),ADi({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,fernEnum:C,enumVarNames:void 0,enumValues:M,_default:void 0,namespace:c,groupName:p,context:u,source:l,inline:void 0})}return A.length===1&&A[0]!=null&&!u.options.preserveSingleSchemaOneOf?A[0]:Dyy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,subtypes:A,namespace:c,groupName:p,encoding:o,source:l})}function iID({schemas:e}){let t={},r=0;for(let a of e){if(!Ig(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let u=Object.keys(a.properties),c={},p=u;for(let[s,o]of Object.entries(t)){let l=y4u(o,u);p=y4u(p,o),c[s]=l}c[r]=p,t=c}}r++}let n=[],i=0;for(let a of e){let u=t[i];if(u!=null&&u.length>0){let c=u.sort();if(c[0]!=null){n.push(c[0]),++i;continue}}Ig(a)?n.push(bDi(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(bDi(i)??`${i}`),++i}return n}function Dyy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,description:i,availability:a,subtypes:u,namespace:c,groupName:p,encoding:s,source:o}){return n?Uh.nullable({nameOverride:e,generatedName:t,title:r,value:Uh.oneOf(gSe.undiscriminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,namespace:c,groupName:p,encoding:s,source:o,inline:void 0})),description:i,availability:a,namespace:c,groupName:p,inline:void 0}):Uh.oneOf(gSe.undiscriminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,namespace:c,groupName:p,encoding:s,source:o,inline:void 0}))}function pQa(e){if(e.default!=null&&typeof e.default=="string")return e.default}function Ays({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=HKi(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function Cyy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=HKi(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function I8r({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=HKi(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function Iyy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=HKi(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var JKi="#/components/schemas/";function E1(e,t,r,n,i,a,u=!1,c=new Set,p){let s=yyy(e)??i,o=dID({schema:e,logger:r.logger});if(Ig(e)){let l=PDi(e);return l!=null?(u?r.markSchemaAsReferencedByRequest(l):r.markSchemaAsReferencedByNonRequest(l),Wci(e,t,r,n,o,s,a)):K3o(r.resolveSchemaReference(e),t,r,mys(e.$ref),o,s,a,c,u,p)}return K3o(e,t,r,n,o,s,a,c,u,p)}function Wci(e,t,r,n,i,a,u){let c=e.$ref.includes("properties")?K3o(r.resolveSchemaReference(e),t,r,n,i,a,u,new Set):Uh.reference(gof(e,n,a,r.options.preserveSchemaIds));if(t===!1){let p=r.resolveSchemaReference(e);(p.nullable===!0||Array.isArray(p.type)&&p.type.length>=2&&p.type.includes("null"))&&(t=!0)}return t?Uh.nullable({title:void 0,nameOverride:void 0,generatedName:doe(n,r.options.preserveSchemaIds),value:c,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0}):c}function aID(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function K3o(e,t,r,n,i,a,u,c=new Set,p=!1,s){typeof e=="string"&&(e={type:e});let o=wy(e,Gv.TYPE_NAME)??(r.options.useTitlesAsName?aID(e.title):void 0),l=wy(e,Gv.SDK_GROUP_NAME)??wy(e,vye.TAGS)?.[0],O=(typeof l=="string"?[l]:l)??[];O=r.resolveGroupName(O);let A=doe(n,r.options.preserveSchemaIds),E=e.title,C=e.description,M=HOe(e),q=[];e.example!=null&&q.push({name:void 0,value:e.example,description:void 0});let L=wy(e,vye.EXAMPLES);L!=null&&Object.keys(L).length>0&&q.push(...Object.entries(L).map(([K,X])=>({name:X?.summary??K,value:X.value,description:X.description})));let U=HKi(e);U!=null&&Object.keys(U).length>0&&q.push(...U.map(K=>({name:void 0,value:K,description:void 0})));let Q=hyy({schema:e,description:C,title:E,nameOverride:o,generatedName:A,availability:M});if(Q!=null)return Q;try{if(Array.isArray(e.type)){let X=e.type.indexOf("null"),te=X!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&te)e.type.splice(X,1),e.type=e.type[0],e.nullable=!0;else if(te&&(e.type.splice(X,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let ee=new Set([...e.oneOf,...e.type]);e.oneOf=[...ee]}}if(!t&&e.nullable===!0&&(t=!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(te=>te!==null),!jys(e.enum))return foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.string({default:pQa(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:I8r({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:O,wrapAsNullable:t,description:C,availability:M});let X=_yy(e);return e.enum.length===1&&e.enum[0]!=null&&X==null?wyy({nameOverride:o,generatedName:A,title:E,wrapAsNullable:t,value:e.enum[0],description:C,availability:M,namespace:u,groupName:O}):ADi({nameOverride:o,generatedName:A,title:E,fernEnum:X,enumVarNames:wy(e,[vye.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:C,availability:M,wrapAsNullable:t,namespace:u,groupName:O,context:r,source:a,inline:void 0})}if(jys(e.type)&&e.type.length>1){let X=e.type.includes("null"),te=e.type.filter(ee=>ee!=="null").map(ee=>({type:ee,nullable:X}));return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:te,namespace:u,groupName:O,encoding:i,source:a})}if(e.type==="boolean"){let X=wy(e,Gv.BOOLEAN_LITERAL);return X!=null?Myy({nameOverride:o,generatedName:A,title:E,literal:JL.boolean(X),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O}):foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.boolean({default:oID(e.default),example:Cyy({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O})}if(e.type==="number")return vof({nameOverride:o,generatedName:A,title:E,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:GKi(e.exclusiveMinimum),exclusiveMaximum:GKi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:Ays({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:O});if(e.type==="integer")return Ayy({nameOverride:o,generatedName:A,title:E,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:GKi(e.exclusiveMinimum),exclusiveMaximum:GKi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:Ays({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:O});if(e.type==="float")return vof({nameOverride:o,generatedName:A,title:E,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:GKi(e.exclusiveMinimum),exclusiveMaximum:GKi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:Ays({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:O});if(e.type==="string"){if(e.format==="date-time")return foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.datetime({example:I8r({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O});if(e.format==="date"&&r.options.typeDatesAsStrings===!1)return foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.date({example:I8r({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O});if(e.format==="json-string")return Uh.unknown({nameOverride:o,generatedName:A,title:E,description:C,availability:M,namespace:u,groupName:O,example:void 0});let X=qyy(e,"const");return X!=null?Myy({nameOverride:o,generatedName:A,title:E,literal:JL.string(X),wrapAsNullable:t,description:C,availability:M,namespace:u,groupName:O}):foe({nameOverride:o,generatedName:A,title:E,primitive:Zg.string({default:pQa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:I8r({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:O,wrapAsNullable:t,description:C,availability:M})}if(e.type==="array")return gyy({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,item:e.items,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,example:Iyy({schema:e,logger:r.logger,fallback:s}),source:a});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&Pys(e))return vyy({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,additionalProperties:e.additionalProperties,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,encoding:i,example:e.example,source:a});if(e.oneOf!=null&&e.oneOf.length>0&&wy(e,Gv.IS_DISCRIMINATED)===!1)return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:e.oneOf,namespace:u,groupName:O,encoding:i,source:a});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?mof({nameOverride:o,generatedName:A,title:E,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,discriminator:e.discriminator,encoding:i,source:a}):hof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:u,groupName:O,encoding:i,source:a});if(e.oneOf!=null&&e.oneOf.length>0){let X=wy(e,Gv.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||X?mof({nameOverride:o,generatedName:A,title:E,description:C,availability:M,wrapAsNullable:t,context:r,namespace:u,groupName:O,discriminator:e.discriminator,encoding:i,source:a}):hof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:u,groupName:O,encoding:i,source:a});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(r.options.preserveSingleSchemaOneOf)return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:e.oneOf.filter(ee=>Ig(ee)||ee.type!=="null"),encoding:i,namespace:u,groupName:O,source:a});let te=E1(e.oneOf[0],t,r,n,a,u,p);return _Qa(te,C,u,O)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let ue=e.oneOf[0],me=e.oneOf[1];if(!Ig(ue)&&ue.type==="null")return E1(me,!0,r,n,a,u);if(!Ig(me)&&me.type==="null")return E1(ue,!0,r,n,a,u)}let te=cID({schemas:e.oneOf});if(te!=null)return ADi({nameOverride:o,generatedName:A,title:E,fernEnum:void 0,enumVarNames:void 0,enumValues:te,_default:e.default,description:C,availability:M,wrapAsNullable:t,namespace:u,groupName:O,context:r,source:a,inline:void 0});let ee=Byy({schemas:e.oneOf,context:r});if(ee!=null&&!r.options.discriminatedUnionV2&&!X)return yof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,properties:e.properties??{},required:e.required,description:C,availability:M,wrapAsNullable:t,discriminant:ee.discriminant,variants:ee.schemas,context:r,namespace:u,groupName:O,encoding:i,source:a});let re=e.oneOf.filter(ue=>!Ig(ue)&&ue.type==="null").length>0;return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t||re,context:r,subtypes:e.oneOf.filter(ue=>Ig(ue)||ue.type!=="null"),encoding:i,namespace:u,groupName:O,source:a})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let ee=E1(e.anyOf[0],t,r,n,a,u,p);return _Qa(ee,C,u,O)}if(e.anyOf.length===2){let[ee,re]=e.anyOf;if(ee!=null&&re!=null){if(!Ig(ee)&&ee.type==="null"){let ue=E1(re,!0,r,n,a,u);return _Qa(ue,C,u,O)}else if(!Ig(re)&&re.type==="null"){let ue=E1(ee,!0,r,n,a,u);return _Qa(ue,C,u,O)}}}let X=Byy({schemas:e.anyOf,context:r});if(X!=null&&!r.options.discriminatedUnionV2)return yof({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,properties:e.properties??{},required:e.required,description:C,availability:M,wrapAsNullable:t,discriminant:X.discriminant,variants:X.schemas,context:r,namespace:u,groupName:O,encoding:i,source:a});let te=e.anyOf.filter(ee=>!Ig(ee)&&ee.type==="null").length>0;return wDi({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t||te,context:r,subtypes:e.anyOf.filter(ee=>Ig(ee)||ee.type!=="null"),encoding:i,namespace:u,groupName:O,source:a})}if(e.allOf!=null||e.properties!=null){let X=[];for(let ee of e.allOf??[])(Ig(ee)||Object.keys(ee).length>0)&&X.push(ee);if((e.properties==null||Pys(e))&&X.length===1&&X[0]!=null){let ee=E1(X[0],t,r,n,a,u,p);return _Qa(ee,C,u,O)}let te=X.filter(ee=>{let re=wys(ee);return re||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(ee)}`),re});if((e.properties==null||Pys(e))&&te.length===1&&te[0]!=null){let ee=E1(te[0],t,r,n,a,u,p);return _Qa(ee,C,u,O)}return Eyy({nameOverride:o,generatedName:A,title:E,breadcrumbs:n,properties:e.properties??{},description:C,required:e.required,wrapAsNullable:t,allOf:te,context:r,propertiesToExclude:c,namespace:u,groupName:O,fullExamples:q,additionalProperties:e.additionalProperties,availability:M,encoding:i,source:a})}if(e.type==="object"&&uID(e)&&sID(e)&&Pys(e))return gys({nameOverride:o,generatedName:A,title:E,description:C,availability:M,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${A}Key`,title:void 0,description:void 0,availability:void 0,schema:Zg.string({default:pQa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:I8r({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:O},valueSchema:Uh.unknown({nameOverride:void 0,generatedName:`${A}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:O}),namespace:u,groupName:O,encoding:i,example:e.example});e.type!=null&&r.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${n.join("->")}. Coercing to unknown.`);let K=e.example??e.default;return Uh.unknown({nameOverride:o,generatedName:A,title:E,description:C,availability:M,namespace:u,groupName:O,example:K})}catch(K){return r.logger.debug(`Error converting schema: ${K.message}
|
|
2407
2407
|
Location: ${n.join("-> ")}`),Uh.unknown({nameOverride:o,generatedName:A,title:E,description:C,availability:M,namespace:u,groupName:O,example:void 0})}}function oID(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 PDi(e){if(e.$ref.startsWith(JKi))return e.$ref.replace(JKi,"")}function gof(e,t,r,n){let i=wy(e,Gv.TYPE_NAME),a=doe(t,n),u=e.description,c=HOe(e),p=PDi(e);if(p==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return $P.reference({generatedName:a,nameOverride:i,title:void 0,schema:p,description:u??void 0,availability:c,namespace:void 0,groupName:void 0,source:r})}function uID(e){return e.oneOf==null||e.oneOf.length===0}function sID(e){return e.allOf==null||e.allOf.length===0}function Pys(e){return e.properties==null||f7(e.properties)===0}function jys(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function _Qa(e,t,r,n){return e.type==="reference"?Uh.reference({...e,description:t,availability:e.availability,namespace:r,groupName:n}):e.type==="optional"?Uh.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0}):e.type==="nullable"?Uh.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0}):e}function wys(e){return Ig(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>wys(t)):e.oneOf!=null?e.oneOf.every(t=>wys(t)):e.anyOf!=null?e.anyOf.every(t=>wys(t)):!1}function Myy({literal:e,wrapAsNullable:t,namespace:r,groupName:n,description:i,availability:a,nameOverride:u,generatedName:c,title:p}){return t?Uh.nullable({nameOverride:u,generatedName:c,title:p,value:Uh.literal({nameOverride:u,generatedName:c,title:p,value:e,description:i,availability:a,namespace:r,groupName:n}),namespace:r,groupName:n,description:i,availability:a,inline:void 0}):Uh.literal({nameOverride:u,generatedName:c,title:p,value:e,namespace:r,groupName:n,description:i,availability:a})}function foe({primitive:e,wrapAsNullable:t,namespace:r,groupName:n,description:i,availability:a,generatedName:u,nameOverride:c,title:p}){return n=typeof n=="string"?[n]:n,t?Uh.nullable({nameOverride:c,generatedName:u,title:p,value:Uh.primitive({nameOverride:c,generatedName:u,title:p,schema:e,description:i,availability:a,namespace:r,groupName:n}),namespace:r,groupName:n,description:i,availability:a,inline:void 0}):Uh.primitive({nameOverride:c,generatedName:u,title:p,schema:e,description:i,availability:a,namespace:r,groupName:n})}function cID({schemas:e}){let t=new Set;for(let r of e){if(Ig(r))return;if(r.enum!=null&&jys(r.enum))r.enum.forEach(n=>t.add(n));else return}return Array.from(t)}function Byy({schemas:e,context:t}){let r={};for(let n of e){let i=Tyy({schema:n,context:t});for(let[a,u]of Object.entries(i)){let c=r[a];c!=null?c[u]=n:r[a]={[u]:n}}}for(let[n,i]of Object.entries(r))if(Object.keys(i).length===e.length)return{discriminant:n,schemas:i}}function Tyy({schema:e,context:t}){let r=Ig(e)?t.resolveSchemaReference(e):e;return lID({schema:r,context:t})}function lID({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let n of e.anyOf){let i=Tyy({schema:n,context:t});for(let[a,u]of Object.entries(i??{}))r[a]=u}return r}for(let[n,i]of Object.entries(e.properties??{})){let a=Ig(i)?t.resolveSchemaReference(i):i;a.type==="string"&&a.enum!=null&&jys(a.enum)&&fID(a.enum).length===1&&a.enum[0]!=null&&(r[n]=a.enum[0]);let u=qyy(a,"const");a.type==="string"&&u!=null&&(r[n]=u),n==="type"&&a.example!=null&&(r[n]=a.example)}return r}function fID(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 qyy(e,t){let r=e[t];if(r!=null)return r}function dID({schema:e,logger:t}){let r=pyy({schema:e,logger:t});if(r!=null)return Oyy(r)}var hQa=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(JKi))throw new Error(`Failed to resolve schema reference: ${t.$ref}`);let n=t.$ref.substring(JKi.length).split("/"),i=this.document.components;if(i==null||i.schemas==null)throw new Error("Document does not have components.schemas.");let[a,u,c]=n;if(a==null||a==="")throw new Error(`${t.$ref} cannot be resolved. No schema key provided.`);let p=i.schemas[a];if(p==null)throw new Error(`Schema "${a}" is undefined in document.components.schemas.`);if(Ig(p)&&(p=this.resolveSchemaReference(p)),u==="properties"&&c!=null){let s=p.properties?.[c];if(s==null)throw new Error(`Property "${c}" not found on "${a}". Full ref: ${t.$ref}`);Ig(s)?p=this.resolveSchemaReference(s):p=s}return p}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 Eys=class extends hQa{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 yQa(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 u=a.namespace;n[u]??={},n[u][i]=a;continue}case"oneOf":case"unknown":r[i]=a;continue;default:cc(a)}return{rootSchemas:r,namespacedSchemas:n}}function jDi(e){if(typeof e=="string")return xS.primitive(Im.string(e));if(typeof e=="number")return Number.isInteger(e)?xS.primitive(Im.int(e)):xS.primitive(Im.double(e));if(typeof e=="boolean")return xS.primitive(Im.boolean(e));if(Array.isArray(e)){let t=e.map(r=>jDi(r));return t.length===0?void 0:xS.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=jDi(n);i!=null&&t.push({key:Im.string(r),value:i})}return xS.map(t)}}function $3o(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function Nyy(e){if(e!=null&&Array.isArray(e))return e}var EDi=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:u,skipReadonly:c}){switch(n.type){case"enum":return typeof r=="string"&&Ryy({schema:n,value:r})?xS.enum(r):n.values[0]!=null?xS.enum(n.values[0]?.value):void 0;case"literal":return xS.literal(n.value);case"nullable":{if(r==null&&!this.hasExample(n.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(i,u)))return;let p=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:u,skipReadonly:c});return p!=null&&p.type==="array"&&p.value.length===0||p!=null&&p.type==="map"&&p.value.length===0||p!=null&&p.type==="object"&&Object.keys(p.properties).length===0?void 0:p}case"optional":{if(r==null&&!this.hasExample(n.value,0,a,u)&&(u.ignoreOptionals||this.exceedsMaxDepth(i,u))||Object.is(r,null))return;let p=this.buildExampleHelper({schema:n.value,visitedSchemaIds:a,exampleId:t,example:r,depth:i,options:u,skipReadonly:c});return p!=null&&p.type==="array"&&p.value.length===0||p!=null&&p.type==="map"&&p.value.length===0||p!=null&&p.type==="object"&&Object.keys(p.properties).length===0?void 0:p}case"primitive":{let p=this.buildExampleFromPrimitive({schema:n.schema,example:r,options:u});return xS.primitive(p)}case"reference":{let p=this.schemas[n.schema];if(p!=null&&!a.has(n.schema)){a.add(n.schema);let s=p?.type==="object"&&!this.nonRequestReferencedSchemas.has(n.schema),o=this.buildExampleHelper({example:r,schema:p,exampleId:t,visitedSchemaIds:a,depth:i,options:u,skipReadonly:s||this.context.options.respectReadonlySchemas?c:!1});return a.delete(n.schema),o}return}case"oneOf":switch(n.value.type){case"discriminated":{let p={},s={},o={},l=$3o(r),O=l?.[n.value.discriminantProperty],A=n.value.schemas[O],E=[],C=this.getDiscriminatedUnionVariantSchema(n.value,l);C!=null&&E.push(C),E.push(...Object.entries(n.value.schemas));for(let M of E)if(O!=null&&A!=null&&A.type==="object"){s=this.getAllProperties(A),o=this.getAllRequiredProperties(A),p[n.value.discriminantProperty]=xS.primitive(Im.string(O));break}else{let q=this.buildExampleHelper({exampleId:t,schema:M[1],example:void 0,visitedSchemaIds:a,depth:i,options:u,skipReadonly:c});if(q!=null){this.mergeExampleWith(q,p),p[n.value.discriminantProperty]=xS.primitive(Im.string(M[0]));break}}for(let M of n.value.commonProperties){s[M.key]={schema:M.schema,readonly:!1};let q=this.getResolvedSchema(M.schema);q.type!=="optional"&&q.type!=="nullable"&&(o[M.key]=M.schema)}for(let[M,q]of Object.entries(s)){let L=M in o;if(L&&l?.[M]!=null){let U=this.buildExampleHelper({schema:q.schema,exampleId:t,example:l[M],visitedSchemaIds:a,depth:i+1,options:u,skipReadonly:c});if(U!=null)p[M]=U;else return}else{let U=this.buildExampleHelper({exampleId:t,schema:q.schema,example:l?.[M],visitedSchemaIds:a,depth:i+1,options:u,skipReadonly:c});if(U!=null)p[M]=U;else if(L)return}}return xS.oneOf(cDi.discriminated(p))}case"undiscriminated":{let p=this.getUnDiscriminatedUnionVariantSchema(n.value,r);if(p!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:p,visitedSchemaIds:a,depth:i,options:u,skipReadonly:c});break}}return;case"unknown":if(r!=null){let p=jDi(r);if(p!=null)return xS.unknown(p)}return u.ignoreOptionals||this.exceedsMaxDepth(i,u)?void 0:u.isParameter?xS.primitive(Im.string(u.name??"string")):xS.map([{key:Im.string("key"),value:xS.primitive(Im.string("value"))}]);case"array":{let p=Nyy(r),s=[];if(p!=null&&p.length>0)for(let o of p){let l=this.buildExampleHelper({exampleId:t,example:o,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u,skipReadonly:c});l!=null&&s.push(l)}else if(n.example!=null&&n.example.length>0)for(let o of n.example){let l=this.buildExampleHelper({exampleId:t,example:o,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u,skipReadonly:c});l!=null&&s.push(l)}else{let o=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,depth:i+1,visitedSchemaIds:a,options:u,skipReadonly:c});o!=null&&s.push(o)}return xS.array(s)}case"map":{let p=$3o(r??n.example);if(p!=null&&Object.entries(p).length>0){let l=[];for(let[O,A]of Object.entries(p)){let E=this.buildExampleFromPrimitive({schema:n.key.schema,example:O,options:u}),C=this.buildExampleHelper({exampleId:t,example:A,schema:n.value,visitedSchemaIds:a,depth:i+1,options:u,skipReadonly:c});C!=null&&l.push({key:E,value:C})}return xS.map(l)}if(n.key.schema.type==="string"&&n.value.type==="unknown")return xS.map([{key:Im.string("key"),value:xS.unknown(xS.primitive(Im.string("value")))}]);let s=this.buildExampleFromPrimitive({schema:n.key.schema,example:void 0,options:{...u,name:"key"}}),o=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,visitedSchemaIds:a,depth:i+1,options:{...u,name:"value"},skipReadonly:c});return o!=null?xS.map([{key:s,value:o}]):xS.map([])}case"object":{let p={},s=n.fullExamples?.find(A=>A.name===t)??n.fullExamples?.find(A=>A.name==null)??n.fullExamples?.[0],o=$3o(r)??(s!=null?$3o(s.value):{})??{},l=this.getAllProperties(n),O=this.getAllRequiredProperties(n);for(let[A,E]of Object.entries(l)){if(c&&E.readonly||E.schema._visit({optional:L=>typeof L.availability=="string"&&L.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=A in O,M=Object.keys(o).includes(A),q=this.buildExampleHelper({schema:E.schema,exampleId:t,example:o[A],visitedSchemaIds:a,depth:i+1,options:{...u,name:A},skipReadonly:c});if(C&&q!=null)p[A]=q;else{if(C)return;(M&&q!=null||!u.ignoreOptionals&&q!=null)&&(p[A]=q)}}if(n.additionalProperties){for(let[A,E]of Object.entries(o))if(!(A in p)){let C=this.buildExampleHelper({schema:Uh.unknown({example:E,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0}),exampleId:t,example:E,visitedSchemaIds:a,depth:i+1,options:{...u,name:A},skipReadonly:c});C!=null&&(p[A]=C)}}return xS.object({properties:p})}default:cc(n)}}mergeExampleWith(t,r){t._visit({array:Hc,enum:Hc,literal:Hc,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:Hc,unknown:Hc,_other:Hc})}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){return r==null?t.schemas[0]:t.schemas.map(a=>({schema:a,heuristic:this.calcExampleHeuristic(a,r)})).sort((a,u)=>u.heuristic-a.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return Ryy({schema:t,value:r})?5:0;case"object":{if(!qT(r))return 0;let n=this.getAllProperties(t),i=0;for(let[a,u]of Object.entries(n))r[a]!=null?(i++,i+=this.calcExampleHeuristic(u.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(!qT(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 u of t.properties)if(this.hasExample(u.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 u=this.hasExample(a,r,n,i);return n.delete(t.schema),u}return!1}case"unknown":return t.example!=null;case"oneOf":return Object.values(t.value.schemas).some(a=>this.hasExample(a,r,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}buildExampleFromPrimitive({example:t,schema:r,options:n}){switch(r.type){case"string":return t!=null&&typeof t=="string"?Im.string(t):r.example!=null?Im.string(r.example):Im.string(n.name??vA.STRING);case"base64":return t!=null&&typeof t=="string"?Im.base64(t):r.example!=null?Im.base64(r.example):Im.base64(vA.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?Im.boolean(t):r.example!=null?Im.boolean(r.example):Im.boolean(vA.BOOLEAN);case"date":return t!=null&&typeof t=="string"?Im.date(t):r.example!=null?Im.date(r.example):Im.date(vA.DATE);case"datetime":return t!=null&&typeof t=="string"?Im.datetime(t):r.example!=null?Im.datetime(r.example):Im.datetime(vA.DATE_TIME);case"double":return t!=null&&typeof t=="number"?Im.double(t):r.example!=null?Im.double(r.example):Im.double(vA.DOUBLE);case"float":return t!=null&&typeof t=="number"?Im.float(t):r.example!=null?Im.float(r.example):Im.float(vA.FLOAT);case"int":return t!=null&&typeof t=="number"?Im.int(t):r.example!=null?Im.int(r.example):Im.int(vA.INT);case"int64":return t!=null&&typeof t=="number"?Im.int64(t):r.example!=null?Im.int64(r.example):Im.int64(vA.INT64);case"uint":return t!=null&&typeof t=="number"?Im.uint(t):r.example!=null?Im.uint(r.example):Im.uint(vA.UINT);case"uint64":return t!=null&&typeof t=="number"?Im.uint64(t):r.example!=null?Im.uint64(r.example):Im.uint64(vA.UINT64);default:cc(r)}}};function Ryy({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function yCr(e){switch(e.type){case"object":return Uh.object({allOf:e.allOf,properties:e.properties.map(t=>_ID(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 Uh.array({description:e.description,availability:e.availability,value:yCr(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 Uh.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 Uh.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 Uh.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:yCr(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"optional":return Uh.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:yCr(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"primitive":return Uh.primitive({description:e.description,availability:e.availability,schema:xyy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Uh.map({description:e.description,availability:e.availability,key:Uh.primitive({description:e.key.description,availability:e.key.availability,schema:xyy(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,namespace:e.namespace,groupName:e.groupName}),value:yCr(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 Uh.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 Uh.oneOf(pID(e.value));case"unknown":return Uh.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:cc(e)}}function pID(e){switch(e.type){case"discriminated":return gSe.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:yCr(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,yCr(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return gSe.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>yCr(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:cc(e)}}function xyy(e){switch(e.type){case"string":return Zg.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return Zg.base64({example:void 0});case"boolean":return Zg.boolean({default:e.default,example:void 0});case"date":return Zg.date({example:void 0});case"datetime":return Zg.datetime({example:void 0});case"double":return Zg.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 Zg.float({example:void 0});case"int":return Zg.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 Zg.int64({default:e.default,example:void 0});case"uint":return Zg.uint({default:void 0,example:void 0});case"uint64":return Zg.uint64({default:void 0,example:void 0});default:cc(e)}}function _ID(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:yCr(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function Sys(e){return e.type!=="optional"&&e.type!=="nullable"}function Oof(e){return e==="POST"||e==="PUT"||e==="PATCH"}function Y3o(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 Dys=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 EDi(t,r.nonRequestReferencedSchemas,r),this.logger=r.logger}buildEndpointExample(t){this.logger.debug(`Building endpoint example for ${t.method.toUpperCase()} ${t.path}`);let r=yID(t.request),n=vID(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 O=this.exampleTypeFactory.buildExample({skipReadonly:Oof(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});O!=null&&i.push([void 0,O])}else for(let{name:O,value:A}of r.examples){let E=this.exampleTypeFactory.buildExample({skipReadonly:Oof(t.method),schema:r.schema,exampleId:O,example:A,options:{isParameter:!1,ignoreOptionals:!0}});E!=null&&i.push([O,E])}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 O=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}});O!=null&&(t.response?.type==="json"?a.push([void 0,jdt.withoutStreaming(O)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,jdt.withStreaming({sse:t.response?.type==="streamingSse",events:[O]})]))}else for(let{name:O,value:A}of n.examples){let E=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:O,example:A,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});E!=null&&(t.response?.type==="json"?a.push([O,jdt.withoutStreaming(E)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&a.push([void 0,jdt.withStreaming({sse:t.response?.type==="streamingSse",events:[E]})]))}if(l&&a.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let u=[];for(let l of t.pathParameters){let O=this.isSchemaRequired(l.schema),A=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(A!=null&&!vCr(A)&&(this.logger.warn(`Expected a primitive example but got ${A.type} for path parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),A=void 0),O&&A==null)return[];A!=null&&u.push({name:l.name,parameterNameOverride:l.parameterNameOverride,value:A})}let c=[];for(let l of t.queryParameters){let O=this.isSchemaRequired(l.schema),A=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(A!=null&&!vCr(A)&&(this.logger.warn(`Expected a primitive example but got ${A.type} for query parameter ${l.name} for ${t.method.toUpperCase()} ${t.path}`),A=void 0),O&&A==null)return[];A!=null&&c.push({name:l.name,value:A})}let p=[];for(let l of t.headers){let O=this.isSchemaRequired(l.schema),A=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:void 0,options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});if(A!=null&&!vCr(A)&&(this.logger.warn(`Expected a primitive example but got ${A.type} for header ${l.name} for ${t.method.toUpperCase()} ${t.path}`),A=void 0),O&&A==null)return[];A!=null&&p.push({name:l.name,value:A})}for(let l of this.globalHeaders){let O=l.schema!=null?yCr(l.schema):Uh.primitive({nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,schema:Zg.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})}),A=this.exampleTypeFactory.buildExample({schema:O,exampleId:void 0,example:void 0,options:{name:l.header,isParameter:!0,ignoreOptionals:!0}});if(A!=null&&!vCr(A)&&(this.logger.warn(`Expected a primitive example but got ${A.type} for global header ${l.header} for ${t.method.toUpperCase()} ${t.path}`),A=void 0),A==null)return[];A!=null&&p.push({name:l.header,value:A})}let s=[];t.request!=null&&t.response!=null?s=hID(i,a):t.request!=null?s=i.map(([l,O])=>({id:l,request:O,response:void 0})):t.response!=null&&(s=a.map(([l,O])=>({id:l,request:void 0,response:O})));let o=t.examples.filter(l=>Y3o(l)).flatMap(l=>{if(l.type==="unknown"){if(l.value!=null){let O=l.value["code-samples"];if(O!=null)return this.convertCodeSamples(O)}return}else return l.codeSamples}).filter(l=>GP(l));return s.length===0?[wdt.full({name:void 0,description:void 0,pathParameters:u,queryParameters:c,headers:p,request:void 0,response:void 0,codeSamples:o})]:s.map(({id:l,request:O,response:A})=>wdt.full({name:l,description:void 0,pathParameters:u,queryParameters:c,headers:p,request:O,response:A,codeSamples:o}))}convertCodeSamples(t){return t.map(r=>"language"in r?A8r.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):A8r.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?Wle.Csharp:r.sdk,code:r.code})).filter(GP)}isSchemaRequired(t){return Sys(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function hID(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[u,c]of t)r.push({id:u??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[u,c]of e)r.push({id:u??i,request:c,response:a});return r}let n=new Set;for(let[i,a]of e){let u=t.find(([p])=>p==null)?.[1]??t[0]?.[1];if(i==null){if(u==null)continue;r.push({id:void 0,request:a,response:u});continue}let c=!1;for(let p=0;p<t.length;p++){let[s,o]=t[p];s==null||n.has(p)||i===s&&(r.push({id:i,request:a,response:o}),s!=null&&n.add(p),c=!0)}!c&&u!=null&&r.push({id:i,request:a,response:u})}for(let i=0;i<t.length;i++){if(n.has(i))continue;let[a,u]=t[i],c=e.find(([p])=>p==null)?.[1]??e[0]?.[1];c!=null&&r.push({id:a,request:c,response:u})}return r}function yID(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:bID(e),examples:[]}:e.type==="json"||e.type==="formUrlEncoded"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function vID(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 vCr(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return vCr(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undiscriminated":return vCr(e.value.value);default:return!1}default:cc(e)}}function bID(e){return Uh.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:yCr(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0,readonly:void 0,writeonly:void 0,inline:void 0}).filter(GP),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 vQa=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new EDi(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,handshake:n,source:i,namespace:a}){let u=[];for(let c of r){let p=[];for(let l of n.queryParameters){let O=this.isSchemaRequired(l.schema),A=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:c.queryParameters?.[l.name],options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});A!=null&&!vCr(A)&&(A=void 0),!(O&&A==null)&&A!=null&&p.push({name:l.name,value:A})}let s=[];for(let l of n.headers){let O=this.isSchemaRequired(l.schema),A=this.exampleTypeFactory.buildExample({schema:l.schema,exampleId:void 0,example:c.headers?.[l.name],options:{name:l.name,isParameter:!0,ignoreOptionals:!0}});A!=null&&!vCr(A)&&(A=void 0),!(O&&A==null)&&A!=null&&s.push({name:l.name,value:A})}let o=[];for(let l of c.messages){let O=t.getExampleMessageReference(l),A=t.resolveMessageReference({$ref:O}),E=Ig(A.payload)?t.resolveSchemaReference(A.payload):A.payload,C=this.exampleTypeFactory.buildExample({schema:E1(E,!1,t,[l.messageId],i,a),exampleId:void 0,example:l.value,options:{isParameter:!1,ignoreOptionals:!0}});C!=null&&o.push({messageType:l.type,payload:C,description:void 0})}u.push({name:c.summary,queryParameters:p,headers:s,description:c.description,messages:o})}return u}buildWebsocketSessionExample({handshake:t,messages:r}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},i=[];for(let u of t.queryParameters){let c=this.isSchemaRequired(u.schema),p=this.exampleTypeFactory.buildExample({schema:u.schema,exampleId:void 0,example:void 0,options:{name:u.name,isParameter:!0,ignoreOptionals:!0}});if(p!=null&&!vCr(p)&&(p=void 0),c&&p==null)return;p!=null&&i.push({name:u.name,value:p})}let a=[];for(let u of t.headers){let c=this.isSchemaRequired(u.schema),p=this.exampleTypeFactory.buildExample({schema:u.schema,exampleId:void 0,example:void 0,options:{name:u.name,isParameter:!0,ignoreOptionals:!0}});if(p!=null&&!vCr(p)&&(p=void 0),c&&p==null)return;p!=null&&a.push({name:u.name,value:p})}for(let u of r){let c=this.exampleTypeFactory.buildExample({schema:u.payload,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});c!=null&&n.messages.push({messageType:u.type,payload:c,description:void 0})}return n}isSchemaRequired(t){return Sys(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 ASe={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 Cys(e){return wy(e,ASe.FERN_EXAMPLES)??[]}function Iys(e,t){return t.includes("://")?t:`${e}://${t}`}function Mys(e){return e.startsWith("/")?e:"/"+e}function Qyy({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let a={},u={};for(let[s,o]of Object.entries(i.components?.schemas??{})){let l=E1(o,!1,e,[s],r,e.namespace);a[s]=l}let c=new vQa(a,e),p={};for(let[s,o]of Object.entries(i.servers??{}))p[s]={name:s,url:Iys(o.protocol,o.url)};for(let[s,o]of Object.entries(i.channels??{})){let l=wy(o,ASe.IGNORE);if(l!=null&&l){e.logger.debug(`Channel ${s} is marked with x-fern-ignore. Skipping.`);continue}let O=[];if(o.parameters!=null)for(let[q,L]of Object.entries(o.parameters??{}))O.push({name:q,description:L.description,parameterNameOverride:void 0,schema:L.schema!=null?E1(L.schema,!1,e,t,r,e.namespace):Uh.primitive({schema:Zg.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:HOe(L),source:r});let A=[],E=[];if(o.bindings?.ws!=null){if(o.bindings.ws.headers!=null){let q=o.bindings.ws.headers.required??[];for(let[L,U]of Object.entries(o.bindings.ws.headers.properties??{})){if(Ig(U)){let Q=e.resolveSchemaReference(U);A.push({name:L,schema:Wci(U,!1,e,t,void 0,r,e.namespace),description:Q.description,parameterNameOverride:void 0,env:void 0,availability:HOe(Q),source:r});continue}A.push({name:L,schema:E1(U,!q.includes(L),e,[...t,L],r,e.namespace),description:U.description,parameterNameOverride:void 0,env:void 0,availability:HOe(U),source:r})}}if(o.bindings.ws.query!=null){let q=o.bindings.ws.query.required??[];for(let[L,U]of Object.entries(o.bindings.ws.query.properties??{})){if(Ig(U)){let Q=e.resolveSchemaReference(U);E.push({name:L,schema:Wci(U,!1,e,t,void 0,r,e.namespace),description:Q.description,parameterNameOverride:void 0,availability:HOe(Q),source:r});continue}E.push({name:L,schema:E1(U,!q.includes(L),e,[...t,L],r,e.namespace),description:U.description,parameterNameOverride:void 0,availability:HOe(U),source:r})}}}let C;o.publish!=null&&("oneOf"in o.publish.message?C=Fyy({generatedName:o.publish.operationId??"PublishEvent",event:o.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):C=zyy({action:"Publish",channelPath:s,message:o.publish.message,context:e,source:r}));let M;if(o.subscribe!=null&&("oneOf"in o.subscribe.message?M=Fyy({generatedName:o.subscribe.operationId??"SubscribeEvent",event:o.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):M=zyy({action:"Subscribe",channelPath:s,message:o.subscribe.message,context:e,source:r})),A.length>0||E.length>0||C!=null||M!=null){let q=Cys(o),L=[];if(q.length>0)L=c.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:q,handshake:{headers:A,queryParameters:E},source:r,namespace:e.namespace});else{let X=[];C!=null&&X.push({type:"publish",payload:C}),M!=null&&X.push({type:"subscribe",payload:M});let te=c.buildWebsocketSessionExample({handshake:{headers:A,queryParameters:E},messages:X});te!=null&&L.push(te)}let U=wy(o,ASe.FERN_CHANNEL_ADDRESS),Q=U??Mys(s),K=[];C!=null&&K.push({origin:"client",name:"publish",body:gz(C)}),M!=null&&K.push({origin:"server",name:"subscribe",body:gz(M)}),u[s]={audiences:wy(o,Gv.AUDIENCES)??[],handshake:{headers:A.map(X=>({...X,schema:gz(X.schema),env:X.env})),queryParameters:E.map(X=>({...X,schema:gz(X.schema)})),pathParameters:O.map(X=>({...X,parameterNameOverride:void 0,schema:gz(X.schema)}))},groupName:e.resolveGroupName([wy(o,ASe.FERN_SDK_GROUP_NAME)??s]),messages:K,servers:(o.servers?.map(X=>p[X])??Object.values(p)).filter(X=>X!=null&&X.name!=null).map(X=>({...X,name:X.name})),summary:wy(o,ASe.FERN_DISPLAY_NAME),path:Q,description:o.description,examples:L,source:r}}}return{groupedSchemas:yQa(e.namespace,a),channels:u??void 0,servers:Object.values(p).map(s=>({...s,name:s.name})),basePath:wy(i,ASe.BASE_PATH)}}function Fyy({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:a,asyncApiOptions:u}){if("oneOf"in t.message&&t.message.oneOf!=null){let c=[],p=[];for(let s of t.message.oneOf){let o,l={type:"notFound"};if(Ig(s)){let O=r.resolveMessageReference(s);!Ig(O.payload)&&u.naming==="v2"?(l=O.name?{type:"name",name:O.name}:l,o={...O.payload,title:O.name??O.payload.title,description:O.name??O.payload.description}):o=O.payload}else o=s;p.push(l),c.push(o)}return wDi({description:t.description??t.message.description,availability:HOe(t.message),subtypes:c,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypePrefixOverrides:u.naming==="v2"?p:[]})}}function zyy({action:e,channelPath:t,message:r,context:n,source:i}){if(r.payload!=null){let a=r.payload;return Ig(r.payload)&&(a=n.resolveSchemaReference(r.payload)),E1(a,!1,n,[t,e],i,n.namespace)}}var Bys=class extends hQa{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){let r="#/channels/",n="#/components/messages/";if(t.$ref.startsWith(r)){let c=t.$ref.split("/"),p=c[2],s=c[4];if(p==null||s==null||!this.document.channels?.[p])throw new Error(`Failed to resolve message reference ${t.$ref} in channel ${p}`);let l=this.document.channels[p].messages?.[s];if(l==null)throw new Error(`${t.$ref} is undefined`);return"$ref"in l?this.resolveMessageReference(l):{name:s,...l}}let i=this.document.components;if(!t.$ref.startsWith(n)||!i?.messages)throw new Error(`Failed to resolve message reference: ${t.$ref} in v3 components`);let a=t.$ref.substring(n.length),u=i.messages[a];if(u==null)throw new Error(`${t.$ref} is undefined`);return{name:a,...u}}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}};var Lyy="#/channels/",Uyy="#/servers/",Aof="$message.";function Wyy({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let a={},u={},c={},p=[],s={};for(let[E,C]of Object.entries(i.components?.schemas??{}))a[E]=E1(C,!1,e,[E],r,e.namespace);for(let[E,C]of Object.entries(i.channels??{}))if(u[E]||(u[E]={}),C.messages){for(let[M,q]of Object.entries(C.messages))if(e.isReferenceObject(q)||e.isMessageWithPayload(q))if(c[M]||(c[M]=[]),e.isReferenceObject(q)){let L=e.resolveMessageReference(q);c[M].push({channelId:E,payload:L.payload})}else c[M].push({channelId:E,payload:q.payload})}for(let[E,C]of Object.entries(c))if(C.length===1){let M=C[0],q=M.channelId;u[q]=u[q]||{},u[q][E]=E1(M.payload,!1,e,[E],r,e.namespace)}else{p.push(E);for(let{channelId:M,payload:q}of C){let L=`${M}_${E}`;u[M]||(u[M]={}),u[M][L]=E1(q,!1,e,[L],r,e.namespace)}}let o=Object.values(u).reduce((E,C)=>({...E,...C}),{}),l=new vQa(o,e),O={};for(let[E,C]of Object.entries(i.servers??{}))O[E]={name:E,url:Iys(C.protocol,C.host)};let A={};for(let[E,C]of Object.entries(i.operations??{})){if(wy(C,ASe.IGNORE))continue;let M=gID(C);if(A[M]||(A[M]={subscribe:[],publish:[],__parsedMessages:[]}),C.action==="receive")A[M].subscribe.push(...C.messages);else if(C.action==="send")A[M].publish.push(...C.messages);else throw new Error(`Operation ${E} has an invalid action: ${C.action}`)}for(let[E,C]of Object.entries(A)){let M=[];M.push(...Vyy({messages:C.subscribe,channelPath:E,origin:"server",messageSchemas:u[E]??{},duplicatedMessageIds:p,context:e})),M.push(...Vyy({messages:C.publish,channelPath:E,origin:"client",messageSchemas:u[E]??{},duplicatedMessageIds:p,context:e})),A[E]!=null&&(A[E].__parsedMessages=M)}for(let[E,C]of Object.entries(i.channels??{})){if(wy(C,ASe.IGNORE))continue;let M=[],q=[],L=[];if(C.parameters!=null)for(let[U,Q]of Object.entries(C.parameters)){let K=e.isReferenceObject(Q)?e.resolveParameterReference(Q):Q,{type:X,parameterKey:te}=K.location!=null?mID(K.location):{type:C.address?.includes(`={${U}}`)?"query":"path",parameterKey:U},ee=wy(K,ASe.FERN_PARAMETER_OPTIONAL),re=g9(IO(E))+g9(IO(U)),ue={...K,type:"string",title:re,example:K.examples?.[0],default:K.default,enum:K.enum,required:void 0},me=E1(ue,!1,e,[te],r,e.namespace);ee&&(me=Uh.optional({value:me,description:void 0,availability:void 0,generatedName:"",title:re,namespace:void 0,groupName:void 0,nameOverride:void 0,inline:void 0}));let Oe={name:te,description:K.description,parameterNameOverride:void 0,schema:me,variableReference:void 0,availability:HOe(Q),source:r};X==="header"?M.push({...Oe,env:void 0}):X==="path"?q.push(Oe):(X==="payload"||X==="query")&&L.push(Oe)}if(M.length>0||L.length>0||A[E]!=null&&(A[E].publish!=null||A[E].subscribe!=null)){let U=Cys(C),Q=A[E]?.__parsedMessages??[],K=[];if(U.length>0)K=l.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:U,handshake:{headers:M,queryParameters:L},source:r,namespace:e.namespace});else{let te=[],{examplePublishMessage:ee,exampleSubscribeMessage:re}=AID({messages:Q,messageSchemas:u[E]??{}});ee!=null&&te.push(ee),re!=null&&te.push(re);let ue=l.buildWebsocketSessionExample({handshake:{headers:M,queryParameters:L},messages:te});ue!=null&&K.push(ue)}let X=wy(C,ASe.FERN_SDK_GROUP_NAME);s[E]={audiences:wy(C,Gv.AUDIENCES)??[],handshake:{headers:M.map(te=>({...te,schema:gz(te.schema),env:te.env})),queryParameters:L.map(te=>({...te,schema:gz(te.schema)})),pathParameters:q.map(te=>({...te,parameterNameOverride:void 0,schema:gz(te.schema)}))},groupName:e.resolveGroupName(typeof X=="string"?[X]:X??[E]),messages:Q,summary:wy(C,ASe.FERN_DISPLAY_NAME),servers:(C.servers?.map(te=>OID(O,te))??Object.values(O)).map(te=>({...te,name:te.name})),path:C.address?.split("?")[0]??Mys(E),description:C.description,examples:K,source:r}}}return{groupedSchemas:yQa(e.namespace,a),channels:s,servers:Object.values(O).map(E=>({...E,name:E.name})),basePath:wy(i,ASe.BASE_PATH)}}function gID(e){if(!e.channel.$ref.startsWith(Lyy))throw new Error(`Failed to resolve channel path from operation ${e.channel.$ref}`);return e.channel.$ref.substring(Lyy.length)}function mID(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(Aof))throw new Error(`Invalid location format: ${e}; expected ${Aof} prefix`);let n=t.substring(Aof.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 OID(e,t){if(!t.$ref.startsWith(Uyy))throw new Error(`Failed to resolve server name from server ref ${t.$ref}`);let r=t.$ref.substring(Uyy.length),n=e[r];if(n==null)throw new Error(`Failed to find server with name ${r}`);return n}function Vyy({messages:e,channelPath:t,origin:r,messageSchemas:n,duplicatedMessageIds:i,context:a}){let u=[];return e.forEach((c,p)=>{let o=a.resolveMessageReference(c).name;i.includes(o)&&(o=`${t}_${o}`);let l=n[o];l!=null&&u.push({origin:r,name:o??`${r}Message${p+1}`,body:gz(l)})}),u}function AID({messages:e,messageSchemas:t}){let r=e.find(u=>u.origin==="client")?.name,n=e.find(u=>u.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 Hyy({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:a}){let u=[];if(a!=null&&u.push(a),parseFloat(e.asyncapi)<3){let c=e;c.tags?.[0]!=null?u.push(c.tags[0].name):i.naming!=="v2"&&u.push("websocket");let p=new Eys({document:c,taskContext:t,options:r,namespace:a});return Qyy({context:p,breadcrumbs:u,source:n,asyncApiOptions:i,document:c})}else{let c=e,p=new Bys({document:c,taskContext:t,options:r,namespace:a});return Wyy({context:p,breadcrumbs:u,source:n,asyncApiOptions:i,document:c})}}function Gyy(e){return wy(e,Gv.ASYNC_CONFIG)}var Jyy="$request.";function Kyy(e){let t=wy(e,Gv.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:PID(t["stream-condition"]),responseStream:t["response-stream"],response:t.response}}function PID(e){return e.startsWith(Jyy)?e.slice(Jyy.length):e}function $yy(e){let t=e;if(t.cursor!=null)return xet.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});if("offset"in e){let r=e;return xet.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 xet.custom({results:r.results})}throw new Error("Invalid pagination extension")}function Yyy(e,t){let r=wy(t,Gv.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=wy(e,Gv.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:$yy(n)}return $yy(r)}}function Xyy(e){let t=wID(e),r={};return Pof({obj:t,occurrences:r,breadcrumbs:[]}),r}function Pof({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)Pof({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)Pof({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function wID(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?X3o(r.get):void 0,put:r?.put!=null?X3o(r.put):void 0,post:r?.post!=null?X3o(r.post):void 0,patch:r?.patch!=null?X3o(r.patch):void 0,delete:r?.delete!=null?X3o(r.delete):void 0}]))}}function X3o(e){return{...e,requestBody:e.requestBody!=null?Ig(e.requestBody)?e.requestBody:jID(e.requestBody):void 0}}function jID(e){let t,r;for(let n in e.content){let i=l7.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[l7.MULTIPART_FORM_DATA]:r}}:e}var Tys=class{endpoints;parser=new eHi;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 Zyy="#/components/parameters/",kyy="#/components/responses/",evy="#/components/examples/",tvy="#/components/requestBodies/",bQa=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=Xyy(t),this.options=i,this.source=a,this.filter=new Tys({context:r,options:i}),this.DUMMY=this.getDummy(),this.namespace=u}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let 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.warn(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(Ig(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(Zyy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(Zyy.length),n=this.document.components.parameters[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Ig(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(tvy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(tvy.length),n=this.document.components.requestBodies[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Ig(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(kyy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(kyy.length),n=this.document.components.responses[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Ig(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(evy))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(evy.length),n=this.document.components.examples[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return Ig(n)?this.resolveExampleReference(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 KKi=class extends bQa{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 EID=el.object({lang:el.string(),label:el.optional(el.string()),source:el.string()}),wof=el.array(EID);var rvy={README_EXT:"x-readme"};function SID(e){if(!Array.isArray(e))return!1;for(let t of e)if(!qT(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function nvy(e){let t=wy(e,rvy.README_EXT);if(!qT(t))return[];let r=t["code-samples"];if(!SID(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 ivy(e,t,r){let i=(wy(t,Gv.EXAMPLES)??[]).filter(s=>{let o=G$.serialization.ExampleEndpointCallSchema.parse(s);return o.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),o.ok}),a=G3o(t,vye.REDOCLY_CODE_SAMPLES_KEBAB,wof,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],c=[...G3o(t,vye.REDOCLY_CODE_SAMPLES_CAMEL,wof,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...a];c.length>0&&i.push({"code-samples":c.map(s=>({name:s.label??s.lang,language:s.lang,code:s.source,install:void 0,docs:void 0}))});let p=nvy(t);return p.length>0&&i.push({"code-samples":p}),i.map(wdt.unknown)}function avy(e){let t=wy(e,Gv.AVAILABILITY);if(t==="ga"||t==="generally-available")return Vle.GenerallyAvailable;if(t==="beta"||t==="pre-release")return Vle.Beta;if(t==="deprecated")return Vle.Deprecated;if(e.deprecated)return Vle.Deprecated}function ovy(e){let t=wy(e,Gv.RETRIES);if(t!=null&&t.disabled===!0)return n_s.RetriesConfiguration.disabled(t.disabled)}function qys(e,t){return{url:DID({url:e.url,variables:e.variables??{}}),description:e.description,name:CID(e,t),audiences:wy(e,Gv.AUDIENCES)}}function DID({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 CID(e,t){let r=wy(e,[Gv.SERVER_NAME_V1,Gv.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 uvy(e){return wy(e,Gv.PARAMETER_NAME)}function svy(e){return wy(e,Gv.SDK_VARIABLE)}function Nys({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:a}){let u={pathParameters:[],queryParameters:[],headers:[]};for(let c of r){let p=wy(c,Gv.IGNORE);if(p!=null&&p){n.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let s=Ig(c)?n.resolveParameterReference(c):c,o=s.required??!1,l=HOe(s),O=[...i,s.name],A=doe(O,n.options.preserveSchemaIds),E=s.schema!=null?E1(s.schema,!o,n,O,a,n.namespace,!1,new Set,I8r({schema:s,logger:n.logger})):o?Uh.primitive({nameOverride:void 0,generatedName:A,title:void 0,schema:Zg.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:I8r({schema:s,logger:n.logger})}),description:void 0,availability:l,namespace:void 0,groupName:void 0}):Uh.optional({nameOverride:void 0,generatedName:A,title:void 0,value:Uh.primitive({nameOverride:void 0,generatedName:A,title:void 0,schema:Zg.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:I8r({schema:s,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(s.in==="header"&&s.schema!=null&&!Ig(s.schema)&&s.schema.default!=null){let M=s.schema.default;typeof M=="string"&&M.length>0&&(E=Uh.literal({nameOverride:void 0,generatedName:A,title:void 0,value:JL.string(M),description:void 0,availability:l,namespace:void 0,groupName:void 0}))}let C={name:s.name,schema:E,description:s.description,parameterNameOverride:uvy(s),availability:l,source:a};s.in==="query"?u.queryParameters.push(C):s.in==="path"?u.pathParameters.push({...C,variableReference:svy(s)}):s.in==="header"?!IID.has(s.name.toLowerCase())&&!n.authHeaders.has(s.name)?u.headers.push({...C,env:void 0}):n.logger.debug(`Ignoring ${s.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${s.in} parameter, ${s.name}, in ${t.toUpperCase()} ${e}`)}return u}var IID=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]);function cvy(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:Z3o(n,t)}}}function MID(e){return e.includes("json")||e==="*/*"}function jof({content:e,context:t}){for(let[r,n]of Object.entries(e))if(Rys({mediaType:r,mediaTypeObject:n,context:t})!=null)return[r,n]}function Rys({mediaType:e,mediaTypeObject:t,context:r}){if(!MID(e))return;let n=t.schema;return{contentType:e.includes("*")?void 0:e,schema:n??{},examples:Z3o(t,r)}}function xys({content:e,context:t}){let r=jof({content:e,context:t});if(!r)return;let[n,i]=r;return Rys({mediaType:n,mediaTypeObject:i,context:t})}function lvy(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:Z3o(n,t)}}}function Z3o(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=wy(e,vye.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 u=Ig(a)?t.resolveExampleReference(a):a;return{name:u.summary??i,value:u.value,description:u.description}})),r}function BID({content:e,context:t}){for(let[r,n]of Object.entries(e))if(dvy({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function dvy({mediaType:e,mediaTypeObject:t,context:r}){if(l7.parse(e)?.isURLEncoded())return{schema:t.schema,contentType:e,examples:Z3o(t,r)}}function TID({content:e}){for(let[t,r]of Object.entries(e))if(pvy({mediaType:t,mediaTypeObject:r}))return[t,r]}function pvy({mediaType:e,mediaTypeObject:t}){if(l7.parse(e)?.isMultipart())return{schema:t.schema,encoding:t.encoding}}function _vy({mediaType:e}){return l7.parse(e)?.isBinary()??!1}function qID({content:e}){for(let[t,r]of Object.entries(e))if(_vy({mediaType:t}))return[t,r]}function NID(e,t){let r=Ig(e)?Eof(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!Ig(i)&&i.type==="string"&&i.format==="binary")!=null}function zys({content:e,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:u}){let c=qID({content:e});if(c){let[O,A]=c;return M8r({mediaType:O,mediaTypeObject:A,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:u})}let p=TID({content:e}),s=jof({content:e,context:n}),o=RID({json:s,multipart:p,document:r,visitor:{json:([O,A])=>M8r({mediaType:O,mediaTypeObject:A,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:u}),multipart:([O,A])=>M8r({mediaType:O,mediaTypeObject:A,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:u}),neither:()=>{}}});if(o)return o;let l=BID({content:e,context:n});if(l){let[O,A]=l;return M8r({mediaType:O,mediaTypeObject:A,description:t,document:r,context:n,requestBreadcrumbs:i,source:a,namespace:u})}}function RID({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&&NID(i.schema,r)?n.multipart(t):n.json(e):i?.schema?n.json(e):a?.schema?n.multipart(t):n.neither()}function M8r({mediaType:e,mediaTypeObject:t,description:r,document:n,context:i,requestBreadcrumbs:a,source:u,namespace:c}){let p=xID({mediaTypeObject:t});if(_vy({mediaType:e}))return bSe.octetStream({description:r,source:u,sdkMethodName:p,contentType:e});let s=pvy({mediaType:e,mediaTypeObject:t}),o=s?.schema,l=s?.encoding;if(o){let E=Ig(o)?Eof(o,n):{id:void 0,schema:o},C=E1(E.schema,!1,i,a,u,c,!1),M=[];if(C.type==="object")for(let q of C.properties){let{isFile:L,isOptional:U,isArray:Q,description:K}=Fys({schema:q.schema});if(L){let X=fvy(q.key,l);M.push({key:q.key,schema:P8r.file({isOptional:U,isArray:Q,description:K}),description:K,contentType:X,exploded:!1,encoding:X==null?i.options.defaultFormParameterEncoding:void 0})}else{let X=fvy(q.key,l);M.push({key:q.key,schema:P8r.json(q.schema),description:void 0,contentType:X,exploded:l?.[q.key]?.explode,encoding:X==null?i.options.defaultFormParameterEncoding:zID(X)})}}return bSe.multipart({name:Ig(o)&&i.getNumberOfOccurrencesForRef(o)===1?E.id:void 0,description:E.schema.description,properties:M,source:u,sdkMethodName:p})}let O=Rys({mediaType:e,mediaTypeObject:t,context:i});if(O){let E=E1(O.schema,!1,i,a,u,c,!0);return bSe.json({description:void 0,schema:E,contentType:O.contentType,fullExamples:O.examples,additionalProperties:!Ig(O.schema)&&dQa(O.schema.additionalProperties,i.options),source:u,sdkMethodName:p})}let A=dvy({mediaType:e,mediaTypeObject:t,context:i});if(A!=null&&A.schema!=null){let E=E1(A.schema,!1,i,a,u,c,!1);return bSe.formUrlEncoded({schema:E,description:r,contentType:A.contentType,source:u,fullExamples:A.examples,additionalProperties:!1,sdkMethodName:p})}}function xID({mediaTypeObject:e}){return wy(e,Gv.SDK_METHOD_NAME)}var FID={"application/json":"json"};function zID(e){return e?FID[e]:void 0}function Eof(e,t){if(!e.$ref.startsWith(JKi))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=PDi(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 Ig(n)?Eof(n,t):{id:r,schema:n}}function Fys({schema:e,isOptional:t,isArray:r,description:n}){return LID(e)?Fys({schema:e.value,isOptional:!0,isArray:r,description:e.description}):UID(e)?Fys({schema:e.value,isOptional:t,isArray:r,description:e.description}):VID(e)?Fys({schema:e.value,isOptional:t,isArray:!0,description:e.description}):QID(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 QID(e){return e.type==="primitive"&&e.schema.type==="string"&&e.schema.format==="binary"}function LID(e){return e.type==="optional"}function UID(e){return e.type==="nullable"}function VID(e){return e.type==="array"}function fvy(e,t){return t?.[e]?.contentType}var Sof={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"},hvy=new Set(Object.values(Sof));var WID=["200","201","202","204"];function vvy({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:a,source:u}){if(t==null)return{value:void 0,errors:{}};let c=HID({responses:t,context:r,source:u,namespace:r.namespace}),p=!1,s;for(let o of i!=null?[i]:WID){let l=t[o];l!=null&&(p=!0,s==null&&(s=yvy({operationContext:e,response:l,context:r,responseBreadcrumbs:n,streamFormat:a,source:u,namespace:r.namespace,statusCode:typeof o=="string"?parseInt(o):o})))}if(s==null&&!p&&t.default!=null&&(s=yvy({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:a,source:u,namespace:r.namespace})),s!=null)switch(s.type){case"json":return{value:s,errors:c};case"streamingJson":case"streamingSse":return{value:s,errors:c};case"bytes":case"file":case"text":case"streamingText":return{value:s,errors:c};default:cc(s)}return{value:void 0,errors:c}}function yvy({operationContext:e,streamFormat:t,response:r,context:n,responseBreadcrumbs:i,source:a,namespace:u,statusCode:c}){let p=Ig(r)?n.resolveResponseReference(r):r;if(p.content!=null&&Object.entries(p.content).find(([O,A])=>{if(A.schema==null)return!1;let E=Ig(A.schema)?n.resolveSchemaReference(A.schema):A.schema;return E.type==="string"&&E.format==="binary"}))return n.options.useBytesForBinaryResponse&&t==null?_Q.bytes({description:p.description,source:a,statusCode:c}):_Q.file({description:p.description,source:a,statusCode:c});let s=cvy(p.content??{},n);if(s!=null&&t!=null)switch(t){case"json":return _Q.streamingJson({statusCode:c,description:p.description,responseProperty:wy(e.operation,Gv.RESPONSE_PROPERTY),fullExamples:s.examples,schema:E1(s.schema,!1,n,i,a,u),source:a});case"sse":return _Q.streamingSse({description:p.description,responseProperty:void 0,fullExamples:s.examples,schema:E1(s.schema,!1,n,i,a,u),source:a,statusCode:c})}let o=xys({context:n,content:p.content??{}});if(o){if(t!=null)switch(t){case"json":return _Q.streamingJson({description:p.description,responseProperty:void 0,fullExamples:o.examples,schema:E1(o.schema,!1,n,i,a,u),source:a,statusCode:c});case"sse":return _Q.streamingSse({description:p.description,responseProperty:void 0,fullExamples:o.examples,schema:E1(o.schema,!1,n,i,a,u),source:a,statusCode:c})}return _Q.json({description:p.description,schema:E1(o.schema,!1,n,i,a,u),responseProperty:wy(e.operation,Gv.RESPONSE_PROPERTY),fullExamples:o.examples,source:a,statusCode:c})}for(let[l,O]of Object.entries(p.content??{})){let A=l7.parse(l);if(A!=null){if(A.isOctetStream()||A.isPDF()||A.isAudio()||A.isImage()||A.isVideo()||A.isMultiPartMixed())return _Q.file({description:p.description,source:a,statusCode:c});if(A.isPlainText()){let E=O.schema;if(E==null)return _Q.text({description:p.description,source:a,statusCode:c});let C=Ig(E)?n.resolveSchemaReference(E):E;return C.type==="string"&&C.format==="byte"?_Q.file({description:p.description,source:a,statusCode:c}):_Q.text({description:p.description,source:a,statusCode:c})}}}}function HID({responses:e,context:t,source:r,namespace:n}){let i={};for(let[a,u]of Object.entries(e)){if(a==="default")continue;let c=parseInt(a);if(c<400||c>600)continue;let p=Ig(u)?t.resolveResponseReference(u):u,s=lvy(p.content??{},t),o=Sof[c];if(o==null){t.logger.warn(`No error name found for status code ${a}`);continue}i[c]={statusCode:c,nameOverride:void 0,generatedName:o,description:p.description,schema:E1(s?.schema??{},!1,t,[o,"Body"],r,n),fullExamples:s?.examples,source:r}}return i}function Hci({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,source:a}){let{document:u,operation:c,path:p,method:s,baseBreadcrumbs:o}=e,l=wy(c,Gv.IDEMPOTENT),O=wy(c,[Gv.REQUEST_NAME_V1,Gv.REQUEST_NAME_V2]),A=[...o,"Request"],E=Nys({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:A,path:p,httpMethod:s,source:a}),C=/{([^}]+)}/g,q=[...p.matchAll(C)].map(ue=>ue[1]).filter(ue=>!E.pathParameters.some(me=>me.name===ue));if(q.length>0)for(let ue of q)E.pathParameters.push({name:ue??"",variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:Uh.primitive({schema:Zg.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});let L=(()=>{if(e.method==="GET")return[void 0];if(!c.requestBody)return[void 0];let ue=Ig(c.requestBody)?t.resolveRequestBodyReference(c.requestBody):c.requestBody,me=Object.values(ue.content).every(Ee=>JID({mediaTypeObject:Ee})!=null),Oe=[];if(me)return Oe.push(...Object.entries(ue.content).map(([Ee,Ae])=>{let Me=M8r({mediaType:Ee,mediaTypeObject:Ae,description:ue.description,document:u,context:new KKi({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:A,source:a,namespace:t.namespace});return bvy({context:t,convertedParameters:E})&&Me!=null&&(Me.type==="json"||Me.type==="formUrlEncoded")&&Me.schema.type!=="object"&&c.requestBody!=null?Me=M8r({mediaType:Ee,mediaTypeObject:Ae,description:ue.description,document:u,context:t,requestBreadcrumbs:[...A,"Body"],source:a,namespace:t.namespace}):c.requestBody!=null&&(Me=M8r({mediaType:Ee,mediaTypeObject:Ae,description:ue.description,document:u,context:t,requestBreadcrumbs:[...A],source:a,namespace:t.namespace})),Me}).filter(Ee=>Ee!=null)),Oe.length===0?[void 0]:Oe;{let Ee=zys({content:ue.content,description:ue.description,document:u,context:new KKi({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:A,source:a,namespace:t.namespace});return bvy({context:t,convertedParameters:E})&&Ee!=null&&(Ee.type==="json"||Ee.type==="formUrlEncoded")&&Ee.schema.type!=="object"&&c.requestBody!=null?Ee=zys({content:ue.content,description:ue.description,document:u,context:t,requestBreadcrumbs:[...A,"Body"],source:a,namespace:t.namespace}):c.requestBody!=null&&(Ee=zys({content:ue.content,description:ue.description,document:u,context:t,requestBreadcrumbs:[...A],source:a,namespace:t.namespace})),[Ee]}})(),U=L.length>1,Q=[...o,"Response"],K=vvy({operationContext:e,streamFormat:i,responses:c.responses,context:t,responseBreadcrumbs:Q,responseStatusCode:r,source:a}),X=ovy(c),te=avy(c),ee=ivy(e,c,t),re=wy(c,Gv.SERVER_NAME_V2);return L.map(ue=>({summary:c.summary,internal:wy(c,vye.INTERNAL),idempotent:l,audiences:wy(c,Gv.AUDIENCES)??[],operationId:c.operationId!=null&&n!=null?c.operationId+"_"+n:c.operationId,tags:t.resolveTagsToTagIds(c.tags),namespace:t.namespace,sdkName:KID({operationContext:e,request:ue}),pathParameters:E.pathParameters,queryParameters:E.queryParameters,headers:E.headers,requestNameOverride:O??void 0,generatedRequestName:doe(U?GID({breadcrumbs:A,request:ue}):A,t.options.preserveSchemaIds),request:ue,response:K.value,errors:K.errors,servers:re!=null?[{name:re,url:void 0,audiences:void 0}]:(c.servers??[]).map(me=>qys(me,{groupMultiApiEnvironments:t.options.groupMultiApiEnvironments})),description:c.description,authed:$ID(c,u),availability:te,method:s,path:p,examples:ee,pagination:e.pagination,source:a,retries:X}))}function GID({breadcrumbs:e,request:t}){return t?[...e,t.type]:e}function JID({mediaTypeObject:e}){return wy(e,Gv.SDK_METHOD_NAME)}function KID({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 $ID(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function bvy({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function mvy({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:a,operationParameters:u}=e,c=r.discriminant.name,p=r.discriminant.value,s=r["response-status-code"],o=gvy({context:t,headerToIgnore:c,parameters:a}),l=gvy({context:t,headerToIgnore:c,parameters:u}),O=Hci({operationContext:{...e,pathItemParameters:o,operationParameters:l,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([E])=>parseInt(E)!==s))}},context:t,streamFormat:void 0,source:n}),A=Hci({operationContext:{...e,pathItemParameters:o,operationParameters:l,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:s,streamFormat:void 0,source:n});return A.forEach(E=>{E.headers.push({name:c,schema:Uh.literal({nameOverride:void 0,generatedName:doe([c],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:JL.string(p),namespace:void 0,groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n})}),{sync:O,async:A}}function gvy({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=Ig(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}var Dof="stream";function wvy({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:Hci({operationContext:e,context:t,streamFormat:r.format,source:t.source}),nonStreaming:[]};case"streamCondition":{let n=Ovy({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0});if(n?.schemaReference!=null){let s=PDi(n.schemaReference);s!=null&&t.excludeSchema(s)}let i=Avy({operation:e.operation,response:r.responseStream}),a=Hci({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+Dof}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:n?.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,Dof]},context:t,streamFormat:r.format,suffix:Dof,source:t.source});a.forEach(s=>{s.examples=s.examples.filter(o=>Pvy(o,t)!==!1)});let u=Ovy({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),c=Avy({operation:e.operation,response:r.response}),p=Hci({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:u?.requestBody,responses:c}},context:t,source:t.source});return p.forEach(s=>{s.examples=s.examples.filter(o=>Pvy(o,t)!==!0)}),{streaming:a,nonStreaming:p}}default:cc(r)}}function Ovy({context:e,operation:t,streamingExtension:r,isStreaming:n}){if(t.requestBody==null)return;let i=Ig(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,a=xys({content:i.content,context:e});if(a==null)return;let u=Ig(a.schema)?e.resolveSchemaReference(a.schema):a.schema;if(u.allOf==null&&u.properties==null)return;let c=u.properties?.[r.streamConditionProperty];c!=null&&Ig(c)&&(c=void 0);let p={...u,properties:{...u.properties,[r.streamConditionProperty]:{type:"boolean","x-fern-boolean-literal":n,...c??{}}},title:void 0,required:[...u.required??[],r.streamConditionProperty]};return{requestBody:{content:{[l7.APPLICATION_JSON]:{schema:p}}},schemaReference:Ig(a.schema)?a.schema:void 0}}function Avy({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[l7.APPLICATION_JSON]:{schema:t}}}}}function Pvy(e,t){return e._visit({unknown:r=>{let n=G$.serialization.ExampleEndpointCallSchema.parse(r);if(n.ok&&n.value.response!=null)return n.value.response.stream!=null},full:()=>{},_other:()=>{}})}function jvy({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:a,method:u,baseBreadcrumbs:c,sdkMethodName:p}=t,s=[...c,"Payload"],o=Nys({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:s,path:a,httpMethod:u,source:r});if(i.requestBody==null)return e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Missing a request body`),[];let l=i.operationId;if(l==null)return e.logger.error(`Skipping webhook ${a} because no operation id present`),[];if(u!=="POST"&&u!=="GET")return e.logger.error(`Skipping webhook ${u.toUpperCase()} ${a}: Not POST or GET`),[];let O=Ig(i.requestBody)?e.resolveRequestBodyReference(i.requestBody):i.requestBody;return Object.entries(O.content).map(([A,E])=>M8r({mediaType:A,mediaTypeObject:E,description:O.description,document:n,context:e,requestBreadcrumbs:[...c,"Payload"],source:r,namespace:e.namespace})).filter(A=>A!=null).map(A=>{if(A==null||A.type!=="json"&&A.type!=="formUrlEncoded"){e.logger.error(`Skipping webhook ${a} because non-json and non-formUrlEncoded request body`);return}return{summary:i.summary,audiences:wy(i,Gv.AUDIENCES)??[],sdkName:p,namespace:e.namespace,method:u,operationId:l,tags:e.resolveTagsToTagIds(i.tags),headers:o.headers,generatedPayloadName:doe(s,e.options.preserveSchemaIds),payload:A.schema,description:i.description,examples:YID(A.fullExamples),source:r}}).filter(A=>A!=null)}function YID(e){if(e==null)return[];let t=[];for(let r of e){let n=jDi(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function Cof({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=wy(r,Gv.IGNORE);if(i!=null&&i){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let a=XID(r,e),u=Yyy(e.document,r),c={...t,sdkMethodName:a,baseBreadcrumbs:ZID({operation:r,sdkMethodName:a,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:u};if(n)return{type:"webhook",value:jvy({context:e,operationContext:c,source:e.source})};let p=Kyy(r);if(p!=null){let l=wvy({context:e,operationContext:c,streamingExtension:p});return l!=null?{type:"streaming",streaming:l.streaming,nonStreaming:l.nonStreaming}:void 0}let s=Gyy(r);if(s!=null){let l=mvy({context:e,operationContext:c,asyncExtension:s,source:e.source});return{type:"async",async:l.async,sync:l.sync}}return{type:"http",value:Hci({context:e,operationContext:c,streamFormat:void 0,source:e.source})}}function XID(e,t){let r=wy(e,Gv.SDK_METHOD_NAME),n=wy(e,Gv.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function ZID({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 u=e.groupName[e.groupName.length-1];u!=null&&a.push(typeof u=="string"?u:u.name)}i||a.push(e.methodName)}else t.operationId!=null?a.push(t.operationId):a.push(IO(`${r}_${n.split("/").join("_")}`));return a}function Evy(e,t,r,n){let i=[],a=Dvy(t),u={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 p=kID({operation:c.operation}),s=Cof({context:n,pathItemContext:{...u,method:c.method},operation:c.operation,convertToWebhook:p});s&&i.push(s)}return i}function Svy(e,t,r,n){let i=[],a=Dvy(t),u={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 p=Cof({context:n,pathItemContext:{...u,method:c.method},operation:c.operation,convertToWebhook:!0});p&&i.push(p)}return i}function Dvy(e){let t=[];return e.get!=null&&t.push({method:Hle.Get,operation:e.get}),e.post!=null&&t.push({method:Hle.Post,operation:e.post}),e.put!=null&&t.push({method:Hle.Put,operation:e.put}),e.delete!=null&&t.push({method:Hle.Delete,operation:e.delete}),e.patch!=null&&t.push({method:Hle.Patch,operation:e.patch}),e.head!=null&&t.push({method:Hle.Head,operation:e.head}),t}function kID({operation:e}){return wy(e,[Gv.WEBHOOK])??!1}function Cvy(e){let t=wy(e,Gv.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=wy(e,Gv.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function Ivy(e){return wy(e,Gv.FERN_BASIC_AUTH)}function Mvy(e,t,r){if(Ig(e))throw new Error(`Converting referenced security schemes is unsupported: ${JSON.stringify(e)}`);return eMD(e,t,r)}function eMD(e,t,r){try{if(e.type==="apiKey"&&e.in==="header"){let n=wy(e,vye.BEARER_FORMAT),i=wy(e,Gv.FERN_HEADER_AUTH);return Ule.header({headerName:e.name,prefix:n!=null?"Bearer":i?.prefix,headerVariableName:i?.name??wy(e,Gv.HEADER_VARIABLE_NAME),headerEnvVar:i?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="bearer"){let n=wy(e,Gv.FERN_BEARER_TOKEN);return Ule.bearer({tokenVariableName:n?.name??wy(e,Gv.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:n?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="basic"){let n=Ivy(e),i=Cvy(e);return Ule.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 Ule.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return Ule.oauth({scopesEnum:tMD(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 tMD(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=ADi({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([a,u])=>[a,{description:u}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsNullable:!1,namespace:void 0,groupName:void 0,context:void 0,source:t,inline:void 0}),i=gz(n);if(i.type==="enum")return i}}function Bvy(e){return wy(e,Gv.BASE_PATH)}var rMD=el.record(el.string(),el.object({summary:el.string().optional(),description:el.string().optional()}));function Tvy({document:e,context:t}){return G3o(e,Gv.GROUPS,rMD,t.logger)}function qvy({context:e,document:t}){return wy(t,Gv.FERN_VERSION)??void 0}function Nvy(e){let t=wy(e,Gv.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?J3o({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 Rvy(e){let t=wy(e,Gv.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?J3o({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 xvy(e,t){let r=wy(e,Gv.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([n,i])=>{if(i.type==="string")return[n,{nameOverride:void 0,generatedName:doe([n],t),title:i.title,schema:iT.string({default:pQa(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 nMD="webhooks";function Fvy(e){return wy(e,nMD)??{}}var Qys=class extends bQa{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:u}){super({document:t,taskContext:r,authHeaders:n,options:i,source:a,namespace:u})}getDummy(){return new KKi({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 zvy(e){return wy(e,Gv.RESOLUTIONS)}function Qvy({openapi:e}){let t=zvy(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=iMD({openapi:e,schemaReference:a,schemaName:n.name}),e=Lvy({openapi:e,replaceReference:a,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(u=>[i,u]))}}return e}function iMD({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(a=>a.replaceAll("~1","/")),i=e;for(let a of n){let u=i[a];if(u==null)return e;i=u}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function Lvy({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(p=>t.startsWith(p)).sort((p,s)=>s.length-p.length)[0];if(i!=null){let p=n[i];if(p!=null){let s=r.replace(i,p);return Lvy({openapi:e,replaceReference:t,schemaReference:s,replacedReferences:{}})}}let a=t.replace("#/","").split("/").map(p=>p.replaceAll("~1","/")),u=e;for(let p of a.slice(0,-1)){let s=u[p];if(s==null)return e;u=s}let c=a[a.length-1];return c==null||(u[c]={$ref:r}),e}function Vvy({openApi:e,taskContext:t,options:r,source:n,namespace:i}){e=Qvy({openapi:e});let a=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([ee,re])=>{let ue=Mvy(re,n,t);return ue==null?null:[ee,ue]}).filter(ee=>ee!==null)),u=new Set(...Object.entries(a).map(([ee,re])=>re.type==="basic"||re.type==="bearer"?"Authorization":re.type==="header"?re.headerName:null)),c=xvy(e,r.preserveSchemaIds),p=Nvy(e),s=Rvy(e),o=r.audiences??[],l=[],O=[],A=new Qys({document:e,taskContext:t,authHeaders:u,options:r,source:n,namespace:i});A.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied..."),Object.entries(e.paths??{}).forEach(([ee,re])=>{if(re==null)return;t.logger.debug(`Converting path ${ee}`);let ue=Evy(ee,re,e,A);for(let me of ue){let Oe=Uvy({operation:me});if(!(o.length>0&&!o.some(Ee=>Oe.includes(Ee))))switch(me.type){case"async":l.push(...me.sync),l.push(...me.async);break;case"http":l.push(...me.value);break;case"streaming":l.push(...me.streaming),me.nonStreaming&&l.push(...me.nonStreaming);break;case"webhook":O.push(...me.value);break;default:cc(me)}}}),Object.entries(Fvy(e)).forEach(([ee,re])=>{if(re==null)return;t.logger.debug(`Converting path ${ee}`);let ue=Svy(ee,re,e,A);for(let me of ue){let Oe=Uvy({operation:me});o.length>0&&!o.some(Ee=>Oe.includes(Ee))||O.push(...me.value)}});let E=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([ee,re])=>{let ue=wy(re,Gv.SDK_NAMESPACE);if(!Ig(re)){let me=wy(re,Gv.IGNORE);if(me!=null&&me)return[];if(hvy.has(ee))return[ee,E1({...re,"x-fern-type-name":`${ee}Body`},!1,A,[ee],n,ue??i)]}return[ee,E1(re,!1,A,[ee],n,ue??i)]}).filter(ee=>ee.length>0)),C=aMD(E,A,n),M=oMD(C,A),q={};for(let[ee,re]of Object.entries(M)){let ue=gz(re);A.isSchemaExcluded(ee)||(q[ee]=ue,t.logger.debug(`Converted schema ${ee}`))}let L=new EDi(M,A.nonRequestReferencedSchemas,A),U=O.map(ee=>{let ue=ee.examples;if(!r.disableExamples&&ue.length===0){let me=L.buildExample({schema:ee.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});me!=null&&(ue=[{name:void 0,description:void 0,payload:me}])}return{...ee,payload:gz(ee.payload),examples:ue}}),Q=new Dys(M,A,p),K=l.map(ee=>{let re=ee.examples,ue=re;if(!r.disableExamples&&(re.length===0||re.every(Y3o))){let Ee=Q.buildEndpointExample(ee);Ee.length>0&&(ue=[...Ee,...re.filter(Ae=>!Y3o(Ae))])}let me=ee.request,Oe=ee.response;return{...ee,request:me?.type==="json"||me?.type==="formUrlEncoded"?{...me,schema:gz(me.schema)}:me,response:Oe?.type==="json"?{...Oe,schema:gz(Oe.schema)}:Oe,queryParameters:ee.queryParameters.map(Ee=>({description:Ee.description,name:Ee.name,schema:gz(Ee.schema),parameterNameOverride:Ee.parameterNameOverride,availability:Ee.availability,source:Ee.source})),pathParameters:ee.pathParameters.map(Ee=>({description:Ee.description,name:Ee.name,schema:gz(Ee.schema),parameterNameOverride:Ee.parameterNameOverride,variableReference:Ee.variableReference,availability:Ee.availability,source:Ee.source})),headers:ee.headers.map(Ee=>({description:Ee.description,name:Ee.name,schema:gz(Ee.schema),parameterNameOverride:Ee.parameterNameOverride,env:Ee.env,availability:Ee.availability,source:Ee.source})),examples:ue,errors:xb(ee.errors,Ee=>{let Ae=Ee.fullExamples?.map(Me=>{let Qe=jDi(Me.value);if(Qe!=null)return{name:Me.name,description:Me.description,example:Qe}}).filter(GP);if(Ae?.length===0){let Me=L.buildExample({schema:Ee.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});Me!=null&&Ae.push({name:void 0,description:void 0,example:Me})}return{generatedName:Ee.generatedName,nameOverride:Ee.nameOverride,schema:gz(Ee.schema),description:Ee.description,source:Ee.source,examples:Ae}}),retries:ee.retries}}),X=Tvy({document:e,context:A});return{apiVersion:qvy({context:A,document:e}),basePath:Bvy(e),title:e.info.title??"",description:e.info.description,groups:Object.fromEntries(Object.entries(X??{}).map(([ee,re])=>[ee,{summary:re.summary??void 0,description:re.description??void 0}])),servers:(e.servers??[]).map(ee=>qys(ee,{groupMultiApiEnvironments:r.groupMultiApiEnvironments})),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(ee=>[ee.name,{id:ee.name,description:ee.description}])),orderedTagIds:e.tags?.map(ee=>ee.name)},endpoints:K,webhooks:U,channels:{},groupedSchemas:yQa(i,q),securitySchemes:a,hasEndpointsMarkedInternal:K.some(ee=>ee.internal),nonRequestReferencedSchemas:A.getReferencedSchemas(),variables:c,globalHeaders:p,idempotencyHeaders:s}}function aMD(e,t,r){let n={};for(let[i,a]of Object.entries(e)){if(a.type!=="object"){n[i]=a;continue}let u={$ref:`#/components/schemas/${i}`},c=t.getReferencesFromDiscriminatedUnion(u);if(c==null){n[i]=a;continue}let p={...a,type:"object",properties:a.properties.filter(o=>!c.discriminants.has(o.key)),allOfPropertyConflicts:a.allOfPropertyConflicts.filter(o=>!c.discriminants.has(o.propertyKey)),source:r};n[i]=p;let s=Wvy({schema:a,schemas:e});for(let o of[...new Set(s)]){let l=n[o]??e[o];l==null||l.type!=="object"||(n[o]={...l,type:"object",properties:l.properties.filter(O=>!c.discriminants.has(O.key)),allOfPropertyConflicts:l.allOfPropertyConflicts.filter(O=>!c.discriminants.has(O.propertyKey))})}}return n}function oMD(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}`},u=t.getDiscriminatedUnionMetadata(a);if(u==null){r[n]=i;continue}let c=[];for(let s of i.properties)if(u.discriminants.has(s.key)){let o=u.discriminants.get(s.key);o!=null&&c.push({...s,schema:Uh.literal({nameOverride:void 0,generatedName:doe([i.generatedName,o],t.options.preserveSchemaIds),title:void 0,value:JL.string(o),namespace:void 0,groupName:void 0,description:void 0,availability:i.availability})})}else c.push(s);let p={...i,type:"object",properties:c};r[n]=p}return r}function Wvy({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(...Wvy({schema:i,schemas:t}))}return r}function Lys(e){return[...new Set(e)]}function Uvy({operation:e}){let t=[];switch(e.type){case"async":t=Lys(e.async.flatMap(r=>r.audiences));break;case"http":t=Lys(e.value.flatMap(r=>r.audiences));break;case"streaming":t=Lys(e.streaming.flatMap(r=>r.audiences));break;case"webhook":t=Lys(e.value.flatMap(r=>r.audiences));break;default:cc(e)}return t}function $Ki({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){let u=a.source!=null?a.source:UOe.openapi({file:"<memory>"});switch(a.type){case"openapi":{let c=Vvy({taskContext:e,openApi:a.value,options:Ddt({options:a.settings,overrides:r}),source:u,namespace:a.namespace});n=lMD(n,c,Ddt({options:a.settings,overrides:r})),i++;break}case"asyncapi":{let c=Hyy({document:a.value,taskContext:e,options:Ddt({options:a.settings,overrides:r}),source:u,asyncApiOptions:uMD({options:a.settings}),namespace:a.namespace});c.servers!=null&&(n.websocketServers=[...n.websocketServers,...c.servers.map(p=>({...p,audiences:void 0,description:void 0}))]),c.channels!=null&&(n.channels={...n.channels,...c.channels}),c.groupedSchemas!=null&&(n.groupedSchemas=Uys(n.groupedSchemas,c.groupedSchemas)),c.basePath!=null&&(n.basePath=c.basePath),i++;break}default:cc(a)}}return n}function uMD({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??dyy.naming}}function Vys(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 sMD(e){try{let n=new URL(e).hostname.split("."),i=new Set(["api","www","service","services","example","com","org","net","io"]);for(let u of n){let c=u.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 cMD(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 u=Vys(a);r.set(u,a.url)}let n=!0,i=!0;for(let a of t){let u=Vys(a),c=r.get(u);c?c===a.url&&(i=!1):n=!1}return n&&i}function Hvy(e){if(e.length===0||!e[0])return"api";let t=e[0].url;return sMD(t)}function lMD(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:Uys(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(cMD(e.servers,t.servers)){let a=[],u=[],c=Hvy(e.servers),p=Hvy(t.servers),s=new Map;for(let O of e.servers){let A=Vys(O);s.has(A)||s.set(A,{});let E=s.get(A);E&&(E[c]={url:O.url,audiences:O.audiences})}for(let O of t.servers){let A=Vys(O);s.has(A)||s.set(A,{});let E=s.get(A);E&&(E[p]={url:O.url,audiences:O.audiences})}for(let[O,A]of s.entries()){let E={type:"grouped",name:O,description:`${O} environment`,urls:A};a.push(E)}let o=e.endpoints.map(O=>({...O,type:"multi-api",apiName:c,servers:[{name:c,url:void 0,audiences:void 0}]})),l=t.endpoints.map(O=>({...O,type:"multi-api",apiName:p,servers:[{name:p,url:void 0,audiences:void 0}]}));return u=[...o,...l],{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:a.map(O=>(O.type==="single",O)),websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:u.map(O=>{if(O.type==="multi-api"){let{type:C,apiName:M,servers:q,...L}=O;return{...L,__apiName:M,servers:q}}let{type:A,...E}=O;return E}),webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:Uys(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:Uys(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 Uys(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 r1y=ea(R0s(),1),x0s={config:new r1y.Config({apis:{},styleguide:{plugins:[_of],rules:{struct:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!0};function _9a(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 rzo(e){return e.swagger!=null}function Lff(e){return e.openapi!=null}function nzo({options:e,overrides:t}={}){return{...Ddt({options:e,overrides:t}),...T3o({options:e,overrides:t})}}function eCi(e,t={}){return{...Object.fromEntries(eZ(e.namedDefinitionFiles).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...eZ(e.importedDefinitions).reduce((r,[n,i])=>({...r,...JCo(eCi(i.definition,{defaultURL:i.url}),(a,u)=>Q$(n,iP.of(u)))}),{})}}function izo(e,t={}){return{...Object.fromEntries(eZ(e.packageMarkers).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...eZ(e.importedDefinitions).reduce((r,[n,i])=>({...r,...JCo(izo(i.definition,{defaultURL:i.url}),(a,u)=>Q$(n,iP.of(u)))}),{})}}function cli(e){return{...izo(e),...eCi(e)}}function hRe(e,t){return cli(e.definition)[t]?.contents}function FZ(e,t){for(let[r,n]of eZ(cli(e.definition)))t(r,n.contents,{isPackageMarker:NVi(r)===JN,defaultUrl:n.defaultUrl})}function O$i(e,t){for(let[r,n]of eZ(izo(e.definition)))t(r,n.contents)}function xdt({breadcrumbs:e=[],title:t,subtitle:r}){let n=[];return e.length>0&&n.push(yd.blue(e.join(" -> "))),n.push(t),r!=null&&n.push(yd.dim(r)),n.join(`
|
|
2408
2408
|
`)}var n1y={None:"none",Header:"header"};var oms={};ds(oms,{ConjureAliasDeclaration:()=>W0s,ConjureArgument:()=>nms,ConjureArgumentWithParamType:()=>rms,ConjureAuthDefinition:()=>b9a,ConjureAuthDefinitionType:()=>ems,ConjureDefinitions:()=>Z0s,ConjureEndpointDefinition:()=>ims,ConjureEnumDeclaration:()=>Y0s,ConjureEnumVariant:()=>$0s,ConjureEnumWithDocs:()=>K0s,ConjureObjectDeclaration:()=>J0s,ConjureParamType:()=>tms,ConjurePrimitive:()=>V0s,ConjureService:()=>ams,ConjureServiceName:()=>U0s,ConjureType:()=>nCi,ConjureTypeDeclaration:()=>X0s,ConjureTypeReference:()=>iCi,ConjureTypeWithDocs:()=>H0s,ConjureTypes:()=>k0s,ConjureUnionDeclaration:()=>G0s,DefinitionFile:()=>M1y,WithDocs:()=>Q8r,commons:()=>Gff,conjure:()=>Jff,services:()=>Kff,types:()=>$ff});var Gff={};ds(Gff,{WithDocs:()=>Q8r});var t0={};ds(t0,{JsonError:()=>h9a,ParseError:()=>y9a,any:()=>b1y,bigint:()=>a1y,boolean:()=>g1y,booleanLiteral:()=>v1y,date:()=>o1y,discriminant:()=>D1y,enum_:()=>z0s,getObjectLikeUtils:()=>ECr,getObjectUtils:()=>A$i,getSchemaUtils:()=>Q2,isProperty:()=>rCi,lazy:()=>u1y,lazyObject:()=>_1y,list:()=>L0s,number:()=>m1y,object:()=>Q0s,objectWithoutOptionalProperties:()=>p1y,optional:()=>Uff,property:()=>c1y,record:()=>w1y,set:()=>j1y,string:()=>O1y,stringLiteral:()=>y1y,transform:()=>Vff,undiscriminatedUnion:()=>S1y,union:()=>I1y,unknown:()=>A1y,withParsedProperties:()=>Hff});var uT={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 j6(e,t){return`Expected ${t}. Received ${ZGD(e)}.`}function ZGD(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 $le(e){return{...e,json:i1y(e.json),parse:i1y(e.parse)}}function i1y(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(`
|
|
2409
2409
|
`)),{ok:!0,value:t}):n}}function F0s(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var h9a=class e extends Error{errors;constructor(t){super(t.map(F0s).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var y9a=class e extends Error{errors;constructor(t){super(t.map(F0s).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Q2(e){return{optional:()=>Uff(e),transform:t=>Vff(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new y9a(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new h9a(n.errors)}}}function Uff(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:()=>uT.OPTIONAL};return{...t,...Q2(t)}}function Vff(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,...Q2(r)}}function a1y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:j6(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:j6(t,"bigint")}]},getType:()=>uT.BIGINT};return{...$le(e),...Q2(e)}}var kGD=/^([+-]?\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 o1y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:j6(t,"string")}]}:kGD.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:j6(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:j6(t,"Date object")}]},getType:()=>uT.DATE};return{...$le(e),...Q2(e)}}function XOe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...$le(r),...Q2(r)}}}function z0s(e){let t=new Set(e);return XOe(uT.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:j6(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:j6(n,"enum")}]}:{ok:!0,value:n})()}function u1y(e){let t=Wff(e);return{...t,...Q2(t)}}function Wff(e){return{parse:(t,r)=>v9a(e).parse(t,r),json:(t,r)=>v9a(e).json(t,r),getType:()=>v9a(e).getType()}}function v9a(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function azo(e){return Object.entries(e)}function ozo(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function tCi(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 uzo(e){return Object.keys(e)}function s1y(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function ECr(e){return{withParsedProperties:t=>Hff(e,t)}}function Hff(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let u=Object.entries(t).reduce((c,[p,s])=>({...c,[p]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(n,i)=>{if(!tCi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:j6(n,"object")}]};let a=new Set(Object.keys(t)),u=ozo(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(u,i)},getType:()=>e.getType()};return{...r,...Q2(r),...ECr(r)}}function c1y(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function rCi(e){return e.isProperty}function Q0s(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>rCi(n)?n.rawKey:r),_getParsedProperties:()=>uzo(e),parse:(r,n)=>{let i={},a=[];for(let[u,c]of azo(e)){let p=rCi(c)?c.rawKey:u,s=rCi(c)?c.valueSchema:c,o={rawKey:p,parsedKey:u,valueSchema:s};i[p]=o,d1y(s)&&a.push(p)}return l1y({value:r,requiredKeys:a,getProperty:u=>{let c=i[u];if(c!=null)return{transformedKey:c.parsedKey,transform:p=>c.valueSchema.parse(p,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,u]of azo(e)){let c=rCi(u)?u.valueSchema:u;d1y(c)&&i.push(a)}return l1y({value:r,requiredKeys:i,getProperty:a=>{let u=e[a];if(u!=null)return rCi(u)?{transformedKey:u.rawKey,transform:c=>u.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>u.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>uT.OBJECT};return{...$le(t),...Q2(t),...ECr(t),...A$i(t)}}function l1y({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!tCi(e))return{ok:!1,errors:[{path:a,message:j6(e,"object")}]};let u=new Set(t),c=[],p={};for(let[s,o]of Object.entries(e)){let l=r(s);if(l!=null){u.delete(s);let O=l.transform(o);O.ok?p[l.transformedKey]=O.value:(p[s]=o,c.push(...O.errors))}else switch(n){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":p[s]=o;break}}return c.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||i?{ok:!0,value:p}:{ok:!1,errors:c}}function A$i(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>f1y({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>f1y({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>uT.OBJECT};return{...r,...Q2(r),...ECr(r),...A$i(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:()=>uT.OBJECT};return{...t,...Q2(t),...ECr(t),...A$i(t)}}}}function f1y({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,u]=s1y(uzo(t),s=>i.has(s)),c=r(ozo(t,u)),p=n(ozo(t,a));return c.ok&&p.ok?{ok:!0,value:{...c.value,...p.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...p.ok?[]:p.errors]}}function d1y(e){return!eJD(e)}function eJD(e){switch(e.getType()){case uT.ANY:case uT.UNKNOWN:case uT.OPTIONAL:return!0;default:return!1}}function p1y(e){return Q0s(e)}function _1y(e){let t={...Wff(e),_getRawProperties:()=>v9a(e)._getRawProperties(),_getParsedProperties:()=>v9a(e)._getParsedProperties()};return{...t,...Q2(t),...ECr(t),...A$i(t)}}function L0s(e){let t={parse:(r,n)=>h1y(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>h1y(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>uT.LIST};return{...$le(t),...Q2(t)}}function h1y(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:j6(e,"list"),path:[]}]}}function y1y(e){return XOe(uT.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:j6(r,`"${e}"`)}]})()}function v1y(e){return XOe(uT.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:j6(r,`${e.toString()}`)}]})()}var b1y=XOe(uT.ANY,e=>({ok:!0,value:e}));var g1y=XOe(uT.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:j6(e,"boolean")}]});var m1y=XOe(uT.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:j6(e,"number")}]});var O1y=XOe(uT.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:j6(e,"string")}]});var A1y=XOe(uT.UNKNOWN,e=>({ok:!0,value:e}));function w1y(e,t){let r={parse:(n,i)=>P1y({value:n,isKeyNumeric:e.getType()===uT.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>P1y({value:n,isKeyNumeric:e.getType()===uT.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>uT.RECORD};return{...$le(r),...Q2(r)}}function P1y({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return tCi(e)?azo(e).reduce((a,[u,c])=>{if(c==null)return a;let p=a,s=u;if(t){let A=u.length>0?Number(u):NaN;isNaN(A)||(s=A)}let o=r(s),l=n(c,s);if(p.ok&&o.ok&&l.ok)return{ok:!0,value:{...p.value,[o.value]:l.value}};let O=[];return p.ok||O.push(...p.errors),o.ok||O.push(...o.errors),l.ok||O.push(...l.errors),{ok:!1,errors:O}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:j6(e,"object")}]}}function j1y(e){let t=L0s(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:j6(n,"Set")}]},getType:()=>uT.SET};return{...$le(r),...Q2(r)}}function S1y(e){let t={parse:(r,n)=>E1y((i,a)=>i.parse(r,a),e,n),json:(r,n)=>E1y((i,a)=>i.json(r,a),e,n),getType:()=>uT.UNDISCRIMINATED_UNION};return{...$le(t),...Q2(t)}}function E1y(e,t,r){let n=[];for(let[i,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let c of u.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function D1y(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function I1y(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=z0s(uzo(t)),a={parse:(u,c)=>C1y({value:u,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:p=>i.parse(p,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:p=>t[p],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(p,s)=>s.parse(p,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(u,c)=>C1y({value:u,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:p=>i.json(p,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:p=>t[p],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(p,s)=>s.json(p,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>uT.UNION};return{...$le(a),...Q2(a),...ECr(a)}}function C1y({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:c=[]}){if(!tCi(e))return{ok:!1,errors:[{path:c,message:j6(e,"object")}]};let{[t]:p,...s}=e;if(p==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let o=n(p);if(!o.ok)return{ok:!1,errors:o.errors};let l=i(o.value);if(l==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let O=u(s,l);return O.ok?{ok:!0,value:{[r]:p,...O.value}}:O}var Q8r=t0.objectWithoutOptionalProperties({docs:t0.string().optional()});var Jff={};ds(Jff,{ConjureServiceName:()=>U0s,DefinitionFile:()=>M1y});var U0s=t0.string();var V0s=t0.enum_(["rid","string","safelong","integer","double","boolean"]);var nCi=t0.undiscriminatedUnion([V0s,t0.string()]);var W0s=t0.objectWithoutOptionalProperties({alias:nCi,docs:t0.string().optional()});var H0s=t0.objectWithoutOptionalProperties({type:nCi,docs:t0.string().optional()});var iCi=t0.undiscriminatedUnion([nCi,H0s]);var G0s=t0.objectWithoutOptionalProperties({union:t0.record(t0.string(),iCi)});var J0s=t0.objectWithoutOptionalProperties({fields:t0.record(t0.string(),iCi)});var K0s=t0.objectWithoutOptionalProperties({value:t0.string()}).extend(Q8r);var $0s=t0.undiscriminatedUnion([t0.string(),K0s]);var Y0s=t0.objectWithoutOptionalProperties({values:t0.list($0s)});var X0s=t0.undiscriminatedUnion([W0s,G0s,J0s,Y0s]);var Z0s=t0.objectWithoutOptionalProperties({objects:t0.record(t0.string(),X0s).optional()});var k0s=t0.objectWithoutOptionalProperties({conjureImports:t0.property("conjure-imports",t0.record(t0.string(),t0.string()).optional()),definitions:Z0s.optional()});var ems=t0.enum_(["none","header"]);var b9a=t0.undiscriminatedUnion([ems,t0.string()]);var tms=t0.enum_(["path","query","body"]);var rms=t0.objectWithoutOptionalProperties({paramType:t0.property("param-type",tms),type:t0.string()}).extend(Q8r);var nms=t0.undiscriminatedUnion([t0.string(),rms]);var ims=t0.objectWithoutOptionalProperties({http:t0.string(),auth:b9a.optional(),args:t0.record(t0.string(),nms).optional(),returns:iCi.optional()}).extend(Q8r);var ams=t0.objectWithoutOptionalProperties({name:t0.string().optional(),package:t0.string().optional(),basePath:t0.property("base-path",t0.string().optional()),defaultAuth:t0.property("default-auth",b9a.optional()),endpoints:t0.record(t0.string(),ims).optional()}).extend(Q8r);var M1y=t0.objectWithoutOptionalProperties({types:k0s.optional(),services:t0.record(U0s,ams).optional()});var Kff={};ds(Kff,{ConjureArgument:()=>nms,ConjureArgumentWithParamType:()=>rms,ConjureAuthDefinition:()=>b9a,ConjureAuthDefinitionType:()=>ems,ConjureEndpointDefinition:()=>ims,ConjureParamType:()=>tms,ConjureService:()=>ams});var $ff={};ds($ff,{ConjureAliasDeclaration:()=>W0s,ConjureDefinitions:()=>Z0s,ConjureEnumDeclaration:()=>Y0s,ConjureEnumVariant:()=>$0s,ConjureEnumWithDocs:()=>K0s,ConjureObjectDeclaration:()=>J0s,ConjurePrimitive:()=>V0s,ConjureType:()=>nCi,ConjureTypeDeclaration:()=>X0s,ConjureTypeReference:()=>iCi,ConjureTypeWithDocs:()=>H0s,ConjureTypes:()=>k0s,ConjureUnionDeclaration:()=>G0s});var B1y=require("fs/promises");async function T1y(e,t){let r=[];for(let n of await gqe(e,t))r.push(await tJD({relativeFilepath:T2(e,n),absoluteFilepath:n}));return r}async function tJD({relativeFilepath:e,absoluteFilepath:t}){let r=(await(0,B1y.readFile)(t)).toString().replaceAll(/: rid(?:$|\s)/g,`: string
|