fern-api 3.13.0 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +4 -4
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1147,7 +1147,7 @@ ${XQp.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&x6s(th
|
|
|
1147
1147
|
`+B7i.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?B7i.default.cyan(oUp(t,this.opt.mask)):B7i.default.italic(B7i.default.dim("[hidden]")):this.opt.mask?oUp(t,this.opt.mask):B7i.default.italic(B7i.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 Wmo=ue(_1(),1);var o4p=ue(w9s(),1),Lmo=require("child_process"),$1n=require("fs"),Umo=ue(require("path"),1),u4p=ue(require("os"),1),s4p=require("crypto"),cGs=ue(n4p(),1);var Nmo=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var zga=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var Fmo=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var Qmo=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function Vmo(e="",t,r){let i=new lGs(e,r);i.runAsync((n,a)=>{if(n)setImmediate(t,n,void 0);else try{i.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function a4p(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function IvS(e){let t=[],r="";for(let i=0;i<e.length;i++){let n=e.charAt(i);i>0&&n===" "&&e[i-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${n}`}return r.length>0&&t.push(r),t}var lGs=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=IvS(t).map(n=>n.replace("\\ "," ")),i=r.shift();this.editor={args:r,bin:i}}createTemporaryFile(){try{let t=this.fileOptions.dir??u4p.default.tmpdir(),r=(0,s4p.randomUUID)(),i=a4p(this.fileOptions.prefix),n=a4p(this.fileOptions.postfix),a=`${i}${r}${n}`,o=Umo.default.resolve(t,a),c=Umo.default.resolve(t)+Umo.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let f={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(f.mode=this.fileOptions.mode),(0,$1n.writeFileSync)(this.tempFile,this.text,f)}catch(t){throw new Nmo(t)}}readTemporaryFile(){try{let t=(0,$1n.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,o4p.detect)(t)??"utf8";cGs.default.encodingExists(r)||(r="utf8"),this.text=cGs.default.decode(t,r)}}catch(t){throw new Fmo(t)}}removeTemporaryFile(){try{(0,$1n.unlinkSync)(this.tempFile)}catch(t){throw new Qmo(t)}}launchEditor(){try{let t=(0,Lmo.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new zga(t)}}launchEditorAsync(t){try{(0,Lmo.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",i=>{this.lastExitStatus=i,setImmediate(t)})}catch(r){throw new zga(r)}}};var c4p=ue(Y_e(),1);var Nga=class extends h1{_run(t){this.done=t,this.editorResult=new c4p.Subject;let r=CQ(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let i=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,i?this.render():this.startExternalEditor(),this}render(t){let r="",i=this.getQuestion();i+=this.status==="answered"?Wmo.default.dim("Received"):Wmo.default.dim("Press <enter> to launch your preferred editor."),t&&(r=Wmo.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),Vmo(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 _4p=require("stream");var d4p=ue(require("readline"),1),p4p=ue(f4p(),1),T7i=class{constructor(t){this.rl||=d4p.default.createInterface(qvS(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 qvS(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let n=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw n.isTtyError=!0,n}let r=new p4p.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var Fga=class extends T7i{constructor(t={}){super(t),this.log=new _4p.Writable({write:(r,i,n)=>{this.writeLog(r),n()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return Aga(this.rl,this.bottomBar.split(`
|
|
1148
1148
|
`).length),this}updateBottomBar(t){return Aga(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+`
|
|
1149
1149
|
`}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&&fmo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var lO=ue(Y_e(),1),b4p=ue(Vva(),1);var xmo=ue(Y_e(),1),h4p=ue(Vva(),1),Gmo=function(e,t,r){return typeof e[t]!="function"?(0,xmo.of)(e):(0,xmo.from)((0,h4p.default)(e[t])(r).then(i=>(e[t]=i,e)))};var y4p={set:(e,t="",r)=>{let i=e;t.split(".").forEach((n,a,o)=>{n==="__proto__"||n==="constructor"||(a===o.length-1?i[n]=r:(!(n in i)||typeof i[n]!="object")&&(i[n]={}),i=i[n])})},get:(e,t="",r)=>{let i=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((o,c)=>o!=null?o[c]:o,e),n=i(/[,[\]]+?/)||i(/[,.[\]]+?/);return n===void 0||n===e?r:n}},Y1n=class extends T7i{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let i;return Array.isArray(t)?i=(0,lO.from)(t):(0,lO.isObservable)(t)?i=t:Object.values(t).every(n=>typeof n=="object"&&!Array.isArray(n)&&n!=null)?i=(0,lO.from)(Object.entries(t).map(([n,a])=>({name:n,...a}))):i=(0,lO.from)([t]),this.process=i.pipe((0,lO.concatMap)(this.processQuestion.bind(this)),(0,lO.publish)()),this.process.connect(),this.process.pipe((0,lO.reduce)((n,a)=>(y4p.set(n,a.name,a.answer),n),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,lO.defer)(()=>(0,lO.of)(t).pipe((0,lO.concatMap)(this.setDefaultType.bind(this)),(0,lO.concatMap)(this.filterIfRunnable.bind(this)),(0,lO.concatMap)(()=>Gmo(t,"message",this.answers)),(0,lO.concatMap)(()=>Gmo(t,"default",this.answers)),(0,lO.concatMap)(()=>Gmo(t,"choices",this.answers)),(0,lO.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,lO.defer)(()=>(0,lO.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,lO.defer)(()=>(0,lO.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&y4p.get(this.answers,t.name)!==void 0)return lO.EMPTY;if(t.when===!1)return lO.EMPTY;if(typeof t.when!="function")return(0,lO.of)(t);let{answers:r}=this;return(0,lO.defer)(()=>(0,lO.from)((0,b4p.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,lO.filter)(i=>i!=null)))}};function v4p(e){let t=function(r,i){let n;try{n=new Y1n(t.prompts,e)}catch(o){return Promise.reject(o)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",Pga),this.registerPrompt("input",D7i),this.registerPrompt("number",jga),this.registerPrompt("confirm",wga),this.registerPrompt("rawlist",Ega),this.registerPrompt("expand",Sga),this.registerPrompt("checkbox",Mga),this.registerPrompt("password",Dga),this.registerPrompt("editor",Nga)},t.restoreDefaultPrompts(),t}var dGs=v4p();function RvS(e,t){dGs.registerPrompt(e,t)}function zvS(){dGs.restoreDefaultPrompts()}var NvS={prompt:dGs,ui:{BottomBar:Fga,Prompt:Y1n},createPromptModule:v4p,registerPrompt:RvS,restoreDefaultPrompts:zvS,Separator:PH},Hmo=NvS;var cTn=require("path"),XLp=require("fs"),ZLp=require("readline"),mLp="posthog-node";function lAS(e,{organization:t,projectId:r,prefix:i,severityAllowList:n=["error"]}={}){return a=>{if(!(n==="*"||n.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[d0o.POSTHOG_ID_TAG];if(c===void 0)return a;let f=e.options.host??"https://us.i.posthog.com",s=new URL(`/project/${e.apiKey}/person/${c}`,f).toString();a.tags["PostHog Person URL"]=s;let u=a.exception?.values||[],l=u.map(_=>({..._,stacktrace:_.stacktrace?{..._.stacktrace,type:"raw",frames:(_.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),p={$exception_message:u[0]?.value||a.message,$exception_type:u[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:u[0]?.value||a.message,$sentry_exception_type:u[0]?.type,$sentry_tags:a.tags};return t&&r&&(p.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:p}),a}}var d0o=class{constructor(t,r,i,n){this.name=mLp,this.name=mLp,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(lAS(t,{organization:r,projectId:c,prefix:i,severityAllowList:n}))}}};d0o.POSTHOG_ID_TAG="posthog_distinct_id";var u0o="0123456789abcdef",p0o=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=u0o.charAt(this.bytes[r]>>>4),t+=u0o.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+=u0o.charAt(this.bytes[r]>>>4),t+=u0o.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},YGs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??fAS()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return p0o.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,p0o.ofInner(t)}},fAS=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),PLp,XGs=()=>dAS().toString(),dAS=()=>(PLp||(PLp=new YGs)).generate();function pAS(e,t){let r=!1;return Object.assign(i=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function _AS(e,t){global.process.on("uncaughtException",pAS(e,t))}function hAS(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var s0o,jLp,c0o;function yAS(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return c0o&&r.length===jLp||(jLp=r.length,c0o=r.reduce((i,n)=>{s0o||(s0o={});let a=s0o[n];if(a)i[a[0]]=a[1];else{let o=e(n);for(let c=o.length-1;c>=0;c--){let s=o[c]?.filename,u=t[n];if(s&&u){i[s]=u,s0o[n]=[s,u];break}}}return i},{})),c0o}function bAS(e){return typeof Event<"u"&&kLp(e,Event)}function vAS(e){return e3p(e,"Object")}function a7s(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return kLp(e,Error)}}function kLp(e,t){try{return e instanceof t}catch{return!1}}function gAS(e){return e3p(e,"ErrorEvent")}function e3p(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function OAS(e,t,r,i){let a=i&&i.mechanism||{handled:!0,type:"generic"},o=t3p(a,r,i);return{$exception_list:await Promise.all(o.map(async s=>{let u=await SAS(e,t,s);return u.value=u.value||"",u.type=u.type||"Error",u.mechanism=a,u}))}}function t3p(e,t,r){let i=AAS(e,t,r);return i.cause?[i,...t3p(e,i.cause,r)]:[i]}function AAS(e,t,r){if(a7s(t))return t;if(e.synthetic=!0,vAS(t)){let n=mAS(t);if(n)return n;let a=PAS(t),o=r?.syntheticException||new Error(a);return o.message=a,o}let i=r?.syntheticException||new Error(t);return i.message=`${t}`,i}function mAS(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(a7s(r))return r}}function PAS(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message '${e.message}'`),i}else if("message"in e&&typeof e.message=="string")return e.message;let t=wAS(e);if(gAS(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=jAS(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function jAS(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function wAS(e,t=40){let r=Object.keys(EAS(e));r.sort();let i=r[0];if(!i)return"[object has no keys]";if(i.length>=t)return wLp(i,t);for(let n=r.length;n>0;n--){let a=r.slice(0,n).join(", ");if(!(a.length>t))return n===r.length?a:wLp(a,t)}return""}function wLp(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function EAS(e){return a7s(e)?{message:e.message,name:e.name,stack:e.stack,...ELp(e)}:bAS(e)?{type:e.type,target:SLp(e.target),currentTarget:SLp(e.currentTarget),...ELp(e)}:e}function ELp(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 SLp(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function SAS(e,t,r){let i={type:r.name||r.constructor.name,value:r.message},n=MAS(e,r);for(let a of t)n=await a(n);return n.length&&(i.stacktrace={frames:n,type:"raw"}),i}function MAS(e,t){return DAS(e(t.stack||"",1),e)}function DAS(e,t){let r=yAS(t);return e.forEach(i=>{i.filename&&(i.chunk_id=r[i.filename])}),e}var BAS=2e3,oTn=class e{static async captureException(t,r,i,n,a){let o={...a};n||(o.$process_person_profile=!1);let c=await OAS(this.stackParser,this.frameModifiers,r,i);t.capture({event:"$exception",distinctId:n||XGs(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(_AS(this.onException.bind(this),this.onFatalError.bind(this)),hAS(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(BAS)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function IAS(e=process.argv[1]?(0,cTn.dirname)(process.argv[1]):process.cwd(),t=cTn.sep==="\\"){let r=t?MLp(e):e;return i=>{if(!i)return;let n=t?MLp(i):i,{dir:a,base:o,ext:c}=cTn.posix.parse(n);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let f=decodeURIComponent(o);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${f}`;if(a.startsWith(r)){let u=a.slice(r.length+1).replace(/\//g,".");return u?`${u}:${f}`:f}return f}}function MLp(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var _0o=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)}}},f0o=new _0o(25),r3p=new _0o(20),o7s=7,CAS=1e3,qAS=1e4;async function TAS(e){let t={};for(let n=e.length-1;n>=0;n--){let a=e[n],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||FAS(o)||QAS(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let i=[];for(let n of r){if(r3p.get(n))continue;let a=t[n];if(!a)continue;a.sort((f,s)=>f-s);let o=LAS(a);if(o.every(f=>UAS(n,f)))continue;let c=VAS(f0o,n,{});i.push(RAS(n,o,c))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&zAS(e,f0o),f0o.reduce(),e}function RAS(e,t,r){return new Promise(i=>{let n=(0,XLp.createReadStream)(e),a=(0,ZLp.createInterface)({input:n});function o(){n.destroy(),i()}let c=0,f=0,s=t[f];if(s===void 0){o();return}let u=s[0],l=s[1];function p(){r3p.set(e,1),a.close(),a.removeAllListeners(),o()}n.on("error",p),a.on("error",p),a.on("close",o),a.on("line",_=>{if(c++,!(c<u)&&(r[c]=WAS(_,0),c>=l)){if(f===t.length-1){a.close(),a.removeAllListeners();return}f++;let h=t[f];if(h===void 0){a.close(),a.removeAllListeners();return}u=h[0],l=h[1]}})})}function zAS(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=t.get(r.filename);if(i===void 0)continue;NAS(r.lineno,r,i)}}function NAS(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=i3p(e);n<e;n++){let a=r[n];if(a===void 0){DLp(t);return}t.pre_context.push(a)}if(r[e]===void 0){DLp(t);return}t.context_line=r[e];let i=n3p(e);t.post_context=[];for(let n=e+1;n<=i;n++){let a=r[n];if(a===void 0)break;t.post_context.push(a)}}function DLp(e){delete e.pre_context,delete e.context_line,delete e.post_context}function FAS(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function QAS(e){return e.lineno!==void 0&&e.lineno>qAS||e.colno!==void 0&&e.colno>CAS}function UAS(e,t){let r=f0o.get(e);if(r===void 0)return!1;for(let i=t[0];i<=t[1];i++)if(r[i]===void 0)return!1;return!0}function LAS(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=BLp(r),n=[];for(;;){if(t===e.length-1){n.push(i);break}let a=e[t+1];if(typeof a!="number")break;a<=i[1]?i[1]=a+o7s:(n.push(i),i=BLp(a)),t++}return n}function BLp(e){return[i3p(e),n3p(e)]}function i3p(e){return Math.max(1,e-o7s)}function n3p(e){return e+o7s}function VAS(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function WAS(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let n=Math.max(t-60,0);n<5&&(n=0);let a=Math.min(n+140,i);return a>i-5&&(a=i),a===i&&(n=Math.max(a-140,0)),r=r.slice(n,a),n>0&&(r=`...${r}`),a<i&&(r+="..."),r}var xAS="4.18.0",MH;(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"})(MH||(MH={}));var ILp;(function(e){e.Left="left",e.Right="right",e.Center="center"})(ILp||(ILp={}));var CLp;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(CLp||(CLp={}));var qLp;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(qLp||(qLp={}));var TLp;(function(e){e.Html="html",e.Text="text"})(TLp||(TLp={}));var RLp;(function(e){e.Number="number",e.Emoji="emoji"})(RLp||(RLp={}));var zLp;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(zLp||(zLp={}));var NLp;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(NLp||(NLp={}));var FLp;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(FLp||(FLp={}));var QLp;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(QLp||(QLp={}));var GAS=e=>{if("flags"in e){let t=KAS(e.flags),r=JAS(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,a3p(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,HAS(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function HAS(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 KAS=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,u7s(r)]).filter(([,t])=>t!==void 0)),JAS=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let i=t[r];return i.enabled&&i.metadata&&i.metadata.payload!==void 0}).map(r=>{let i=t[r].metadata?.payload;return[r,i?a3p(i):void 0]}))},u7s=e=>e===void 0?void 0:e.variant??e.enabled,a3p=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},$AS=1,YAS=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"]),XAS="utf8";function ZAS(e,t){if(!e||typeof e!="string"||kAS(e))throw new Error(t)}function kAS(e){return e.trim().length===0}function emS(e){return e?.replace(/\/+$/,"")}async function tmS(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function ULp(){return new Date().getTime()}function JGs(){return new Date().toISOString()}function h0o(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function rmS(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function imS(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 nmS(e,t=0,r){let i=imS(e);return r?.has(i)?!1:parseInt(i,16)/4294967295<t}function LLp(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var Jga=String.fromCharCode,VLp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l0o={};function amS(e,t){if(!l0o[e]){l0o[e]={};for(let r=0;r<e.length;r++)l0o[e][e.charAt(r)]=r}return l0o[e][t]}var nTn={compressToBase64:function(e){if(e==null)return"";let t=nTn._compress(e,6,function(r){return VLp.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:nTn._decompress(e.length,32,function(t){return amS(VLp,e.charAt(t))})},compress:function(e){return nTn._compress(e,16,function(t){return Jga(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],o,c,f="",s="",u="",l=2,p=3,_=2,h=0,y=0,b;for(b=0;b<e.length;b+=1)if(f=e.charAt(b),Object.prototype.hasOwnProperty.call(i,f)||(i[f]=p++,n[f]=!0),s=u+f,Object.prototype.hasOwnProperty.call(i,s))u=s;else{if(Object.prototype.hasOwnProperty.call(n,u)){if(u.charCodeAt(0)<256){for(o=0;o<_;o++)h=h<<1,y==t-1?(y=0,a.push(r(h)),h=0):y++;for(c=u.charCodeAt(0),o=0;o<8;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}else{for(c=1,o=0;o<_;o++)h=h<<1|c,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=0;for(c=u.charCodeAt(0),o=0;o<16;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}l--,l==0&&(l=Math.pow(2,_),_++),delete n[u]}else for(c=i[u],o=0;o<_;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1;l--,l==0&&(l=Math.pow(2,_),_++),i[s]=p++,u=String(f)}if(u!==""){if(Object.prototype.hasOwnProperty.call(n,u)){if(u.charCodeAt(0)<256){for(o=0;o<_;o++)h=h<<1,y==t-1?(y=0,a.push(r(h)),h=0):y++;for(c=u.charCodeAt(0),o=0;o<8;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}else{for(c=1,o=0;o<_;o++)h=h<<1|c,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=0;for(c=u.charCodeAt(0),o=0;o<16;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1}l--,l==0&&(l=Math.pow(2,_),_++),delete n[u]}else for(c=i[u],o=0;o<_;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1;l--,l==0&&(l=Math.pow(2,_),_++)}for(c=2,o=0;o<_;o++)h=h<<1|c&1,y==t-1?(y=0,a.push(r(h)),h=0):y++,c=c>>1;for(;;)if(h=h<<1,y==t-1){a.push(r(h));break}else y++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:nTn._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},o=4,c=4,f=3,s="",u,l,p,_,h,y,b;for(u=0;u<3;u+=1)i[u]=u;for(p=0,h=Math.pow(2,2),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;switch(p){case 0:for(p=0,h=Math.pow(2,8),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;b=Jga(p);break;case 1:for(p=0,h=Math.pow(2,16),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;b=Jga(p);break;case 2:return""}for(i[3]=b,l=b,n.push(b);;){if(a.index>e)return"";for(p=0,h=Math.pow(2,f),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;switch(b=p){case 0:for(p=0,h=Math.pow(2,8),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;i[c++]=Jga(p),b=c-1,o--;break;case 1:for(p=0,h=Math.pow(2,16),y=1;y!=h;)_=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),p|=(_>0?1:0)*y,y<<=1;i[c++]=Jga(p),b=c-1,o--;break;case 2:return n.join("")}if(o==0&&(o=Math.pow(2,f),f++),i[b])s=i[b];else if(b===c)s=l+l.charAt(0);else return null;n.push(s),i[c++]=l+s.charAt(0),o--,l=s,o==0&&(o=Math.pow(2,f),f++)}}},ZGs=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}},uTn=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()}},$ga=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function WLp(e){if(e instanceof uTn){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 $Gs(e){return typeof e=="object"&&(e instanceof uTn||e instanceof $ga)}function xLp(e){return typeof e=="object"&&e instanceof uTn&&e.status===413}var kGs;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(kGs||(kGs={}));var e7s=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new ZGs,this._isInitialized=!1,ZAS(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=emS(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:$Gs},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(MH.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(MH.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(MH.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}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=XGs();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}async identifyStatelessImmediate(t,r,i){let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",n,i)}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}async captureStatelessImmediate(t,r,i,n){let a=this.buildPayload({distinct_id:t,event:r,properties:i});await this.sendImmediate("capture",a,n)}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}async aliasStatelessImmediate(t,r,i,n){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,n)}groupIdentifyStateless(t,r,i,n,a,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...o||{}}});this.enqueue("capture",c,n)})}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`,i={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,i,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(n=>n.json()).catch(n=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",n)),this._events.emit("error",n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let c=nmS(this.apiKey,$AS,YAS)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,f={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,f,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(s=>s.json()).then(s=>GAS(s)).catch(s=>{this._events.emit("error",s)})}async getFeatureFlagStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,i,n,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let f=u7s(c.response);return f===void 0&&(f=!1),{response:f,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,i,n,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,i,n,a,o,[t]);if(!c)return;let f=c[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,o)).payloads}async getFeatureFlagsStateless(t,r={},i={},n={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,i,n,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},i={},n={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let f=await this.getDecide(t,r,i,n,c);if(f!==void 0)return f.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),f.quotaLimited?.includes(kGs.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:f?.requestId}):f}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},n=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return n&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(n))),n??[]}get props(){return this._props||(this._props=this.getPersistedProperty(MH.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(MH.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(MH.Props,this.props)})}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n=this.prepareMessage(t,r,i),a=this.getPersistedProperty(MH.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:n}),this.setPersistedProperty(MH.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=h0o(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,i){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 n={api_key:this.apiKey,batch:[this.prepareMessage(t,r,i)],sent_at:JGs()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${ULp()}&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(nTn.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(f){this._events.emit("error",f)}}prepareMessage(t,r,i){let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:JGs(),uuid:i?.uuid?i.uuid:XGs()};return(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId),n}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await WLp(t)})}async flush(){let t=LLp([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),LLp([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(MH.Queue)||[];if(!t.length)return;let r=[],i=t.length;for(;t.length>0&&r.length<i;){let n=t.slice(0,this.maxBatchSize),a=n.map(p=>p.message),o=()=>{let _=(this.getPersistedProperty(MH.Queue)||[]).slice(n.length);this.setPersistedProperty(MH.Queue,_),t=_},c={api_key:this.apiKey,batch:a,sent_at:JGs()};this.historicalMigration&&(c.historical_migration=!0);let f=JSON.stringify(c),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${ULp()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,u=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(nTn.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f},l={retryCheck:p=>xLp(p)?!1:$Gs(p)};try{await this.fetchWithRetry(s,u,l)}catch(p){if(xLp(p)&&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 p instanceof $ga||o(),this._events.emit("error",p),p}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,i,n){var a;(a=AbortSignal).timeout??(a.timeout=function(s){let u=new AbortController;return setTimeout(()=>u.abort(),s),u.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,XAS)}catch{c=new TextEncoder().encode(o).length}return await tmS(async()=>{let f=null;try{f=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(u){throw new $ga(u)}if(!(r.mode==="no-cors")&&(f.status<200||f.status>=400))throw new uTn(f,c);return f},{...this._retryOptions,...i})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(MH.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!$Gs(n))throw n;await WLp(n)}};return Promise.race([new Promise((n,a)=>{h0o(()=>{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)}),i()])}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}},t7s=rmS();if(!t7s){let e=ALp();t7s=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var o3p=t7s,y0o=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()}},u3p=new y0o(async()=>{try{return await import("crypto")}catch{return}});async function omS(){return await u3p.getValue()}var umS=new y0o(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await u3p.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function smS(){return await umS.getValue()}async function cmS(e){let t=await omS();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await smS();if(r){let i=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(i)).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 lmS=60*1e3,fmS=1152921504606847e3,dmS=["is_not"],aTn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},y1=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},r7s=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=c.fetch||o3p,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let f of this.featureFlags)if(t===f.key){c=f;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(f){f instanceof y1?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async f=>{try{let s=await this.computeFlagLocally(f,t,r,i,n);a[f.key]=s;let u=await this.computeFeatureFlagPayloadLocally(f.key,s);u&&(o[f.key]=u)}catch(s){s instanceof y1||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${s}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new y1("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let f=this.groupTypeMapping[String(c)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new y1("Flag has unknown group type index");if(!(f in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[f];return await this.matchFeatureFlagProperties(t,i[f],s)}else return await this.matchFeatureFlagProperties(t,r,n)}async matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],o=!1,c,f=[...a].sort((s,u)=>{let l=!!s.variant,p=!!u.variant;return l&&p?0:l?-1:p?1:0});for(let s of f)try{if(await this.isConditionMatch(t,r,s,i)){let u=s.variant,l=n.multivariate?.variants||[];u&&l.some(p=>p.key===u)?c=u:c=await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof y1)o=!0;else throw u}if(c!==void 0)return c;if(o)throw new y1("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,i,n){let a=i.rollout_percentage,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((i.properties||[]).length>0){for(let c of i.properties){let f=c.type,s=!1;if(f==="cohort"?s=c3p(c,n,this.cohorts,this.debugMode):s=s3p(c,n,o),!s)return!1}if(a==null)return!0}return!(a!=null&&await GLp(t.key,r)>a/100)}async getMatchingVariant(t,r){let i=await GLp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{n=i+c.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:c.key}),i=n}),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(lmS,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 aTn(`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 aTn(`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 aTn(`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((i,n)=>(i[n.key]=n,i),{}),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 aTn&&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(),i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=h0o(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,i=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;n=h0o(()=>{a.abort()},this.timeout),i.signal=a.signal}try{return this.fetch(r,i)}finally{clearTimeout(n)}}};async function GLp(e,t,r=""){let i=await cmS(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/fmS}function s3p(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new y1("Operator is_not_set is not supported")}else throw new y1(`Property ${i} not found in propertyValues`);let o=t[i];if(o==null&&!dmS.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function c(s,u){return Array.isArray(s)?s.map(l=>String(l).toLowerCase()).includes(String(u).toLowerCase()):String(s).toLowerCase()===String(u).toLowerCase()}function f(s,u,l){if(l==="gt")return s>u;if(l==="gte")return s>=u;if(l==="lt")return s<u;if(l==="lte")return s<=u;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(n,o);case"is_not":return!c(n,o);case"is_set":return i in t;case"icontains":return String(o).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(n).toLowerCase());case"regex":return HLp(String(n))&&String(o).match(String(n))!==null;case"not_regex":return HLp(String(n))&&String(o).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&o!=null?typeof o=="string"?f(o,String(n),a):f(o,s,a):f(String(o),String(n),a)}case"is_date_after":case"is_date_before":{let s=pmS(String(n));if(s==null&&(s=KLp(n)),s==null)throw new y1(`Invalid date: ${n}`);let u=KLp(o);return["is_date_before"].includes(a)?u<s:u>s}default:throw new y1(`Unknown operator: ${a}`)}}function c3p(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new y1("can't match cohort without a given cohort property value");let a=r[n];return l3p(a,t,r,i)}function l3p(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let f=l3p(c,t,r,i);if(n==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof y1)i&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new y1("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let c of a)try{let f;c.type==="cohort"?f=c3p(c,t,r,i):f=s3p(c,t);let s=c.negation||!1;if(n==="AND"){if(!f&&!s||f&&s)return!1}else if(f&&!s||!f&&s)return!0}catch(f){if(f instanceof y1)i&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new y1("can't match cohort without a given cohort property value");return n==="AND"}}function HLp(e){try{return new RegExp(e),!0}catch{return!1}}function KLp(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 y1(`${e} is in an invalid date format`)}else throw new y1(`The date provided ${e} must be a string, number, or date object`)}function pmS(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var i7s=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},_mS=100,JLp=30*1e3,hmS=50*1e3,n7s=class extends e7s{constructor(t,r={}){if(super(t,r),this._memoryStorage=new i7s,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,_mS):JLp,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 r7s({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new oTn(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||hmS}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):o3p(t,r)}getLibraryVersion(){return xAS}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:i,properties:n,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:s}=t,u=_=>{super.captureStateless(r,i,_,{timestamp:c,disableGeoip:f,uuid:s})},l=async(_,h,y)=>(await super.getFeatureFlagsStateless(_,h,void 0,void 0,y)).flags,p=Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let _={};for(let[h,y]of Object.entries(a||{}))_[h]=String(y);return await this.getAllFlags(r,{groups:_,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(_=>{let h={};if(_)for(let[b,v]of Object.entries(_))h[`$feature/${b}`]=v;let y=Object.keys(_||{}).filter(b=>_?.[b]!==!1).sort();return y.length>0&&(h.$active_feature_flags=y),h}).catch(()=>({})).then(_=>{u({..._,...n,$groups:a})});this.addPendingPromise(p)}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:i,properties:n,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:s}=t,u=_=>super.captureStatelessImmediate(r,i,_,{timestamp:c,disableGeoip:f,uuid:s}),l=async(_,h,y)=>(await super.getFeatureFlagsStateless(_,h,void 0,void 0,y)).flags;await Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let _={};for(let[h,y]of Object.entries(a||{}))_[h]=String(y);return await this.getAllFlags(r,{groups:_,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(_=>{let h={};if(_)for(let[b,v]of Object.entries(_))h[`$feature/${b}`]=v;let y=Object.keys(_||{}).filter(b=>_?.[b]!==!1).sort();return y.length>0&&(h.$active_feature_flags=y),h}).catch(()=>({})).then(_=>{u({..._,...n,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:n},{disableGeoip:i})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:n},{disableGeoip:i})}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=JLp){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let i=setTimeout(()=>{n(),r(!1)},t),n=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(i),n(),r(a>0)})})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:f,groupProperties:s}=i||{},u=this.addLocalPersonAndGroupProperties(r,n,f,s);f=u.allPersonProperties,s=u.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,f,s),p=l!==void 0,_,h;if(!p&&!o){let b=await super.getFeatureFlagDetailStateless(t,r,n,f,s,a);if(b===void 0)return;h=b.response,l=u7s(h),_=b?.requestId}let y=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(y))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(y):this.distinctIdHasSentFlagCalls[r]=[y],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:h?.metadata?.id,$feature_flag_version:h?.metadata?.version,$feature_flag_reason:h?.reason?.description??h?.reason?.code,locally_evaluated:p,[`$feature/${t}`]:l,$feature_flag_request_id:_},groups:n,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:o}=n||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:f,personProperties:s,groupProperties:u}=n||{},l=this.addLocalPersonAndGroupProperties(r,a,s,u);s=l.allPersonProperties,u=l.allGroupProperties;let p;return this.featureFlagsPoller!==void 0&&(i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),i&&(p=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i))),c==null&&(c=!1),f==null&&(f=!0),c==null&&(c=!1),!(p!==void 0)&&!c&&(p=await super.getFeatureFlagPayloadStateless(t,r,a,s,u,o)),p}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:o,groupProperties:c}=r||{},f=this.addLocalPersonAndGroupProperties(t,i,o,c);o=f.allPersonProperties,c=f.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,o,c),u={},l={},p=!0;if(s&&(u=s.response,l=s.payloads,p=s.fallbackToDecide),p&&!a){let _=await super.getFeatureFlagsAndPayloadsStateless(t,i,o,c,n);u={...u,..._.flags||{}},l={...l,..._.payloads||{}}}return{featureFlags:u,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...n?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,i){let n=new Error("PostHog syntheticException");oTn.captureException(this,t,{syntheticException:n},r,i)}},$Lp=/\(error: (.*)\)/,f3p=50,d3p="?";function ymS(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return i=>{let n=i.match(r);if(n){let a,o,c,f,s;if(n[1]){c=n[1];let p=c.lastIndexOf(".");if(c[p-1]==="."&&p--,p>0){a=c.slice(0,p),o=c.slice(p+1);let _=a.indexOf(".Module");_>0&&(c=c.slice(_+1),a=a.slice(0,_))}f=void 0}o&&(f=a,s=o),o==="<anonymous>"&&(s=void 0,c=void 0),c===void 0&&(s=s||d3p,c=f?`${f}.${s}`:s);let u=n[2]?.startsWith("file://")?n[2].slice(7):n[2],l=n[5]==="native";return u?.match(/\/[A-Z]:/)&&(u=u.slice(1)),!u&&n[5]&&!l&&(u=n[5]),{filename:u?decodeURI(u):void 0,module:e?e(u):void 0,function:c,lineno:YLp(n[3]),colno:YLp(n[4]),in_app:bmS(u||"",l),platform:"node:javascript"}}if(i.match(t))return{filename:i,platform:"node:javascript"}}}function bmS(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 YLp(e){return parseInt(e||"",10)||void 0}function vmS(e){return[90,ymS(e)]}function gmS(e){let r=[vmS(e)].sort((i,n)=>i[0]-n[0]).map(i=>i[1]);return(i,n=0)=>{let a=[],o=i.split(`
|
|
1150
|
-
`);for(let c=n;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let s=$Lp.test(f)?f.replace($Lp,"$1"):f;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=f3p)break}}return OmS(a)}}function OmS(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,f3p).map(r=>({...r,filename:r.filename||AmS(t).filename,function:r.function||d3p}))}function AmS(e){return e[e.length-1]||{}}oTn.stackParser=gmS(IAS());oTn.frameModifiers=[TAS];var sTn=class extends n7s{getLibraryId(){return"posthog-node"}};var b0o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new sTn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"3.13.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Yga=class{async sendEvent(){}async identify(){}async flush(){}};var lTn=require("fs/promises"),y3p=require("os"),b3p=require("path");var p3p=ue(require("crypto")),g0o=new Uint8Array(256),v0o=g0o.length;function s7s(){return v0o>g0o.length-16&&(p3p.default.randomFillSync(g0o),v0o=0),g0o.slice(v0o,v0o+=16)}var TQ=[];for(let e=0;e<256;++e)TQ.push((e+256).toString(16).slice(1));function _3p(e,t=0){return TQ[e[t+0]]+TQ[e[t+1]]+TQ[e[t+2]]+TQ[e[t+3]]+"-"+TQ[e[t+4]]+TQ[e[t+5]]+"-"+TQ[e[t+6]]+TQ[e[t+7]]+"-"+TQ[e[t+8]]+TQ[e[t+9]]+"-"+TQ[e[t+10]]+TQ[e[t+11]]+TQ[e[t+12]]+TQ[e[t+13]]+TQ[e[t+14]]+TQ[e[t+15]]}var h3p=ue(require("crypto")),c7s={randomUUID:h3p.default.randomUUID};function mmS(e,t,r){if(c7s.randomUUID&&!t&&!e)return c7s.randomUUID();e=e||{};let i=e.random||(e.rng||s7s)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return _3p(i)}var Z_e=mmS;var PmS="id",jmS=".fern",Xga=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new sTn(r),this.userId=t==null?void 0:B8s(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:"3.13.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ft(Ur.of((0,y3p.homedir)()),Ze.of(jmS),Ze.of(PmS));await Ri(t)||(await(0,lTn.mkdir)((0,b3p.dirname)(t),{recursive:!0}),await(0,lTn.writeFile)(t,Z_e())),this.persistedDistinctId=(await(0,lTn.readFile)(t)).toString()}return this.persistedDistinctId}};var l7s;async function fTn(){return l7s==null&&(l7s=await wmS()),l7s}async function wmS(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Yga;let r=await zyo();return r!=null?new Xga({token:r,posthogApiKey:e}):await _qn()!=null?new b0o({posthogApiKey:e}):new Xga({token:void 0,posthogApiKey:e})}catch{return new Yga}}function Zga(e,t){return function(){return e.apply(t,arguments)}}var{toString:EmS}=Object.prototype,{getPrototypeOf:d7s}=Object,{iterator:A0o,toStringTag:g3p}=Symbol,m0o=(e=>t=>{let r=EmS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),RNt=e=>(e=e.toLowerCase(),t=>m0o(t)===e),P0o=e=>t=>typeof t===e,{isArray:pTn}=Array,dTn=P0o("undefined");function kga(e){return e!==null&&!dTn(e)&&e.constructor!==null&&!dTn(e.constructor)&&DH(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var O3p=RNt("ArrayBuffer");function SmS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&O3p(e.buffer),t}var MmS=P0o("string"),DH=P0o("function"),A3p=P0o("number"),eOa=e=>e!==null&&typeof e=="object",DmS=e=>e===!0||e===!1,O0o=e=>{if(m0o(e)!=="object")return!1;let t=d7s(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(g3p in e)&&!(A0o in e)},BmS=e=>{if(!eOa(e)||kga(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ImS=RNt("Date"),CmS=RNt("File"),qmS=RNt("Blob"),TmS=RNt("FileList"),RmS=e=>eOa(e)&&DH(e.pipe),zmS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||DH(e.append)&&((t=m0o(e))==="formdata"||t==="object"&&DH(e.toString)&&e.toString()==="[object FormData]"))},NmS=RNt("URLSearchParams"),[FmS,QmS,UmS,LmS]=["ReadableStream","Request","Response","Headers"].map(RNt),VmS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tOa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),pTn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(kga(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(i=0;i<o;i++)c=a[i],t.call(null,e[c],c,e)}}function m3p(e,t){if(kga(e))return null;t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var U7i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,P3p=e=>!dTn(e)&&e!==U7i;function f7s(){let{caseless:e,skipUndefined:t}=P3p(this)&&this||{},r={},i=(n,a)=>{let o=e&&m3p(r,a)||a;O0o(r[o])&&O0o(n)?r[o]=f7s(r[o],n):O0o(n)?r[o]=f7s({},n):pTn(n)?r[o]=n.slice():(!t||!dTn(n))&&(r[o]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&tOa(arguments[n],i);return r}var WmS=(e,t,r,{allOwnKeys:i}={})=>(tOa(t,(n,a)=>{r&&DH(n)?e[a]=Zga(n,r):e[a]=n},{allOwnKeys:i}),e),xmS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),GmS=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},HmS=(e,t,r,i)=>{let n,a,o,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)o=n[a],(!i||i(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&d7s(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},KmS=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},JmS=e=>{if(!e)return null;if(pTn(e))return e;let t=e.length;if(!A3p(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},$mS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&d7s(Uint8Array)),YmS=(e,t)=>{let i=(e&&e[A0o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},XmS=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},ZmS=RNt("HTMLFormElement"),kmS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),v3p=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),e0S=RNt("RegExp"),j3p=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};tOa(r,(n,a)=>{let o;(o=t(n,a,e))!==!1&&(i[a]=o||n)}),Object.defineProperties(e,i)},t0S=e=>{j3p(e,(t,r)=>{if(DH(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(DH(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},r0S=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return pTn(e)?i(e):i(String(e).split(t)),r},i0S=()=>{},n0S=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function a0S(e){return!!(e&&DH(e.append)&&e[g3p]==="FormData"&&e[A0o])}var o0S=e=>{let t=new Array(10),r=(i,n)=>{if(eOa(i)){if(t.indexOf(i)>=0)return;if(kga(i))return i;if(!("toJSON"in i)){t[n]=i;let a=pTn(i)?[]:{};return tOa(i,(o,c)=>{let f=r(o,n+1);!dTn(f)&&(a[c]=f)}),t[n]=void 0,a}}return i};return r(e,0)},u0S=RNt("AsyncFunction"),s0S=e=>e&&(eOa(e)||DH(e))&&DH(e.then)&&DH(e.catch),w3p=((e,t)=>e?setImmediate:t?((r,i)=>(U7i.addEventListener("message",({source:n,data:a})=>{n===U7i&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),U7i.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",DH(U7i.postMessage)),c0S=typeof queueMicrotask<"u"?queueMicrotask.bind(U7i):typeof process<"u"&&process.nextTick||w3p,l0S=e=>e!=null&&DH(e[A0o]),er={isArray:pTn,isArrayBuffer:O3p,isBuffer:kga,isFormData:zmS,isArrayBufferView:SmS,isString:MmS,isNumber:A3p,isBoolean:DmS,isObject:eOa,isPlainObject:O0o,isEmptyObject:BmS,isReadableStream:FmS,isRequest:QmS,isResponse:UmS,isHeaders:LmS,isUndefined:dTn,isDate:ImS,isFile:CmS,isBlob:qmS,isRegExp:e0S,isFunction:DH,isStream:RmS,isURLSearchParams:NmS,isTypedArray:$mS,isFileList:TmS,forEach:tOa,merge:f7s,extend:WmS,trim:VmS,stripBOM:xmS,inherits:GmS,toFlatObject:HmS,kindOf:m0o,kindOfTest:RNt,endsWith:KmS,toArray:JmS,forEachEntry:YmS,matchAll:XmS,isHTMLForm:ZmS,hasOwnProperty:v3p,hasOwnProp:v3p,reduceDescriptors:j3p,freezeMethods:t0S,toObjectSet:r0S,toCamelCase:kmS,noop:i0S,toFiniteNumber:n0S,findKey:m3p,global:U7i,isContextDefined:P3p,isSpecCompliantForm:a0S,toJSONObject:o0S,isAsyncFn:u0S,isThenable:s0S,setImmediate:w3p,asap:c0S,isIterable:l0S};function _Tn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}er.inherits(_Tn,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:er.toJSONObject(this.config),code:this.code,status:this.status}}});var E3p=_Tn.prototype,S3p={};["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=>{S3p[e]={value:e}});Object.defineProperties(_Tn,S3p);Object.defineProperty(E3p,"isAxiosError",{value:!0});_Tn.from=(e,t,r,i,n,a)=>{let o=Object.create(E3p);er.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return _Tn.call(o,c,f,r,i,n),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var ha=_Tn;var M3p=ue(jGi(),1),j0o=M3p.default;function p7s(e){return er.isPlainObject(e)||er.isArray(e)}function B3p(e){return er.endsWith(e,"[]")?e.slice(0,-2):e}function D3p(e,t,r){return e?e.concat(t).map(function(n,a){return n=B3p(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function f0S(e){return er.isArray(e)&&!e.some(p7s)}var d0S=er.toFlatObject(er,{},null,function(t){return/^is[A-Z]/.test(t)});function p0S(e,t,r){if(!er.isObject(e))throw new TypeError("target must be an object");t=t||new(j0o||FormData),r=er.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!er.isUndefined(b[y])});let i=r.metaTokens,n=r.visitor||u,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&er.isSpecCompliantForm(t);if(!er.isFunction(n))throw new TypeError("visitor must be a function");function s(h){if(h===null)return"";if(er.isDate(h))return h.toISOString();if(er.isBoolean(h))return h.toString();if(!f&&er.isBlob(h))throw new ha("Blob is not supported. Use a Buffer instead.");return er.isArrayBuffer(h)||er.isTypedArray(h)?f&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,b){let v=h;if(h&&!b&&typeof h=="object"){if(er.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(er.isArray(h)&&f0S(h)||(er.isFileList(h)||er.endsWith(y,"[]"))&&(v=er.toArray(h)))return y=B3p(y),v.forEach(function(A,g){!(er.isUndefined(A)||A===null)&&t.append(o===!0?D3p([y],g,a):o===null?y:y+"[]",s(A))}),!1}return p7s(h)?!0:(t.append(D3p(b,y,a),s(h)),!1)}let l=[],p=Object.assign(d0S,{defaultVisitor:u,convertValue:s,isVisitable:p7s});function _(h,y){if(!er.isUndefined(h)){if(l.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));l.push(h),er.forEach(h,function(v,O){(!(er.isUndefined(v)||v===null)&&n.call(t,v,er.isString(O)?O.trim():O,y,p))===!0&&_(v,y?y.concat(O):[O])}),l.pop()}}if(!er.isObject(e))throw new TypeError("data must be an object");return _(e),t}var BBi=p0S;function I3p(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function C3p(e,t){this._pairs=[],e&&BBi(e,this,t)}var q3p=C3p.prototype;q3p.append=function(t,r){this._pairs.push([t,r])};q3p.toString=function(t){let r=t?function(i){return t.call(this,i,I3p)}:I3p;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var T3p=C3p;function _0S(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function L7i(e,t,r){if(!t)return e;let i=r&&r.encode||_0S;er.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=er.isURLSearchParams(t)?t.toString():new T3p(t,r).toString(i),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var _7s=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){er.forEach(this.handlers,function(i){i!==null&&t(i)})}},h7s=_7s;var hTn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var F3p=ue(require("crypto"),1);var R3p=ue(require("url"),1),z3p=R3p.default.URLSearchParams;var y7s="abcdefghijklmnopqrstuvwxyz",N3p="0123456789",Q3p={DIGIT:N3p,ALPHA:y7s,ALPHA_DIGIT:y7s+y7s.toUpperCase()+N3p},h0S=(e=16,t=Q3p.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);F3p.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},U3p={isNode:!0,classes:{URLSearchParams:z3p,FormData:j0o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Q3p,generateString:h0S,protocols:["http","https","file","data"]};var g7s={};Yt(g7s,{hasBrowserEnv:()=>v7s,hasStandardBrowserEnv:()=>y0S,hasStandardBrowserWebWorkerEnv:()=>b0S,navigator:()=>b7s,origin:()=>v0S});var v7s=typeof window<"u"&&typeof document<"u",b7s=typeof navigator=="object"&&navigator||void 0,y0S=v7s&&(!b7s||["ReactNative","NativeScript","NS"].indexOf(b7s.product)<0),b0S=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",v0S=v7s&&window.location.href||"http://localhost";var gA={...g7s,...U3p};function O7s(e,t){return BBi(e,new gA.classes.URLSearchParams,{visitor:function(r,i,n,a){return gA.isNode&&er.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function g0S(e){return er.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function O0S(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function A0S(e){function t(r,i,n,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&er.isArray(n)?n.length:o,f?(er.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!c):((!n[o]||!er.isObject(n[o]))&&(n[o]=[]),t(r,i,n[o],a)&&er.isArray(n[o])&&(n[o]=O0S(n[o])),!c)}if(er.isFormData(e)&&er.isFunction(e.entries)){let r={};return er.forEachEntry(e,(i,n)=>{t(g0S(i),n,r,0)}),r}return null}var w0o=A0S;function m0S(e,t,r){if(er.isString(e))try{return(t||JSON.parse)(e),er.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var A7s={transitional:hTn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=er.isObject(t);if(a&&er.isHTMLForm(t)&&(t=new FormData(t)),er.isFormData(t))return n?JSON.stringify(w0o(t)):t;if(er.isArrayBuffer(t)||er.isBuffer(t)||er.isStream(t)||er.isFile(t)||er.isBlob(t)||er.isReadableStream(t))return t;if(er.isArrayBufferView(t))return t.buffer;if(er.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return O7s(t,this.formSerializer).toString();if((c=er.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return BBi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),m0S(t)):t}],transformResponse:[function(t){let r=this.transitional||A7s.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(er.isResponse(t)||er.isReadableStream(t))return t;if(t&&er.isString(t)&&(i&&!this.responseType||n)){let o=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?ha.from(c,ha.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:gA.classes.FormData,Blob:gA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};er.forEach(["delete","get","head","post","put","patch"],e=>{A7s.headers[e]={}});var yTn=A7s;var P0S=er.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"]),L3p=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1150
|
+
`);for(let c=n;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let s=$Lp.test(f)?f.replace($Lp,"$1"):f;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=f3p)break}}return OmS(a)}}function OmS(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,f3p).map(r=>({...r,filename:r.filename||AmS(t).filename,function:r.function||d3p}))}function AmS(e){return e[e.length-1]||{}}oTn.stackParser=gmS(IAS());oTn.frameModifiers=[TAS];var sTn=class extends n7s{getLibraryId(){return"posthog-node"}};var b0o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new sTn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"3.14.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Yga=class{async sendEvent(){}async identify(){}async flush(){}};var lTn=require("fs/promises"),y3p=require("os"),b3p=require("path");var p3p=ue(require("crypto")),g0o=new Uint8Array(256),v0o=g0o.length;function s7s(){return v0o>g0o.length-16&&(p3p.default.randomFillSync(g0o),v0o=0),g0o.slice(v0o,v0o+=16)}var TQ=[];for(let e=0;e<256;++e)TQ.push((e+256).toString(16).slice(1));function _3p(e,t=0){return TQ[e[t+0]]+TQ[e[t+1]]+TQ[e[t+2]]+TQ[e[t+3]]+"-"+TQ[e[t+4]]+TQ[e[t+5]]+"-"+TQ[e[t+6]]+TQ[e[t+7]]+"-"+TQ[e[t+8]]+TQ[e[t+9]]+"-"+TQ[e[t+10]]+TQ[e[t+11]]+TQ[e[t+12]]+TQ[e[t+13]]+TQ[e[t+14]]+TQ[e[t+15]]}var h3p=ue(require("crypto")),c7s={randomUUID:h3p.default.randomUUID};function mmS(e,t,r){if(c7s.randomUUID&&!t&&!e)return c7s.randomUUID();e=e||{};let i=e.random||(e.rng||s7s)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return _3p(i)}var Z_e=mmS;var PmS="id",jmS=".fern",Xga=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new sTn(r),this.userId=t==null?void 0:B8s(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:"3.14.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ft(Ur.of((0,y3p.homedir)()),Ze.of(jmS),Ze.of(PmS));await Ri(t)||(await(0,lTn.mkdir)((0,b3p.dirname)(t),{recursive:!0}),await(0,lTn.writeFile)(t,Z_e())),this.persistedDistinctId=(await(0,lTn.readFile)(t)).toString()}return this.persistedDistinctId}};var l7s;async function fTn(){return l7s==null&&(l7s=await wmS()),l7s}async function wmS(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Yga;let r=await zyo();return r!=null?new Xga({token:r,posthogApiKey:e}):await _qn()!=null?new b0o({posthogApiKey:e}):new Xga({token:void 0,posthogApiKey:e})}catch{return new Yga}}function Zga(e,t){return function(){return e.apply(t,arguments)}}var{toString:EmS}=Object.prototype,{getPrototypeOf:d7s}=Object,{iterator:A0o,toStringTag:g3p}=Symbol,m0o=(e=>t=>{let r=EmS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),RNt=e=>(e=e.toLowerCase(),t=>m0o(t)===e),P0o=e=>t=>typeof t===e,{isArray:pTn}=Array,dTn=P0o("undefined");function kga(e){return e!==null&&!dTn(e)&&e.constructor!==null&&!dTn(e.constructor)&&DH(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var O3p=RNt("ArrayBuffer");function SmS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&O3p(e.buffer),t}var MmS=P0o("string"),DH=P0o("function"),A3p=P0o("number"),eOa=e=>e!==null&&typeof e=="object",DmS=e=>e===!0||e===!1,O0o=e=>{if(m0o(e)!=="object")return!1;let t=d7s(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(g3p in e)&&!(A0o in e)},BmS=e=>{if(!eOa(e)||kga(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ImS=RNt("Date"),CmS=RNt("File"),qmS=RNt("Blob"),TmS=RNt("FileList"),RmS=e=>eOa(e)&&DH(e.pipe),zmS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||DH(e.append)&&((t=m0o(e))==="formdata"||t==="object"&&DH(e.toString)&&e.toString()==="[object FormData]"))},NmS=RNt("URLSearchParams"),[FmS,QmS,UmS,LmS]=["ReadableStream","Request","Response","Headers"].map(RNt),VmS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tOa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),pTn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(kga(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(i=0;i<o;i++)c=a[i],t.call(null,e[c],c,e)}}function m3p(e,t){if(kga(e))return null;t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var U7i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,P3p=e=>!dTn(e)&&e!==U7i;function f7s(){let{caseless:e,skipUndefined:t}=P3p(this)&&this||{},r={},i=(n,a)=>{let o=e&&m3p(r,a)||a;O0o(r[o])&&O0o(n)?r[o]=f7s(r[o],n):O0o(n)?r[o]=f7s({},n):pTn(n)?r[o]=n.slice():(!t||!dTn(n))&&(r[o]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&tOa(arguments[n],i);return r}var WmS=(e,t,r,{allOwnKeys:i}={})=>(tOa(t,(n,a)=>{r&&DH(n)?e[a]=Zga(n,r):e[a]=n},{allOwnKeys:i}),e),xmS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),GmS=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},HmS=(e,t,r,i)=>{let n,a,o,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)o=n[a],(!i||i(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&d7s(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},KmS=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},JmS=e=>{if(!e)return null;if(pTn(e))return e;let t=e.length;if(!A3p(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},$mS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&d7s(Uint8Array)),YmS=(e,t)=>{let i=(e&&e[A0o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},XmS=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},ZmS=RNt("HTMLFormElement"),kmS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),v3p=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),e0S=RNt("RegExp"),j3p=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};tOa(r,(n,a)=>{let o;(o=t(n,a,e))!==!1&&(i[a]=o||n)}),Object.defineProperties(e,i)},t0S=e=>{j3p(e,(t,r)=>{if(DH(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(DH(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},r0S=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return pTn(e)?i(e):i(String(e).split(t)),r},i0S=()=>{},n0S=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function a0S(e){return!!(e&&DH(e.append)&&e[g3p]==="FormData"&&e[A0o])}var o0S=e=>{let t=new Array(10),r=(i,n)=>{if(eOa(i)){if(t.indexOf(i)>=0)return;if(kga(i))return i;if(!("toJSON"in i)){t[n]=i;let a=pTn(i)?[]:{};return tOa(i,(o,c)=>{let f=r(o,n+1);!dTn(f)&&(a[c]=f)}),t[n]=void 0,a}}return i};return r(e,0)},u0S=RNt("AsyncFunction"),s0S=e=>e&&(eOa(e)||DH(e))&&DH(e.then)&&DH(e.catch),w3p=((e,t)=>e?setImmediate:t?((r,i)=>(U7i.addEventListener("message",({source:n,data:a})=>{n===U7i&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),U7i.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",DH(U7i.postMessage)),c0S=typeof queueMicrotask<"u"?queueMicrotask.bind(U7i):typeof process<"u"&&process.nextTick||w3p,l0S=e=>e!=null&&DH(e[A0o]),er={isArray:pTn,isArrayBuffer:O3p,isBuffer:kga,isFormData:zmS,isArrayBufferView:SmS,isString:MmS,isNumber:A3p,isBoolean:DmS,isObject:eOa,isPlainObject:O0o,isEmptyObject:BmS,isReadableStream:FmS,isRequest:QmS,isResponse:UmS,isHeaders:LmS,isUndefined:dTn,isDate:ImS,isFile:CmS,isBlob:qmS,isRegExp:e0S,isFunction:DH,isStream:RmS,isURLSearchParams:NmS,isTypedArray:$mS,isFileList:TmS,forEach:tOa,merge:f7s,extend:WmS,trim:VmS,stripBOM:xmS,inherits:GmS,toFlatObject:HmS,kindOf:m0o,kindOfTest:RNt,endsWith:KmS,toArray:JmS,forEachEntry:YmS,matchAll:XmS,isHTMLForm:ZmS,hasOwnProperty:v3p,hasOwnProp:v3p,reduceDescriptors:j3p,freezeMethods:t0S,toObjectSet:r0S,toCamelCase:kmS,noop:i0S,toFiniteNumber:n0S,findKey:m3p,global:U7i,isContextDefined:P3p,isSpecCompliantForm:a0S,toJSONObject:o0S,isAsyncFn:u0S,isThenable:s0S,setImmediate:w3p,asap:c0S,isIterable:l0S};function _Tn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}er.inherits(_Tn,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:er.toJSONObject(this.config),code:this.code,status:this.status}}});var E3p=_Tn.prototype,S3p={};["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=>{S3p[e]={value:e}});Object.defineProperties(_Tn,S3p);Object.defineProperty(E3p,"isAxiosError",{value:!0});_Tn.from=(e,t,r,i,n,a)=>{let o=Object.create(E3p);er.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return _Tn.call(o,c,f,r,i,n),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var ha=_Tn;var M3p=ue(jGi(),1),j0o=M3p.default;function p7s(e){return er.isPlainObject(e)||er.isArray(e)}function B3p(e){return er.endsWith(e,"[]")?e.slice(0,-2):e}function D3p(e,t,r){return e?e.concat(t).map(function(n,a){return n=B3p(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function f0S(e){return er.isArray(e)&&!e.some(p7s)}var d0S=er.toFlatObject(er,{},null,function(t){return/^is[A-Z]/.test(t)});function p0S(e,t,r){if(!er.isObject(e))throw new TypeError("target must be an object");t=t||new(j0o||FormData),r=er.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!er.isUndefined(b[y])});let i=r.metaTokens,n=r.visitor||u,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&er.isSpecCompliantForm(t);if(!er.isFunction(n))throw new TypeError("visitor must be a function");function s(h){if(h===null)return"";if(er.isDate(h))return h.toISOString();if(er.isBoolean(h))return h.toString();if(!f&&er.isBlob(h))throw new ha("Blob is not supported. Use a Buffer instead.");return er.isArrayBuffer(h)||er.isTypedArray(h)?f&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,b){let v=h;if(h&&!b&&typeof h=="object"){if(er.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(er.isArray(h)&&f0S(h)||(er.isFileList(h)||er.endsWith(y,"[]"))&&(v=er.toArray(h)))return y=B3p(y),v.forEach(function(A,g){!(er.isUndefined(A)||A===null)&&t.append(o===!0?D3p([y],g,a):o===null?y:y+"[]",s(A))}),!1}return p7s(h)?!0:(t.append(D3p(b,y,a),s(h)),!1)}let l=[],p=Object.assign(d0S,{defaultVisitor:u,convertValue:s,isVisitable:p7s});function _(h,y){if(!er.isUndefined(h)){if(l.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));l.push(h),er.forEach(h,function(v,O){(!(er.isUndefined(v)||v===null)&&n.call(t,v,er.isString(O)?O.trim():O,y,p))===!0&&_(v,y?y.concat(O):[O])}),l.pop()}}if(!er.isObject(e))throw new TypeError("data must be an object");return _(e),t}var BBi=p0S;function I3p(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function C3p(e,t){this._pairs=[],e&&BBi(e,this,t)}var q3p=C3p.prototype;q3p.append=function(t,r){this._pairs.push([t,r])};q3p.toString=function(t){let r=t?function(i){return t.call(this,i,I3p)}:I3p;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var T3p=C3p;function _0S(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function L7i(e,t,r){if(!t)return e;let i=r&&r.encode||_0S;er.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=er.isURLSearchParams(t)?t.toString():new T3p(t,r).toString(i),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var _7s=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){er.forEach(this.handlers,function(i){i!==null&&t(i)})}},h7s=_7s;var hTn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var F3p=ue(require("crypto"),1);var R3p=ue(require("url"),1),z3p=R3p.default.URLSearchParams;var y7s="abcdefghijklmnopqrstuvwxyz",N3p="0123456789",Q3p={DIGIT:N3p,ALPHA:y7s,ALPHA_DIGIT:y7s+y7s.toUpperCase()+N3p},h0S=(e=16,t=Q3p.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);F3p.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},U3p={isNode:!0,classes:{URLSearchParams:z3p,FormData:j0o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Q3p,generateString:h0S,protocols:["http","https","file","data"]};var g7s={};Yt(g7s,{hasBrowserEnv:()=>v7s,hasStandardBrowserEnv:()=>y0S,hasStandardBrowserWebWorkerEnv:()=>b0S,navigator:()=>b7s,origin:()=>v0S});var v7s=typeof window<"u"&&typeof document<"u",b7s=typeof navigator=="object"&&navigator||void 0,y0S=v7s&&(!b7s||["ReactNative","NativeScript","NS"].indexOf(b7s.product)<0),b0S=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",v0S=v7s&&window.location.href||"http://localhost";var gA={...g7s,...U3p};function O7s(e,t){return BBi(e,new gA.classes.URLSearchParams,{visitor:function(r,i,n,a){return gA.isNode&&er.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function g0S(e){return er.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function O0S(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function A0S(e){function t(r,i,n,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&er.isArray(n)?n.length:o,f?(er.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!c):((!n[o]||!er.isObject(n[o]))&&(n[o]=[]),t(r,i,n[o],a)&&er.isArray(n[o])&&(n[o]=O0S(n[o])),!c)}if(er.isFormData(e)&&er.isFunction(e.entries)){let r={};return er.forEachEntry(e,(i,n)=>{t(g0S(i),n,r,0)}),r}return null}var w0o=A0S;function m0S(e,t,r){if(er.isString(e))try{return(t||JSON.parse)(e),er.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var A7s={transitional:hTn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=er.isObject(t);if(a&&er.isHTMLForm(t)&&(t=new FormData(t)),er.isFormData(t))return n?JSON.stringify(w0o(t)):t;if(er.isArrayBuffer(t)||er.isBuffer(t)||er.isStream(t)||er.isFile(t)||er.isBlob(t)||er.isReadableStream(t))return t;if(er.isArrayBufferView(t))return t.buffer;if(er.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return O7s(t,this.formSerializer).toString();if((c=er.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return BBi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),m0S(t)):t}],transformResponse:[function(t){let r=this.transitional||A7s.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(er.isResponse(t)||er.isReadableStream(t))return t;if(t&&er.isString(t)&&(i&&!this.responseType||n)){let o=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?ha.from(c,ha.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:gA.classes.FormData,Blob:gA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};er.forEach(["delete","get","head","post","put","patch"],e=>{A7s.headers[e]={}});var yTn=A7s;var P0S=er.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"]),L3p=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1151
1151
|
`).forEach(function(o){n=o.indexOf(":"),r=o.substring(0,n).trim().toLowerCase(),i=o.substring(n+1).trim(),!(!r||t[r]&&P0S[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var V3p=Symbol("internals");function rOa(e){return e&&String(e).trim().toLowerCase()}function E0o(e){return e===!1||e==null?e:er.isArray(e)?e.map(E0o):String(e)}function j0S(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var w0S=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function m7s(e,t,r,i,n){if(er.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!er.isString(t)){if(er.isString(i))return t.indexOf(i)!==-1;if(er.isRegExp(i))return i.test(t)}}function E0S(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function S0S(e,t){let r=er.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,o){return this[i].call(this,t,n,a,o)},configurable:!0})})}var bTn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(c,f,s){let u=rOa(f);if(!u)throw new Error("header name must be a non-empty string");let l=er.findKey(n,u);(!l||n[l]===void 0||s===!0||s===void 0&&n[l]!==!1)&&(n[l||f]=E0o(c))}let o=(c,f)=>er.forEach(c,(s,u)=>a(s,u,f));if(er.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(er.isString(t)&&(t=t.trim())&&!w0S(t))o(L3p(t),r);else if(er.isObject(t)&&er.isIterable(t)){let c={},f,s;for(let u of t){if(!er.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[s=u[0]]=(f=c[s])?er.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}o(c,r)}else t!=null&&a(r,t,i);return this}get(t,r){if(t=rOa(t),t){let i=er.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return j0S(n);if(er.isFunction(r))return r.call(this,n,i);if(er.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=rOa(t),t){let i=er.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||m7s(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(o){if(o=rOa(o),o){let c=er.findKey(i,o);c&&(!r||m7s(i,i[c],c,r))&&(delete i[c],n=!0)}}return er.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||m7s(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return er.forEach(this,(n,a)=>{let o=er.findKey(i,a);if(o){r[o]=E0o(n),delete r[a];return}let c=t?E0S(a):String(a).trim();c!==a&&delete r[a],r[c]=E0o(n),i[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return er.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&er.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
1152
1152
|
`)}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 i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[V3p]=this[V3p]={accessors:{}}).accessors,n=this.prototype;function a(o){let c=rOa(o);i[c]||(S0S(n,o),i[c]=!0)}return er.isArray(t)?t.forEach(a):a(t),this}};bTn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);er.reduceDescriptors(bTn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});er.freezeMethods(bTn);var QS=bTn;function iOa(e,t){let r=this||yTn,i=t||r,n=QS.from(i.headers),a=i.data;return er.forEach(e,function(c){a=c.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function nOa(e){return!!(e&&e.__CANCEL__)}function W3p(e,t,r){ha.call(this,e??"canceled",ha.ERR_CANCELED,t,r),this.name="CanceledError"}er.inherits(W3p,ha,{__CANCEL__:!0});var k_e=W3p;function t6t(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new ha("Request failed with status code "+r.status,[ha.ERR_BAD_REQUEST,ha.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function P7s(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function j7s(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function V7i(e,t,r){let i=!P7s(t);return e&&(i||r==!1)?j7s(e,t):t}var a8p=ue(Kmo(),1),o8p=ue(require("http"),1),u8p=ue(require("https"),1),s8p=ue(require("util"),1),c8p=ue(wGs(),1),zbi=ue(require("zlib"),1);var W7i="1.12.2";function aOa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var M0S=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function w7s(e,t,r){let i=r&&r.Blob||gA.classes.Blob,n=aOa(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=M0S.exec(e);if(!a)throw new ha("Invalid URL",ha.ERR_INVALID_URL);let o=a[1],c=a[2],f=a[3],s=Buffer.from(decodeURIComponent(f),c?"base64":"utf8");if(t){if(!i)throw new ha("Blob is not supported",ha.ERR_NOT_SUPPORT);return new i([s],{type:o})}return s}throw new ha("Unsupported protocol "+n,ha.ERR_NOT_SUPPORT)}var G7i=ue(require("stream"),1);var x3p=ue(require("stream"),1);var E7s=Symbol("internals"),S7s=class extends x3p.default.Transform{constructor(t){t=er.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!er.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[E7s]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[E7s];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[E7s],a=n.maxRate,o=this.readableHighWaterMark,c=n.timeWindow,f=1e3/c,s=a/f,u=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,l=(_,h)=>{let y=Buffer.byteLength(_);n.bytesSeen+=y,n.bytes+=y,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(_)?process.nextTick(h):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(h)}},p=(_,h)=>{let y=Buffer.byteLength(_),b=null,v=o,O,A=0;if(a){let g=Date.now();(!n.ts||(A=g-n.ts)>=c)&&(n.ts=g,O=s-n.bytes,n.bytes=O<0?-O:0,A=0),O=s-n.bytes}if(a){if(O<=0)return setTimeout(()=>{h(null,_)},c-A);O<v&&(v=O)}v&&y>v&&y-v>u&&(b=_.subarray(v),_=_.subarray(0,v)),l(_,b?()=>{process.nextTick(h,null,b)}:h)};p(t,function _(h,y){if(h)return i(h);y?p(y,_):i(null)})}},M7s=S7s;var l8p=require("events");var H3p=ue(require("util"),1),K3p=require("stream");var{asyncIterator:G3p}=Symbol,D0S=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[G3p]?yield*e[G3p]():yield e},S0o=D0S;var B0S=gA.ALPHABET.ALPHA_DIGIT+"-_",oOa=typeof TextEncoder=="function"?new TextEncoder:new H3p.default.TextEncoder,x7i=`\r
|
|
1153
1153
|
`,I0S=oOa.encode(x7i),C0S=2,D7s=class{constructor(t,r){let{escapeName:i}=this.constructor,n=er.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${x7i}`;n?r=oOa.encode(String(r).replace(/\r?\n|\r\n?/g,x7i)):a+=`Content-Type: ${r.type||"application/octet-stream"}${x7i}`,this.headers=oOa.encode(a+x7i),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+C0S,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;er.isTypedArray(t)?yield t:yield*S0o(t),yield I0S}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},q0S=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+gA.generateString(n,B0S)}=r||{};if(!er.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=oOa.encode("--"+a+x7i),c=oOa.encode("--"+a+"--"+x7i),f=c.byteLength,s=Array.from(e.entries()).map(([l,p])=>{let _=new D7s(l,p);return f+=_.size,_});f+=o.byteLength*s.length,f=er.toFiniteNumber(f);let u={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(u["Content-Length"]=f),t&&t(u),K3p.Readable.from((async function*(){for(let l of s)yield o,yield*l.encode();yield c})())},J3p=q0S;var $3p=ue(require("stream"),1),B7s=class extends $3p.default.Transform{__transform(t,r,i){this.push(t),i()}_transform(t,r,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,r)}this.__transform(t,r,i)}},Y3p=B7s;var T0S=(e,t)=>er.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,X3p=T0S;function R0S(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,o;return t=t!==void 0?t:1e3,function(f){let s=Date.now(),u=i[a];o||(o=s),r[n]=f,i[n]=s;let l=a,p=0;for(;l!==n;)p+=r[l++],l=l%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-o<t)return;let _=u&&s-u;return _?Math.round(p*1e3/_):void 0}}var Z3p=R0S;function z0S(e,t){let r=0,i=1e3/t,n,a,o=(s,u=Date.now())=>{r=u,n=null,a&&(clearTimeout(a),a=null),e(...s)};return[(...s)=>{let u=Date.now(),l=u-r;l>=i?o(s,u):(n=s,a||(a=setTimeout(()=>{a=null,o(n)},i-l)))},()=>n&&o(n)]}var k3p=z0S;var Rbi=(e,t,r=3)=>{let i=0,n=Z3p(50,250);return k3p(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,f=o-i,s=n(f),u=o<=c;i=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:s||void 0,estimated:s&&c&&u?(c-o)/s:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},vTn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},gTn=e=>(...t)=>er.asap(()=>e(...t));function I7s(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),i=e.slice(t+1);if(/;base64/i.test(r)){let a=i.length,o=i.length;for(let p=0;p<o;p++)if(i.charCodeAt(p)===37&&p+2<o){let _=i.charCodeAt(p+1),h=i.charCodeAt(p+2);(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102)&&(a-=2,p+=2)}let c=0,f=o-1,s=p=>p>=2&&i.charCodeAt(p-2)===37&&i.charCodeAt(p-1)===51&&(i.charCodeAt(p)===68||i.charCodeAt(p)===100);f>=0&&(i.charCodeAt(f)===61?(c++,f--):s(f)&&(c++,f-=3)),c===1&&f>=0&&(i.charCodeAt(f)===61||s(f))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(i,"utf8")}var e8p={flush:zbi.default.constants.Z_SYNC_FLUSH,finishFlush:zbi.default.constants.Z_SYNC_FLUSH},N0S={flush:zbi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:zbi.default.constants.BROTLI_OPERATION_FLUSH},t8p=er.isFunction(zbi.default.createBrotliDecompress),{http:F0S,https:Q0S}=c8p.default,U0S=/https:?/,r8p=gA.protocols.map(e=>e+":"),i8p=(e,[t,r])=>(e.on("end",r).on("error",r),t);function L0S(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function f8p(e,t,r){let i=t;if(!i&&i!==!1){let n=a8p.default.getProxyForUrl(r);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let a=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let n=i.hostname||i.host;e.hostname=n,e.host=n,e.port=i.port,e.path=r,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(a){f8p(a,t,a.href)}}var V0S=typeof process<"u"&&er.kindOf(process)==="process",W0S=e=>new Promise((t,r)=>{let i,n,a=(f,s)=>{n||(n=!0,i&&i(f,s))},o=f=>{a(f),t(f)},c=f=>{a(f,!0),r(f)};e(o,c,f=>i=f).catch(c)}),x0S=({address:e,family:t})=>{if(!er.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},n8p=(e,t)=>x0S(er.isObject(e)?e:{address:e,family:t}),d8p=V0S&&function(t){return W0S(async function(i,n,a){let{data:o,lookup:c,family:f}=t,{responseType:s,responseEncoding:u}=t,l=t.method.toUpperCase(),p,_=!1,h;if(c){let K=X3p(c,fe=>er.isArray(fe)?fe:[fe]);c=(fe,pe,L)=>{K(fe,pe,(G,Re,le)=>{if(G)return L(G);let Ie=er.isArray(Re)?Re.map(Ke=>n8p(Ke)):[n8p(Re,le)];pe.all?L(G,Ie):L(G,Ie[0].address,Ie[0].family)})}}let y=new l8p.EventEmitter,b=()=>{t.cancelToken&&t.cancelToken.unsubscribe(v),t.signal&&t.signal.removeEventListener("abort",v),y.removeAllListeners()};a((K,fe)=>{p=!0,fe&&(_=!0,b())});function v(K){y.emit("abort",!K||K.type?new k_e(null,t,h):K)}y.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(v),t.signal&&(t.signal.aborted?v():t.signal.addEventListener("abort",v)));let O=V7i(t.baseURL,t.url,t.allowAbsoluteUrls),A=new URL(O,gA.hasBrowserEnv?gA.origin:void 0),g=A.protocol||r8p[0];if(g==="data:"){if(t.maxContentLength>-1){let fe=String(t.url||O||"");if(I7s(fe)>t.maxContentLength)return n(new ha("maxContentLength size of "+t.maxContentLength+" exceeded",ha.ERR_BAD_RESPONSE,t))}let K;if(l!=="GET")return t6t(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{K=w7s(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(fe){throw ha.from(fe,ha.ERR_BAD_REQUEST,t)}return s==="text"?(K=K.toString(u),(!u||u==="utf8")&&(K=er.stripBOM(K))):s==="stream"&&(K=G7i.default.Readable.from(K)),t6t(i,n,{data:K,status:200,statusText:"OK",headers:new QS,config:t})}if(r8p.indexOf(g)===-1)return n(new ha("Unsupported protocol "+g,ha.ERR_BAD_REQUEST,t));let m=QS.from(t.headers).normalize();m.set("User-Agent","axios/"+W7i,!1);let{onUploadProgress:j,onDownloadProgress:M}=t,E=t.maxRate,D,B;if(er.isSpecCompliantForm(o)){let K=m.getContentType(/boundary=([-_\w\d]{10,70})/i);o=J3p(o,fe=>{m.set(fe)},{tag:`axios-${W7i}-boundary`,boundary:K&&K[1]||void 0})}else if(er.isFormData(o)&&er.isFunction(o.getHeaders)){if(m.set(o.getHeaders()),!m.hasContentLength())try{let K=await s8p.default.promisify(o.getLength).call(o);Number.isFinite(K)&&K>=0&&m.setContentLength(K)}catch{}}else if(er.isBlob(o)||er.isFile(o))o.size&&m.setContentType(o.type||"application/octet-stream"),m.setContentLength(o.size||0),o=G7i.default.Readable.from(S0o(o));else if(o&&!er.isStream(o)){if(!Buffer.isBuffer(o))if(er.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(er.isString(o))o=Buffer.from(o,"utf-8");else return n(new ha("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",ha.ERR_BAD_REQUEST,t));if(m.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return n(new ha("Request body larger than maxBodyLength limit",ha.ERR_BAD_REQUEST,t))}let F=er.toFiniteNumber(m.getContentLength());er.isArray(E)?(D=E[0],B=E[1]):D=B=E,o&&(j||D)&&(er.isStream(o)||(o=G7i.default.Readable.from(o,{objectMode:!1})),o=G7i.default.pipeline([o,new M7s({maxRate:er.toFiniteNumber(D)})],er.noop),j&&o.on("progress",i8p(o,vTn(F,Rbi(gTn(j),!1,3)))));let N;if(t.auth){let K=t.auth.username||"",fe=t.auth.password||"";N=K+":"+fe}if(!N&&A.username){let K=A.username,fe=A.password;N=K+":"+fe}N&&m.delete("authorization");let R;try{R=L7i(A.pathname+A.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(K){let fe=new Error(K.message);return fe.config=t,fe.url=t.url,fe.exists=!0,n(fe)}m.set("Accept-Encoding","gzip, compress, deflate"+(t8p?", br":""),!1);let z={path:R,method:l,headers:m.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:N,protocol:g,family:f,beforeRedirect:L0S,beforeRedirects:{}};!er.isUndefined(c)&&(z.lookup=c),t.socketPath?z.socketPath=t.socketPath:(z.hostname=A.hostname.startsWith("[")?A.hostname.slice(1,-1):A.hostname,z.port=A.port,f8p(z,t.proxy,g+"//"+A.hostname+(A.port?":"+A.port:"")+z.path));let U,W=U0S.test(z.protocol);if(z.agent=W?t.httpsAgent:t.httpAgent,t.transport?U=t.transport:t.maxRedirects===0?U=W?u8p.default:o8p.default:(t.maxRedirects&&(z.maxRedirects=t.maxRedirects),t.beforeRedirect&&(z.beforeRedirects.config=t.beforeRedirect),U=W?Q0S:F0S),t.maxBodyLength>-1?z.maxBodyLength=t.maxBodyLength:z.maxBodyLength=1/0,t.insecureHTTPParser&&(z.insecureHTTPParser=t.insecureHTTPParser),h=U.request(z,function(fe){if(h.destroyed)return;let pe=[fe],L=+fe.headers["content-length"];if(M||B){let Ke=new M7s({maxRate:er.toFiniteNumber(B)});M&&Ke.on("progress",i8p(Ke,vTn(L,Rbi(gTn(M),!0,3)))),pe.push(Ke)}let G=fe,Re=fe.req||h;if(t.decompress!==!1&&fe.headers["content-encoding"])switch((l==="HEAD"||fe.statusCode===204)&&delete fe.headers["content-encoding"],(fe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":pe.push(zbi.default.createUnzip(e8p)),delete fe.headers["content-encoding"];break;case"deflate":pe.push(new Y3p),pe.push(zbi.default.createUnzip(e8p)),delete fe.headers["content-encoding"];break;case"br":t8p&&(pe.push(zbi.default.createBrotliDecompress(N0S)),delete fe.headers["content-encoding"])}G=pe.length>1?G7i.default.pipeline(pe,er.noop):pe[0];let le=G7i.default.finished(G,()=>{le(),b()}),Ie={status:fe.statusCode,statusText:fe.statusMessage,headers:new QS(fe.headers),config:t,request:Re};if(s==="stream")Ie.data=G,t6t(i,n,Ie);else{let Ke=[],se=0;G.on("data",function(Je){Ke.push(Je),se+=Je.length,t.maxContentLength>-1&&se>t.maxContentLength&&(_=!0,G.destroy(),n(new ha("maxContentLength size of "+t.maxContentLength+" exceeded",ha.ERR_BAD_RESPONSE,t,Re)))}),G.on("aborted",function(){if(_)return;let Je=new ha("stream has been aborted",ha.ERR_BAD_RESPONSE,t,Re);G.destroy(Je),n(Je)}),G.on("error",function(Je){h.destroyed||n(ha.from(Je,null,t,Re))}),G.on("end",function(){try{let Je=Ke.length===1?Ke[0]:Buffer.concat(Ke);s!=="arraybuffer"&&(Je=Je.toString(u),(!u||u==="utf8")&&(Je=er.stripBOM(Je))),Ie.data=Je}catch(Je){return n(ha.from(Je,null,t,Ie.request,Ie))}t6t(i,n,Ie)})}y.once("abort",Ke=>{G.destroyed||(G.emit("error",Ke),G.destroy())})}),y.once("abort",K=>{n(K),h.destroy(K)}),h.on("error",function(fe){n(ha.from(fe,null,t,h))}),h.on("socket",function(fe){fe.setKeepAlive(!0,1e3*60)}),t.timeout){let K=parseInt(t.timeout,10);if(Number.isNaN(K)){n(new ha("error trying to parse `config.timeout` to int",ha.ERR_BAD_OPTION_VALUE,t,h));return}h.setTimeout(K,function(){if(p)return;let pe=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",L=t.transitional||hTn;t.timeoutErrorMessage&&(pe=t.timeoutErrorMessage),n(new ha(pe,L.clarifyTimeoutError?ha.ETIMEDOUT:ha.ECONNABORTED,t,h)),v()})}if(er.isStream(o)){let K=!1,fe=!1;o.on("end",()=>{K=!0}),o.once("error",pe=>{fe=!0,h.destroy(pe)}),o.on("close",()=>{!K&&!fe&&v(new k_e("Request stream has been aborted",t,h))}),o.pipe(h)}else h.end(o)})};var p8p=gA.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,gA.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(gA.origin),gA.navigator&&/(msie|trident)/i.test(gA.navigator.userAgent)):()=>!0;var _8p=gA.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let o=[e+"="+encodeURIComponent(t)];er.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),er.isString(i)&&o.push("path="+i),er.isString(n)&&o.push("domain="+n),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var h8p=e=>e instanceof QS?{...e}:e;function zNt(e,t){t=t||{};let r={};function i(s,u,l,p){return er.isPlainObject(s)&&er.isPlainObject(u)?er.merge.call({caseless:p},s,u):er.isPlainObject(u)?er.merge({},u):er.isArray(u)?u.slice():u}function n(s,u,l,p){if(er.isUndefined(u)){if(!er.isUndefined(s))return i(void 0,s,l,p)}else return i(s,u,l,p)}function a(s,u){if(!er.isUndefined(u))return i(void 0,u)}function o(s,u){if(er.isUndefined(u)){if(!er.isUndefined(s))return i(void 0,s)}else return i(void 0,u)}function c(s,u,l){if(l in t)return i(s,u);if(l in e)return i(void 0,s)}let f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(s,u,l)=>n(h8p(s),h8p(u),l,!0)};return er.forEach(Object.keys({...e,...t}),function(u){let l=f[u]||n,p=l(e[u],t[u],u);er.isUndefined(p)&&l!==c||(r[u]=p)}),r}var M0o=e=>{let t=zNt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=QS.from(o),t.url=L7i(V7i(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),er.isFormData(r)){if(gA.hasStandardBrowserEnv||gA.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(er.isFunction(r.getHeaders)){let f=r.getHeaders(),s=["content-type","content-length"];Object.entries(f).forEach(([u,l])=>{s.includes(u.toLowerCase())&&o.set(u,l)})}}if(gA.hasStandardBrowserEnv&&(i&&er.isFunction(i)&&(i=i(t)),i||i!==!1&&p8p(t.url))){let f=n&&a&&_8p.read(a);f&&o.set(n,f)}return t};var G0S=typeof XMLHttpRequest<"u",y8p=G0S&&function(e){return new Promise(function(r,i){let n=M0o(e),a=n.data,o=QS.from(n.headers).normalize(),{responseType:c,onUploadProgress:f,onDownloadProgress:s}=n,u,l,p,_,h;function y(){_&&_(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(n.method.toUpperCase(),n.url,!0),b.timeout=n.timeout;function v(){if(!b)return;let A=QS.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),m={data:!c||c==="text"||c==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:A,config:e,request:b};t6t(function(M){r(M),y()},function(M){i(M),y()},m),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(v)},b.onabort=function(){b&&(i(new ha("Request aborted",ha.ECONNABORTED,e,b)),b=null)},b.onerror=function(g){let m=g&&g.message?g.message:"Network Error",j=new ha(m,ha.ERR_NETWORK,e,b);j.event=g||null,i(j),b=null},b.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",m=n.transitional||hTn;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),i(new ha(g,m.clarifyTimeoutError?ha.ETIMEDOUT:ha.ECONNABORTED,e,b)),b=null},a===void 0&&o.setContentType(null),"setRequestHeader"in b&&er.forEach(o.toJSON(),function(g,m){b.setRequestHeader(m,g)}),er.isUndefined(n.withCredentials)||(b.withCredentials=!!n.withCredentials),c&&c!=="json"&&(b.responseType=n.responseType),s&&([p,h]=Rbi(s,!0),b.addEventListener("progress",p)),f&&b.upload&&([l,_]=Rbi(f),b.upload.addEventListener("progress",l),b.upload.addEventListener("loadend",_)),(n.cancelToken||n.signal)&&(u=A=>{b&&(i(!A||A.type?new k_e(null,e,b):A),b.abort(),b=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));let O=aOa(n.url);if(O&&gA.protocols.indexOf(O)===-1){i(new ha("Unsupported protocol "+O+":",ha.ERR_BAD_REQUEST,e));return}b.send(a||null)})};var H0S=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,c();let u=s instanceof Error?s:this.reason;i.abort(u instanceof ha?u:new k_e(u instanceof Error?u.message:u))}},o=t&&setTimeout(()=>{o=null,a(new ha(`timeout ${t} of ms exceeded`,ha.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:f}=i;return f.unsubscribe=()=>er.asap(c),f}},b8p=H0S;var K0S=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let i=0,n;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},J0S=async function*(e,t){for await(let r of $0S(e))yield*K0S(r,t)},$0S=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:i}=await t.read();if(r)break;yield i}}finally{await t.cancel()}},C7s=(e,t,r,i)=>{let n=J0S(e,t),a=0,o,c=f=>{o||(o=!0,i&&i(f))};return new ReadableStream({async pull(f){try{let{done:s,value:u}=await n.next();if(s){c(),f.close();return}let l=u.byteLength;if(r){let p=a+=l;r(p)}f.enqueue(new Uint8Array(u))}catch(s){throw c(s),s}},cancel(f){return c(f),n.return()}},{highWaterMark:2})};var v8p=64*1024,{isFunction:D0o}=er,Y0S=(({Request:e,Response:t})=>({Request:e,Response:t}))(er.global),{ReadableStream:g8p,TextEncoder:O8p}=er.global,A8p=(e,...t)=>{try{return!!e(...t)}catch{return!1}},X0S=e=>{e=er.merge.call({skipUndefined:!0},Y0S,e);let{fetch:t,Request:r,Response:i}=e,n=t?D0o(t):typeof fetch=="function",a=D0o(r),o=D0o(i);if(!n)return!1;let c=n&&D0o(g8p),f=n&&(typeof O8p=="function"?(h=>y=>h.encode(y))(new O8p):async h=>new Uint8Array(await new r(h).arrayBuffer())),s=a&&c&&A8p(()=>{let h=!1,y=new r(gA.origin,{body:new g8p,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!y}),u=o&&c&&A8p(()=>er.isReadableStream(new i("").body)),l={stream:u&&(h=>h.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!l[h]&&(l[h]=(y,b)=>{let v=y&&y[h];if(v)return v.call(y);throw new ha(`Response type '${h}' is not supported`,ha.ERR_NOT_SUPPORT,b)})});let p=async h=>{if(h==null)return 0;if(er.isBlob(h))return h.size;if(er.isSpecCompliantForm(h))return(await new r(gA.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(er.isArrayBufferView(h)||er.isArrayBuffer(h))return h.byteLength;if(er.isURLSearchParams(h)&&(h=h+""),er.isString(h))return(await f(h)).byteLength},_=async(h,y)=>{let b=er.toFiniteNumber(h.getContentLength());return b??p(y)};return async h=>{let{url:y,method:b,data:v,signal:O,cancelToken:A,timeout:g,onDownloadProgress:m,onUploadProgress:j,responseType:M,headers:E,withCredentials:D="same-origin",fetchOptions:B}=M0o(h),F=t||fetch;M=M?(M+"").toLowerCase():"text";let N=b8p([O,A&&A.toAbortSignal()],g),R=null,z=N&&N.unsubscribe&&(()=>{N.unsubscribe()}),U;try{if(j&&s&&b!=="get"&&b!=="head"&&(U=await _(E,v))!==0){let G=new r(y,{method:"POST",body:v,duplex:"half"}),Re;if(er.isFormData(v)&&(Re=G.headers.get("content-type"))&&E.setContentType(Re),G.body){let[le,Ie]=vTn(U,Rbi(gTn(j)));v=C7s(G.body,v8p,le,Ie)}}er.isString(D)||(D=D?"include":"omit");let W=a&&"credentials"in r.prototype,K={...B,signal:N,method:b.toUpperCase(),headers:E.normalize().toJSON(),body:v,duplex:"half",credentials:W?D:void 0};R=a&&new r(y,K);let fe=await(a?F(R,B):F(y,K)),pe=u&&(M==="stream"||M==="response");if(u&&(m||pe&&z)){let G={};["status","statusText","headers"].forEach(Ke=>{G[Ke]=fe[Ke]});let Re=er.toFiniteNumber(fe.headers.get("content-length")),[le,Ie]=m&&vTn(Re,Rbi(gTn(m),!0))||[];fe=new i(C7s(fe.body,v8p,le,()=>{Ie&&Ie(),z&&z()}),G)}M=M||"text";let L=await l[er.findKey(l,M)||"text"](fe,h);return!pe&&z&&z(),await new Promise((G,Re)=>{t6t(G,Re,{data:L,headers:QS.from(fe.headers),status:fe.status,statusText:fe.statusText,config:h,request:R})})}catch(W){throw z&&z(),W&&W.name==="TypeError"&&/Load failed|fetch/i.test(W.message)?Object.assign(new ha("Network Error",ha.ERR_NETWORK,h,R),{cause:W.cause||W}):ha.from(W,W&&W.code,h,R)}}},Z0S=new Map,q7s=e=>{let t=e?e.env:{},{fetch:r,Request:i,Response:n}=t,a=[i,n,r],o=a.length,c=o,f,s,u=Z0S;for(;c--;)f=a[c],s=u.get(f),s===void 0&&u.set(f,s=c?new Map:X0S(t)),u=s;return s},Av5=q7s();var T7s={http:d8p,xhr:y8p,fetch:{get:q7s}};er.forEach(T7s,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var m8p=e=>`- ${e}`,ePS=e=>er.isFunction(e)||e===null||e===!1,B0o={getAdapter:(e,t)=>{e=er.isArray(e)?e:[e];let{length:r}=e,i,n,a={};for(let o=0;o<r;o++){i=e[o];let c;if(n=i,!ePS(i)&&(n=T7s[(c=String(i)).toLowerCase()],n===void 0))throw new ha(`Unknown adapter '${c}'`);if(n&&(er.isFunction(n)||(n=n.get(t))))break;a[c||"#"+o]=n}if(!n){let o=Object.entries(a).map(([f,s])=>`adapter ${f} `+(s===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
|
|
@@ -1391,7 +1391,7 @@ ${g}${O}${m}${lQn}`});function OQo({message:e,error:t,logger:r,logLevel:i=Js.Err
|
|
|
1391
1391
|
Run ${Ut.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
|
|
1392
1392
|
Run ${Ut.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),qBi(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function yuc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!_f_(e))return;let n=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,f)=>c.generatorName.localeCompare(f.generatorName)||c.currentVersion.localeCompare(f.currentVersion));for(let c of o)n+=`
|
|
1393
1393
|
${await UXS(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+Ut.dim(c.currentVersion)+Ut.reset(" \u2192 ")+Ut.green(c.latestVersion);return n+=`
|
|
1394
|
-
`,i?qBi(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function UXS(e){let r=await new pf_.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 LXS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await yf_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let p=IMi(u.name,l),_=await lNt({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:n,includeMajor:a,context:l});_!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:_})},generatorFilter:r,groupFilter:i}),c}let o={type:"multiApi",versions:{}};return await yf_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=IMi(s.name,u),p=await lNt({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:u});p!=null&&(o.versions[c][f][s.name]={previousVersion:s.version,latestVersion:p})},generatorFilter:r,groupFilter:i}),o}async function yf_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await K_e({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,o)}})}))}function bf_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${n} has an upgrade available...`);let f=XH(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:o,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function jQo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let o=[];if(e!=null){let c=await LXS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[f,s]of Object.entries(c.versions))o.push(...bf_(s,f,t.logger));else o.push(...bf_(c.versions,void 0,t.logger))}return o}var OPa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${n} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var _Qn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var buc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),vf_=typeof globalThis.AbortController=="function",gf_=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Of_=typeof globalThis.ReadableStream=="function",Af_=typeof globalThis.FormData=="function",wQo=["get","post","put","patch","head","delete"],VXS=()=>{};VXS();var mf_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},EQo=2147483647,Pf_=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,SQo=Symbol("stop"),jf_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},wf_={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 WXS=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=Pf_,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.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},Ef_=(e,t,r)=>{let i,n=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),i){n+=i.byteLength;let c=t===0?0:n/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,n),transferredBytes:n},i)}i=a},flush(){i&&(n+=i.byteLength,r?.({percent:1,totalBytes:Math.max(t,n),transferredBytes:n},i))}}))},Sf_=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(Ef_(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},Mf_=(e,t,r)=>{if(!e.body)return e;let i=WXS(r??e.body);return new Request(e,{duplex:"half",body:Ef_(e.body,i,t)})};var hQn=e=>e!==null&&typeof e=="object";var APa=(...e)=>{for(let t of e)if((!hQn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Ouc({},...e)},vuc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,o]of n.entries())i&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function MQo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Ouc(e[r]??[],t[r]??[])}var guc=(e={},t={})=>({beforeRequest:MQo(e,t,"beforeRequest"),beforeRetry:MQo(e,t,"beforeRetry"),afterResponse:MQo(e,t,"afterResponse"),beforeError:MQo(e,t,"beforeError")}),Ouc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(hQn(n)){for(let[a,o]of Object.entries(n))hQn(o)&&a in t&&(o=Ouc(t[a],o)),t={...t,[a]:o};hQn(n.hooks)&&(i=guc(i,n.hooks),t.hooks=i),hQn(n.headers)&&(r=vuc(r,n.headers),t.headers=r)}return t};var Bf_=e=>wQo.includes(e)?e.toUpperCase():e,xXS=["get","put","head","delete","options","trace"],GXS=[408,413,429,500,502,503,504],HXS=[413,429,503],Df_={limit:2,methods:xXS,statusCodes:GXS,afterStatusCodes:HXS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},If_=(e={})=>{if(typeof e=="number")return{...Df_,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{...Df_,...e}};async function Auc(e,t,r,i){return new Promise((n,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new _Qn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(o)})})}async function muc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var Cf_=(e,t)=>{let r={};for(let i in t)!(i in wf_)&&!(i in jf_)&&!(i in e)&&(r[i]=t[i]);return r},qf_=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 mPa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>EQo)throw new RangeError(`The \`timeout\` option cannot be greater than ${EQo}`);await Promise.resolve();let c=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let f=new OPa(c,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Of_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Sf_(c.clone(),i._options.onDownloadProgress)}return c},o=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{let c=i._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),i.request.bodyUsed||f.push(i.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(mf_))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:vuc(this._input.headers,r.headers),hooks:guc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Bf_(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:If_(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(vf_&&gf_){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(buc&&(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),qf_(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(Af_&&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(!buc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=Mf_(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof _Qn)throw t;if(t instanceof OPa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),EQo);if(this._retryCount<1)throw r;await muc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===SQo)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Cf_(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):Auc(this._originalRequest,t,this.abortController,this._options)}};var Puc=e=>{let t=(r,i)=>mPa.create(r,APa(e,i));for(let r of wQo)t[r]=(i,n)=>mPa.create(i,APa(e,n,{method:r}));return t.create=r=>Puc(APa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Puc(APa(e,r))),t.stop=SQo,t},KXS=Puc(),Tf_=KXS;var id_=ue(rd_(),1);function Muc(e){let t=(0,id_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Xd_=ue(Yd_(),1),Zd_=ue(O_e(),1),Luc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Vuc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Wuc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Muc(n),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Xd_.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let s;try{s=await Tf_(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Luc(e):l}if(t.allVersions)return s;let u=new Vuc(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(i&&!l)for(let[_,h]of Object.entries(s.versions))h.deprecated&&delete s.versions[_];if(!l){let _=Object.keys(s.versions);if(r=Zd_.default.maxSatisfying(_,r),!r)throw u}let{time:p}=s;if(s=s.versions[r],s.time=p,!s)throw u}return s}async function MPa(e,t){let{version:r}=await Wuc(e.toLowerCase(),t);return r}async function ECi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:MPa(e.packageName,{version:t?"prerelease":"latest"})}var kd_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],UQo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Js.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new PQo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(n==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"3.13.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Ut.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new TE}failWithoutThrowing(t,r){this.didSucceed=!1,OQo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await fTn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await hf_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1394
|
+
`,i?qBi(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function UXS(e){let r=await new pf_.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 LXS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await yf_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let p=IMi(u.name,l),_=await lNt({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:n,includeMajor:a,context:l});_!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:_})},generatorFilter:r,groupFilter:i}),c}let o={type:"multiApi",versions:{}};return await yf_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=IMi(s.name,u),p=await lNt({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:u});p!=null&&(o.versions[c][f][s.name]={previousVersion:s.version,latestVersion:p})},generatorFilter:r,groupFilter:i}),o}async function yf_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await K_e({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,o)}})}))}function bf_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${n} has an upgrade available...`);let f=XH(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:o,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function jQo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let o=[];if(e!=null){let c=await LXS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[f,s]of Object.entries(c.versions))o.push(...bf_(s,f,t.logger));else o.push(...bf_(c.versions,void 0,t.logger))}return o}var OPa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${n} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var _Qn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var buc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),vf_=typeof globalThis.AbortController=="function",gf_=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Of_=typeof globalThis.ReadableStream=="function",Af_=typeof globalThis.FormData=="function",wQo=["get","post","put","patch","head","delete"],VXS=()=>{};VXS();var mf_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},EQo=2147483647,Pf_=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,SQo=Symbol("stop"),jf_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},wf_={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 WXS=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=Pf_,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.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},Ef_=(e,t,r)=>{let i,n=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),i){n+=i.byteLength;let c=t===0?0:n/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,n),transferredBytes:n},i)}i=a},flush(){i&&(n+=i.byteLength,r?.({percent:1,totalBytes:Math.max(t,n),transferredBytes:n},i))}}))},Sf_=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(Ef_(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},Mf_=(e,t,r)=>{if(!e.body)return e;let i=WXS(r??e.body);return new Request(e,{duplex:"half",body:Ef_(e.body,i,t)})};var hQn=e=>e!==null&&typeof e=="object";var APa=(...e)=>{for(let t of e)if((!hQn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Ouc({},...e)},vuc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,o]of n.entries())i&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function MQo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Ouc(e[r]??[],t[r]??[])}var guc=(e={},t={})=>({beforeRequest:MQo(e,t,"beforeRequest"),beforeRetry:MQo(e,t,"beforeRetry"),afterResponse:MQo(e,t,"afterResponse"),beforeError:MQo(e,t,"beforeError")}),Ouc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(hQn(n)){for(let[a,o]of Object.entries(n))hQn(o)&&a in t&&(o=Ouc(t[a],o)),t={...t,[a]:o};hQn(n.hooks)&&(i=guc(i,n.hooks),t.hooks=i),hQn(n.headers)&&(r=vuc(r,n.headers),t.headers=r)}return t};var Bf_=e=>wQo.includes(e)?e.toUpperCase():e,xXS=["get","put","head","delete","options","trace"],GXS=[408,413,429,500,502,503,504],HXS=[413,429,503],Df_={limit:2,methods:xXS,statusCodes:GXS,afterStatusCodes:HXS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},If_=(e={})=>{if(typeof e=="number")return{...Df_,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{...Df_,...e}};async function Auc(e,t,r,i){return new Promise((n,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new _Qn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(o)})})}async function muc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var Cf_=(e,t)=>{let r={};for(let i in t)!(i in wf_)&&!(i in jf_)&&!(i in e)&&(r[i]=t[i]);return r},qf_=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 mPa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>EQo)throw new RangeError(`The \`timeout\` option cannot be greater than ${EQo}`);await Promise.resolve();let c=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let f=new OPa(c,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Of_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Sf_(c.clone(),i._options.onDownloadProgress)}return c},o=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{let c=i._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),i.request.bodyUsed||f.push(i.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(mf_))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:vuc(this._input.headers,r.headers),hooks:guc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Bf_(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:If_(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(vf_&&gf_){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(buc&&(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),qf_(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(Af_&&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(!buc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=Mf_(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof _Qn)throw t;if(t instanceof OPa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),EQo);if(this._retryCount<1)throw r;await muc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===SQo)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let i=await r(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Cf_(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):Auc(this._originalRequest,t,this.abortController,this._options)}};var Puc=e=>{let t=(r,i)=>mPa.create(r,APa(e,i));for(let r of wQo)t[r]=(i,n)=>mPa.create(i,APa(e,n,{method:r}));return t.create=r=>Puc(APa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Puc(APa(e,r))),t.stop=SQo,t},KXS=Puc(),Tf_=KXS;var id_=ue(rd_(),1);function Muc(e){let t=(0,id_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Xd_=ue(Yd_(),1),Zd_=ue(O_e(),1),Luc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Vuc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Wuc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Muc(n),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Xd_.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let s;try{s=await Tf_(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Luc(e):l}if(t.allVersions)return s;let u=new Vuc(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(i&&!l)for(let[_,h]of Object.entries(s.versions))h.deprecated&&delete s.versions[_];if(!l){let _=Object.keys(s.versions);if(r=Zd_.default.maxSatisfying(_,r),!r)throw u}let{time:p}=s;if(s=s.versions[r],s.time=p,!s)throw u}return s}async function MPa(e,t){let{version:r}=await Wuc(e.toLowerCase(),t);return r}async function ECi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:MPa(e.packageName,{version:t?"prerelease":"latest"})}var kd_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],UQo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Js.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new PQo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(n==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"3.14.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Ut.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new TE}failWithoutThrowing(t,r){this.didSucceed=!1,OQo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await fTn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await hf_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1395
1395
|
`)||(r+=`
|
|
1396
1396
|
`),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=Yjs(t.map(i=>i.type==="docs"?"docs":i.workspaceName??"api"),i=>i.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new _Pa(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let i=this.addTaskWithInit(t).start(),n;try{n=await r(i)}catch(a){throw a.message.includes("globalThis")?(i.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),i.failWithoutThrowing()):i.failWithoutThrowing(void 0,a),new TE}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await fTn()).sendEvent(t)}logger=G8t((t,...r)=>this.log(t,...r));stderr=G8t((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=ep_(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?ep_(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=kd_[this.numTasks++%kd_.length],o=Ut.hex(a)(n);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===yj.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 i=t.filter(n=>kSi.indexOf(n.level)>=kSi.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===Js.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 ECi({cliEnvironment:this.environment,includePreReleases:t}),i=XH(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await jQo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await nuc({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:Ut.yellow("?"),style:{answer:n=>Ut.cyan(n),message:n=>Ut.bold(n),highlight:n=>Ut.cyan(n)}}})}catch(i){throw i?.name==="ExitPromptError"?(this.logger.info(`
|
|
1397
1397
|
Cancelled by user.`),new TE):i}}async getInput(t){return await euc({message:t.message,default:t.default})}};function ep_(e){return`[${e}]:`}var pFt=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};function LQo(e,t,r,i){if(typeof r!="function")throw new Error("method for before hook must be a function");return i||(i={}),Array.isArray(t)?t.reverse().reduce((n,a)=>LQo.bind(null,e,a,n,i),r)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((n,a)=>a.hook.bind(null,n,i),r)():r(i))}function tp_(e,t,r,i){let n=i;e.registry[r]||(e.registry[r]=[]),t==="before"&&(i=(a,o)=>Promise.resolve().then(n.bind(null,o)).then(a.bind(null,o))),t==="after"&&(i=(a,o)=>{let c;return Promise.resolve().then(a.bind(null,o)).then(f=>(c=f,n(c,o))).then(()=>c)}),t==="error"&&(i=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(c=>n(c,o))),e.registry[r].push({hook:i,orig:n})}function rp_(e,t,r){if(!e.registry[t])return;let i=e.registry[t].map(n=>n.orig).indexOf(r);i!==-1&&e.registry[t].splice(i,1)}var ip_=Function.bind,np_=ip_.bind(ip_);function ap_(e,t,r){let i=np_(rp_,null).apply(null,r?[t,r]:[t]);e.api={remove:i},e.remove=i,["before","error","after","wrap"].forEach(n=>{let a=r?[t,n,r]:[t,n];e[n]=e.api[n]=np_(tp_,null).apply(null,a)})}function kZS(){let e=Symbol("Singular"),t={registry:{}},r=LQo.bind(null,t,e);return ap_(r,t,e),r}function e2S(){let e={registry:{}},t=LQo.bind(null,e);return ap_(t,e),t}var op_={Singular:kZS,Collection:e2S};var t2S="0.0.0-development",r2S=`octokit-endpoint.js/${t2S} ${BR()}`,i2S={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":r2S},mediaType:{format:""}};function n2S(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function a2S(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function cp_(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(i=>{a2S(t[i])?i in e?r[i]=cp_(e[i],t[i]):Object.assign(r,{[i]:t[i]}):Object.assign(r,{[i]:t[i]})}),r}function up_(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function Guc(e,t,r){if(typeof t=="string"){let[n,a]=t.split(" ");r=Object.assign(a?{method:n,url:a}:{url:n},r)}else r=Object.assign({},t);r.headers=n2S(r.headers),up_(r),up_(r.headers);let i=cp_(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(i.mediaType.previews=e.mediaType.previews.filter(n=>!i.mediaType.previews.includes(n)).concat(i.mediaType.previews)),i.mediaType.previews=(i.mediaType.previews||[]).map(n=>n.replace(/-preview/,""))),i}function o2S(e,t){let r=/\?/.test(e)?"&":"?",i=Object.keys(t);return i.length===0?e:e+r+i.map(n=>n==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${n}=${encodeURIComponent(t[n])}`).join("&")}var u2S=/\{[^{}}]+\}/g;function s2S(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function c2S(e){let t=e.match(u2S);return t?t.map(s2S).reduce((r,i)=>r.concat(i),[]):[]}function sp_(e,t){let r={__proto__:null};for(let i of Object.keys(e))t.indexOf(i)===-1&&(r[i]=e[i]);return r}function lp_(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function PQn(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function DPa(e,t,r){return t=e==="+"||e==="#"?lp_(t):PQn(t),r?PQn(r)+"="+t:t}function mQn(e){return e!=null}function xuc(e){return e===";"||e==="&"||e==="?"}function l2S(e,t,r,i){var n=e[r],a=[];if(mQn(n)&&n!=="")if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")n=n.toString(),i&&i!=="*"&&(n=n.substring(0,parseInt(i,10))),a.push(DPa(t,n,xuc(t)?r:""));else if(i==="*")Array.isArray(n)?n.filter(mQn).forEach(function(o){a.push(DPa(t,o,xuc(t)?r:""))}):Object.keys(n).forEach(function(o){mQn(n[o])&&a.push(DPa(t,n[o],o))});else{let o=[];Array.isArray(n)?n.filter(mQn).forEach(function(c){o.push(DPa(t,c))}):Object.keys(n).forEach(function(c){mQn(n[c])&&(o.push(PQn(c)),o.push(DPa(t,n[c].toString())))}),xuc(t)?a.push(PQn(r)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?mQn(n)&&a.push(PQn(r)):n===""&&(t==="&"||t==="?")?a.push(PQn(r)+"="):n===""&&a.push("");return a}function f2S(e){return{expand:d2S.bind(null,e)}}function d2S(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(i,n,a){if(n){let c="",f=[];if(r.indexOf(n.charAt(0))!==-1&&(c=n.charAt(0),n=n.substr(1)),n.split(/,/g).forEach(function(s){var u=/([^:\*]*)(?::(\d+)|(\*))?/.exec(s);f.push(l2S(t,c,u[1],u[2]||u[3]))}),c&&c!=="+"){var o=",";return c==="?"?o="&":c!=="#"&&(o=c),(f.length!==0?c:"")+f.join(o)}else return f.join(",")}else return lp_(a)}),e==="/"?e:e.replace(/\/$/,"")}function fp_(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),i=Object.assign({},e.headers),n,a=sp_(e,["method","baseUrl","url","headers","request","mediaType"]),o=c2S(r);r=f2S(r).expand(a),/^http/.test(r)||(r=e.baseUrl+r);let c=Object.keys(e).filter(u=>o.includes(u)).concat("baseUrl"),f=sp_(a,c);if(!/application\/octet-stream/i.test(i.accept)&&(e.mediaType.format&&(i.accept=i.accept.split(/,/).map(u=>u.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let u=i.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];i.accept=u.concat(e.mediaType.previews).map(l=>{let p=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${l}-preview${p}`}).join(",")}return["GET","HEAD"].includes(t)?r=o2S(r,f):"data"in f?n=f.data:Object.keys(f).length&&(n=f),!i["content-type"]&&typeof n<"u"&&(i["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof n>"u"&&(n=""),Object.assign({method:t,url:r,headers:i},typeof n<"u"?{body:n}:null,e.request?{request:e.request}:null)}function p2S(e,t,r){return fp_(Guc(e,t,r))}function dp_(e,t){let r=Guc(e,t),i=p2S.bind(null,r);return Object.assign(i,{DEFAULTS:r,defaults:dp_.bind(null,r),merge:Guc.bind(null,r),parse:fp_})}var pp_=dp_(null,i2S);var gp_=ue(bp_(),1);var _Ft=class extends Error{name;status;request;response;constructor(t,r,i){super(t),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0),"response"in i&&(this.response=i.response);let n=Object.assign({},i.request);i.request.headers.authorization&&(n.headers=Object.assign({},i.request.headers,{authorization:i.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),n.url=n.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=n}};var _2S="10.0.6",h2S={headers:{"user-agent":`octokit-request.js/${_2S} ${BR()}`}};function y2S(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}async function vp_(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,i=e.request?.parseSuccessResponseBody!==!1,n=y2S(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([l,p])=>[l,String(p)])),o;try{o=await t(e.url,{method:e.method,body:n,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(l){let p="Unknown Error";if(l instanceof Error){if(l.name==="AbortError")throw l.status=500,l;p=l.message,l.name==="TypeError"&&"cause"in l&&(l.cause instanceof Error?p=l.cause.message:typeof l.cause=="string"&&(p=l.cause))}let _=new _Ft(p,500,{request:e});throw _.cause=l,_}let c=o.status,f=o.url,s={};for(let[l,p]of o.headers)s[l]=p;let u={url:f,status:c,headers:s,data:""};if("deprecation"in s){let l=s.link&&s.link.match(/<([^<>]+)>; rel="deprecation"/),p=l&&l.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${s.sunset}${p?`. See ${p}`:""}`)}if(c===204||c===205)return u;if(e.method==="HEAD"){if(c<400)return u;throw new _Ft(o.statusText,c,{response:u,request:e})}if(c===304)throw u.data=await Huc(o),new _Ft("Not modified",c,{response:u,request:e});if(c>=400)throw u.data=await Huc(o),new _Ft(v2S(u.data),c,{response:u,request:e});return u.data=i?await Huc(o):o.body,u}async function Huc(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(()=>"");let r=(0,gp_.safeParse)(t);if(b2S(r)){let i="";try{return i=await e.text(),JSON.parse(i)}catch{return i}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(()=>""):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function b2S(e){return e.type==="application/json"||e.type==="application/scim+json"}function v2S(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){let t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(r=>JSON.stringify(r)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function Kuc(e,t){let r=e.defaults(t);return Object.assign(function(n,a){let o=r.merge(n,a);if(!o.request||!o.request.hook)return vp_(r.parse(o));let c=(f,s)=>vp_(r.parse(r.merge(f,s)));return Object.assign(c,{endpoint:r,defaults:Kuc.bind(null,r)}),o.request.hook(c,o)},{endpoint:r,defaults:Kuc.bind(null,r)})}var VO=Kuc(pp_,h2S);var g2S="0.0.0-development";function O2S(e){return`Request failed due to following response errors:
|
|
@@ -1408,7 +1408,7 @@ Cancelled by user.`),new TE):i}}async getInput(t){return await euc({message:t.me
|
|
|
1408
1408
|
})
|
|
1409
1409
|
`);let s={},u=new i.Events(s);return s.on("secondary-limit",f.onSecondaryRateLimit),s.on("rate-limit",f.onRateLimit),s.on("error",l=>e.log.warn("Error in throttling-plugin limit handler",l)),f.retryLimiter.on("failed",async function(l,p){let[_,h,y]=p.args,{pathname:b}=new URL(y.url,"http://github.test");if(!(b.startsWith("/graphql")&&l.status!==401||l.status===403||l.status===429))return;let O=~~h.retryCount;h.retryCount=O,y.request.retryCount=O;let{wantRetry:A,retryAfter:g=0}=await(async function(){if(/\bsecondary rate\b/i.test(l.message)){let m=Number(l.response.headers["retry-after"])||_.fallbackSecondaryRateRetryAfter;return{wantRetry:await u.trigger("secondary-limit",m,y,e,O),retryAfter:m}}if(l.response.headers!=null&&l.response.headers["x-ratelimit-remaining"]==="0"||(l.response.data?.errors??[]).some(m=>m.type==="RATE_LIMITED")){let m=new Date(~~l.response.headers["x-ratelimit-reset"]*1e3).getTime(),j=Math.max(Math.ceil((m-Date.now())/1e3)+1,0);return{wantRetry:await u.trigger("rate-limit",j,y,e,O),retryAfter:j}}return{}})();if(A)return h.retryCount++,g*_.retryAfterBaseValue}),e.hook.wrap("request",X2S.bind(null,f)),{}}HQo.VERSION=Y2S;HQo.triggersNotification=Qp_;function Up_(e){let t=e.clientType||"oauth-app",r=e.baseUrl||"https://github.com",i={clientType:t,allowSignup:e.allowSignup!==!1,clientId:e.clientId,login:e.login||null,redirectUrl:e.redirectUrl||null,state:e.state||Math.random().toString(36).substr(2),url:""};if(t==="oauth-app"){let n="scopes"in e?e.scopes:[];i.scopes=typeof n=="string"?n.split(/[,\s]+/).filter(Boolean):n}return i.url=ikS(`${r}/login/oauth/authorize`,i),i}function ikS(e,t){let r={allowSignup:"allow_signup",clientId:"client_id",login:"login",redirectUrl:"redirect_uri",scopes:"scope",state:"state"},i=e;return Object.keys(r).filter(n=>t[n]!==null).filter(n=>n!=="scopes"?!0:t.clientType==="github-app"?!1:!Array.isArray(t[n])||t[n].length>0).map(n=>[r[n],`${t[n]}`]).forEach(([n,a],o)=>{i+=o===0?"?":"&",i+=`${n}=${encodeURIComponent(a)}`}),i}function xp_(e){let t=e.endpoint.DEFAULTS;return/^https:\/\/(api\.)?github\.com$/.test(t.baseUrl)?"https://github.com":t.baseUrl.replace("/api/v3","")}async function KQo(e,t,r){let i={baseUrl:xp_(e),headers:{accept:"application/json"},...r},n=await e(t,i);if("error"in n.data){let a=new _Ft(`${n.data.error_description} (${n.data.error}, ${n.data.error_uri})`,400,{request:e.endpoint.merge(t,i)});throw a.response=n,a}return n}function Gp_({request:e=VO,...t}){let r=xp_(e);return Up_({...t,baseUrl:r})}async function Hp_(e){let t=e.request||VO,r=await KQo(t,"POST /login/oauth/access_token",{client_id:e.clientId,client_secret:e.clientSecret,code:e.code,redirect_uri:e.redirectUrl}),i={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.data.access_token,scopes:r.data.scope.split(/\s+/).filter(Boolean)};if(e.clientType==="github-app"){if("refresh_token"in r.data){let n=new Date(r.headers.date).getTime();i.refreshToken=r.data.refresh_token,i.expiresAt=Lp_(n,r.data.expires_in),i.refreshTokenExpiresAt=Lp_(n,r.data.refresh_token_expires_in)}delete i.scopes}return{...r,authentication:i}}function Lp_(e,t){return new Date(e+t*1e3).toISOString()}async function Kp_(e){let t=e.request||VO,r={client_id:e.clientId};return"scopes"in e&&Array.isArray(e.scopes)&&(r.scope=e.scopes.join(" ")),KQo(t,"POST /login/device/code",r)}async function asc(e){let t=e.request||VO,r=await KQo(t,"POST /login/oauth/access_token",{client_id:e.clientId,device_code:e.code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),i={clientType:e.clientType,clientId:e.clientId,token:r.data.access_token,scopes:r.data.scope.split(/\s+/).filter(Boolean)};if("clientSecret"in e&&(i.clientSecret=e.clientSecret),e.clientType==="github-app"){if("refresh_token"in r.data){let n=new Date(r.headers.date).getTime();i.refreshToken=r.data.refresh_token,i.expiresAt=Vp_(n,r.data.expires_in),i.refreshTokenExpiresAt=Vp_(n,r.data.refresh_token_expires_in)}delete i.scopes}return{...r,authentication:i}}function Vp_(e,t){return new Date(e+t*1e3).toISOString()}async function JQo(e){let r=await(e.request||VO)("POST /applications/{client_id}/token",{headers:{authorization:`basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`},client_id:e.clientId,access_token:e.token}),i={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.token,scopes:r.data.scopes};return r.data.expires_at&&(i.expiresAt=r.data.expires_at),e.clientType==="github-app"&&delete i.scopes,{...r,authentication:i}}async function $Qo(e){let t=e.request||VO,r=await KQo(t,"POST /login/oauth/access_token",{client_id:e.clientId,client_secret:e.clientSecret,grant_type:"refresh_token",refresh_token:e.refreshToken}),i=new Date(r.headers.date).getTime(),n={clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,token:r.data.access_token,refreshToken:r.data.refresh_token,expiresAt:Wp_(i,r.data.expires_in),refreshTokenExpiresAt:Wp_(i,r.data.refresh_token_expires_in)};return{...r,authentication:n}}function Wp_(e,t){return new Date(e+t*1e3).toISOString()}async function Jp_(e){let{request:t,clientType:r,clientId:i,clientSecret:n,token:a,...o}=e,f=await(e.request||VO)("POST /applications/{client_id}/token/scoped",{headers:{authorization:`basic ${btoa(`${i}:${n}`)}`},client_id:i,access_token:a,...o}),s=Object.assign({clientType:r,clientId:i,clientSecret:n,token:f.data.token},f.data.expires_at?{expiresAt:f.data.expires_at}:{});return{...f,authentication:s}}async function CPa(e){let t=e.request||VO,r=btoa(`${e.clientId}:${e.clientSecret}`),i=await t("PATCH /applications/{client_id}/token",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token}),n={clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.data.token,scopes:i.data.scopes};return i.data.expires_at&&(n.expiresAt=i.data.expires_at),e.clientType==="github-app"&&delete n.scopes,{...i,authentication:n}}async function qPa(e){let t=e.request||VO,r=btoa(`${e.clientId}:${e.clientSecret}`);return t("DELETE /applications/{client_id}/token",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token})}async function TPa(e){let t=e.request||VO,r=btoa(`${e.clientId}:${e.clientSecret}`);return t("DELETE /applications/{client_id}/grant",{headers:{authorization:`basic ${r}`},client_id:e.clientId,access_token:e.token})}async function Yp_(e,t){let r=nkS(e,t.auth);if(r)return r;let{data:i}=await Kp_({clientType:e.clientType,clientId:e.clientId,request:t.request||e.request,scopes:t.auth.scopes||e.scopes});await e.onVerification(i);let n=await osc(t.request||e.request,e.clientId,e.clientType,i);return e.authentication=n,n}function nkS(e,t){if(t.refresh===!0||!e.authentication)return!1;if(e.clientType==="github-app")return e.authentication;let r=e.authentication,i=("scopes"in t&&t.scopes||e.scopes).join(" "),n=r.scopes.join(" ");return i===n?r:!1}async function $p_(e){await new Promise(t=>setTimeout(t,e*1e3))}async function osc(e,t,r,i){try{let n={clientId:t,request:e,code:i.device_code},{authentication:a}=r==="oauth-app"?await asc({...n,clientType:"oauth-app"}):await asc({...n,clientType:"github-app"});return{type:"token",tokenType:"oauth",...a}}catch(n){if(!n.response)throw n;let a=n.response.data.error;if(a==="authorization_pending")return await $p_(i.interval),osc(e,t,r,i);if(a==="slow_down")return await $p_(i.interval+7),osc(e,t,r,i);throw n}}async function akS(e,t){return Yp_(e,{auth:t})}async function okS(e,t,r,i){let n=t.endpoint.merge(r,i);if(/\/login\/(oauth\/access_token|device\/code)$/.test(n.url))return t(n);let{token:a}=await Yp_(e,{request:t,auth:{type:"oauth"}});return n.headers.authorization=`token ${a}`,t(n)}var ukS="0.0.0-development";function Xp_(e){let t=e.request||VO.defaults({headers:{"user-agent":`octokit-auth-oauth-device.js/${ukS} ${BR()}`}}),{request:r=t,...i}=e,n=e.clientType==="github-app"?{...i,clientType:"github-app",request:r}:{...i,clientType:"oauth-app",request:r,scopes:e.scopes||[]};if(!e.clientId)throw new Error('[@octokit/auth-oauth-device] "clientId" option must be set (https://github.com/octokit/auth-oauth-device.js#usage)');if(!e.onVerification)throw new Error('[@octokit/auth-oauth-device] "onVerification" option must be a function (https://github.com/octokit/auth-oauth-device.js#usage)');return Object.assign(akS.bind(null,n),{hook:okS.bind(null,n)})}var kp_="0.0.0-development";async function Zp_(e){if("code"in e.strategyOptions){let{authentication:t}=await Hp_({clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,onTokenCreated:e.onTokenCreated,...e.strategyOptions,request:e.request});return{type:"token",tokenType:"oauth",...t}}if("onVerification"in e.strategyOptions){let r=await Xp_({clientType:e.clientType,clientId:e.clientId,onTokenCreated:e.onTokenCreated,...e.strategyOptions,request:e.request})({type:"oauth"});return{clientSecret:e.clientSecret,...r}}if("token"in e.strategyOptions)return{type:"token",tokenType:"oauth",clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,onTokenCreated:e.onTokenCreated,...e.strategyOptions};throw new Error("[@octokit/auth-oauth-user] Invalid strategy options")}async function usc(e,t={}){if(e.authentication||(e.authentication=e.clientType==="oauth-app"?await Zp_(e):await Zp_(e)),e.authentication.invalid)throw new Error("[@octokit/auth-oauth-user] Token is invalid");let r=e.authentication;if("expiresAt"in r&&(t.type==="refresh"||new Date(r.expiresAt)<new Date)){let{authentication:i}=await $Qo({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:r.refreshToken,request:e.request});e.authentication={tokenType:"oauth",type:"token",...i}}if(t.type==="refresh"){if(e.clientType==="oauth-app")throw new Error("[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens");if(!r.hasOwnProperty("expiresAt"))throw new Error("[@octokit/auth-oauth-user] Refresh token missing");await e.onTokenCreated?.(e.authentication,{type:t.type})}if(t.type==="check"||t.type==="reset"){let i=t.type==="check"?JQo:CPa;try{let{authentication:n}=await i({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.authentication.token,request:e.request});return e.authentication={tokenType:"oauth",type:"token",...n},t.type==="reset"&&await e.onTokenCreated?.(e.authentication,{type:t.type}),e.authentication}catch(n){throw n.status===404&&(n.message="[@octokit/auth-oauth-user] Token is invalid",e.authentication.invalid=!0),n}}if(t.type==="delete"||t.type==="deleteAuthorization"){let i=t.type==="delete"?qPa:TPa;try{await i({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:e.authentication.token,request:e.request})}catch(n){if(n.status!==404)throw n}return e.authentication.invalid=!0,e.authentication}return e.authentication}var skS=/\/applications\/[^/]+\/(token|grant)s?/;function RPa(e){return e&&skS.test(e)}async function ckS(e,t,r,i={}){let n=t.endpoint.merge(r,i);if(/\/login\/(oauth\/access_token|device\/code)$/.test(n.url))return t(n);if(RPa(n.url)){let o=btoa(`${e.clientId}:${e.clientSecret}`);return n.headers.authorization=`basic ${o}`,t(n)}let{token:a}=e.clientType==="oauth-app"?await usc({...e,request:t}):await usc({...e,request:t});return n.headers.authorization="token "+a,t(n)}function x3({clientId:e,clientSecret:t,clientType:r="oauth-app",request:i=VO.defaults({headers:{"user-agent":`octokit-auth-oauth-app.js/${kp_} ${BR()}`}}),onTokenCreated:n,...a}){let o=Object.assign({clientType:r,clientId:e,clientSecret:t,onTokenCreated:n,strategyOptions:a,request:i});return Object.assign(usc.bind(null,o),{hook:ckS.bind(null,o)})}x3.VERSION=kp_;async function lkS(e,t){if(t.type==="oauth-app")return{type:"oauth-app",clientId:e.clientId,clientSecret:e.clientSecret,clientType:e.clientType,headers:{authorization:`basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`}};if("factory"in t){let{type:n,...a}={...t,...e};return t.factory(a)}let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.request,...t};return(e.clientType==="oauth-app"?await x3({...r,clientType:e.clientType}):await x3({...r,clientType:e.clientType}))()}async function fkS(e,t,r,i){let n=t.endpoint.merge(r,i);if(/\/login\/(oauth\/access_token|device\/code)$/.test(n.url))return t(n);if(e.clientType==="github-app"&&!RPa(n.url))throw new Error(`[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${n.method} ${n.url}" is not supported.`);let a=btoa(`${e.clientId}:${e.clientSecret}`);n.headers.authorization=`basic ${a}`;try{return await t(n)}catch(o){throw o.status!==401||(o.message=`[@octokit/auth-oauth-app] "${n.method} ${n.url}" does not support clientId/clientSecret basic authentication.`),o}}var dkS="0.0.0-development";function YQo(e){let t=Object.assign({request:VO.defaults({headers:{"user-agent":`octokit-auth-oauth-app.js/${dkS} ${BR()}`}}),clientType:"oauth-app"},e);return Object.assign(lkS.bind(null,t),{hook:fkS.bind(null,t)})}async function ZQo({appId:e,privateKey:t,timeDifference:r,createJwt:i}){try{if(i){let{jwt:o,expiresAt:c}=await i(e,r);return{type:"app",token:o,appId:e,expiresAt:c}}let n={id:e,privateKey:t};r&&Object.assign(n,{now:Math.floor(Date.now()/1e3)+r});let a=await UUs(n);return{type:"app",token:a.token,appId:a.appId,expiresAt:new Date(a.expiration*1e3).toISOString()}}catch(n){throw t==="-----BEGIN RSA PRIVATE KEY-----"?new Error("The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'"):n}}function _kS(){return new m_o(15e3,1e3*60*59)}async function hkS(e,t){let r=ssc(t),i=await e.get(r);if(!i)return;let[n,a,o,c,f,s]=i.split("|"),u=t.permissions||f.split(/,/).reduce((l,p)=>(/!$/.test(p)?l[p.slice(0,-1)]="write":l[p]="read",l),{});return{token:n,createdAt:a,expiresAt:o,permissions:u,repositoryIds:t.repositoryIds,repositoryNames:t.repositoryNames,singleFileName:s,repositorySelection:c}}async function ykS(e,t,r){let i=ssc(t),n=t.permissions?"":Object.keys(r.permissions).map(o=>`${o}${r.permissions[o]==="write"?"!":""}`).join(","),a=[r.token,r.createdAt,r.expiresAt,r.repositorySelection,n,r.singleFileName].join("|");await e.set(i,a)}function ssc({installationId:e,permissions:t={},repositoryIds:r=[],repositoryNames:i=[]}){let n=Object.keys(t).sort().map(c=>t[c]==="read"?c:`${c}!`).join(","),a=r.sort().join(","),o=i.join(",");return[e,a,o,n].filter(Boolean).join("|")}function e__({installationId:e,token:t,createdAt:r,expiresAt:i,repositorySelection:n,permissions:a,repositoryIds:o,repositoryNames:c,singleFileName:f}){return Object.assign({type:"token",tokenType:"installation",token:t,installationId:e,permissions:a,createdAt:r,expiresAt:i,repositorySelection:n},o?{repositoryIds:o}:null,c?{repositoryNames:c}:null,f?{singleFileName:f}:null)}async function t__(e,t,r){let i=Number(t.installationId||e.installationId);if(!i)throw new Error("[@octokit/auth-app] installationId option is required for installation authentication.");if(t.factory){let{type:a,factory:o,oauthApp:c,...f}={...e,...t};return o(f)}let n=r||e.request;return bkS(e,{...t,installationId:i},n)}var XQo=new Map;function bkS(e,t,r){let i=ssc(t);if(XQo.has(i))return XQo.get(i);let n=vkS(e,t,r).finally(()=>XQo.delete(i));return XQo.set(i,n),n}async function vkS(e,t,r){if(!t.refresh){let O=await hkS(e.cache,t);if(O){let{token:A,createdAt:g,expiresAt:m,permissions:j,repositoryIds:M,repositoryNames:E,singleFileName:D,repositorySelection:B}=O;return e__({installationId:t.installationId,token:A,createdAt:g,expiresAt:m,permissions:j,repositorySelection:B,repositoryIds:M,repositoryNames:E,singleFileName:D})}}let i=await ZQo(e),n={installation_id:t.installationId,mediaType:{previews:["machine-man"]},headers:{authorization:`bearer ${i.token}`}};t.repositoryIds&&Object.assign(n,{repository_ids:t.repositoryIds}),t.repositoryNames&&Object.assign(n,{repositories:t.repositoryNames}),t.permissions&&Object.assign(n,{permissions:t.permissions});let{data:{token:a,expires_at:o,repositories:c,permissions:f,repository_selection:s,single_file:u}}=await r("POST /app/installations/{installation_id}/access_tokens",n),l=f||{},p=s||"all",_=c?c.map(O=>O.id):void 0,h=c?c.map(O=>O.name):void 0,y=new Date().toISOString(),b={token:a,createdAt:y,expiresAt:o,repositorySelection:p,permissions:l,repositoryIds:_,repositoryNames:h};u&&Object.assign(n,{singleFileName:u}),await ykS(e.cache,t,b);let v={installationId:t.installationId,token:a,createdAt:y,expiresAt:o,repositorySelection:p,permissions:l,repositoryIds:_,repositoryNames:h};return u&&Object.assign(v,{singleFileName:u}),e__(v)}async function gkS(e,t){switch(t.type){case"app":return ZQo(e);case"oauth-app":return e.oauthApp({type:"oauth-app"});case"installation":return t__(e,{...t,type:"installation"});case"oauth-user":return e.oauthApp(t);default:throw new Error(`Invalid auth type: ${t.type}`)}}var OkS=["/app","/app/hook/config","/app/hook/deliveries","/app/hook/deliveries/{delivery_id}","/app/hook/deliveries/{delivery_id}/attempts","/app/installations","/app/installations/{installation_id}","/app/installations/{installation_id}/access_tokens","/app/installations/{installation_id}/suspended","/app/installation-requests","/marketplace_listing/accounts/{account_id}","/marketplace_listing/plan","/marketplace_listing/plans","/marketplace_listing/plans/{plan_id}/accounts","/marketplace_listing/stubbed/accounts/{account_id}","/marketplace_listing/stubbed/plan","/marketplace_listing/stubbed/plans","/marketplace_listing/stubbed/plans/{plan_id}/accounts","/orgs/{org}/installation","/repos/{owner}/{repo}/installation","/users/{username}/installation"];function AkS(e){let r=`^(?:${e.map(i=>i.split("/").map(n=>n.startsWith("{")?"(?:.+?)":n).join("/")).map(i=>`(?:${i})`).join("|")})$`;return new RegExp(r,"i")}var mkS=AkS(OkS);function PkS(e){return!!e&&mkS.test(e.split("?")[0])}var jkS=5*1e3;function wkS(e){return!(e.message.match(/'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/)||e.message.match(/'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/))}async function EkS(e,t,r,i){let n=t.endpoint.merge(r,i),a=n.url;if(/\/login\/oauth\/access_token$/.test(a))return t(n);if(PkS(a.replace(t.endpoint.DEFAULTS.baseUrl,""))){let{token:f}=await ZQo(e);n.headers.authorization=`bearer ${f}`;let s;try{s=await t(n)}catch(u){if(wkS(u)||typeof u.response.headers.date>"u")throw u;let l=Math.floor((Date.parse(u.response.headers.date)-Date.parse(new Date().toString()))/1e3);e.log.warn(u.message),e.log.warn(`[@octokit/auth-app] GitHub API time and system time are different by ${l} seconds. Retrying request with the difference accounted for.`);let{token:p}=await ZQo({...e,timeDifference:l});return n.headers.authorization=`bearer ${p}`,t(n)}return s}if(RPa(a)){let f=await e.oauthApp({type:"oauth-app"});return n.headers.authorization=f.headers.authorization,t(n)}let{token:o,createdAt:c}=await t__(e,{},t.defaults({baseUrl:n.baseUrl}));return n.headers.authorization=`token ${o}`,r__(e,t,n,c)}async function r__(e,t,r,i,n=0){let a=+new Date-+new Date(i);try{return await t(r)}catch(o){if(o.status!==401)throw o;if(a>=jkS)throw n>0&&(o.message=`After ${n} retries within ${a/1e3}s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`),o;++n;let c=n*1e3;return e.log.warn(`[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${n}, wait: ${c/1e3}s)`),await new Promise(f=>setTimeout(f,c)),r__(e,t,r,i,n)}}var SkS="8.1.2";function jQn(e){if(!e.appId)throw new Error("[@octokit/auth-app] appId option is required");if(!e.privateKey&&!e.createJwt)throw new Error("[@octokit/auth-app] privateKey option is required");if(e.privateKey&&e.createJwt)throw new Error("[@octokit/auth-app] privateKey and createJwt options are mutually exclusive");if("installationId"in e&&!e.installationId)throw new Error("[@octokit/auth-app] installationId is set to a falsy value");let t=e.log||{};typeof t.warn!="function"&&(t.warn=console.warn.bind(console));let r=e.request||VO.defaults({headers:{"user-agent":`octokit-auth-app.js/${SkS} ${BR()}`}}),i=Object.assign({request:r,cache:_kS()},e,e.installationId?{installationId:Number(e.installationId)}:{},{log:t,oauthApp:YQo({clientType:"github-app",clientId:e.clientId||"",clientSecret:e.clientSecret||"",request:r})});return Object.assign(gkS.bind(null,i),{hook:EkS.bind(null,i)})}async function MkS(e){return{type:"unauthenticated",reason:e}}function DkS(e){return e.status!==403||!e.response?!1:e.response.headers["x-ratelimit-remaining"]==="0"}var BkS=/\babuse\b/i;function IkS(e){return e.status!==403?!1:BkS.test(e.message)}async function CkS(e,t,r,i){let n=t.endpoint.merge(r,i);return t(n).catch(a=>{throw a.status===404?(a.message=`Not found. May be due to lack of authentication. Reason: ${e}`,a):DkS(a)?(a.message=`API rate limit exceeded. This maybe caused by the lack of authentication. Reason: ${e}`,a):IkS(a)?(a.message=`You have triggered an abuse detection mechanism. This maybe caused by the lack of authentication. Reason: ${e}`,a):a.status===401?(a.message=`Unauthorized. "${n.method} ${n.url}" failed most likely due to lack of authentication. Reason: ${e}`,a):(a.status>=400&&a.status<500&&(a.message=a.message.replace(/\.?$/,`. May be caused by lack of authentication (${e}).`)),a)})}var _Ji=function(t){if(!t||!t.reason)throw new Error("[@octokit/auth-unauthenticated] No reason passed to createUnauthenticatedAuth");return Object.assign(MkS.bind(null,t.reason),{hook:CkS.bind(null,t.reason)})};var i__="8.0.3";function n__(e,t,r){if(Array.isArray(t)){for(let i of t)n__(e,i,r);return}e.eventHandlers[t]||(e.eventHandlers[t]=[]),e.eventHandlers[t].push(r)}var qkS=SCi.defaults({userAgent:`octokit-oauth-app.js/${i__} ${BR()}`});async function Nvi(e,t){let{name:r,action:i}=t;if(e.eventHandlers[`${r}.${i}`])for(let n of e.eventHandlers[`${r}.${i}`])await n(t);if(e.eventHandlers[r])for(let n of e.eventHandlers[r])await n(t)}async function TkS(e,t){return e.octokit.auth({type:"oauth-user",...t,async factory(r){let i=new e.Octokit({authStrategy:x3,auth:r}),n=await i.auth({type:"get"});return await Nvi(e,{name:"token",action:"created",token:n.token,scopes:n.scopes,authentication:n,octokit:i}),i}})}function RkS(e,t){let r={clientId:e.clientId,request:e.octokit.request,...t,allowSignup:e.allowSignup??t.allowSignup,redirectUrl:t.redirectUrl??e.redirectUrl,scopes:t.scopes??e.defaultScopes};return Gp_({clientType:e.clientType,...r})}async function zkS(e,t){let r=await e.octokit.auth({type:"oauth-user",...t});return await Nvi(e,{name:"token",action:"created",token:r.token,scopes:r.scopes,authentication:r,octokit:new e.Octokit({authStrategy:x3,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.token,scopes:r.scopes,refreshToken:r.refreshToken,expiresAt:r.expiresAt,refreshTokenExpiresAt:r.refreshTokenExpiresAt}})}),{authentication:r}}async function NkS(e,t){let r=await JQo({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t});return Object.assign(r.authentication,{type:"token",tokenType:"oauth"}),r}async function FkS(e,t){let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};if(e.clientType==="oauth-app"){let a=await CPa({clientType:"oauth-app",...r}),o=Object.assign(a.authentication,{type:"token",tokenType:"oauth"});return await Nvi(e,{name:"token",action:"reset",token:a.authentication.token,scopes:a.authentication.scopes||void 0,authentication:o,octokit:new e.Octokit({authStrategy:x3,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:a.authentication.token,scopes:a.authentication.scopes}})}),{...a,authentication:o}}let i=await CPa({clientType:"github-app",...r}),n=Object.assign(i.authentication,{type:"token",tokenType:"oauth"});return await Nvi(e,{name:"token",action:"reset",token:i.authentication.token,authentication:n,octokit:new e.Octokit({authStrategy:x3,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.authentication.token}})}),{...i,authentication:n}}async function QkS(e,t){if(e.clientType==="oauth-app")throw new Error("[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps");let r=await $Qo({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,refreshToken:t.refreshToken}),i=Object.assign(r.authentication,{type:"token",tokenType:"oauth"});return await Nvi(e,{name:"token",action:"refreshed",token:r.authentication.token,authentication:i,octokit:new e.Octokit({authStrategy:x3,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.authentication.token}})}),{...r,authentication:i}}async function UkS(e,t){if(e.clientType==="oauth-app")throw new Error("[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps");let r=await Jp_({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t}),i=Object.assign(r.authentication,{type:"token",tokenType:"oauth"});return await Nvi(e,{name:"token",action:"scoped",token:r.authentication.token,authentication:i,octokit:new e.Octokit({authStrategy:x3,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:r.authentication.token}})}),{...r,authentication:i}}async function LkS(e,t){let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t},i=e.clientType==="oauth-app"?await qPa({clientType:"oauth-app",...r}):await qPa({clientType:"github-app",...r});return await Nvi(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:_Ji,auth:{reason:'Handling "token.deleted" event. The access for the token has been revoked.'}})}),i}async function VkS(e,t){let r={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t},i=e.clientType==="oauth-app"?await TPa({clientType:"oauth-app",...r}):await TPa({clientType:"github-app",...r});return await Nvi(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:_Ji,auth:{reason:'Handling "token.deleted" event. The access for the token has been revoked.'}})}),await Nvi(e,{name:"authorization",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:_Ji,auth:{reason:'Handling "authorization.deleted" event. The access for the app has been revoked.'}})}),i}var kQo=class{static VERSION=i__;static defaults(e){return class extends this{constructor(...r){super({...e,...r[0]})}}}constructor(e){let t=e.Octokit||qkS;this.type=e.clientType||"oauth-app";let r=new t({authStrategy:YQo,auth:{clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret}}),i={clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret,defaultScopes:e.defaultScopes||[],allowSignup:e.allowSignup,baseUrl:e.baseUrl,redirectUrl:e.redirectUrl,log:e.log,Octokit:t,octokit:r,eventHandlers:{}};this.on=n__.bind(null,i),this.octokit=r,this.getUserOctokit=TkS.bind(null,i),this.getWebFlowAuthorizationUrl=RkS.bind(null,i),this.createToken=zkS.bind(null,i),this.checkToken=NkS.bind(null,i),this.resetToken=FkS.bind(null,i),this.refreshToken=QkS.bind(null,i),this.scopeToken=UkS.bind(null,i),this.deleteToken=LkS.bind(null,i),this.deleteAuthorization=VkS.bind(null,i)}type;on;octokit;getUserOctokit;getWebFlowAuthorizationUrl;createToken;checkToken;resetToken;refreshToken;scopeToken;deleteToken;deleteAuthorization};var a__=require("crypto"),u__=require("crypto"),csc=require("buffer"),o__="6.0.0";async function eUo(e,t){if(!e||!t)throw new TypeError("[@octokit/webhooks-methods] secret & payload required for sign()");if(typeof t!="string")throw new TypeError("[@octokit/webhooks-methods] payload must be a string");let r="sha256";return`${r}=${(0,a__.createHmac)(r,e).update(t).digest("hex")}`}eUo.VERSION=o__;async function zPa(e,t,r){if(!e||!t||!r)throw new TypeError("[@octokit/webhooks-methods] secret, eventPayload & signature required");if(typeof t!="string")throw new TypeError("[@octokit/webhooks-methods] eventPayload must be a string");let i=csc.Buffer.from(r),n=csc.Buffer.from(await eUo(e,t));return i.length!==n.length?!1:(0,u__.timingSafeEqual)(i,n)}zPa.VERSION=o__;async function s__(e,t,r,i){if(await zPa(e,t,r))return!0;if(i!==void 0)for(let a of i){let o=await zPa(a,t,r);if(o)return o}return!1}var f__=(e={})=>(typeof e.debug!="function"&&(e.debug=()=>{}),typeof e.info!="function"&&(e.info=()=>{}),typeof e.warn!="function"&&(e.warn=console.warn.bind(console)),typeof e.error!="function"&&(e.error=console.error.bind(console)),e),WkS=["branch_protection_configuration","branch_protection_configuration.disabled","branch_protection_configuration.enabled","branch_protection_rule","branch_protection_rule.created","branch_protection_rule.deleted","branch_protection_rule.edited","check_run","check_run.completed","check_run.created","check_run.requested_action","check_run.rerequested","check_suite","check_suite.completed","check_suite.requested","check_suite.rerequested","code_scanning_alert","code_scanning_alert.appeared_in_branch","code_scanning_alert.closed_by_user","code_scanning_alert.created","code_scanning_alert.fixed","code_scanning_alert.reopened","code_scanning_alert.reopened_by_user","commit_comment","commit_comment.created","create","custom_property","custom_property.created","custom_property.deleted","custom_property.promote_to_enterprise","custom_property.updated","custom_property_values","custom_property_values.updated","delete","dependabot_alert","dependabot_alert.auto_dismissed","dependabot_alert.auto_reopened","dependabot_alert.created","dependabot_alert.dismissed","dependabot_alert.fixed","dependabot_alert.reintroduced","dependabot_alert.reopened","deploy_key","deploy_key.created","deploy_key.deleted","deployment","deployment.created","deployment_protection_rule","deployment_protection_rule.requested","deployment_review","deployment_review.approved","deployment_review.rejected","deployment_review.requested","deployment_status","deployment_status.created","discussion","discussion.answered","discussion.category_changed","discussion.closed","discussion.created","discussion.deleted","discussion.edited","discussion.labeled","discussion.locked","discussion.pinned","discussion.reopened","discussion.transferred","discussion.unanswered","discussion.unlabeled","discussion.unlocked","discussion.unpinned","discussion_comment","discussion_comment.created","discussion_comment.deleted","discussion_comment.edited","fork","github_app_authorization","github_app_authorization.revoked","gollum","installation","installation.created","installation.deleted","installation.new_permissions_accepted","installation.suspend","installation.unsuspend","installation_repositories","installation_repositories.added","installation_repositories.removed","installation_target","installation_target.renamed","issue_comment","issue_comment.created","issue_comment.deleted","issue_comment.edited","issues","issues.assigned","issues.closed","issues.deleted","issues.demilestoned","issues.edited","issues.labeled","issues.locked","issues.milestoned","issues.opened","issues.pinned","issues.reopened","issues.transferred","issues.typed","issues.unassigned","issues.unlabeled","issues.unlocked","issues.unpinned","issues.untyped","label","label.created","label.deleted","label.edited","marketplace_purchase","marketplace_purchase.cancelled","marketplace_purchase.changed","marketplace_purchase.pending_change","marketplace_purchase.pending_change_cancelled","marketplace_purchase.purchased","member","member.added","member.edited","member.removed","membership","membership.added","membership.removed","merge_group","merge_group.checks_requested","merge_group.destroyed","meta","meta.deleted","milestone","milestone.closed","milestone.created","milestone.deleted","milestone.edited","milestone.opened","org_block","org_block.blocked","org_block.unblocked","organization","organization.deleted","organization.member_added","organization.member_invited","organization.member_removed","organization.renamed","package","package.published","package.updated","page_build","personal_access_token_request","personal_access_token_request.approved","personal_access_token_request.cancelled","personal_access_token_request.created","personal_access_token_request.denied","ping","project","project.closed","project.created","project.deleted","project.edited","project.reopened","project_card","project_card.converted","project_card.created","project_card.deleted","project_card.edited","project_card.moved","project_column","project_column.created","project_column.deleted","project_column.edited","project_column.moved","projects_v2","projects_v2.closed","projects_v2.created","projects_v2.deleted","projects_v2.edited","projects_v2.reopened","projects_v2_item","projects_v2_item.archived","projects_v2_item.converted","projects_v2_item.created","projects_v2_item.deleted","projects_v2_item.edited","projects_v2_item.reordered","projects_v2_item.restored","projects_v2_status_update","projects_v2_status_update.created","projects_v2_status_update.deleted","projects_v2_status_update.edited","public","pull_request","pull_request.assigned","pull_request.auto_merge_disabled","pull_request.auto_merge_enabled","pull_request.closed","pull_request.converted_to_draft","pull_request.demilestoned","pull_request.dequeued","pull_request.edited","pull_request.enqueued","pull_request.labeled","pull_request.locked","pull_request.milestoned","pull_request.opened","pull_request.ready_for_review","pull_request.reopened","pull_request.review_request_removed","pull_request.review_requested","pull_request.synchronize","pull_request.unassigned","pull_request.unlabeled","pull_request.unlocked","pull_request_review","pull_request_review.dismissed","pull_request_review.edited","pull_request_review.submitted","pull_request_review_comment","pull_request_review_comment.created","pull_request_review_comment.deleted","pull_request_review_comment.edited","pull_request_review_thread","pull_request_review_thread.resolved","pull_request_review_thread.unresolved","push","registry_package","registry_package.published","registry_package.updated","release","release.created","release.deleted","release.edited","release.prereleased","release.published","release.released","release.unpublished","repository","repository.archived","repository.created","repository.deleted","repository.edited","repository.privatized","repository.publicized","repository.renamed","repository.transferred","repository.unarchived","repository_advisory","repository_advisory.published","repository_advisory.reported","repository_dispatch","repository_dispatch.sample.collected","repository_import","repository_ruleset","repository_ruleset.created","repository_ruleset.deleted","repository_ruleset.edited","repository_vulnerability_alert","repository_vulnerability_alert.create","repository_vulnerability_alert.dismiss","repository_vulnerability_alert.reopen","repository_vulnerability_alert.resolve","secret_scanning_alert","secret_scanning_alert.created","secret_scanning_alert.publicly_leaked","secret_scanning_alert.reopened","secret_scanning_alert.resolved","secret_scanning_alert.validated","secret_scanning_alert_location","secret_scanning_alert_location.created","secret_scanning_scan","secret_scanning_scan.completed","security_advisory","security_advisory.published","security_advisory.updated","security_advisory.withdrawn","security_and_analysis","sponsorship","sponsorship.cancelled","sponsorship.created","sponsorship.edited","sponsorship.pending_cancellation","sponsorship.pending_tier_change","sponsorship.tier_changed","star","star.created","star.deleted","status","sub_issues","sub_issues.parent_issue_added","sub_issues.parent_issue_removed","sub_issues.sub_issue_added","sub_issues.sub_issue_removed","team","team.added_to_repository","team.created","team.deleted","team.edited","team.removed_from_repository","team_add","watch","watch.started","workflow_dispatch","workflow_job","workflow_job.completed","workflow_job.in_progress","workflow_job.queued","workflow_job.waiting","workflow_run","workflow_run.completed","workflow_run.in_progress","workflow_run.requested"];function xkS(e,t={}){if(typeof e!="string")throw new TypeError("eventName must be of type string");if(e==="*")throw new TypeError('Using the "*" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onAny() method instead');if(e==="error")throw new TypeError('Using the "error" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onError() method instead');if(t.onUnknownEventName!=="ignore"&&!WkS.includes(e)){if(t.onUnknownEventName!=="warn")throw new TypeError(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`);(t.log||console).warn(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`)}}function lsc(e,t,r){e.hooks[t]||(e.hooks[t]=[]),e.hooks[t].push(r)}function d__(e,t,r){if(Array.isArray(t)){t.forEach(i=>d__(e,i,r));return}xkS(t,{onUnknownEventName:"warn",log:e.log}),lsc(e,t,r)}function GkS(e,t){lsc(e,"*",t)}function HkS(e,t){lsc(e,"error",t)}function c__(e,t){let r;try{r=e(t)}catch(i){console.log('FATAL: Error occurred in "error" event handler'),console.log(i)}r&&r.catch&&r.catch(i=>{console.log('FATAL: Error occurred in "error" event handler'),console.log(i)})}function KkS(e,t,r){let i=[e.hooks[r],e.hooks["*"]];return t&&i.unshift(e.hooks[`${r}.${t}`]),[].concat(...i.filter(Boolean))}function JkS(e,t){let r=e.hooks.error||[];if(t instanceof Error){let o=Object.assign(new AggregateError([t],t.message),{event:t});return r.forEach(c=>c__(c,o)),Promise.reject(o)}if(!t||!t.name){let o=new Error("Event name not passed");throw new AggregateError([o],o.message)}if(!t.payload){let o=new Error("Event name not passed");throw new AggregateError([o],o.message)}let i=KkS(e,"action"in t.payload?t.payload.action:null,t.name);if(i.length===0)return Promise.resolve();let n=[],a=i.map(o=>{let c=Promise.resolve(t);return e.transform&&(c=c.then(e.transform)),c.then(f=>o(f)).catch(f=>n.push(Object.assign(f,{event:t})))});return Promise.all(a).then(()=>{if(n.length===0)return;let o=new AggregateError(n,n.map(c=>c.message).join(`
|
|
1410
1410
|
`));throw Object.assign(o,{event:t}),r.forEach(c=>c__(c,o)),o})}function p__(e,t,r){if(Array.isArray(t)){t.forEach(i=>p__(e,i,r));return}if(e.hooks[t]){for(let i=e.hooks[t].length-1;i>=0;i--)if(e.hooks[t][i]===r){e.hooks[t].splice(i,1);return}}}function $kS(e){let t={hooks:{},log:f__(e&&e.log)};return e&&e.transform&&(t.transform=e.transform),{on:d__.bind(null,t),onAny:GkS.bind(null,t),onError:HkS.bind(null,t),removeListener:p__.bind(null,t),receive:JkS.bind(null,t)}}async function YkS(e,t){if(!await s__(e.secret,t.payload,t.signature,e.additionalSecrets).catch(()=>!1)){let n=new Error("[@octokit/webhooks] signature does not match event payload and secret");return n.event=t,n.status=400,e.eventHandler.receive(n)}let i;try{i=JSON.parse(t.payload)}catch(n){throw n.message="Invalid JSON",n.status=400,new AggregateError([n],n.message)}return e.eventHandler.receive({id:t.id,name:t.name,payload:i})}var l__=new TextDecoder("utf-8",{fatal:!1}),xGW=l__.decode.bind(l__);var ___=class{sign;verify;on;onAny;onError;removeListener;receive;verifyAndReceive;constructor(e){if(!e||!e.secret)throw new Error("[@octokit/webhooks] options.secret required");let t={eventHandler:$kS(e),secret:e.secret,additionalSecrets:e.additionalSecrets,hooks:{},log:f__(e.log)};this.sign=eUo.bind(null,e.secret),this.verify=zPa.bind(null,e.secret),this.on=t.eventHandler.on,this.onAny=t.eventHandler.onAny,this.onError=t.eventHandler.onError,this.removeListener=t.eventHandler.removeListener,this.receive=t.eventHandler.receive,this.verifyAndReceive=YkS.bind(null,t)}};var XkS="16.1.2";function ZkS(e,t){return new ___({secret:t.secret,transform:async r=>{if(!("installation"in r.payload)||typeof r.payload.installation!="object"){let a=new e.constructor({authStrategy:_Ji,auth:{reason:'"installation" key missing in webhook event payload'}});return{...r,octokit:a}}let i=r.payload.installation.id,n=await e.auth({type:"installation",installationId:i,factory(a){return new a.octokit.constructor({...a.octokitOptions,authStrategy:jQn,auth:{...a,installationId:i}})}});return n.hook.before("request",a=>{a.headers["x-github-delivery"]=r.id}),{...r,octokit:n}}})}async function h__(e,t){return e.octokit.auth({type:"installation",installationId:t,factory(r){let i={...r.octokitOptions,authStrategy:jQn,auth:{...r,installationId:t}};return new r.octokit.constructor(i)}})}function kkS(e){return Object.assign(eeM.bind(null,e),{iterator:y__.bind(null,e)})}async function eeM(e,t){let r=y__(e)[Symbol.asyncIterator](),i=await r.next();for(;!i.done;)await t(i.value),i=await r.next()}function y__(e){return{async*[Symbol.asyncIterator](){let t=GQo.iterator(e.octokit,"GET /app/installations");for await(let{data:r}of t)for(let i of r)yield{octokit:await h__(e,i.id),installation:i}}}}function teM(e){return Object.assign(reM.bind(null,e),{iterator:b__.bind(null,e)})}async function reM(e,t,r){let i=b__(e,r?t:void 0)[Symbol.asyncIterator](),n=await i.next();for(;!n.done;)r?await r(n.value):await t(n.value),n=await i.next()}function ieM(e,t){return{async*[Symbol.asyncIterator](){yield{octokit:await e.getInstallationOctokit(t)}}}}function b__(e,t){return{async*[Symbol.asyncIterator](){let r=t?ieM(e,t.installationId):e.eachInstallation.iterator();for await(let{octokit:i}of r){let n=GQo.iterator(i,"GET /installation/repositories");for await(let{data:a}of n)for(let o of a)yield{octokit:i,repository:o}}}}}function neM(e){let t;return async function(i={}){t||(t=aeM(e));let n=await t,a=new URL(n);return i.target_id!==void 0&&(a.pathname+="/permissions",a.searchParams.append("target_id",i.target_id.toFixed())),i.state!==void 0&&a.searchParams.append("state",i.state),a.href}}async function aeM(e){let{data:t}=await e.octokit.request("GET /app");if(!t)throw new Error("[@octokit/app] unable to fetch metadata for app");return`${t.html_url}/installations/new`}var v__=class{static VERSION=XkS;static defaults(e){return class extends this{constructor(...r){super({...e,...r[0]})}}}octokit;webhooks;oauth;getInstallationOctokit;eachInstallation;eachRepository;getInstallationUrl;log;constructor(e){let t=e.Octokit||SCi,r=Object.assign({appId:e.appId,privateKey:e.privateKey},e.oauth?{clientId:e.oauth.clientId,clientSecret:e.oauth.clientSecret}:{}),i={authStrategy:jQn,auth:r};"log"in e&&typeof e.log<"u"&&(i.log=e.log),this.octokit=new t(i),this.log=Object.assign({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console)},e.log),e.webhooks?this.webhooks=ZkS(this.octokit,e.webhooks):Object.defineProperty(this,"webhooks",{get(){throw new Error("[@octokit/app] webhooks option not set")}}),e.oauth?this.oauth=new kQo({...e.oauth,clientType:"github-app",Octokit:t}):Object.defineProperty(this,"oauth",{get(){throw new Error("[@octokit/app] oauth.clientId / oauth.clientSecret options are not set")}}),this.getInstallationOctokit=h__.bind(null,this),this.eachInstallation=kkS(this),this.eachRepository=teM(this),this.getInstallationUrl=neM(this)}};var oeM="0.0.0-development",tUo=SCi.plugin(rsc,Zuc,qp_,isc,HQo).defaults({userAgent:`octokit.js/${oeM}`,throttle:{onRateLimit:ueM,onSecondaryRateLimit:seM}});function ueM(e,t,r){if(r.log.warn(`Request quota exhausted for request ${t.method} ${t.url}`),t.request.retryCount===0)return r.log.info(`Retrying after ${e} seconds!`),!0}function seM(e,t,r){if(r.log.warn(`SecondaryRateLimit detected for request ${t.method} ${t.url}`),t.request.retryCount===0)return r.log.info(`Retrying after ${e} seconds!`),!0}var p7W=v__.defaults({Octokit:tUo}),_7W=kQo.defaults({Octokit:tUo});var g__=ue(O_e(),1);async function fsc({packageName:e,generatorInvocation:t}){if(t.language==null||e==null)return;let r=await ceM({packageName:e,language:t.language,githubRepository:_eM(t)});return r==null?void 0:g__.default.inc(r,"patch")??void 0}async function ceM({packageName:e,language:t,githubRepository:r}){let i;switch(t){case"typescript":i=await leM(e);break;case"python":i=await feM(e);break;case"csharp":case"go":case"java":case"ruby":case"php":case"swift":break}return i!=null||r!=null&&(i=await deM(r)),i}async function leM(e){try{return await MPa(e)}catch{return}}async function feM(e){try{let t=await fetch(`https://pypi.org/pypi/${e}/json`);return t.ok?(await t.json()).info.version:void 0}catch{return}}async function deM(e){try{let{owner:t,repo:r}=peM(e);return(await new tUo().rest.repos.listTags({owner:t,repo:r,per_page:1})).data?.[0]?.name}catch{return}}function peM(e){let[t,r]=e.split("/");if(t==null||r==null)throw new Error(`Invalid github repository: ${e}`);return{owner:t,repo:r}}function _eM(e){if(e.outputMode.type==="githubV2")return`${e.outputMode.githubV2.owner}/${e.outputMode.githubV2.repo}`}var eK=class extends pFt{definition;sources;type="fern";constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var heM={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:hn.RemoveDiscriminantsFromSchemas.Always};function yeM(e){let{defaults:t,options:r,overrides:i,overrideOnly:n=new Set,undefinedIfAbsent:a=new Set}=e,o={};for(let c of Object.keys(t))n.has(c)?o[c]=i?.[c]!==void 0?i[c]:t[c]:a.has(c)?o[c]=i?.[c]!==void 0?i[c]:r?.[c]!==void 0?r[c]:void 0:o[c]=i?.[c]??r?.[c]??t[c];return o}function hJi({options:e,overrides:t}){return yeM({defaults:heM,options:e,overrides:t})}var G3={openapi:e=>({...e,type:"openapi",_visit:function(t){return G3._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return G3._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 wQn={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return wQn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var dz={basic:e=>({...e,type:"basic",_visit:function(t){return dz._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return dz._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return dz._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return dz._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return dz._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 wl={primitive:e=>({value:e,type:"primitive",_visit:function(t){return wl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return wl._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return wl._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return wl._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return wl._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return wl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return wl._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return wl._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return wl._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var Ka={int:e=>({value:e,type:"int",_visit:function(t){return Ka._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return Ka._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return Ka._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return Ka._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return Ka._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return Ka._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Ka._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return Ka._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return Ka._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return Ka._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return Ka._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 MCi={boolean:e=>({value:e,type:"boolean",_visit:function(t){return MCi._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return MCi._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 DCi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return DCi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return DCi._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 rUo={};Yt(rUo,{Availability:()=>pz,CustomCodeSample:()=>u9t,EndpointExample:()=>x0e,EndpointResponseExample:()=>G0e,HttpMethod:()=>hz,LiteralSchemaValue:()=>Rj,MultipartRequestPropertyEncoding:()=>_sc,MultipartSchema:()=>s9t,OneOfSchema:()=>c9t,Pagination:()=>She,PrimitiveSchemaValue:()=>ih,Request:()=>hFt,Response:()=>KQ,RetriesConfiguration:()=>NPa,Schema:()=>Xs,SupportedSdkLanguage:()=>_z,WebhookHttpMethod:()=>psc,WebsocketMessageOrigin:()=>dsc});var dsc={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case dsc.Client:return t.client();case dsc.Server:return t.server();default:return t._other()}}};var psc={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case psc.Get:return t.get();case psc.Post:return t.post();default:return t._other()}}};var pz={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case pz.GenerallyAvailable:return t.generallyAvailable();case pz.Beta:return t.beta();case pz.Deprecated:return t.deprecated();default:return t._other()}}};var NPa={disabled:e=>({value:e,type:"disabled",_visit:function(t){return NPa._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"disabled":return t.disabled(e.value);default:return t._other(e)}}};var She={cursor:e=>({...e,type:"cursor",_visit:function(t){return She._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return She._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return She._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 u9t={language:e=>({...e,type:"language",_visit:function(t){return u9t._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return u9t._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 _z={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 _z.Curl:return t.curl();case _z.Python:return t.python();case _z.Javascript:return t.javascript();case _z.Typescript:return t.typescript();case _z.Go:return t.go();case _z.Ruby:return t.ruby();case _z.Csharp:return t.csharp();case _z.Java:return t.java();case _z.Js:return t.js();case _z.Node:return t.node();case _z.Ts:return t.ts();case _z.Nodets:return t.nodets();case _z.Golang:return t.golang();case _z.Dotnet:return t.dotnet();case _z.Jvm:return t.jvm();default:return t._other()}}};var x0e={unknown:e=>({value:e,type:"unknown",_visit:function(t){return x0e._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return x0e._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 G0e={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return G0e._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return G0e._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 hz={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case hz.Get:return t.get();case hz.Post:return t.post();case hz.Put:return t.put();case hz.Patch:return t.patch();case hz.Delete:return t.delete();case hz.Head:return t.head();case hz.Options:return t.options();case hz.Trace:return t.trace();default:return t._other()}}};var hFt={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return hFt._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return hFt._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return hFt._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return hFt._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 _sc={Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case _sc.Json:return t.json();case _sc.Form:return t.form();default:return t._other()}}};var s9t={file:e=>({...e,type:"file",_visit:function(t){return s9t._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return s9t._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 KQ={file:e=>({...e,type:"file",_visit:function(t){return KQ._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return KQ._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return KQ._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return KQ._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return KQ._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return KQ._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return KQ._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 Xs={primitive:e=>({...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=>({...e,type:"array",_visit:function(t){return Xs._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Xs._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Xs._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Xs._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Xs._visit(this,t)}}),literal:e=>({...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)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Xs._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Xs._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 ih={int:e=>({...e,type:"int",_visit:function(t){return ih._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return ih._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return ih._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return ih._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return ih._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return ih._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return ih._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return ih._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return ih._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return ih._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return ih._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 Rj={boolean:e=>({value:e,type:"boolean",_visit:function(t){return Rj._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Rj._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 c9t={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return c9t._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return c9t._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 vx={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return vx._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return vx._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return vx._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return vx._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 yP={file:e=>({...e,type:"file",_visit:function(t){return yP._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return yP._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return yP._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return yP._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return yP._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return yP._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return yP._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 ni={primitive:e=>({...e,type:"primitive",_visit:function(t){return ni._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ni._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return ni._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return ni._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return ni._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return ni._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ni._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return ni._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ni._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return ni._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return ni._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 Mhe={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Mhe._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Mhe._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 Un={int:e=>({...e,type:"int",_visit:function(t){return Un._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Un._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Un._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Un._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Un._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Un._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Un._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Un._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Un._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Un._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Un._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 zs={};Yt(zs,{AllOfPropertyConflict:()=>YQn,ArraySchema:()=>O4o,ArraySchemaWithExample:()=>X4o,Availability:()=>dUo,Base64WithExample:()=>H4o,BasicSecurityScheme:()=>_Uo,BearerSecurityScheme:()=>hUo,BooleanSchema:()=>p4o,BooleanWithExample:()=>K4o,BytesResponse:()=>UQn,CasingOverrides:()=>vUo,CommonProperty:()=>M4o,CommonPropertyWithExample:()=>oLo,CursorPagination:()=>YUo,CustomCodeSample:()=>JUo,CustomCodeSampleLanguage:()=>GUo,CustomCodeSampleSdk:()=>KUo,CustomPagination:()=>ZUo,DateWithExample:()=>G4o,DatetimeWithExample:()=>x4o,DiscriminatedOneOfSchema:()=>E4o,DiscriminatedOneOfSchemaWithExample:()=>nLo,DoubleSchema:()=>f4o,DoubleWithExample:()=>V4o,Encoding:()=>fUo,Endpoint:()=>kUo,EndpointExample:()=>xQn,EndpointResponseExample:()=>xUo,EndpointSdkName:()=>d9t,EndpointSecurity:()=>CQn,EndpointWithExample:()=>$__,EnumSchema:()=>DQn,EnumSchemaWithExample:()=>$4o,EnumValue:()=>qCi,ErrorExample:()=>QUo,FernExample:()=>LUo,FileResponse:()=>FQn,FileSchema:()=>IUo,FloatWithExample:()=>L4o,FormUrlEncodedRequest:()=>zUo,FullEndpointExample:()=>$Uo,FullExample:()=>$m,FullObjectExample:()=>EUo,FullOneOfExample:()=>MUo,GlobalHeader:()=>y4o,GlobalSecurity:()=>h4o,Header:()=>RCi,HeaderExample:()=>WQn,HeaderSecurityScheme:()=>yUo,HeaderWithExample:()=>FCi,HttpEndpointServer:()=>LQn,HttpError:()=>UUo,HttpErrorWithExample:()=>z4o,HttpMethod:()=>qQn,IdempotencyHeader:()=>b4o,Int64WithExample:()=>F4o,IntSchema:()=>c4o,IntWithExample:()=>N4o,JsonRequest:()=>RUo,JsonRequestWithExample:()=>C4o,JsonResponse:()=>QQn,JsonResponseWithExample:()=>kQn,KeyValuePair:()=>SUo,LiteralExample:()=>jUo,LiteralSchema:()=>$Qn,LiteralSchemaValue:()=>v4o,LongSchema:()=>l4o,MapSchema:()=>A4o,MapSchemaWithExample:()=>Z4o,MultipartRequest:()=>NQn,MultipartRequestProperty:()=>TUo,MultipartRequestPropertyEncoding:()=>qUo,MultipartSchema:()=>CUo,NamedFullExample:()=>K0e,Namespace:()=>gUo,NamespaceId:()=>PUo,NullExample:()=>wUo,NullableSchema:()=>P4o,NullableSchemaWithExample:()=>eLo,OauthSecurityScheme:()=>AUo,ObjectProperty:()=>w4o,ObjectPropertyConflictInfo:()=>XQn,ObjectPropertyWithExample:()=>iLo,ObjectSchema:()=>g4o,ObjectSchemaWithExample:()=>tLo,OctetStreamRequest:()=>zQn,OffsetPagination:()=>XUo,OneOfSchema:()=>j4o,OneOfSchemaWithExample:()=>rLo,OpenApiIntermediateRepresentation:()=>K__,OpenApiSource:()=>uUo,OptionalSchema:()=>m4o,OptionalSchemaWithExample:()=>k4o,Pagination:()=>GQn,ParseFormUrlEncodedRequest:()=>q4o,ParseMultipartRequest:()=>I4o,ParseOctetStreamRequest:()=>B4o,PathParameter:()=>TQn,PathParameterExample:()=>VUo,PathParameterWithExample:()=>D4o,PrimitiveExample:()=>IQn,PrimitiveSchema:()=>NCi,PrimitiveSchemaValue:()=>_4o,PrimitiveSchemaValueWithExample:()=>J4o,PrimitiveSchemaWithExample:()=>eUn,PropertyKey:()=>BQn,ProtobufEncoding:()=>lUo,ProtobufSource:()=>sUo,QueryParameter:()=>RQn,QueryParameterExample:()=>VQn,QueryParameterWithExample:()=>ZQn,QuerySecurityScheme:()=>bUo,ReferencedSchema:()=>p9t,Request:()=>NUo,RequestWithExample:()=>T4o,Response:()=>FUo,ResponseWithExample:()=>R4o,RetriesConfiguration:()=>HQn,Schema:()=>id,SchemaId:()=>gx,SchemaWithExample:()=>dO,Schemas:()=>s4o,SdkGroup:()=>OUo,SdkGroupInfo:()=>DUo,SdkGroupName:()=>TCi,SecurityScheme:()=>mUo,SecuritySchemeId:()=>CCi,Server:()=>LPa,Source:()=>cUo,StatusCode:()=>l9t,StreamingResponseExample:()=>WUo,StringSchema:()=>d4o,StringSchemaWithExample:()=>W4o,SupportedSdkLanguage:()=>HUo,Tag:()=>pUo,TagId:()=>Ox,Tags:()=>BUo,TextResponse:()=>zCi,Uint64WithExample:()=>U4o,UintWithExample:()=>Q4o,UnDiscriminatedOneOfSchema:()=>S4o,UnDiscriminatedOneOfSchemaWithExample:()=>aLo,UnknownSchemaWithExample:()=>Y4o,Webhook:()=>e4o,WebhookExampleCall:()=>JQn,WebhookHttpMethod:()=>KQn,WebhookWithExample:()=>Y__,WebsocketChannel:()=>u4o,WebsocketHandshake:()=>t4o,WebsocketHandshakeWithExample:()=>J__,WebsocketMessageExample:()=>a4o,WebsocketMessageOrigin:()=>r4o,WebsocketMessageSchema:()=>i4o,WebsocketServer:()=>n4o,WebsocketSessionExample:()=>o4o,WithAvailability:()=>vu,WithDescription:()=>qi,WithEncoding:()=>tK,WithInline:()=>fO,WithName:()=>xl,WithNamespace:()=>El,WithSdkGroupName:()=>Gd,WithSdkMethodName:()=>f9t,WithSource:()=>ru,WithStatusCode:()=>H0e,WithTitle:()=>xd,commons:()=>gsc,example:()=>Osc,finalIr:()=>Asc,parseIr:()=>msc});var gsc={};Yt(gsc,{BasicSecurityScheme:()=>_Uo,BearerSecurityScheme:()=>hUo,Encoding:()=>fUo,HeaderSecurityScheme:()=>yUo,Namespace:()=>gUo,NamespaceId:()=>PUo,OauthSecurityScheme:()=>AUo,OpenApiSource:()=>uUo,ProtobufEncoding:()=>lUo,ProtobufSource:()=>sUo,QuerySecurityScheme:()=>bUo,SchemaId:()=>gx,SdkGroup:()=>OUo,SdkGroupName:()=>TCi,SecurityScheme:()=>mUo,SecuritySchemeId:()=>CCi,Server:()=>LPa,Source:()=>cUo,StatusCode:()=>l9t,Tag:()=>pUo,TagId:()=>Ox,WithAvailability:()=>vu,WithDescription:()=>qi,WithEncoding:()=>tK,WithInline:()=>fO,WithName:()=>xl,WithNamespace:()=>El,WithSdkGroupName:()=>Gd,WithSdkMethodName:()=>f9t,WithSource:()=>ru,WithStatusCode:()=>H0e,WithTitle:()=>xd});var V={};Yt(V,{JsonError:()=>EQn,ParseError:()=>SQn,any:()=>T__,bigint:()=>A__,boolean:()=>R__,booleanLiteral:()=>q__,date:()=>m__,discriminant:()=>x__,enum_:()=>nUo,getObjectLikeUtils:()=>yFt,getObjectUtils:()=>yJi,getSchemaUtils:()=>Jm,isProperty:()=>ICi,lazy:()=>P__,lazyObject:()=>B__,list:()=>oUo,number:()=>z__,object:()=>aUo,objectWithoutOptionalProperties:()=>D__,optional:()=>hsc,property:()=>w__,record:()=>U__,set:()=>L__,string:()=>N__,stringLiteral:()=>C__,transform:()=>ysc,undiscriminatedUnion:()=>W__,union:()=>H__,unknown:()=>F__,withParsedProperties:()=>vsc});var nh={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 MA(e,t){return`Expected ${t}. Received ${beM(e)}.`}function beM(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 yz(e){return{...e,json:O__(e.json),parse:O__(e.parse)}}function O__(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
1411
|
-
`)),{ok:!0,value:t}):i}}function iUo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var EQn=class e extends Error{errors;constructor(t){super(t.map(iUo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var SQn=class e extends Error{errors;constructor(t){super(t.map(iUo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Jm(e){return{optional:()=>hsc(e),transform:t=>ysc(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new SQn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new EQn(i.errors)}}}function hsc(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>nh.OPTIONAL};return{...t,...Jm(t)}}function ysc(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...Jm(r)}}function A__(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:MA(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:MA(t,"bigint")}]},getType:()=>nh.BIGINT};return{...yz(e),...Jm(e)}}var veM=/^([+-]?\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 m__(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:MA(t,"string")}]}:veM.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:MA(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:MA(t,"Date object")}]},getType:()=>nh.DATE};return{...yz(e),...Jm(e)}}function H3(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...yz(r),...Jm(r)}}}function nUo(e){let t=new Set(e);return H3(nh.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:MA(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:MA(i,"enum")}]}:{ok:!0,value:i})()}function P__(e){let t=bsc(e);return{...t,...Jm(t)}}function bsc(e){return{parse:(t,r)=>MQn(e).parse(t,r),json:(t,r)=>MQn(e).json(t,r),getType:()=>MQn(e).getType()}}function MQn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function FPa(e){return Object.entries(e)}function QPa(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function BCi(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 UPa(e){return Object.keys(e)}function j__(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function yFt(e){return{withParsedProperties:t=>vsc(e,t)}}function vsc(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,s])=>({...c,[f]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...o}}},json:(i,n)=>{if(!BCi(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:MA(i,"object")}]};let a=new Set(Object.keys(t)),o=QPa(i,Object.keys(i).filter(c=>!a.has(c)));return e.json(o,n)},getType:()=>e.getType()};return{...r,...Jm(r),...yFt(r)}}function w__(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function ICi(e){return e.isProperty}function aUo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>ICi(i)?i.rawKey:r),_getParsedProperties:()=>UPa(e),parse:(r,i)=>{let n={},a=[];for(let[o,c]of FPa(e)){let f=ICi(c)?c.rawKey:o,s=ICi(c)?c.valueSchema:c,u={rawKey:f,parsedKey:o,valueSchema:s};n[f]=u,M__(s)&&a.push(f)}return E__({value:r,requiredKeys:a,getProperty:o=>{let c=n[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,o]of FPa(e)){let c=ICi(o)?o.valueSchema:o;M__(c)&&n.push(a)}return E__({value:r,requiredKeys:n,getProperty:a=>{let o=e[a];if(o!=null)return ICi(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>nh.OBJECT};return{...yz(t),...Jm(t),...yFt(t),...yJi(t)}}function E__({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!BCi(e))return{ok:!1,errors:[{path:a,message:MA(e,"object")}]};let o=new Set(t),c=[],f={};for(let[s,u]of Object.entries(e)){let l=r(s);if(l!=null){o.delete(s);let p=l.transform(u);p.ok?f[l.transformedKey]=p.value:(f[s]=u,c.push(...p.errors))}else switch(i){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":f[s]=u;break}}return c.push(...t.filter(s=>o.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||n?{ok:!0,value:f}:{ok:!1,errors:c}}function yJi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>S__({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>S__({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>nh.OBJECT};return{...r,...Jm(r),...yFt(r),...yJi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>nh.OBJECT};return{...t,...Jm(t),...yFt(t),...yJi(t)}}}}function S__({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,o]=j__(UPa(t),s=>n.has(s)),c=r(QPa(t,o)),f=i(QPa(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function M__(e){return!geM(e)}function geM(e){switch(e.getType()){case nh.ANY:case nh.UNKNOWN:case nh.OPTIONAL:return!0;default:return!1}}function D__(e){return aUo(e)}function B__(e){let t={...bsc(e),_getRawProperties:()=>MQn(e)._getRawProperties(),_getParsedProperties:()=>MQn(e)._getParsedProperties()};return{...t,...Jm(t),...yFt(t),...yJi(t)}}function oUo(e){let t={parse:(r,i)=>I__(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>I__(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>nh.LIST};return{...yz(t),...Jm(t)}}function I__(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:MA(e,"list"),path:[]}]}}function C__(e){return H3(nh.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:MA(r,`"${e}"`)}]})()}function q__(e){return H3(nh.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:MA(r,`${e.toString()}`)}]})()}var T__=H3(nh.ANY,e=>({ok:!0,value:e}));var R__=H3(nh.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:MA(e,"boolean")}]});var z__=H3(nh.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:MA(e,"number")}]});var N__=H3(nh.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:MA(e,"string")}]});var F__=H3(nh.UNKNOWN,e=>({ok:!0,value:e}));function U__(e,t){let r={parse:(i,n)=>Q__({value:i,isKeyNumeric:e.getType()===nh.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>Q__({value:i,isKeyNumeric:e.getType()===nh.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>nh.RECORD};return{...yz(r),...Jm(r)}}function Q__({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return BCi(e)?FPa(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,s=o;if(t){let _=o.length>0?Number(o):NaN;isNaN(_)||(s=_)}let u=r(s),l=i(c,s);if(f.ok&&u.ok&&l.ok)return{ok:!0,value:{...f.value,[u.value]:l.value}};let p=[];return f.ok||p.push(...f.errors),u.ok||p.push(...u.errors),l.ok||p.push(...l.errors),{ok:!1,errors:p}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:MA(e,"object")}]}}function L__(e){let t=oUo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:MA(i,"Set")}]},getType:()=>nh.SET};return{...yz(r),...Jm(r)}}function W__(e){let t={parse:(r,i)=>V__((n,a)=>n.parse(r,a),e,i),json:(r,i)=>V__((n,a)=>n.json(r,a),e,i),getType:()=>nh.UNDISCRIMINATED_UNION};return{...yz(t),...Jm(t)}}function V__(e,t,r){let i=[];for(let[n,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)i.push({path:c.path,message:`[Variant ${n}] ${c.message}`})}return{ok:!1,errors:i}}function x__(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function H__(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=nUo(UPa(t)),a={parse:(o,c)=>G__({value:o,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:f=>n.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,s)=>s.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>G__({value:o,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:f=>n.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,s)=>s.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>nh.UNION};return{...yz(a),...Jm(a),...yFt(a)}}function G__({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!BCi(e))return{ok:!1,errors:[{path:c,message:MA(e,"object")}]};let{[t]:f,...s}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let u=i(f);if(!u.ok)return{ok:!1,errors:u.errors};let l=n(u.value);if(l==null)return a?{ok:!0,value:{[r]:u.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let p=o(s,l);return p.ok?{ok:!0,value:{[r]:f,...p.value}}:p}var xd=V.objectWithoutOptionalProperties({title:V.string().optional()});var uUo=V.objectWithoutOptionalProperties({file:V.string()});var sUo=V.objectWithoutOptionalProperties({file:V.string()});var cUo=V.union("type",{openapi:uUo,protobuf:sUo}).transform({transform:e=>{switch(e.type){case"openapi":return G3.openapi(e);case"protobuf":return G3.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var ru=V.objectWithoutOptionalProperties({source:cUo.optional()});var lUo=V.objectWithoutOptionalProperties({typeName:V.string()});var fUo=V.union("type",{protobuf:lUo}).transform({transform:e=>{switch(e.type){case"protobuf":return wQn.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var tK=V.objectWithoutOptionalProperties({encoding:fUo.optional()});var qi=V.objectWithoutOptionalProperties({description:V.string().optional()});var dUo=V.enum_(["GenerallyAvailable","Beta","Deprecated"]);var vu=V.objectWithoutOptionalProperties({availability:dUo.optional()});var l9t=V.number();var H0e=V.objectWithoutOptionalProperties({statusCode:l9t.optional()});var xl=V.objectWithoutOptionalProperties({nameOverride:V.string().optional(),generatedName:V.string()});var fO=V.objectWithoutOptionalProperties({inline:V.boolean().optional()});var gx=V.string();var Ox=V.string();var pUo=V.objectWithoutOptionalProperties({id:Ox}).extend(qi);var CCi=V.string();var _Uo=V.objectWithoutOptionalProperties({usernameVariableName:V.string().optional(),usernameEnvVar:V.string().optional(),passwordVariableName:V.string().optional(),passwordEnvVar:V.string().optional()});var hUo=V.objectWithoutOptionalProperties({tokenVariableName:V.string().optional(),tokenEnvVar:V.string().optional()});var yUo=V.objectWithoutOptionalProperties({headerName:V.string(),prefix:V.string().optional(),headerVariableName:V.string().optional(),headerEnvVar:V.string().optional()});var bUo=V.objectWithoutOptionalProperties({queryParameterName:V.string()});var vUo=V.objectWithoutOptionalProperties({snake:V.string().optional(),camel:V.string().optional(),screamingSnake:V.string().optional(),pascal:V.string().optional()});var qCi=V.objectWithoutOptionalProperties({nameOverride:V.string().optional(),generatedName:V.string(),value:V.string(),casing:vUo.optional()}).extend(qi).extend(vu);var gUo=V.objectWithoutOptionalProperties({type:V.stringLiteral("namespace"),name:V.string()});var OUo=V.undiscriminatedUnion([V.string(),gUo]);var TCi=V.list(OUo);var Gd=V.objectWithoutOptionalProperties({groupName:TCi.optional()});var El=V.objectWithoutOptionalProperties({namespace:V.string().optional()});var DQn=V.objectWithoutOptionalProperties({default:qCi.optional(),values:V.list(qCi)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var AUo=V.objectWithoutOptionalProperties({scopesEnum:DQn.optional()});var mUo=V.union("type",{basic:_Uo,bearer:hUo,header:yUo,query:bUo,oauth:AUo}).transform({transform:e=>{switch(e.type){case"basic":return dz.basic(e);case"bearer":return dz.bearer(e);case"header":return dz.header(e);case"query":return dz.query(e);case"oauth":return dz.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var LPa=V.objectWithoutOptionalProperties({name:V.string().optional(),url:V.string(),audiences:V.list(V.string()).optional()}).extend(qi);var PUo=V.string();var f9t=V.objectWithoutOptionalProperties({sdkMethodName:V.string().optional()});var Osc={};Yt(Osc,{FullExample:()=>$m,FullObjectExample:()=>EUo,FullOneOfExample:()=>MUo,KeyValuePair:()=>SUo,LiteralExample:()=>jUo,NullExample:()=>wUo,PrimitiveExample:()=>IQn,PropertyKey:()=>BQn});var BQn=V.string();var IQn=V.union("type",{int:V.object({value:V.number()}),int64:V.object({value:V.number()}),uint:V.object({value:V.number()}),uint64:V.object({value:V.number()}),float:V.object({value:V.number()}),double:V.object({value:V.number()}),string:V.object({value:V.string()}),datetime:V.object({value:V.string()}),date:V.object({value:V.string()}),base64:V.object({value:V.string()}),boolean:V.object({value:V.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return Ka.int(e.value);case"int64":return Ka.int64(e.value);case"uint":return Ka.uint(e.value);case"uint64":return Ka.uint64(e.value);case"float":return Ka.float(e.value);case"double":return Ka.double(e.value);case"string":return Ka.string(e.value);case"datetime":return Ka.datetime(e.value);case"date":return Ka.date(e.value);case"base64":return Ka.base64(e.value);case"boolean":return Ka.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var jUo=V.union("type",{boolean:V.object({value:V.boolean()}),string:V.object({value:V.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return MCi.boolean(e.value);case"string":return MCi.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var wUo=V.objectWithoutOptionalProperties({});var $m=V.union("type",{primitive:V.object({value:IQn}),object:V.lazyObject(()=>EUo),array:V.object({value:V.list(V.lazy(()=>$m))}),map:V.object({value:V.list(V.lazyObject(()=>SUo))}),enum:V.object({value:V.string()}),literal:V.object({value:jUo}),oneOf:V.object({value:V.lazy(()=>MUo)}),null:wUo,unknown:V.object({value:V.lazy(()=>$m)})}).transform({transform:e=>{switch(e.type){case"primitive":return wl.primitive(e.value);case"object":return wl.object(e);case"array":return wl.array(e.value);case"map":return wl.map(e.value);case"enum":return wl.enum(e.value);case"literal":return wl.literal(e.value);case"oneOf":return wl.oneOf(e.value);case"null":return wl.null(e);case"unknown":return wl.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var EUo=V.objectWithoutOptionalProperties({properties:V.record(BQn,V.lazy(()=>$m))});var SUo=V.objectWithoutOptionalProperties({key:IQn,value:V.lazy(()=>$m)});var MUo=V.union("type",{discriminated:V.object({value:V.record(BQn,V.lazy(()=>$m))}),undiscriminated:V.object({value:V.lazy(()=>$m)})}).transform({transform:e=>{switch(e.type){case"discriminated":return DCi.discriminated(e.value);case"undiscriminated":return DCi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Asc={};Yt(Asc,{AllOfPropertyConflict:()=>YQn,ArraySchema:()=>O4o,Availability:()=>dUo,BooleanSchema:()=>p4o,BytesResponse:()=>UQn,CasingOverrides:()=>vUo,CommonProperty:()=>M4o,CursorPagination:()=>YUo,CustomCodeSample:()=>JUo,CustomCodeSampleLanguage:()=>GUo,CustomCodeSampleSdk:()=>KUo,CustomPagination:()=>ZUo,DiscriminatedOneOfSchema:()=>E4o,DoubleSchema:()=>f4o,Endpoint:()=>kUo,EndpointExample:()=>xQn,EndpointResponseExample:()=>xUo,EndpointSdkName:()=>d9t,EndpointSecurity:()=>CQn,EnumSchema:()=>DQn,EnumValue:()=>qCi,ErrorExample:()=>QUo,FernExample:()=>LUo,FileResponse:()=>FQn,FileSchema:()=>IUo,FormUrlEncodedRequest:()=>zUo,FullEndpointExample:()=>$Uo,GlobalHeader:()=>y4o,GlobalSecurity:()=>h4o,Header:()=>RCi,HeaderExample:()=>WQn,HttpEndpointServer:()=>LQn,HttpError:()=>UUo,HttpMethod:()=>qQn,IdempotencyHeader:()=>b4o,IntSchema:()=>c4o,JsonRequest:()=>RUo,JsonResponse:()=>QQn,LiteralSchema:()=>$Qn,LiteralSchemaValue:()=>v4o,LongSchema:()=>l4o,MapSchema:()=>A4o,MultipartRequest:()=>NQn,MultipartRequestProperty:()=>TUo,MultipartRequestPropertyEncoding:()=>qUo,MultipartSchema:()=>CUo,NullableSchema:()=>P4o,ObjectProperty:()=>w4o,ObjectPropertyConflictInfo:()=>XQn,ObjectSchema:()=>g4o,OctetStreamRequest:()=>zQn,OffsetPagination:()=>XUo,OneOfSchema:()=>j4o,OpenApiIntermediateRepresentation:()=>K__,OptionalSchema:()=>m4o,Pagination:()=>GQn,PathParameter:()=>TQn,PathParameterExample:()=>VUo,PrimitiveSchema:()=>NCi,PrimitiveSchemaValue:()=>_4o,QueryParameter:()=>RQn,QueryParameterExample:()=>VQn,ReferencedSchema:()=>p9t,Request:()=>NUo,Response:()=>FUo,RetriesConfiguration:()=>HQn,Schema:()=>id,Schemas:()=>s4o,SdkGroupInfo:()=>DUo,StreamingResponseExample:()=>WUo,StringSchema:()=>d4o,SupportedSdkLanguage:()=>HUo,Tags:()=>BUo,TextResponse:()=>zCi,UnDiscriminatedOneOfSchema:()=>S4o,Webhook:()=>e4o,WebhookExampleCall:()=>JQn,WebhookHttpMethod:()=>KQn,WebsocketChannel:()=>u4o,WebsocketHandshake:()=>t4o,WebsocketMessageExample:()=>a4o,WebsocketMessageOrigin:()=>r4o,WebsocketMessageSchema:()=>i4o,WebsocketServer:()=>n4o,WebsocketSessionExample:()=>o4o});var DUo=V.objectWithoutOptionalProperties({summary:V.string().optional(),description:V.string().optional()});var BUo=V.objectWithoutOptionalProperties({tagsById:V.record(Ox,pUo),orderedTagIds:V.list(Ox).optional()});var CQn=V.list(V.record(CCi,V.list(V.string())));var qQn=V.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var TQn=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>id),variableReference:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var RQn=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>id),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var RCi=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>id),env:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var d9t=V.objectWithoutOptionalProperties({groupName:TCi,methodName:V.string()});var zQn=V.objectWithoutOptionalProperties({contentType:V.string().optional()}).extend(qi).extend(ru);var IUo=V.objectWithoutOptionalProperties({isOptional:V.boolean(),isArray:V.boolean()}).extend(qi);var CUo=V.union("type",{file:IUo,json:V.object({value:V.lazy(()=>id)})}).transform({transform:e=>{switch(e.type){case"file":return s9t.file(e);case"json":return s9t.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var qUo=V.enum_(["json","form"]);var TUo=V.objectWithoutOptionalProperties({key:V.string(),schema:CUo,contentType:V.string().optional(),exploded:V.boolean().optional(),encoding:qUo.optional()}).extend(qi);var NQn=V.objectWithoutOptionalProperties({name:V.string().optional(),properties:V.list(TUo)}).extend(qi).extend(ru);var RUo=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id),contentType:V.string().optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru);var zUo=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id),contentType:V.string().optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru);var NUo=V.union("type",{octetStream:zQn,multipart:NQn,json:RUo,formUrlEncoded:zUo}).transform({transform:e=>{switch(e.type){case"octetStream":return hFt.octetStream(e);case"multipart":return hFt.multipart(e);case"json":return hFt.json(e);case"formUrlEncoded":return hFt.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var FQn=V.objectWithoutOptionalProperties({}).extend(qi).extend(ru).extend(H0e);var QQn=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id),responseProperty:V.string().optional()}).extend(qi).extend(ru).extend(H0e);var zCi=V.objectWithoutOptionalProperties({}).extend(qi).extend(ru).extend(H0e);var UQn=V.objectWithoutOptionalProperties({}).extend(qi).extend(ru).extend(H0e);var FUo=V.union("type",{file:FQn,json:QQn,text:zCi,bytes:UQn,streamingSse:QQn,streamingText:zCi,streamingJson:QQn}).transform({transform:e=>{switch(e.type){case"file":return KQ.file(e);case"json":return KQ.json(e);case"text":return KQ.text(e);case"bytes":return KQ.bytes(e);case"streamingSse":return KQ.streamingSse(e);case"streamingText":return KQ.streamingText(e);case"streamingJson":return KQ.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var QUo=V.objectWithoutOptionalProperties({name:V.string().optional(),description:V.string().optional(),example:V.lazy(()=>$m)});var UUo=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id).optional(),examples:V.list(QUo).optional()}).extend(qi).extend(xl).extend(ru);var LQn=V.objectWithoutOptionalProperties({name:V.string().optional(),url:V.string().optional(),audiences:V.list(V.string()).optional()});var LUo=V.unknown();var VUo=V.objectWithoutOptionalProperties({name:V.string(),parameterNameOverride:V.string().optional(),value:V.lazy(()=>$m)});var VQn=V.objectWithoutOptionalProperties({name:V.string(),value:V.lazy(()=>$m)});var WQn=V.objectWithoutOptionalProperties({name:V.string(),value:V.lazy(()=>$m)});var WUo=V.objectWithoutOptionalProperties({sse:V.boolean(),events:V.list(V.lazy(()=>$m))});var xUo=V.union("type",{withStreaming:WUo,withoutStreaming:V.object({value:V.lazy(()=>$m)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return G0e.withStreaming(e);case"withoutStreaming":return G0e.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var GUo=V.objectWithoutOptionalProperties({name:V.string().optional(),language:V.string(),code:V.string(),install:V.string().optional()}).extend(qi);var HUo=V.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var KUo=V.objectWithoutOptionalProperties({name:V.string().optional(),sdk:HUo,code:V.string()}).extend(qi);var JUo=V.union("type",{language:GUo,sdk:KUo}).transform({transform:e=>{switch(e.type){case"language":return u9t.language(e);case"sdk":return u9t.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var $Uo=V.objectWithoutOptionalProperties({name:V.string().optional(),pathParameters:V.list(VUo).optional(),queryParameters:V.list(VQn).optional(),headers:V.list(WQn).optional(),request:V.lazy(()=>$m).optional(),response:xUo.optional(),codeSamples:V.list(JUo)}).extend(qi);var xQn=V.union("type",{unknown:V.object({value:LUo}),full:$Uo}).transform({transform:e=>{switch(e.type){case"unknown":return x0e.unknown(e.value);case"full":return x0e.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var YUo=V.objectWithoutOptionalProperties({cursor:V.string(),nextCursor:V.property("next_cursor",V.string()),results:V.string()});var XUo=V.objectWithoutOptionalProperties({offset:V.string(),results:V.string(),step:V.string().optional(),hasNextPage:V.string().optional()});var ZUo=V.objectWithoutOptionalProperties({results:V.string()});var GQn=V.union("type",{cursor:YUo,offset:XUo,custom:ZUo}).transform({transform:e=>{switch(e.type){case"cursor":return She.cursor(e);case"offset":return She.offset(e);case"custom":return She.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var HQn=V.union("type",{disabled:V.object({value:V.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return NPa.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var kUo=V.objectWithoutOptionalProperties({authed:V.boolean(),security:CQn.optional(),internal:V.boolean().optional(),idempotent:V.boolean().optional(),method:qQn,audiences:V.list(V.string()),path:V.string(),summary:V.string().optional(),operationId:V.string().optional(),tags:V.list(Ox),pathParameters:V.list(TQn),queryParameters:V.list(RQn),headers:V.list(RCi),sdkName:d9t.optional(),generatedRequestName:V.string(),requestNameOverride:V.string().optional(),request:NUo.optional(),response:FUo.optional(),errors:V.record(l9t,UUo),servers:V.list(LQn),examples:V.list(xQn),pagination:GQn.optional(),retries:HQn.optional()}).extend(qi).extend(vu).extend(ru).extend(El);var KQn=V.enum_(["GET","POST"]);var JQn=V.objectWithoutOptionalProperties({name:V.string().optional(),payload:V.lazy(()=>$m)}).extend(qi);var e4o=V.objectWithoutOptionalProperties({audiences:V.list(V.string()),sdkName:d9t.optional(),method:KQn,summary:V.string().optional(),operationId:V.string(),tags:V.list(Ox),headers:V.list(RCi),generatedPayloadName:V.string(),payload:V.lazy(()=>id),examples:V.list(JQn)}).extend(qi).extend(ru).extend(El);var t4o=V.objectWithoutOptionalProperties({queryParameters:V.list(RQn),headers:V.list(RCi),pathParameters:V.list(TQn)});var r4o=V.enum_(["client","server"]);var i4o=V.objectWithoutOptionalProperties({name:V.string(),origin:r4o,body:V.lazy(()=>id)});var n4o=V.objectWithoutOptionalProperties({name:V.string(),url:V.string()});var a4o=V.objectWithoutOptionalProperties({messageType:V.string(),payload:V.lazy(()=>$m)}).extend(qi);var o4o=V.objectWithoutOptionalProperties({name:V.string().optional(),queryParameters:V.list(VQn).optional(),headers:V.list(WQn).optional(),messages:V.list(a4o)}).extend(qi);var u4o=V.objectWithoutOptionalProperties({audiences:V.list(V.string()),path:V.string(),groupName:TCi,summary:V.string().optional(),handshake:t4o,messages:V.list(i4o),servers:V.list(n4o),examples:V.list(o4o)}).extend(qi).extend(ru);var s4o=V.objectWithoutOptionalProperties({rootSchemas:V.record(gx,V.lazy(()=>id)),namespacedSchemas:V.record(PUo,V.record(gx,V.lazy(()=>id)))});var c4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional()});var l4o=V.objectWithoutOptionalProperties({default:V.number().optional()});var f4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional()});var d4o=V.objectWithoutOptionalProperties({default:V.string().optional(),pattern:V.string().optional(),format:V.string().optional(),minLength:V.number().optional(),maxLength:V.number().optional()});var p4o=V.objectWithoutOptionalProperties({default:V.boolean().optional()});var _4o=V.union("type",{int:c4o,int64:l4o,uint:V.object({}),uint64:V.object({}),float:V.object({}),double:f4o,string:d4o,datetime:V.object({}),date:V.object({}),base64:V.object({}),boolean:p4o}).transform({transform:e=>{switch(e.type){case"int":return ih.int(e);case"int64":return ih.int64(e);case"uint":return ih.uint();case"uint64":return ih.uint64();case"float":return ih.float();case"double":return ih.double(e);case"string":return ih.string(e);case"datetime":return ih.datetime();case"date":return ih.date();case"base64":return ih.base64();case"boolean":return ih.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var NCi=V.objectWithoutOptionalProperties({schema:_4o}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var h4o=V.list(V.record(CCi,V.list(V.string())));var y4o=V.objectWithoutOptionalProperties({header:V.string(),name:V.string().optional(),optional:V.boolean().optional(),env:V.string().optional(),schema:V.lazy(()=>id).optional()});var b4o=V.objectWithoutOptionalProperties({header:V.string(),name:V.string().optional(),env:V.string().optional(),schema:V.lazy(()=>id).optional()});var K__=V.objectWithoutOptionalProperties({apiVersion:V.unknown().optional(),title:V.string().optional(),description:V.string().optional(),basePath:V.string().optional(),servers:V.list(LPa),websocketServers:V.list(LPa),groups:V.record(V.string(),DUo),tags:BUo,hasEndpointsMarkedInternal:V.boolean(),endpoints:V.list(kUo),webhooks:V.list(e4o),channels:V.record(V.string(),u4o),groupedSchemas:s4o,variables:V.record(V.string(),NCi),nonRequestReferencedSchemas:V.set(gx),securitySchemes:V.record(CCi,mUo),security:h4o.optional(),globalHeaders:V.list(y4o).optional(),idempotencyHeaders:V.list(b4o).optional()});var p9t=V.objectWithoutOptionalProperties({schema:gx}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd);var v4o=V.union("type",{boolean:V.object({value:V.boolean()}),string:V.object({value:V.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return Rj.boolean(e.value);case"string":return Rj.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var $Qn=V.objectWithoutOptionalProperties({value:v4o}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var id=V.union("type",{primitive:NCi,object:V.lazyObject(()=>g4o),array:V.lazyObject(()=>O4o),map:V.lazyObject(()=>A4o),optional:V.lazyObject(()=>m4o),enum:DQn,reference:p9t,literal:$Qn,oneOf:V.object({value:V.lazy(()=>j4o)}),nullable:V.lazyObject(()=>P4o),unknown:xl}).transform({transform:e=>{switch(e.type){case"primitive":return Xs.primitive(e);case"object":return Xs.object(e);case"array":return Xs.array(e);case"map":return Xs.map(e);case"optional":return Xs.optional(e);case"enum":return Xs.enum(e);case"reference":return Xs.reference(e);case"literal":return Xs.literal(e);case"oneOf":return Xs.oneOf(e.value);case"nullable":return Xs.nullable(e);case"unknown":return Xs.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var YQn=V.objectWithoutOptionalProperties({propertyKey:V.string(),allOfSchemaIds:V.list(gx),conflictingTypeSignatures:V.boolean()});var g4o=V.objectWithoutOptionalProperties({allOf:V.list(p9t),properties:V.list(V.lazyObject(()=>w4o)),allOfPropertyConflicts:V.list(YQn),additionalProperties:V.boolean()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var XQn=V.objectWithoutOptionalProperties({differentSchema:V.boolean()});var w4o=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>id),readonly:V.boolean().optional(),writeonly:V.boolean().optional(),conflict:V.record(gx,XQn),generatedName:V.string(),nameOverride:V.string().optional(),audiences:V.list(V.string())}).extend(vu);var O4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var A4o=V.objectWithoutOptionalProperties({key:NCi,value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(xd).extend(fO);var m4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var P4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var j4o=V.union("type",{discriminated:V.lazyObject(()=>E4o),undiscriminated:V.lazyObject(()=>S4o)}).transform({transform:e=>{switch(e.type){case"discriminated":return c9t.discriminated(e);case"undiscriminated":return c9t.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var E4o=V.objectWithoutOptionalProperties({discriminantProperty:V.string(),commonProperties:V.list(V.lazyObject(()=>M4o)),schemas:V.record(V.string(),V.lazy(()=>id))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var M4o=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>id)});var S4o=V.objectWithoutOptionalProperties({schemas:V.list(V.lazy(()=>id))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var msc={};Yt(msc,{ArraySchemaWithExample:()=>X4o,Base64WithExample:()=>H4o,BooleanWithExample:()=>K4o,CommonPropertyWithExample:()=>oLo,DateWithExample:()=>G4o,DatetimeWithExample:()=>x4o,DiscriminatedOneOfSchemaWithExample:()=>nLo,DoubleWithExample:()=>V4o,EndpointWithExample:()=>$__,EnumSchemaWithExample:()=>$4o,FloatWithExample:()=>L4o,HeaderWithExample:()=>FCi,HttpErrorWithExample:()=>z4o,Int64WithExample:()=>F4o,IntWithExample:()=>N4o,JsonRequestWithExample:()=>C4o,JsonResponseWithExample:()=>kQn,MapSchemaWithExample:()=>Z4o,NamedFullExample:()=>K0e,NullableSchemaWithExample:()=>eLo,ObjectPropertyWithExample:()=>iLo,ObjectSchemaWithExample:()=>tLo,OneOfSchemaWithExample:()=>rLo,OptionalSchemaWithExample:()=>k4o,ParseFormUrlEncodedRequest:()=>q4o,ParseMultipartRequest:()=>I4o,ParseOctetStreamRequest:()=>B4o,PathParameterWithExample:()=>D4o,PrimitiveSchemaValueWithExample:()=>J4o,PrimitiveSchemaWithExample:()=>eUn,QueryParameterWithExample:()=>ZQn,RequestWithExample:()=>T4o,ResponseWithExample:()=>R4o,SchemaWithExample:()=>dO,StringSchemaWithExample:()=>W4o,Uint64WithExample:()=>U4o,UintWithExample:()=>Q4o,UnDiscriminatedOneOfSchemaWithExample:()=>aLo,UnknownSchemaWithExample:()=>Y4o,WebhookWithExample:()=>Y__,WebsocketHandshakeWithExample:()=>J__});var K0e=V.objectWithoutOptionalProperties({name:V.string().optional(),value:V.unknown()}).extend(qi);var ZQn=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>dO),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var FCi=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>dO),env:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var J__=V.objectWithoutOptionalProperties({queryParameters:V.list(ZQn),headers:V.list(FCi)});var D4o=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>dO),variableReference:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var B4o=V.objectWithoutOptionalProperties({}).extend(zQn).extend(f9t);var I4o=V.objectWithoutOptionalProperties({}).extend(NQn).extend(f9t);var C4o=V.objectWithoutOptionalProperties({schema:V.lazy(()=>dO),contentType:V.string().optional(),fullExamples:V.list(K0e).optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru).extend(f9t);var q4o=V.objectWithoutOptionalProperties({schema:V.lazy(()=>dO),contentType:V.string().optional(),fullExamples:V.list(K0e).optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru).extend(f9t);var T4o=V.union("type",{octetStream:B4o,multipart:I4o,json:C4o,formUrlEncoded:q4o}).transform({transform:e=>{switch(e.type){case"octetStream":return vx.octetStream(e);case"multipart":return vx.multipart(e);case"json":return vx.json(e);case"formUrlEncoded":return vx.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var kQn=V.objectWithoutOptionalProperties({schema:V.lazy(()=>dO),responseProperty:V.string().optional(),fullExamples:V.list(K0e).optional()}).extend(qi).extend(ru).extend(H0e);var R4o=V.union("type",{file:FQn,json:kQn,text:zCi,bytes:UQn,streamingSse:kQn,streamingText:zCi,streamingJson:kQn}).transform({transform:e=>{switch(e.type){case"file":return yP.file(e);case"json":return yP.json(e);case"text":return yP.text(e);case"bytes":return yP.bytes(e);case"streamingSse":return yP.streamingSse(e);case"streamingText":return yP.streamingText(e);case"streamingJson":return yP.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var z4o=V.objectWithoutOptionalProperties({statusCode:l9t,schema:V.lazy(()=>dO),fullExamples:V.list(K0e).optional()}).extend(qi).extend(xl).extend(ru);var $__=V.objectWithoutOptionalProperties({authed:V.boolean(),security:CQn.optional(),internal:V.boolean().optional(),idempotent:V.boolean().optional(),method:qQn,audiences:V.list(V.string()),path:V.string(),summary:V.string().optional(),operationId:V.string().optional(),tags:V.list(Ox),pathParameters:V.list(D4o),queryParameters:V.list(ZQn),headers:V.list(FCi),sdkName:d9t.optional(),generatedRequestName:V.string(),requestNameOverride:V.string().optional(),request:T4o.optional(),response:R4o.optional(),errors:V.record(l9t,z4o),servers:V.list(LQn),examples:V.list(xQn),pagination:GQn.optional(),retries:HQn.optional()}).extend(qi).extend(vu).extend(ru).extend(El);var Y__=V.objectWithoutOptionalProperties({audiences:V.list(V.string()),sdkName:d9t.optional(),method:KQn,summary:V.string().optional(),operationId:V.string(),tags:V.list(Ox),headers:V.list(FCi),generatedPayloadName:V.string(),payload:V.lazy(()=>dO),examples:V.list(JQn)}).extend(qi).extend(ru).extend(El);var N4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional(),example:V.number().optional()});var F4o=V.objectWithoutOptionalProperties({default:V.number().optional(),example:V.number().optional()});var Q4o=V.objectWithoutOptionalProperties({default:V.number().optional(),example:V.number().optional()});var U4o=V.objectWithoutOptionalProperties({default:V.number().optional(),example:V.number().optional()});var L4o=V.objectWithoutOptionalProperties({example:V.number().optional()});var V4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional(),example:V.number().optional()});var W4o=V.objectWithoutOptionalProperties({default:V.string().optional(),pattern:V.string().optional(),format:V.string().optional(),minLength:V.number().optional(),maxLength:V.number().optional(),example:V.string().optional()});var x4o=V.objectWithoutOptionalProperties({example:V.string().optional()});var G4o=V.objectWithoutOptionalProperties({example:V.string().optional()});var H4o=V.objectWithoutOptionalProperties({example:V.string().optional()});var K4o=V.objectWithoutOptionalProperties({default:V.boolean().optional(),example:V.boolean().optional()});var J4o=V.union("type",{int:N4o,int64:F4o,uint:Q4o,uint64:U4o,float:L4o,double:V4o,string:W4o,datetime:x4o,date:G4o,base64:H4o,boolean:K4o}).transform({transform:e=>{switch(e.type){case"int":return Un.int(e);case"int64":return Un.int64(e);case"uint":return Un.uint(e);case"uint64":return Un.uint64(e);case"float":return Un.float(e);case"double":return Un.double(e);case"string":return Un.string(e);case"datetime":return Un.datetime(e);case"date":return Un.date(e);case"base64":return Un.base64(e);case"boolean":return Un.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var eUn=V.objectWithoutOptionalProperties({schema:J4o}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var $4o=V.objectWithoutOptionalProperties({default:qCi.optional(),values:V.list(qCi),example:V.string().optional()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var Y4o=V.objectWithoutOptionalProperties({example:V.unknown()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var dO=V.union("type",{primitive:eUn,object:V.lazyObject(()=>tLo),array:V.lazyObject(()=>X4o),map:V.lazyObject(()=>Z4o),optional:V.lazyObject(()=>k4o),enum:$4o,reference:p9t,literal:$Qn,oneOf:V.object({value:V.lazy(()=>rLo)}),nullable:V.lazyObject(()=>eLo),unknown:Y4o}).transform({transform:e=>{switch(e.type){case"primitive":return ni.primitive(e);case"object":return ni.object(e);case"array":return ni.array(e);case"map":return ni.map(e);case"optional":return ni.optional(e);case"enum":return ni.enum(e);case"reference":return ni.reference(e);case"literal":return ni.literal(e);case"oneOf":return ni.oneOf(e.value);case"nullable":return ni.nullable(e);case"unknown":return ni.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var X4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>dO),example:V.list(V.unknown()).optional()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var Z4o=V.objectWithoutOptionalProperties({key:eUn,value:V.lazy(()=>dO),example:V.unknown().optional()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(xd).extend(fO);var k4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>dO)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var eLo=V.objectWithoutOptionalProperties({value:V.lazy(()=>dO)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var tLo=V.objectWithoutOptionalProperties({allOf:V.list(p9t),properties:V.list(V.lazyObject(()=>iLo)),allOfPropertyConflicts:V.list(YQn),fullExamples:V.list(K0e).optional(),additionalProperties:V.boolean()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var iLo=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>dO),readonly:V.boolean().optional(),writeonly:V.boolean().optional(),audiences:V.list(V.string()),conflict:V.record(gx,XQn),nameOverride:V.string().optional(),generatedName:V.string()}).extend(vu);var rLo=V.union("type",{discriminated:V.lazyObject(()=>nLo),undiscriminated:V.lazyObject(()=>aLo)}).transform({transform:e=>{switch(e.type){case"discriminated":return Mhe.discriminated(e);case"undiscriminated":return Mhe.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var nLo=V.objectWithoutOptionalProperties({discriminantProperty:V.string(),commonProperties:V.list(V.lazyObject(()=>oLo)),schemas:V.record(V.string(),V.lazy(()=>dO))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var oLo=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>dO)});var aLo=V.objectWithoutOptionalProperties({schemas:V.list(V.lazy(()=>dO))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var X__=/^(\d+)/,tUn=/^[a-zA-Z][a-zA-Z0-9_]*$/,Z__={"<":"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 bJi(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let o=Math.floor(e/10),c=e%10;return c===0?i[o]:`${i[o]}_${t[c]}`}if(e<1e3){let o=Math.floor(e/100),c=e%100;return c===0?`${t[o]}_hundred`:`${t[o]}_hundred_${bJi(c)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${bJi(a)}`}function VPa(e){let t=e.match(X__);if(t&&t[0]!=null){let r=t[0],i=e.substring(r.length),n=parseFloat(r);if(!isNaN(n)&&isFinite(n)){let a=bJi(n);return i.length>0?`${a}_${i}`:a}}}function rUn(e){let t=VPa(e),r=Z__[e];return t!=null?TP(Fo(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":TP(Fo(e)))}function rK(e,t){return e.type==="primitive"&&t.type==="primitive"?k__(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?OeM(e.values,t.values):e.type==="array"&&t.type==="array"?rK(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"?rK(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?AeM(e.value,t.value):e.type==="object"&&t.type==="object"?meM(e,t):e.type==="map"&&t.type==="map"?k__(e.key.schema,t.key.schema)&&rK(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function k__(e,t){return e.type===t.type}function OeM(e,t){let r=new Set(...e.map(n=>n.value)),i=new Set(...t.map(n=>n.value));return kq(r,i)}function AeM(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,i])=>{let n=t.schemas[r];return n==null?!1:rK(i,n)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,i)=>{let n=t.schemas[i];return n==null?!1:rK(r,n)}):!1}function meM(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(i=>[i.key,i.schema]));return Object.entries(t.properties).every(([i,n])=>{let a=r[i];return a==null?!1:rK(a,n.schema)})}function ZE(e){switch(e){case pz.Deprecated:return"deprecated";case pz.Beta:return"pre-release";case pz.GenerallyAvailable:return"generally-available";default:return}}function PeM(e){let t=e.find(i=>typeof i=="object"&&i.type==="namespace"),r=e.filter(i=>typeof i=="string"||i.type!=="namespace");return t?[t,...r]:r}function eh_(e){let t=e?PeM(e):void 0;if(t==null||t.length===0)return Lxi;let r=[];for(let[i,n]of t.entries())if(typeof n=="string")r.push(Fo(n));else if(typeof n=="object")switch(n.type){case"namespace":{i<t.length-1?r.push(Fo(n.name)):r.push(n.name,Lxi);break}default:Ot(n.type)}else Ot(n);return r.join("/")}function QCi(e){return qu.of(`${eh_(e)}.yml`)}function Psc({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?Lxi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(i=>typeof i=="string"||i.type!=="namespace")]:r=e.groupName,eh_(r))}function th_({sdkName:e,namespaceOverride:t}){return qu.of(`${Psc({sdkName:e,namespaceOverride:t})}.yml`)}function rh_({location:e,namespaceOverride:t}){return t!=null?tD(qu.of(t),e):e}function uLo(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Ot(e.type)}}function iUn(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:Ot(e)}}function pO(e){return typeof e=="string"?e:e.type}function nUn(e){if(typeof e!="string")return e.docs}function WPa(e){if(typeof e!="string")return e.default}function jsc(e){if(typeof e!="string")return e.validation}function xPa(e){let t=e.match(/^optional<\s*nullable<\s*(.+)\s*>\s*>$/);if(t!=null&&t[1]!=null)return t[1].trim();let r=e.match(/^nullable<\s*(.+)\s*>$/);return r!=null&&r[1]!=null?r[1].trim():e}function nh_(e){let t=pO(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?ih_(e):{...e,type:ih_(e.type)}}function ih_(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function vJi(e){return pO(e).startsWith("optional<")?e:typeof e=="string"?ah_(e):{...e,type:ah_(e.type)}}function ah_(e){return e.startsWith("optional<")?e:`optional<${e}>`}var jeM=-2147483648,weM=2147483647,EeM=-17976931348623157e292,SeM=17976931348623157e292;function Of({schema:e,fileContainingReference:t,declarationFile:r=t,context:i,namespace:n,declarationDepth:a}){switch(i.shouldMarkSchemaAsReferenced()&&i.markSchemaAsReferenced(e,n),e.type){case"primitive":return sLo(e);case"array":return Ssc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"map":return Msc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"reference":return Esc({schema:e,fileContainingReference:t,context:i,namespace:n});case"unknown":return Bsc();case"optional":return cLo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"nullable":return Dsc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"enum":return zeM({schema:e,fileContainingReference:t,context:i,declarationFile:r,declarationDepth:a});case"literal":return e.value,Isc(e);case"object":return NeM({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"oneOf":return FeM({schema:e.value,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});default:Ot(e)}}function sLo(e){switch(e.schema.type){case"string":return BeM({description:e.description,schema:e.schema});case"int":return IeM({description:e.description,schema:e.schema});case"float":return CeM({description:e.description,schema:e.schema});case"double":return qeM({description:e.description,schema:e.schema});case"boolean":return MeM({description:e.description,schema:e.schema});case"int64":return DeM({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:ZE(e.availability)}:{}}}function MeM({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function DeM({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function BeM({description:e,schema:t}){let r="string",i=TeM(t);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function IeM({description:e,schema:t}){let r="integer",i=oh_(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function CeM({description:e,schema:t}){let r="float";if(e==null)return r;let i={type:r};return e!=null&&(i.docs=e),i}function qeM({description:e,schema:t}){let r="double",i=oh_(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function TeM(e){if(e==null)return;let{format:t,pattern:r,minLength:i,maxLength:n}=e,a=ReM(t);if(!(a==null&&r==null&&i==null&&n==null))return{format:a,pattern:r,minLength:i,maxLength:n}}function ReM(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 oh_(e,t){if(e==null)return;let{minimum:r,maximum:i,multipleOf:n}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=wsc(r,t),i=wsc(i,t),n=wsc(n,t),!(r==null&&i==null&&a==null&&o==null&&n==null))return{min:r,max:i,exclusiveMin:a,exclusiveMax:o,multipleOf:n}}function wsc(e,t){if(e===void 0)return;let[r,i]=t==="integer"?[jeM,weM]:[EeM,SeM];return e<r||e>i?void 0:e}function Esc({schema:e,fileContainingReference:t,context:r,namespace:i}){let n=r.getSchema(e.schema,i);if(n==null)return"unknown";let a=QeM(n)??e.schema,o=iUn(n),c=UeM(n),s=lLo({context:r,fileContainingReference:t,declarationFile:QCi(o),type:a});return n.type==="nullable"&&(s=r.options.wrapReferencesToNullableInOptional?`optional<${s}>`:`nullable<${s}>`),n.type==="optional"&&!s.startsWith("optional<")&&(s=`optional<${s}>`),e.description==null&&c==null?s:{type:s,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function Ssc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=`list<${pO(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{},type:c}}function Msc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=sLo(e.key),c=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),f=e.encoding!=null?uLo(e.encoding):void 0,s=`map<${pO(o)}, ${pO(c)}>`;if(e.description==null&&f==null&&e.title==null)return s;let u={type:s};return e.description!=null&&(u.docs=e.description),e.encoding!=null&&(u.encoding=f),e.availability!=null&&(u.availability=ZE(e.availability)),u}function Dsc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){if(!i.options.respectNullableSchemas)return cLo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});let o=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=pO(o),f=nUn(o),s=WPa(o),u=jsc(o),l=nh_(c);if(i.options.wrapReferencesToNullableInOptional&&(l=vJi(l)),e.availability==null&&e.description==null&&f==null&&s==null&&u==null&&e.title==null)return l;let p=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(p.docs=e.description??f),s!=null&&(p.default=s),u!=null&&(p.validation=u),e.availability!=null&&(p.availability=ZE(e.availability)),p}function cLo({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=pO(o),f=nUn(o),s=WPa(o),u=jsc(o),l=vJi(c);if(e.availability==null&&e.description==null&&f==null&&s==null&&u==null&&e.title==null)return l;let p=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(p.docs=e.description??f),s!=null&&(p.default=s),u!=null&&(p.validation=u),e.availability!=null&&(p.availability=ZE(e.availability)),p}function Bsc(){return"unknown"}function Isc(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ot(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function zeM({schema:e,fileContainingReference:t,declarationFile:r,context:i,declarationDepth:n}){let a=GPa(e,n),o=e.nameOverride??e.generatedName;i.builder.addType(r,{name:o,schema:a.schema});let c=lLo({type:o,fileContainingReference:t,declarationFile:r,context:i});if(e.description==null&&e.default==null&&e.title==null)return c;let f={type:c};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.availability!=null&&(f.availability=ZE(e.availability)),f}function NeM({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=Csc({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=e.nameOverride??e.generatedName;i.builder.addType(r,{name:c,schema:o.schema});let f=lLo({type:c,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?f:{type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function FeM({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=qsc({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=e.nameOverride??e.generatedName;i.builder.addType(r,{name:c,schema:o.schema});let f=lLo({type:c,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function lLo({type:e,fileContainingReference:t,declarationFile:r,context:i}){if(r===t)return e;let n=i.builder.addImport({file:t,fileToImport:r});return n!=null?`${n}.${e}`:e}function QeM(e){return Xs._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 UeM(e){return Xs._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 I1;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(I1||(I1={}));function Fvi(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ot(e)}}function sh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a;switch(e.type){case"primitive":a=WeM(e);break;case"array":a=LeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"map":a=VeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"reference":a=xeM({schema:e,context:t,declarationFile:r,namespace:i});break;case"unknown":a=HeM(e.nameOverride,e.generatedName);break;case"optional":a=lh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"nullable":a=GeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"enum":a=GPa(e,n);break;case"literal":a=KeM(e,e.nameOverride,e.generatedName);break;case"object":a=Csc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"oneOf":a=qsc({schema:e.value,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;default:Ot(e)}return a}function Csc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=t.isInState(I1.Request)&&t.options.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},f=new Set;for(let _ of e.properties){if(_.readonly&&(o=!0),a&&_.readonly)continue;if(Object.keys(_.conflict).length>0){if(Object.entries(_.conflict).every(([g,m])=>!m.differentSchema))continue;Object.entries(_.conflict).forEach(([g])=>{Tsc({property:_.key,schemaId:g,context:t,namespace:i}).forEach(j=>{f.add(j)})})}let h=Of({schema:_.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}),y=_.audiences,b=_.nameOverride,v=ZE(_.availability),O=XeM(_);c[_.key]=YeM({typeReference:h,audiences:y,name:b,availability:v,propertyAccess:O})}let s=new Set;for(let _ of e.allOfPropertyConflicts)_.allOfSchemaIds.forEach(h=>f.add(h)),_.conflictingTypeSignatures&&s.add(_.propertyKey);let u=[];for(let _ of e.allOf){let h=fh_({schema:_.schema,context:t,namespace:i});if(h==null||f.has(_.schema)||f.has(h))continue;let y=Of({schema:Xs.reference(_),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});u.push(xPa(pO(y)))}for(let _ of f){let h=Rsc(t,_,i);for(let y of h.properties)c[y.key]==null&&(s.has(y.key)&&(c[y.key]="unknown"),c[y.key]=Of({schema:y.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}));for(let y of h.allOf){if(f.has(y.schema))continue;let b=Of({schema:Xs.reference(y),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});u.push(xPa(pO(b)))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([_,h])=>$eM(_)?[_,typeof h=="string"?{type:h,name:`_${_}`}:{...h,name:`_${_}`}]:[_,h]))};u.length>0&&(l.extends=u),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=ZE(e.availability)),e.source!=null&&(l.source=Fvi(e.source)),l.inline=zsc(e,n);let p=e.nameOverride??e.generatedName;return{name:o&&t.options.respectReadonlySchemas&&!a?`${p}Read`:p,schema:l}}function Tsc({property:e,schemaId:t,context:r,namespace:i}){let n=r.getSchema(t,i);if(n==null)return[];if(n.type==="reference")return Tsc({property:e,schemaId:n.schema,context:r,namespace:i});if(n.type==="object"){let{properties:a,allOf:o}=Rsc(r,t,i),c=a.some(s=>s.key===e),f=[...o.flatMap(s=>Tsc({property:e,context:r,schemaId:s.schema,namespace:i}))];if(c||f.length>0)return[t,...f]}return[]}function ch_(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?Rsc(e,t.schema,r):t.type==="nullable"?ch_(e,t.value,r):{properties:[],allOf:[]}}function Rsc(e,t,r){let i=e.getSchema(t,r);return i==null?{properties:[],allOf:[]}:ch_(e,i,r)}function LeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:Ssc({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function VeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:Msc({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function WeM(e){let t=sLo(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...i}=t;return{name:e.nameOverride??e.generatedName,schema:{...i}}}function uh_(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function GPa(e,t){let r={enum:e.values.map(a=>{let o=a.nameOverride??a.generatedName,c=a.value;if(o===c&&a.description==null&&(a.casing==null||uh_(a.casing)))return o;let f={value:a.value};if(o!==c&&(f.name=o),a.description!=null&&(f.docs=a.description),a.casing!=null&&!uh_(a.casing)){let s={},u=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,u=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,u=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,u=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,u=!0),u&&(f.casing=s)}return f})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=zsc(e,t);let i=new Set,n={...r,enum:[],source:e.source!=null?Fvi(e.source):void 0};for(let a of r.enum){let o=typeof a=="string"?a:a.name??a.value;i.has(o.toLowerCase())||(n.enum.push(a),i.add(o.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:n}}function xeM({schema:e,context:t,declarationFile:r,namespace:i}){return{name:e.nameOverride??e.generatedName,schema:Esc({schema:e,context:t,fileContainingReference:r,namespace:i})}}function GeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:Dsc({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}:lh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n})}function lh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:cLo({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}}function HeM(e,t){return{name:e??t,schema:Bsc()}}function KeM(e,t,r){return{name:t??r,schema:Isc(e)}}function qsc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=e.encoding!=null?uLo(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let s of e.commonProperties)c[s.key]=Of({schema:s.schema,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1});let f={};for(let[s,u]of Object.entries(e.schemas))f[s]=Of({schema:u,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?ZE(e.availability):void 0,union:f,encoding:a,source:e.source!=null?Fvi(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(Of({schema:c,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:o,encoding:a,source:e.source!=null?Fvi(e.source):void 0,inline:zsc(e,n)}}}var JeM=/^[0-9]/;function $eM(e){return JeM.test(e)}function fh_({schema:e,context:t,namespace:r}){let i=t.getSchema(e,r);if(i!=null)return i.type==="reference"?fh_({context:t,schema:i.schema,namespace:r}):e}function YeM({typeReference:e,audiences:t,name:r,availability:i,propertyAccess:n}){return t.length===0&&r==null&&i==null&&n==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...i!=null?{availability:i}:{},...n!=null?{access:n}:{}}}function zsc(e,t){return e.inline===!0||t>0?!0:void 0}function XeM(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return OD.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return OD.ObjectPropertyAccess.WriteOnly}}function dh_(e){let t=e.replace(/^x-|^X-/,"");return Fo(t)}function ph_(e){if(e.authOverrides!=null){for(let[r,i]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:i});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,i]of Object.entries(e.ir.securitySchemes))if(i.type==="basic"){let n={scheme:"basic"};i.usernameVariableName!=null&&(n.username===void 0?n.username={name:i.usernameVariableName}:n.username.name=i.usernameVariableName),i.usernameEnvVar!=null&&(n.username===void 0?n.username={env:i.usernameEnvVar}:n.username.env=i.usernameEnvVar),i.passwordVariableName!=null&&(n.password===void 0?n.password={name:i.passwordVariableName}:n.password.name=i.passwordVariableName),i.passwordEnvVar!=null&&(n.password===void 0?n.password={env:i.passwordEnvVar}:n.password.env=i.passwordEnvVar),e.builder.addAuthScheme({name:r,schema:n}),t||(e.builder.setAuth(r),t=!0)}else if(i.type==="bearer"){let n={scheme:"bearer"};i.tokenVariableName!=null&&(n.token===void 0?n.token={name:i.tokenVariableName}:n.token.name=i.tokenVariableName),i.tokenEnvVar!=null&&(n.token===void 0?n.token={env:i.tokenEnvVar}:n.token.env=i.tokenEnvVar),e.builder.addAuthScheme({name:r,schema:n}),t||(e.builder.setAuth(r),t=!0)}else if(i.type==="header")if(t)e.builder.addGlobalHeader({name:i.headerName,schema:{type:"string",name:i.headerVariableName??dh_(i.headerName),env:i.headerEnvVar}});else{let n={header:i.headerName,name:i.headerVariableName??"apiKey",type:"string"};i.headerEnvVar!=null&&(n.env=i.headerEnvVar),i.prefix!=null&&(n.prefix=i.prefix),e.builder.addAuthScheme({name:r,schema:n}),e.builder.setAuth(r),t=!0}else if(i.type==="oauth"){let n={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:n}),t||(e.builder.setAuth(r),t=!0),i.scopesEnum!=null&&i.scopesEnum.values.length>0&&e.builder.addType(qu.of("__package__.yml"),{name:"OauthScope",schema:GPa(i.scopesEnum,0).schema})}}function _9t({header:e,context:t,fileContainingReference:r,namespace:i}){let n=Of({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),a=pO(n),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:Fo(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let f={type:a};return c!==e.name&&(f.name=c),e.description!=null&&(f.docs=e.description),e.env!=null&&(f.env=e.env),e.availability!=null&&(f.availability=ZE(e.availability)),f}function fLo({pathParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=Of({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return pO(n);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:pO(n)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=ZE(e.availability)),a}function pLo({queryParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=Nsc({schema:e.schema,context:t,fileContainingReference:r,namespace:i});if(n==null)return;let a=pO(n.value),o=WPa(n.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return o!=null&&(c.default=o),n.allowMultiple&&(c["allow-multiple"]=!0),e.description!=null&&(c.docs=e.description),e.parameterNameOverride!=null&&(c.name=e.parameterNameOverride),e.availability!=null&&(c.availability=ZE(e.availability)),ZeM(n.value)&&n.value.validation!==void 0&&(c.validation=n.value.validation),c.default==null&&c["allow-multiple"]==null&&c.docs==null&&c.name==null&&c.availability==null&&c.validation==null?a:c}function Nsc({schema:e,context:t,fileContainingReference:r,namespace:i}){if(e.type==="reference"){let n=t.getSchema(e.schema,i);if(n==null)return;if(n.type==="array")return{value:Of({schema:Xs.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:qu.of(ib),fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(n.type==="oneOf"&&n.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(n.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(tUn.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:rUn(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(n.value.schemas.length===2){let[c,f]=n.value.schemas;if(c!=null&&f!=null&&dLo({array:c,primitive:f}))return{value:Of({schema:Xs.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&dLo({array:c,primitive:f}))return{value:Of({schema:Xs.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:i,declarationDepth:0}),allowMultiple:!0}}for(let[c,f]of Object.entries(n.value.schemas))return Nsc({schema:f,context:t,fileContainingReference:r,namespace:i})}else if(t.options.objectQueryParameters)return{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let n=e.type==="optional"?Xs.optional:Xs.nullable;if(e.value.type==="reference"){let a=t.getSchema(e.value.schema,i);if(a==null)return;if(a.type==="array")return{value:Of({schema:n({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a.value,description:e.description??a.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Of({schema:n({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:i,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(e.value.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(tUn.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:rUn(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[c,f]=e.value.value.schemas;if(c!=null&&f!=null&&dLo({array:c,primitive:f}))return{value:Of({schema:n({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&dLo({array:f,primitive:c}))return{value:Of({schema:n({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:i,declarationDepth:0}),allowMultiple:!0}}if(t.options.objectQueryParameters)return{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1};for(let[c,f]of Object.entries(e.value.value.schemas))return Nsc({schema:n({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i})}else if(e.value.type==="object")return t.options.objectQueryParameters?{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Of({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Of({schema:Xs.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:i,declarationDepth:0}),allowMultiple:!0}:{value:Of({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}function dLo({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function ZeM(e){return typeof e=="object"&&e!==null&&"type"in e}function _h_({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"]=keM(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=etM({context:t,namedFullExamples:e.headers}));for(let i of e.messages){let n=UCi(i.payload);n!=null&&r.messages.push({type:i.messageType,body:n})}return r}function keM(e){let t={};return e.forEach(r=>{let i=UCi(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function etM({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),i={};return t.forEach(n=>{let a=UCi(n.value);r.has(n.name)||a!=null&&(i[n.name]=a)}),i}function UCi(e){switch(e.type){case"primitive":return hh_(e.value);case"object":return yh_(e.properties);case"array":return ttM(e.value);case"map":return rtM(e.value);case"oneOf":return itM(e.value);case"enum":return e.value;case"literal":return ntM(e.value);case"unknown":return UCi(e.value);case"null":return null;default:Ot(e)}}function hh_(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:Ot(e)}}function yh_(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,UCi(r)]))}function ttM(e){return e.map(t=>UCi(t))}function rtM(e){return Object.fromEntries(e.map(t=>[hh_(t.key),UCi(t.value)]))}function itM(e){return e.type==="discriminated"?yh_(e.value):UCi(e.value)}function ntM(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ot(e)}}function HPa(e){try{let r=new URL(e).pathname.split("/").filter(i=>i.length>0);if(r.length>0)return r[r.length-1]}catch{}}function _Lo(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function hLo(e,t,r=!1){let i=HPa(t);return r&&i!=null?i:e!=null&&i!=null?`${e}_${i}`:i??e??"websocket"}function Qvi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function yLo(e,t){return t??(e?.groupName!=null?Qvi(e.groupName):void 0)}function bh_({channel:e,context:t,declarationFile:r}){let i=e.servers[0],n=i!=null?t.options.groupEnvironmentsByHost?t.getUrlId(i.url)??hLo(i.name,i.url,!0):i.name:void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${i?.name}", server url="${i?.url}", resolved urlId="${n}" (from collision map: ${t.getUrlId(i?.url??"")!=null})`);let a={path:e.path,url:n,auth:!1};e.audiences!=null&&e.audiences.length>0&&(a.audiences=e.audiences),e.summary!=null&&(a["display-name"]=e.summary),e.description!=null&&(a.docs=e.description);let o=Qvi(e.groupName),c={};if(e.handshake.pathParameters.length>0)for(let u of e.handshake.pathParameters)c[u.name]=fLo({pathParameter:u,context:t,fileContainingReference:r,namespace:o});Object.keys(c).length>0&&(a["path-parameters"]=c);let f={};if(e.handshake.queryParameters.length>0)for(let u of e.handshake.queryParameters){let l=pLo({queryParameter:u,context:t,fileContainingReference:r,namespace:o});l!=null&&(f[u.name]=l)}Object.keys(f).length>0&&(a["query-parameters"]=f);let s={};if(e.handshake.headers.length>0)for(let u of e.handshake.headers){let l=_9t({header:u,context:t,fileContainingReference:r,namespace:o});s[u.name]=l}Object.keys(s).length>0&&(a.headers=s),t.builder.addChannel(r,{channel:a});for(let u of e.messages)t.builder.addChannelMessage(r,{messageId:u.name,message:{origin:u.origin,body:Of({schema:u.body,context:t,fileContainingReference:r,namespace:o,declarationDepth:0})}});for(let u of e.examples){let l=_h_({context:t,websocketExample:u});t.builder.addChannelExample(r,{example:l})}}function Fsc(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var J0e="Base",Oh_="Default";function vh_(e){try{return new URL(e).hostname}catch{return}}function gh_(e){return e??Oh_}function atM(e,t){let r=new Map;for(let i of e){if(Fsc(i)||!("url"in i)||!i.url)continue;let n=vh_(i.url)??i.url;r.has(n)||r.set(n,{environmentName:gh_(i.name),httpServers:[],websocketServers:[]}),r.get(n)?.httpServers.push({name:i.name,url:i.url,audiences:i.audiences})}for(let i of t){let n=vh_(i.url)??i.url;r.has(n)||r.set(n,{environmentName:gh_(i.name),httpServers:[],websocketServers:[]}),r.get(n)?.websocketServers.push(i)}return r}function gJi(e){return Object.entries(e).reduce((t,[r,i])=>(bhe(i)?Object.entries(i.urls).forEach(([n,a])=>{t[n]=a}):t[r]=typeof i=="string"?i:i.url,t),{})}function Ah_(e){if(e.environmentOverrides!=null){for(let[v,O]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:v,schema:O});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],i=e.ir.servers.some(v=>Fsc(v)),n=e.ir.servers;for(let v of n)if(Fsc(v)){let O={urls:{}};for(let[A,g]of Object.entries(v.urls))O.urls[A]=g.url;v.name&&(t[v.name]=O)}else if("url"in v&&v.url){let O=v.audiences?{url:v.url,audiences:v.audiences}:v.url;if(v.name==null){r.push(O);continue}t[v.name]=O}let a={},o={},c=[];for(let v of e.ir.endpoints)for(let O of v.servers){if(O.url==null&&O.name!=null){a[O.name]||(a[O.name]=[]);continue}if(O.url==null)continue;let A=O.audiences?{url:O.url,audiences:O.audiences}:O.url;if(O.name==null){c.push(A);continue}a[O.name]||(a[O.name]=[]),a[O.name]?.push({url:O.url,audiences:O.audiences}),o[O.name]=A}let f={},s=[];for(let v of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${v.name}", url="${v.url}"`);let O=v.audiences?{url:v.url,audiences:v.audiences}:v.url;if(v.name==null){s.push(O);continue}f[v.name]=O}let u=Object.keys(t).length,l=u>0,p=Object.keys(o).length>0,_=Object.keys(a).some(v=>a[v]?.length===0),h=Object.keys(f).length>0;if(e.options.groupEnvironmentsByHost&&h&&(l||e.ir.servers.length>0)){let v=Object.entries(f).map(([A,g])=>({name:A,url:typeof g=="string"?g:g.url,audiences:typeof g=="string"?void 0:g.audiences})),O=atM(n,v);if(O.size>0){let A=!0;for(let[g,m]of O.entries()){let j={},M=[...m.httpServers.map(D=>({...D,isHttp:!0})),...m.websocketServers.map(D=>({...D,isHttp:!1}))],E=new Map;for(let D of M){let B=HPa(D.url),F=_Lo(D.url);B&&F&&(E.has(B)||E.set(B,new Set),E.get(B)?.add(F))}if(m.httpServers.length>0){let D=m.httpServers[0];D!=null&&(j[J0e]=D.url,e.setUrlId(D.url,J0e));for(let B=1;B<m.httpServers.length;B++){let F=m.httpServers[B];if(F!=null){let N=HPa(F.url),R=_Lo(F.url),z=N?E.get(N):void 0,U=z&&z.size>1,K=U&&R!=="https"?`${N}_${R}`:N||`Http${B+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${F.url}", pathSegment="${N}", protocol="${R}", hasCollision=${U}, urlId="${K}"`),j[K]=F.url,e.setUrlId(F.url,K)}}}for(let D of m.websocketServers){let B=HPa(D.url),F=_Lo(D.url),N=B?E.get(B):void 0,R=N&&N.size>1,z=R?`${B}_${F}`:hLo(D.name,D.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${D.name}", url="${D.url}", pathSegment="${B}", protocol="${F}", hasCollision=${R}, urlId="${z}"`),j[z]=D.url,e.setUrlId(D.url,z)}if(Object.keys(j).length>1)e.builder.addEnvironment({name:m.environmentName,schema:{urls:j}});else if(Object.keys(j).length===1){let D=Object.values(j)[0];D!=null&&e.builder.addEnvironment({name:m.environmentName,schema:D})}A&&(e.builder.setDefaultEnvironment(m.environmentName),Object.keys(j).length>1&&e.builder.setDefaultUrl(J0e),A=!1)}return}}if(!l&&!p&&h&&e.ir.servers.length===0){for(let[v,O]of Object.entries(f))e.builder.addEnvironment({name:v,schema:O});e.builder.setDefaultEnvironment(Object.keys(f)[0]),e.builder.setDefaultUrl(J0e);return}if(c.length>0&&e.logger.debug(`Skipping endpoint level servers ${c.map(v=>typeof v=="string"?v:v.url).join(", ")} because x-fern-server-name was not provided.`),!l){let v=e.ir.servers[0]?.url,O=e.ir.servers[0]?.audiences;if(v!=null){let A=O?{url:v,audiences:O}:v;t[Oh_]=A}}let y=Object.values(t).map(v=>typeof v=="string"?v:bhe(v)?Object.values(v.urls)[0]:v.url),b=r.filter(v=>{let O=typeof v=="string"?v:v.url;return!y.includes(O)});if(b.length>0&&e.logger.debug(`Skipping top level servers ${b.map(v=>typeof v=="string"?v:v.url).join(", ")} because x-fern-server-name was not provided.`),i){let v=!0;for(let[O,A]of Object.entries(t))if(e.builder.addEnvironment({name:O,schema:A}),v){if(e.builder.setDefaultEnvironment(O),bhe(A)){let g=Object.keys(A.urls)[0];g&&e.builder.setDefaultUrl(g)}v=!1}return}if(!p&&!_){let v=!0;for(let[O,A]of Object.entries(t))if(v){if(h){let g=typeof A=="string"?A:bhe(A)?Object.values(A.urls)[0]:A.url;e.builder.addEnvironment({name:O,schema:{urls:{[J0e]:g??"",...gJi(f)}}})}else e.builder.addEnvironment({name:O,schema:A});e.builder.setDefaultEnvironment(O),v=!1}else if(h){let g=typeof A=="string"?A:bhe(A)?Object.values(A.urls)[0]:A.url;e.builder.addEnvironment({name:O,schema:{urls:{[J0e]:g??"",...gJi(f)}}})}else e.builder.addEnvironment({name:O,schema:A});h&&e.builder.setDefaultUrl(J0e)}else if(u===1){let v=Object.keys(t)[0],O=Object.values(t)[0],A=typeof O=="string"?O:bhe(O)?Object.values(O.urls)[0]:O.url;e.builder.addEnvironment({name:v,schema:{urls:{[J0e]:A??"",...gJi(o),...gJi(f)}}}),e.builder.setDefaultEnvironment(v),e.builder.setDefaultUrl(J0e)}else{let v=new Map;for(let O of e.ir.endpoints)for(let A of O.servers)if(A.url!=null&&A.name!=null){v.has(A.name)||v.set(A.name,new Map);let g=A.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",m=v.get(A.name);m&&m.set(g,A.url)}if(v.size>0){let O=!0;for(let[A,g]of Object.entries(t)){let m=typeof g=="string"?g:bhe(g)?Object.values(g.urls)[0]:g.url;if(!m)continue;let j=m.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",M={[J0e]:m};for(let[E,D]of v.entries()){let B=D.get(j)||D.get("production")||D.values().next().value;B&&(M[E]=B)}h&&Object.assign(M,gJi(f)),Object.keys(M).length>1?e.builder.addEnvironment({name:A,schema:{urls:M}}):e.builder.addEnvironment({name:A,schema:m}),O&&(e.builder.setDefaultEnvironment(A),O=!1)}v.size>0&&e.builder.setDefaultUrl(J0e)}else{let O=!0;for(let[A,g]of Object.entries(t)){if(h||Object.keys(o).length>0){let m=typeof g=="string"?g:bhe(g)?Object.values(g.urls)[0]:g.url;e.builder.addEnvironment({name:A,schema:{urls:{[J0e]:m??"",...gJi(o),...gJi(f)}}})}else e.builder.addEnvironment({name:A,schema:g});O&&(e.builder.setDefaultEnvironment(A),O=!1)}}}}var Qsc=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},otM=.75,utM=new Set("authorization");function mh_(e){if(e.globalHeaderOverrides!=null){for(let[r,i]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:i});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,i]of Object.entries(t)){let n="optional<string>";if(i.name==null&&i.env==null&&typeof i.schema=="string")n=i.schema;else if(i!=null){let a=i.schema?iUn(i.schema):void 0,o=a!=null?Qvi(a):void 0,c=qu.of("api.yml");n={name:i.name,env:i.env,type:i.schema!=null?pO(Of({schema:i.schema,context:e,fileContainingReference:o?tD(qu.of(Fo(o)),c):c,namespace:o,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:n})}if(e.options.detectGlobalHeaders){let r={};for(let n of e.ir.endpoints)for(let a of n.headers){if(utM.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],f=_9t({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:qu.of(t1),context:e,namespace:void 0});o=new Qsc(f),r[a.name]=o}o.increment()}let i=e.ir.endpoints.length*otM;for(let[n,a]of Object.entries(r)){let o=t[n],c=a.count===e.ir.endpoints.length,f=a.count>=i;o==null&&(c?e.builder.addGlobalHeader({name:n,schema:a.schema}):f&&e.builder.addGlobalHeader({name:n,schema:vJi(a.schema)}))}}}function Ph_(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?iUn(t.schema):void 0,i=r!=null?Qvi(r):void 0,n=_9t({header:{...t,schema:t.schema??Xs.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:ih.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:qu.of(t1),context:e,namespace:i});e.builder.addIdempotencyHeader({name:t.header,schema:vJi(n)})}}function K3(e){switch(e.type){case"primitive":return wh_(e.value);case"object":return Eh_(e.properties);case"array":return Sh_(e.value);case"map":return ctM(e.value);case"oneOf":return ltM(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return ftM(e.value);case"unknown":return K3(e.value);case"null":return null;default:Ot(e)}}function jh_(e){switch(e.type){case"withStreaming":return e.sse?{stream:stM(e.events)}:{stream:Sh_(e.events)};case"withoutStreaming":return{body:K3(e.value)};default:Ot(e)}}function wh_(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:Ot(e)}}function Eh_(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,K3(r)]))}function stM(e){return e.map(t=>({event:"",data:K3(t)}))}function Sh_(e){return e.map(t=>K3(t))}function ctM(e){return Object.fromEntries(e.map(t=>[wh_(t.key),K3(t.value)]))}function ltM(e){return e.type==="discriminated"?Eh_(e.value):K3(e.value)}function ftM(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:Ot(e)}}function Mh_({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"]=dtM(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=ptM(e.queryParameters));let i=e.headers!=null&&e.headers.length>0,n=t.builder.getGlobalHeaders(),a=Object.keys(n).length>0,o=new Set(e.headers?.map(c=>c.name)??[]);if(i||a){let c=[];if(e.headers!=null)for(let f of e.headers)f.name!==t.builder.getAuthHeaderName()&&c.push(f);for(let[f,s]of Object.entries(n))if(!o.has(f))if(s!=null&&typeof s=="object"&&s.type!=null){let u=PB({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:Mt}});u!=null&&c.push({name:f,value:wl.literal(MCi.string(u))})}else c.push({name:f,value:wl.primitive(Ka.string(f))});r.headers=_tM({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=K3(e.request)),e.response!=null&&(r.response=jh_(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(Xu)),r}function dtM(e){let t={};return e.forEach(r=>{let i=K3(r.value);i!=null&&(t[r.parameterNameOverride??r.name]=i)}),t}function ptM(e){let t={};return e.forEach(r=>{let i=K3(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function _tM({context:e,namedFullExamples:t}){let r={};return t.forEach(i=>{let n=K3(i.value);n!=null&&(r[i.name]=n)}),r}function Dh_(e){return hz._visit(e,{get:()=>OD.HttpMethodSchema.Get,post:()=>OD.HttpMethodSchema.Post,put:()=>OD.HttpMethodSchema.Put,patch:()=>OD.HttpMethodSchema.Patch,delete:()=>OD.HttpMethodSchema.Delete,head:()=>OD.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 Bh_(e){return e==="POST"||e==="PUT"||e==="PATCH"}function Ih_({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:i}=r.ir,n=[],a=new Set,o=e.path,c=yLo(e.sdkName,e.namespace),f={};for(let b of e.pathParameters)b.parameterNameOverride&&(o=o.replace(b.name,b.parameterNameOverride)),f[b.parameterNameOverride??b.name]=fLo({pathParameter:b,context:r,fileContainingReference:t,namespace:c}),a.add(b.name);let s={};for(let b of e.queryParameters){let v=pLo({queryParameter:b,context:r,fileContainingReference:t,namespace:c});v!=null&&(s[b.name]=v,a.add(b.name))}let u;if(e.pagination!=null)switch(e.pagination.type){case"cursor":u={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":u={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":u={type:"custom",results:e.pagination.results};break;default:Ot(e.pagination)}let l={path:o,method:Dh_(e.method),auth:htM({endpoint:e,context:r}),docs:e.description??void 0,pagination:u,source:e.source!=null?Fvi(e.source):void 0};!gtM({context:r,request:e.request})&&Object.keys(f).length>0&&(l["path-parameters"]=f),e.summary!=null&&(l["display-name"]=e.summary);let p={},_=r.builder.getGlobalHeaderNames(),h=r.builder.getAuthHeaderName();h!=null&&_.add(h);let y=e.headers.filter(b=>!_.has(b.name));for(let b of y){let v=_9t({header:b,context:r,fileContainingReference:t,namespace:c});p[b.name]=v,a.add(typeof v=="string"?b.name:v.name??b.name)}if(e.request!=null){r.setInState(I1.Request);let b=vtM({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(s).length>0?s:void 0,nonRequestReferencedSchemas:Array.from(i),headers:Object.keys(p).length>0?p:void 0,usedNames:a,namespace:c});l.request=b.value,n=[...n,...b.schemaIdsToExclude??[]],r.unsetInState(I1.Request)}else{let b=r.options.inlinePathParameters&&Object.keys(f).length>0,v=Object.keys(s).length>0,O=Object.keys(p).length>0,A={};(b||v||O)&&(A.name=e.requestNameOverride??e.generatedRequestName),b&&(A["path-parameters"]=f),v&&(A["query-parameters"]=s),O&&(A.headers=p),Object.keys(A).length>0&&(l.request=A)}if(e.response!=null&&e.response._visit({json:b=>{let v=Of({schema:b.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:b.description??void 0,type:pO(v)},b.statusCode!=null&&(l.response["status-code"]=b.statusCode),b.responseProperty!=null&&(l.response.property=b.responseProperty)},streamingJson:b=>{let v=Of({schema:b.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:b.description??void 0,type:pO(v),format:"json"}},streamingSse:b=>{let v=Of({schema:b.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:b.description??void 0,type:pO(v),format:"sse"}},file:b=>{l.response={docs:b.description??void 0,type:"file","status-code":b.statusCode}},bytes:b=>{l.response={docs:b.description??void 0,type:"bytes","status-code":b.statusCode}},streamingText:b=>{l["response-stream"]={docs:b.description??void 0,type:"text"}},text:b=>{l.response={docs:b.description??void 0,type:"text","status-code":b.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let b=r.getDefaultServerName(),v=e.servers[0];v==null?b!=null&&(l.url=b):l.url=v.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=ZE(e.availability)),Object.entries(e.errors).forEach(([b,v])=>{let O=v.generatedName,A=qu.of(ib);r.builder.enableUniqueErrorsPerEndpoint&&(O=`${e.generatedRequestName}${v.generatedName}`,v.schema!=null&&(v.schema.type!=="reference"&&v.schema.type!=="oneOf"?v.schema.generatedName=`${e.generatedRequestName}${v.schema.generatedName}`:v.schema.type==="oneOf"&&(v.schema.value.generatedName=`${e.generatedRequestName}${v.schema.value.generatedName}`)));let g={"status-code":parseInt(b)},m=rh_({location:Ch_,namespaceOverride:c});if(v.schema!=null){let E=Of({schema:v.schema,context:r,fileContainingReference:m,declarationFile:m,namespace:c,declarationDepth:0});g.type=pO(E),g.docs=v.description}r.builder.addError(m,{name:O,schema:r.isErrorUnknownSchema(parseInt(b))?{...g,type:"unknown"}:g}),l.errors==null&&(l.errors=[]);let j=r.builder.addImport({file:t,fileToImport:m});l.errors.push(j!=null?`${j}.${O}`:O),g.type!=null&&v.examples?.forEach(E=>{let D={value:K3(E.example),name:E.name,docs:E.description};r.builder.addErrorExample(m,{name:O,example:D})})}),e.examples.length>0&&(l.examples=ytM({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=btM({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[Usc,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:n}}function htM({endpoint:e,context:t}){if(e.security==null)return t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0;if(e.security.length!==0)return JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function ytM({endpointExamples:e,context:t}){return e.map(r=>{try{return Mh_({endpointExample:r,context:t})}catch(i){throw console.error(`Error building endpoint example: ${i}`),i}})}function btM({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:Ot(e)}}function vtM({endpoint:e,declarationFile:t,context:r,request:i,requestNameOverride:n,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:f,headers:s,usedNames:u,namespace:l}){if(i.type==="json"||i.type==="formUrlEncoded"){let p=i.schema.type==="reference"?i.schema.schema:void 0,_=i.schema.type==="reference"?r.getSchema(i.schema.schema,l):i.schema;if(_?.type!=="object"||p!=null&&f.includes(p)){let O=Of({schema:i.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),A={schemaIdsToExclude:[],value:{body:O}},g=Object.keys(o??{}).length>0,m=Object.keys(c??{}).length>0,j=Object.keys(s??{}).length>0;return g&&(A.value["path-parameters"]=o),m&&(A.value["query-parameters"]=c),j&&(A.value.headers=s),(g||m||j)&&(A.value.name=n??a),i.contentType!=null&&(A.value["content-type"]=i.contentType),i.description!=null&&(A.value.docs=i.description),A}let h=Object.fromEntries(_.properties.filter(O=>O.readonly==null?!0:!(Bh_(e.method)&&O.readonly)).map(O=>{let A=Of({schema:O.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),g=O.nameOverride??O.key,m=ZE(O.availability);if(!u.has(g)&&O.audiences.length<=0)return u.add(g),O.nameOverride!=null?[O.key,{type:pO(A),docs:nUn(A),name:O.nameOverride,availability:m}]:[O.key,m?{...typeof A=="string"?{type:A}:A,availability:m}:A];let j={type:pO(A),docs:nUn(A)};return u.has(g)&&(j.name=O.generatedName),O.audiences.length>0&&(j.audiences=O.audiences),m!=null&&(j.availability=m),u.add(g),[O.key,j]})),y=_.allOf.map(O=>{let A=Of({schema:Xs.reference(O),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return xPa(pO(A))}).filter(O=>O!=="unknown"),b={properties:h};y.length>0&&(b.extends=y),i.additionalProperties&&(b["extra-properties"]=!0);let v={name:n??_.nameOverride??_.generatedName,"path-parameters":o,"query-parameters":c,headers:s,body:b};return i.contentType!=null&&(v["content-type"]=i.contentType),i.description!=null&&(v.docs=i.description),{schemaIdsToExclude:p!=null?[p]:[],value:v}}else if(i.type==="octetStream"){let p={body:"bytes","content-type":i.contentType??nO.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(p.name=n??a),i.description!=null&&(p.docs=i.description),{schemaIdsToExclude:[],value:p}}else if(i.type==="multipart"){let p=Object.fromEntries(i.properties.map(_=>{if(_.schema.type==="file"){let h=_.schema.isArray?"list<file>":"file";if(h=_.schema.isOptional?`optional<${h}>`:h,_.description!=null||_.contentType!=null){let y={type:h};if(_.description!=null&&(y.docs=_.description),_.contentType!=null){let b=_.contentType.split(",")[0];y["content-type"]=b}return[_.key,y]}return[_.key,h]}else{let h=Of({schema:_.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(_.contentType||_.exploded||_.encoding){let y=typeof h=="string"?{type:h}:h;_.contentType!=null&&(y["content-type"]=_.contentType),_.encoding==="form"?y.style="form":_.encoding==="json"?y.style="json":_.exploded&&(y.style="exploded"),h=y}return[_.key,h]}}));return{schemaIdsToExclude:i.name==null?[]:[i.name],value:{name:n??i.name??a,"path-parameters":o,"query-parameters":c,headers:s,body:{properties:p},"content-type":nO.MULTIPART_FORM_DATA,...i.description?{docs:i.description}:{}}}}else Ot(i)}function gtM({context:e,request:t}){if(!e.options.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:Ot(t)}}function OtM({location:e,namespaceOverride:t}){return t!=null?{...e,file:tD(qu.of(t),e.file)}:e}function AtM(e){let t=e.namespace,r=e.tags.filter(f=>f!==t)[0],i=e.operationId;if(i==null)return r!=null?{file:qu.of(`${Fo(r)}.yml`),endpointId:e.summary!=null?Fo(e.summary):Fo(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:qu.of(ib),endpointId:Fo(e.summary)}:{file:qu.of(ib),endpointId:Fo(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:qu.of(ib),endpointId:i};let n=KPa(r),a=KPa(i);if(kq(n,a))return{file:qu.of("__package__.yml"),endpointId:r};let o=jtM({operationId:i,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let f=0;f<n.length;++f){let s=n[f];if(s!=null&&s===a[f])c.push(s);else{let u=Fo(r);return{file:qu.of(`${u}.yml`),endpointId:i,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:qu.of(Fo(c.join("_"))+".yml"),endpointId:Fo(a.slice(c.length).join("_")),tag:r}}function JPa(e){let t=e.tags[0];if(e.sdkName!=null){let r=Psc({sdkName:e.sdkName,namespaceOverride:e.namespace}),i=`${r}.yml`,n=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:qu.of(i),endpointId:e.sdkName.methodName,tag:n?t:void 0}}return OtM({namespaceOverride:e.namespace,location:AtM(e)})}function KPa(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=JOe(t),t}var mtM=new RegExp("[^a-zA-Z0-9{}]+"),PtM=new RegExp("[{}]","g");function jtM({operationId:e,tag:t,path:r,method:i}){let a=`${r.split(mtM).join("_").replaceAll(PtM,"_")}_${i.toLowerCase()}`;if(e.endsWith(a))return{file:qu.of(Fo(t)+".yml"),endpointId:Fo(e.slice(0,-1*a.length)),tag:t}}function qh_(e){let t=new Set,{endpoints:r,tags:i}=e.ir,n=[];for(let a of r){let{endpointId:o,file:c,tag:f}=JPa(a),s=c.split(".")[0];s!=null&&t.add(s);let u;if(a.sdkName!=null){let _=e.ir.groups;for(let h of a.sdkName.groupName){let y=typeof h=="string"?h:h.name,b=_[y];if(b==null)break;if(b.summary!=null||b.description!=null){u=_[y];break}}}let l=f==null?void 0:i.tagsById[f];e.setInState(I1.Endpoint),e.setEndpointMethod(a.method);let p=Ih_({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(I1.Endpoint),n=[...n,...p.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:p.value,source:a.source!=null?Fvi(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":u?.summary??l?.id,docs:u?.description??l?.description??void 0})}return{schemaIdsToExclude:n,sdkGroups:t}}function Th_(e){for(let[t,r]of Object.entries(e.ir.variables)){let i=r.groupName!=null?Qvi(r.groupName):void 0,n=Of({schema:Xs.primitive(r),context:e,fileContainingReference:qu.of(ib),namespace:i,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:pO(n),docs:r.description??void 0}})}}function Rh_(e){for(let t of e.ir.webhooks){let r=StM({webhook:t,context:e});if(r==null)continue;let i=yLo(t.sdkName,t.namespace),n={};for(let o of t.headers)n[o.name]=_9t({header:o,context:e,fileContainingReference:r.file,namespace:i});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:n,payload:Of({schema:t.payload,context:e,fileContainingReference:r.file,namespace:i,declarationDepth:0}),examples:t.examples!=null?t.examples.map(o=>({docs:o.description,name:o.name,payload:K3(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function wtM({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:tD(qu.of(t),e.file)}:e}function EtM({webhook:e,context:t}){let r=e.tags[0],i=e.operationId;if(r==null)return{file:qu.of(ib),endpointId:i};let n=KPa(r),a=KPa(i);if(kq(n,a))return{file:qu.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<n.length;++c){let f=n[c];if(f!=null&&f===a[c])o.push(f);else{let s=Fo(r);return{file:qu.of(`${s}.yml`),endpointId:i,tag:r}}}if(o.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:qu.of(Fo(o.join("_"))+".yml"),endpointId:Fo(a.slice(o.length).join("_")),tag:r}}function StM({webhook:e,context:t}){return e.sdkName!=null?{file:th_({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:wtM({namespaceOverride:e.namespace,location:EtM({webhook:e,context:t})})}var MtM=qu.of(ib);function Nh_(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return zh_({namespace:e.namespace,groupName:e.groupName});case"oneOf":return zh_({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return MtM;default:Ot(e)}}function zh_({namespace:e,groupName:t}){return e!=null&&t!=null?QCi([{type:"namespace",name:e},...t]):e!=null?QCi([{type:"namespace",name:e}]):QCi(t)}var Usc="external",Ch_=qu.of(ib);function Fh_({schemas:e,schemaIdsToExclude:t,namespace:r,context:i}){for(let[n,a]of Object.entries(e)){if(t.includes(n))continue;let o=Nh_(a),c=sh_({schema:a,context:i,declarationFile:o,namespace:r,declarationDepth:0});if(_Ci(c.schema)){let f=pO(c.schema);if(f===(c.name??n)||f===`optional<${c.name??n}>`||f===`nullable<${c.name??n}>`||f===`optional<nullable<${c.name??n}>>`)continue}i.builder.addType(o,{name:c.name??n,schema:c.schema})}}function Qh_(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),Ah_(e),mh_(e),Ph_(e),ph_(e),Th_(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(Usc);let t=qh_(e),r=t.sdkGroups;e.setInState(I1.Webhook),Rh_(e),e.unsetInState(I1.Webhook),e.setInState(I1.Channel);for(let n of Object.values(e.ir.channels)){let a=QCi(n.groupName);bh_({channel:n,context:e,declarationFile:a})}e.unsetInState(I1.Channel);let i=DtM({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});Fh_({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:i,namespace:void 0,context:e});for(let[n,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))Fh_({schemas:a,schemaIdsToExclude:i,namespace:n,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(a=>r.has(a))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.optimizeServiceAuth(),e.builder.build()}function DtM({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let i=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),n=new Set(t);for(let a of i)r.includes(a)||n.add(a);return Array.from(n)}var $Pa=class{context;constructor(t){this.context=t}};var bLo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[o,c]of Object.entries(i.files)){let f=n!=null?qu.of(`${n}${"/"}${o}`):qu.of(o);t[f]=c}let a=Object.keys(i.directories).sort();for(let o of a){let c=n!=null?`${n}${"/"}${o}`:o,f=i.directories[o];r(f,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[qu.of(t[0])]??={};let[r,...i]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(i)}};var OJi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new bLo,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":i,"display-name":n,docs:a}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(o.service.auth=r),i!=null&&(o.service["base-path"]=i),n!=null&&(o.service["display-name"]=n),a!=null&&(o.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return e9t(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let i of Object.values(this.rootApiFile["auth-schemes"]))Uh_(i)&&t.push(i.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(Uh_(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}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:i}){if(t===r)return;let n=i??Fo((fAe(r)+"/"+f6i(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===qu.of(t1))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=auo(fAe(TDn.of(`/${t}`)),TDn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=auo(fAe(TDn.of(`/${t}`)),TDn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===qu.of(t1))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(c=>kq(c,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=tD(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}optimizeServiceAuth(){let t=[this.packageMarkerFile,...Object.values(this.root.getAllFiles())];for(let r of t){if(r.service==null)continue;let i=Object.values(r.service.endpoints);if(i.length===0)continue;if(i.every(a=>a.auth===!0)){r.service.auth=!0;for(let a of Object.values(r.service.endpoints))delete a.auth}}}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:tD(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,o])=>[a,{...o,path:tD(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===ib?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 Uh_(e){return e?.header!=null}var vLo=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:i,environmentOverrides:n,globalHeaderOverrides:a,authOverrides:o}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=n,this.authOverrides=o,this.globalHeaderOverrides=a,this.options=hJi({options:i}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new OJi(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let f of r.endpoints)for(let[s,u]of Object.entries(f.errors)){let l=parseInt(s),p=c[l];p==null&&u.schema!=null?c[l]=u.schema:p!=null&&u.schema!=null&&rK(p,u.schema)||this.unknownSchema.add(l)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.options.onlyIncludeReferencedSchemas&&this.isInAnyState(I1.Channel,I1.Endpoint,I1.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:Ot(t)}}markObjectSchemaAsReferenced(t,r){for(let i of t.allOf)this.markSchemaIdAsReferenced(i.schema,r);for(let i of t.properties)this.markSchemaAsReferenced(i.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let i of Object.values(t.schemas))this.markSchemaAsReferenced(i,r);return;case"undiscriminated":for(let i of t.schemas)this.markSchemaAsReferenced(i,r);return;default:Ot(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let i=this.getSchema(t,r);i!=null&&this.markSchemaAsReferenced(i,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function Lsc(e){let t=new vLo(e);return Qh_(t)}function BtM(e){return DKi(e,{single:t=>[typeof t=="string"?t:t.scheme],any:t=>t.any.map(r=>typeof r=="string"?r:r.scheme)})}function ItM(e,t){if(e==null)return;let r=BtM(t),i={};for(let n of r)e[n]!=null&&(i[n]=e[n]);return Object.keys(i).length>0?i:void 0}var gLo=class{args;constructor(t){this.args=t}buildAuthOverrides(t,r){let i=this.args.generatorsConfiguration?.api?.["auth-schemes"],n=this.args.generatorsConfiguration?.api?.auth,a=t??n;if(a==null)return;let o=r!=null||i!=null?{...i,...r}:void 0,c=ItM(o,a);return{auth:a,"auth-schemes":c}}convert({context:t,ir:r,settings:i,absoluteFilePath:n}){let a=Lsc({taskContext:t,ir:r,options:hJi({options:i,overrides:this.args}),authOverrides:this.buildAuthOverrides(i?.auth,i?.authSchemes),environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.args.generatorsConfiguration?.api?.headers!=null?{...this.args.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:n??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Ii.dump(a.rootApiFile)},namedDefinitionFiles:{..._n(a.definitionFiles,o=>({absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Ii.dump(o),contents:o})),[qu.of(ib)]:{absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Ii.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var YPa=class extends pFt{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;groupEnvironmentsByHost;removeDiscriminantsFromSchemas;defaultIntegerFormat;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.groupEnvironmentsByHost=t.groupEnvironmentsByHost,this.removeDiscriminantsFromSchemas=t.removeDiscriminantsFromSchemas,this.defaultIntegerFormat=t.defaultIntegerFormat,this.converter=new gLo(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:i},n){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:i},n);return this.converter.convert({context:t,ir:a,settings:n,absoluteFilePath:r})}async toFernWorkspace({context:t},r,i){let n=await this.getDefinition({context:t},r);return new eK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var JQ={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 aUn={of(e){return e}};var Lh_={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},Vsc={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:Lh_,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},xi={SOURCE:aUn.of("source"),SDK_NAMESPACE:aUn.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:aUn.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:aUn.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:aUn.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",RETRIES:"x-fern-retries",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport",IS_DISCRIMINATED:"x-fern-discriminated",EXPLORER_ENABLED:"x-fern-explorer-enabled"};var CtM={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!1,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!1,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,preserveSchemaIds:!1,objectQueryParameters:!0,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!0,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!1,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,groupEnvironmentsByHost:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,removeDiscriminantsFromSchemas:hn.RemoveDiscriminantsFromSchemas.Always,defaultIntegerFormat:hn.DefaultIntegerFormat.Int32};function qtM(e){let{defaults:t,options:r,overrides:i,overrideOnly:n=new Set,undefinedIfAbsent:a=new Set}=e,o={};for(let c of Object.keys(t))n.has(c)?o[c]=i?.[c]!==void 0?i[c]:t[c]:a.has(c)?o[c]=i?.[c]!==void 0?i[c]:r?.[c]!==void 0?r[c]:void 0:o[c]=i?.[c]??r?.[c]??t[c];return o}function $0e({options:e,overrides:t}){return qtM({defaults:CtM,options:e,overrides:t,overrideOnly:new Set(["disableExamples","preserveSchemaIds"]),undefinedIfAbsent:new Set(["exampleGeneration","defaultFormParameterEncoding"])})}var Vh_={naming:"v1"};function Di(e,t){let r=Array.isArray(t)?t:[t];for(let i of r){let n=e[i];if(n!=null)return n}}function XPa(e,t,r,i,n=[]){try{let a=Di(e,t);if(a!=null)return r.parse(a)}catch{let o=JOe(n).join(" -> ");i.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function AJi(e){let t=Di(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 Wh_({schema:e,logger:t}){return Di(e,xi.ENCODING)??void 0}function xh_(e){return Di(e,xi.FERN_ENUM)}function Gh_({nameOverride:e,generatedName:t,title:r,schema:i,description:n,availability:a}){let o=Di(i,xi.SDK_NAMESPACE),c=Di(i,xi.SDK_GROUP_NAME),f=Di(i,xi.TYPE_DEFINITION);if(f!=null)return ZPa({fernType:f,nameOverride:e,generatedName:t,title:r,description:n,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function ZPa({fernType:e,nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c}){return PB({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.base64({example:void 0})});case"BOOLEAN":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.boolean({default:void 0,example:void 0})});case"DATE":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.date({example:void 0})});case"DATE_TIME":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.datetime({example:void 0})});case"FLOAT":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.float({example:void 0})});case"DOUBLE":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.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 ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.uint({default:void 0,example:void 0})});case"INTEGER":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.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 ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.uint64({default:void 0,example:void 0})});case"LONG":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Ot(f.v1)}},unknown:()=>ni.unknown({nameOverride:t,generatedName:r,title:i,example:void 0,description:n,availability:a,namespace:o,groupName:c}),map:({keyType:f,valueType:s})=>f?.type==="primitive"&&s!=null?ni.map({nameOverride:t,generatedName:r,title:i,key:f,value:s,description:n,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:f=>f!=null?ni.array({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:f=>f!=null?ni.optional({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:f=>f!=null?ni.nullable({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:f=>f!=null?ni.array({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:f=>ni.literal({nameOverride:t,generatedName:r,title:i,value:f._visit({string:s=>Rj.string(s),boolean:s=>Rj.boolean(s),_other:()=>{throw new Error("Unexpected literal type")}}),description:n,availability:a,namespace:o,groupName:c}),named:f=>ni.reference({schema:f,nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,source:G3.openapi({file:"<memory>"})})}})}function Hh_(e){let t=Di(e,xi.SOURCE);if(t!=null)return t.endsWith(".proto")?G3.protobuf({file:t}):G3.openapi({file:t})}function mJi(e){if(e!=null&&typeof e=="boolean")return e}function Pn(e){return e?.$ref!=null}function Kh_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,additionalProperties:n,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:s,namespace:u,groupName:l,example:p,encoding:_,source:h}){return n===void 0&&(n=s.options.additionalPropertiesDefaultsTo),Wsc({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Un.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof n=="boolean"||kPa(n,s.options)?ni.unknown({...TtM(n),generatedName:`${t}Value`}):Jh_(Sl(n,!1,s.options.optionalAdditionalProperties?f:!1,s,[...i,"Value"],h,u,void 0,void 0,void 0)),namespace:u,groupName:l,example:p,encoding:_})}function Jh_(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=Jh_(e.value);break;case"oneOf":e.value.inline=!0;break;default:Ot(e)}return e}function Wsc({nameOverride:e,generatedName:t,title:r,keySchema:i,valueSchema:n,wrapAsOptional:a,wrapAsNullable:o,description:c,availability:f,namespace:s,groupName:u,example:l,encoding:p}){let _=ni.map({nameOverride:e,generatedName:t,title:r,description:c,availability:f,key:i,value:n,namespace:s,groupName:u,encoding:p,example:l,inline:void 0});return o&&(_=ni.nullable({nameOverride:e,generatedName:t,title:r,value:_,description:c,availability:f,namespace:s,groupName:u,inline:void 0})),a&&(_=ni.optional({nameOverride:e,generatedName:t,title:r,value:_,description:c,availability:f,namespace:s,groupName:u,inline:void 0})),_}function kPa(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!(Pn(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null||"allOf"in e&&e.allOf!=null||"enum"in e&&e.enum!=null)}function TtM(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||Pn(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function $h_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,item:n,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:s,namespace:u,groupName:l,example:p,source:_}){let h=n==null?ni.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:l}):Sl(n,!1,!1,s,[...i,"Item"],_,u);return RtM({nameOverride:e,generatedName:t,title:r,namespace:u,groupName:l,itemSchema:h,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,example:p})}function RtM({nameOverride:e,generatedName:t,title:r,itemSchema:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:s,example:u}){let l=ni.array({nameOverride:e,generatedName:t,title:r,value:i,description:o,availability:c,namespace:f,groupName:s,example:u,inline:void 0});return a&&(l=ni.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),n&&(l=ni.optional({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),l}function J3(e){switch(Di(e,xi.AVAILABILITY)){case"deprecated":return pz.Deprecated;case"beta":return pz.Beta;case"generally-available":return pz.GenerallyAvailable;default:break}if(!Pn(e)&&e.deprecated)return pz.Deprecated}function xsc({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:s,discriminator:u,context:l,namespace:p,groupName:_,encoding:h,source:y}){let b=u.propertyName,v=Object.fromEntries(Object.entries(u.mapping??{}).map(([A,g])=>{let m=Uvi({$ref:g},!1,!1,l,[g],h,y,p);return l.markReferencedByDiscriminatedUnion({$ref:g},b,1),[A,m]})),O=Object.entries(n).filter(([A])=>A!==b).map(([A,g])=>{let m=c!=null&&c.includes(A),[j,M]=l.options.coerceOptionalSchemasToNullable?[!1,!m]:[!m,!1],E=Sl(g,j,M,l,[...i,A],y,p);return{key:A,schema:E}});return Yh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:s,properties:O,description:a,availability:o,discriminant:b,subtypes:v,namespace:p,groupName:_,source:y})}function Gsc({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:s,discriminant:u,variants:l,context:p,namespace:_,groupName:h,encoding:y,source:b}){let v=Object.fromEntries(Object.entries(l).map(([A,g])=>{if(Pn(g)){let m=Uvi(g,!1,!1,p,[g.$ref],y,b,_);return p.markReferencedByDiscriminatedUnion(g,u,1),[A,m]}else{let m=oUn(g,!1,!1,p,[...i,A],y,b,_,new Set([u]));return[A,m]}})),O=Object.entries(n).filter(([A])=>A!==u).map(([A,g])=>{let m=c!=null&&c.includes(A),[j,M]=p.options.coerceOptionalSchemasToNullable?[!1,!m]:[!m,!1],E=Sl(g,j,M,p,[...i,A],b,_);return{key:A,schema:E}});return Yh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:s,properties:O,description:a,availability:o,discriminant:u,subtypes:v,namespace:_,groupName:h,source:b})}function Yh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,properties:a,description:o,availability:c,discriminant:f,subtypes:s,namespace:u,groupName:l,source:p}){let _=ni.oneOf(Mhe.discriminated({description:o,availability:c,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:s,commonProperties:a,namespace:u,groupName:l,encoding:void 0,source:p,inline:void 0}));return n&&(_=ni.nullable({nameOverride:e,generatedName:t,title:r,value:_,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),i&&(_=ni.optional({nameOverride:e,generatedName:t,title:r,value:_,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),_}function Xh_(e){if(e.proto!=null)return wQn.protobuf({typeName:e.proto.type})}function LCi({nameOverride:e,generatedName:t,title:r,fernEnum:i,enumVarNames:n,enumValues:a,_default:o,description:c,availability:f,wrapAsOptional:s,wrapAsNullable:u,namespace:l,groupName:p,context:_,source:h,inline:y}){let b=NtM(n??[]),v=new Set(a),O=Array.from(v).map((g,m)=>{let j=i?.[g],M=b[m],E=tUn.test(g),D=j?.name??M,B=E?g:rUn(g);return D!=null&&!tUn.test(D)&&(_?.logger.warn(`Enum name override ${D} is not a valid name. Falling back on ${B}.`),D=void 0),{nameOverride:D,generatedName:B,value:g,description:j?.description,availability:f,casing:{snake:j?.casing?.snake??void 0,pascal:j?.casing?.pascal??void 0,screamingSnake:j?.casing?.screamingSnake??void 0,camel:j?.casing?.camel??void 0}}}),A=o!=null?O.find(g=>g.value===o):void 0;return ztM({wrapAsOptional:s,wrapAsNullable:u,nameOverride:e,generatedName:t,title:r,values:O,_default:A,description:c,availability:f,namespace:l,groupName:p,source:h,inline:y})}function ztM({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:i,title:n,values:a,_default:o,description:c,availability:f,namespace:s,groupName:u,source:l,inline:p}){let _=ni.enum({nameOverride:r,generatedName:i,title:n,values:a,description:c,availability:f,default:o,example:void 0,namespace:s,groupName:u,source:l,inline:p});return t&&(_=ni.nullable({nameOverride:r,generatedName:i,title:n,value:_,description:c,availability:f,namespace:s,groupName:u,inline:p})),e&&(_=ni.optional({nameOverride:r,generatedName:i,title:n,value:_,description:c,availability:f,namespace:s,groupName:u,inline:p})),_}function NtM(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(i=>i[r]===t[r]);)r++;return e.map(i=>i.substring(r))}function Zh_({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,description:u,availability:l,wrapAsOptional:p,wrapAsNullable:_,example:h,namespace:y,groupName:b,defaultIntegerFormat:v=hn.DefaultIntegerFormat.Int32}){let O=i??v,A=(()=>{switch(O){case hn.DefaultIntegerFormat.Int64:return Un.int64({default:n,example:h});case hn.DefaultIntegerFormat.Uint32:return Un.uint({default:n,example:h});case hn.DefaultIntegerFormat.Uint64:return Un.uint64({default:n,example:h});default:return Un.int({default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,example:h})}})();return $3({nameOverride:e,generatedName:t,title:r,primitive:A,wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b})}function FtM(e){return typeof e=="string"?Rj.string(e):typeof e=="boolean"?Rj.boolean(e):Rj.string(`${e}`)}function kh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,value:a,description:o,availability:c,namespace:f,groupName:s}){let u=ni.literal({nameOverride:e,generatedName:t,title:r,value:FtM(a),description:o,availability:c,namespace:f,groupName:s});return n&&(u=ni.nullable({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),i&&(u=ni.optional({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),u}function Hsc({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,description:u,availability:l,wrapAsOptional:p,wrapAsNullable:_,example:h,namespace:y,groupName:b}){return i==null||i==="double"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.double({default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="float"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.float({example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="int32"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.int({default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="int64"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.int64({default:n,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="uint32"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.uint({default:n,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="uint64"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.uint64({default:n,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="time-delta"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.float({example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):$3({nameOverride:e,generatedName:t,title:r,primitive:Un.float({example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b})}var QtM={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},UtM={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}}},LtM={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}}},VtM={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},WtM={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},xtM={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},GtM={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},HtM={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function eja(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],i=[QtM,UtM,LtM,VtM,WtM,xtM,GtM,HtM],n;do{n=t;for(let a of i)if(a.isApplicable(t)){let{refUnderProcessing:o,newBreadcrumbs:c}=a.applyStrategy(t);t=o,r=[...r,...c]}}while(t.join("")!==n.join(""));return r}function qC(e,t){let i=e.map(n=>/^[^a-zA-Z0-9]+$/.test(n)?n:TP(Fo(n))).join("");return/^\d/.test(i)?VPa(i)??i:i}function ey_(e){let t=e.join("_");return Fo(t)}function WO(e){switch(e.type){case"object":return Xs.object({allOf:e.allOf,properties:e.properties.map(t=>JtM(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 Xs.array({description:e.description,availability:e.availability,value:WO(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return Xs.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 Xs.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 Xs.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:WO(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return Xs.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:WO(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return Xs.primitive({description:e.description,availability:e.availability,schema:ty_(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Xs.map({description:e.description,availability:e.availability,key:Xs.primitive({description:e.key.description,availability:e.key.availability,schema:ty_(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:WO(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 Xs.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 Xs.oneOf(KtM(e.value));case"unknown":return Xs.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Ot(e)}}function KtM(e){switch(e.type){case"discriminated":return c9t.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:WO(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,WO(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return c9t.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>WO(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:Ot(e)}}function ty_(e){switch(e.type){case"string":return ih.string(e);case"base64":return ih.base64();case"boolean":return ih.boolean(e);case"date":return ih.date();case"datetime":return ih.datetime();case"double":return ih.double(e);case"float":return ih.float();case"int":return ih.int(e);case"int64":return ih.int64(e);case"uint":return ih.uint();case"uint64":return ih.uint64();default:Ot(e)}}function JtM(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:WO(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function OLo(e,t){return rK(WO(e),WO(t))}function ry_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,required:o,wrapAsOptional:c,wrapAsNullable:f,allOf:s,context:u,propertiesToExclude:l,namespace:p,groupName:_,fullExamples:h,additionalProperties:y,availability:b,source:v}){let O=[...o??[]],A={...iy_({properties:n,breadcrumbs:i,context:u})},g=[],m=[];for(let B of s)if(!u.options.inlineAllOfSchemas&&Pn(B)){let F=u.resolveSchemaReference(B);if(F.discriminator!=null&&F.discriminator.mapping!=null)continue;if(F.oneOf!=null||F.anyOf!=null){let R=F.oneOf??F.anyOf;if(R!=null){for(let z of R){let U=Pn(z)?u.resolveSchemaReference(z):z,W=Sl(U,!1,!1,u.DUMMY,i,v,p);W.type==="object"&&g.push(...W.properties.map(K=>K.schema.type!=="optional"&&K.schema.type!=="nullable"?{...K,schema:ni.optional({nameOverride:void 0,generatedName:"",title:void 0,value:K.schema,description:void 0,availability:K.availability,namespace:void 0,groupName:void 0,inline:void 0})}:K))}continue}}let N=VCi(B);if(N==null)continue;m.push({schemaId:N,convertedSchema:Ksc(B,[N],v,u.options.preserveSchemaIds),properties:ny_({schema:B,context:u,breadcrumbs:i,source:v,namespace:p})}),u.markSchemaAsReferencedByNonRequest(N)}else if(Pn(B)){let F=u.resolveSchemaReference(B),N=Sl(F,!1,!1,u,i,v,p);N.type==="object"&&g.push(...N.properties)}else{let F=B.required??[];g=g.map(R=>(R.schema.type==="optional"||R.schema.type==="nullable")&&F.includes(R.key)?{...R,schema:R.schema.value}:R);let N=Sl(B,!1,!1,u,i,v,p);N.type==="object"&&g.push(...N.properties)}let j={};for(let B of m)for(let[F,N]of Object.entries(B.properties)){let R=j[F];R!=null?(R.schemaIds.push(B.schemaId),R.schemas.some(U=>OLo(U,N))||R.schemas.push(N)):j[F]={schemaIds:[B.schemaId],schemas:[N]}}let M=[];for(let[B,F]of Object.entries(j))F.schemaIds.length>1&&M.push({propertyKey:B,allOfSchemaIds:F.schemaIds,conflictingTypeSignatures:F.schemas.length>1});let E=Object.fromEntries(Object.entries(A).filter(([B,F])=>!(!Pn(F)&&F.type==="null"))),D=Object.entries(E).map(([B,F])=>{let N=Di(F,xi.AUDIENCES)??[],R=J3(F),z=Pn(F)?!1:F.readOnly,U=Pn(F)?!1:F.writeOnly,K=!(O.includes(B)&&!z),fe=Di(F,xi.FERN_PROPERTY_NAME),pe=[...i,B],L=ey_(pe),G=Sl(F,K,!1,u,pe,v,p),Re={};for(let le of m){let Ie=le.properties[B];Ie!=null&&!OLo(G,Ie)?Re[le.schemaId]={differentSchema:!0}:Ie!=null&&(Re[le.schemaId]={differentSchema:!1})}return{key:B,schema:G,nameOverride:fe,audiences:N,conflict:Re,generatedName:L,availability:R,readonly:z,writeonly:U}});return D.push(...g.map(B=>{let F=B.conflict;for(let N of m){let R=N.properties[B.key];R!=null&&!OLo(B.schema,R)?F[N.schemaId]={differentSchema:!0}:R!=null&&(F[N.schemaId]={differentSchema:!1})}return{...B,conflict:F}})),$tM({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,properties:D.filter(B=>!l.has(B.key)),description:a,allOf:m.map(B=>B.convertedSchema),allOfPropertyConflicts:M,namespace:p,groupName:_,fullExamples:h,additionalProperties:y,availability:b,source:v,context:u})}function $tM({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,properties:a,description:o,allOf:c,allOfPropertyConflicts:f,namespace:s,groupName:u,fullExamples:l,additionalProperties:p,availability:_,source:h,context:y}){let b=ni.object({description:o,properties:a,nameOverride:e,generatedName:t,title:r,allOf:c,allOfPropertyConflicts:f,namespace:s,groupName:u,fullExamples:l,additionalProperties:kPa(p,y.options),availability:_,source:h,inline:void 0});return n&&(b=ni.nullable({nameOverride:e,generatedName:t,title:r,value:b,description:o,availability:_,namespace:s,groupName:u,inline:void 0})),i&&(b=ni.optional({nameOverride:e,generatedName:t,title:r,value:b,description:o,availability:_,namespace:s,groupName:u,inline:void 0})),b}function iy_({properties:e,breadcrumbs:t,context:r}){return Object.fromEntries(Object.entries(e).filter(([i,n])=>{let a=Di(n,xi.IGNORE);return a&&r.logger.debug(`Property ${t.join(".")}.${i} is marked with x-fern-ignore. Skipping.`),!a}))}function ny_({schema:e,context:t,breadcrumbs:r,source:i,namespace:n}){let a={},[o,c]=Pn(e)?[t.resolveSchemaReference(e),eja(e.$ref)]:[e,r];for(let f of o.allOf??[])a={...a,...ny_({schema:f,context:t,breadcrumbs:c,source:i,namespace:n})};for(let[f,s]of Object.entries(iy_({properties:o.properties??{},breadcrumbs:r,context:t}))){let u=Sl(s,!1,!1,t,[...c,f],i,n);a[f]=u}return a}function WCi({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,description:n,availability:a,wrapAsOptional:o,wrapAsNullable:c,context:f,subtypes:s,namespace:u,groupName:l,encoding:p,source:_,subtypeSuffixOverrides:h}){let y=ZtM({schemas:s}),b=s.flatMap((O,A)=>{if(!Pn(O)&&O.enum!=null&&f.options.coerceEnumsToLiterals&&O.type==="string")return O.enum.map(m=>ni.literal({nameOverride:void 0,generatedName:qC([t,m],f.options.preserveSchemaIds),title:void 0,value:Rj.string(String(m)),namespace:u,groupName:void 0,description:void 0,availability:m.availability}));let g=y[A];if(h!=null){let m=h[A];m!=null&&"name"in m&&(g=m.name)}return[Sl(O,!1,!1,f,[...i,g??`${A}`],_,u)]}),v=YtM(b);return XtM({uniqueSubtypes:v,nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:c,description:n,availability:a,namespace:u,groupName:l,context:f,encoding:p,source:_})}function YtM(e){let t=[];for(let r=0;r<e.length;++r){let i=e[r],n=!1;for(let a=r+1;a<e.length;++a){let o=e[a];if(i!=null&&o!=null&&rK(i,o)){n=!0;break}}i!=null&&!n&&t.push(i)}return t}function XtM({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:s,context:u,encoding:l,source:p}){if(Object.entries(e).every(([h,y])=>y.type==="literal")){let h={},y=[];return Object.entries(e).forEach(([b,v])=>{v.type==="literal"&&v.value.type==="string"&&(y.push(v.value.value),v.description!=null&&(h[v.value.value]={description:v.description}))}),LCi({nameOverride:t,generatedName:r,title:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,fernEnum:h,enumVarNames:void 0,enumValues:y,_default:void 0,namespace:f,groupName:s,context:u,source:p,inline:void 0})}if(e.length===1&&e[0]!=null&&!u.options.preserveSingleSchemaOneOf){let h=e[0];return a&&(h=ni.nullable({nameOverride:t,generatedName:r,title:i,value:h,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),n&&(h=ni.optional({nameOverride:t,generatedName:r,title:i,value:h,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),h}return ay_({nameOverride:t,generatedName:r,title:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,subtypes:e,namespace:f,groupName:s,encoding:l,source:p})}function Jsc({nameOverride:e,generatedName:t,title:r,description:i,availability:n,wrapAsOptional:a,wrapAsNullable:o,context:c,namespace:f,groupName:s,discriminator:u,encoding:l,source:p}){let _=Object.entries(u.mapping??{}).map(([b,v],O)=>{let A={$ref:v},g=Uvi(A,!1,!1,c,[v],l,p,f);return c.markSchemaWithDiscriminantValue(A,u.propertyName,b),g.type==="object"&&(g.properties={[u.propertyName]:ni.literal({nameOverride:void 0,generatedName:qC([t,b],c.options.preserveSchemaIds),title:void 0,value:Rj.string(b),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...g.properties.filter(m=>m.key!==u.propertyName)}),g}),h=[];for(let b=0;b<_.length;++b){let v=_[b],O=!1;for(let A=b+1;A<_.length;++A){let g=_[A];if(v!=null&&g!=null&&rK(v,g)){O=!0;break}}v!=null&&!O&&h.push(v)}if(Object.entries(h).every(([b,v])=>v.type==="literal")){let b={},v=[];return Object.entries(h).forEach(([O,A])=>{A.type==="literal"&&A.value.type==="string"&&(v.push(A.value.value),A.description!=null&&(b[A.value.value]={description:A.description}))}),LCi({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:i,availability:n,fernEnum:b,enumVarNames:void 0,enumValues:v,_default:void 0,namespace:f,groupName:s,context:c,source:p,inline:void 0})}return h.length===1&&h[0]!=null&&!c.options.preserveSingleSchemaOneOf?h[0]:ay_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:i,availability:n,subtypes:h,namespace:f,groupName:s,encoding:l,source:p})}function ZtM({schemas:e}){let t={},r=0;for(let n of e){if(!Pn(n)){if(n.properties!=null&&Object.entries(n.properties).length>0){let a=Object.keys(n.properties),o={},c=a;for(let[f,s]of Object.entries(t)){let u=bro(s,a);c=bro(c,s),o[f]=u}o[r]=c,t=o}}r++}return e.map((n,a)=>{let o=t[a];if(o!=null&&o.length>0){let c=o.sort();if(c[0]!=null)return c[0]}return bJi(a)??`${a}`})}function ay_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,description:a,availability:o,subtypes:c,namespace:f,groupName:s,encoding:u,source:l}){let p=ni.oneOf(Mhe.undiscriminated({description:a,availability:o,nameOverride:e,generatedName:t,title:r,schemas:c,namespace:f,groupName:s,encoding:u,source:l,inline:void 0}));return n&&(p=ni.nullable({nameOverride:e,generatedName:t,title:r,value:p,description:a,availability:o,namespace:f,groupName:s,inline:void 0})),i&&(p=ni.optional({nameOverride:e,generatedName:t,title:r,value:p,description:a,availability:o,namespace:f,groupName:s,inline:void 0})),p}function uUn(e){if(e.default!=null&&typeof e.default=="string")return e.default}function ALo({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let i=AJi(e);for(let n of i??[])if(typeof n=="number")return n;if(r&&typeof r=="number")return r}function oy_({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let i=AJi(e);for(let n of i??[])if(typeof n=="boolean")return n;if(r&&typeof r=="boolean")return r}function h9t({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let i=AJi(e);for(let n of i??[])if(typeof n=="string")return n;if(r&&typeof r=="string")return r}function uy_({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let i=AJi(e);for(let n of i??[])if(Array.isArray(n))return n;if(r&&Array.isArray(r))return r}var PJi="#/components/schemas/";function ly_(e,t){let r=Pn(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"integer":return!0;case"string":return r.enum==null;case"array":return ly_(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function ktM(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:ly_(t,r):!1}function Sl(e,t,r,i,n,a,o,c=!1,f=new Set,s){let u=Hh_(e)??a,l=urM({schema:e,logger:i.logger});if(Pn(e)){let p=VCi(e);return p!=null?ktM(p,e,i)?oUn(i.resolveSchemaReference(e),t,r,i,eja(e.$ref),l,u,o,f,c,s):(c?i.markSchemaAsReferencedByRequest(p):i.markSchemaAsReferencedByNonRequest(p),Uvi(e,t,r,i,n,l,u,o)):oUn(i.resolveSchemaReference(e),t,r,i,eja(e.$ref),l,u,o,f,c,s)}return oUn(e,t,r,i,n,l,u,o,f,c,s)}function Uvi(e,t,r,i,n,a,o,c){let f=e.$ref.includes("properties")?oUn(i.resolveSchemaReference(e),t,r,i,n,a,o,c,new Set):ni.reference(Ksc(e,n,o,i.options.preserveSchemaIds));if(r===!1){let s=i.resolveSchemaReference(e);(s.nullable===!0||Array.isArray(s.type)&&s.type.length>=2&&s.type.includes("null"))&&(r=!0)}return r&&(f=ni.nullable({title:void 0,nameOverride:void 0,generatedName:qC(n,i.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(f=ni.optional({title:void 0,nameOverride:void 0,generatedName:qC(n,i.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),f}function erM(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function oUn(e,t,r,i,n,a,o,c,f=new Set,s=!1,u){typeof e=="string"&&(e={type:e});let l=Di(e,xi.TYPE_NAME)??(i.options.useTitlesAsName?erM(e.title):void 0),p=Di(e,xi.SDK_GROUP_NAME)??Di(e,JQ.TAGS)?.[0],_=(typeof p=="string"?[p]:p)??[];_=i.resolveGroupName(_);let h=qC(n,i.options.preserveSchemaIds),y=e.title,b=e.description,v=J3(e),O=[];e.example!=null&&O.push({name:void 0,value:e.example,description:void 0});let A=Di(e,JQ.EXAMPLES);A!=null&&Object.keys(A).length>0&&O.push(...Object.entries(A).map(([j,M])=>({name:M?.summary??j,value:M.value,description:M.description})));let g=AJi(e);g!=null&&Object.keys(g).length>0&&O.push(...g.map(j=>({name:void 0,value:j,description:void 0})));let m=Gh_({schema:e,description:b,title:y,nameOverride:l,generatedName:h,availability:v});if(m!=null){let j=m;return r&&(j=ni.nullable({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:j})),t&&(j=ni.optional({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:j})),j}try{if(Array.isArray(e.type)){let E=e.type.indexOf("null"),D=E!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&D)e.type.splice(E,1),e.type=e.type[0],e.nullable=!0;else if(D&&(e.type.splice(E,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let B=new Set([...e.oneOf,...e.type]);e.oneOf=[...B]}}if(r=r||e.nullable===!0,"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(D=>D!==null),!jLo(e.enum))return $3({nameOverride:l,generatedName:h,title:y,primitive:Un.string({default:uUn(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:h9t({schema:e,logger:i.logger,fallback:u})}),namespace:c,groupName:_,wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v});let E=xh_(e);return i.options.coerceEnumsToLiterals&&e.enum.length===1&&e.enum[0]!=null&&E==null?kh_({nameOverride:l,generatedName:h,title:y,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:b,availability:v,namespace:c,groupName:_}):LCi({nameOverride:l,generatedName:h,title:y,fernEnum:E,enumVarNames:Di(e,[JQ.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:_,context:i,source:o,inline:void 0})}if(jLo(e.type)&&e.type.length>1){let E=e.type.includes("null"),D=e.type.filter(B=>B!=="null").map(B=>({type:B,nullable:E}));return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,subtypes:D,namespace:c,groupName:_,encoding:a,source:o})}if(e.type==="boolean"){let E=Di(e,xi.BOOLEAN_LITERAL);return E!=null?sy_({nameOverride:l,generatedName:h,title:y,literal:Rj.boolean(E),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_}):$3({nameOverride:l,generatedName:h,title:y,primitive:Un.boolean({default:trM(e.default),example:oy_({schema:e,logger:i.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_})}if(e.type==="number")return Hsc({nameOverride:l,generatedName:h,title:y,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:mJi(e.exclusiveMinimum),exclusiveMaximum:mJi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,example:ALo({schema:e,logger:i.logger,fallback:u}),namespace:c,groupName:_});if(e.type==="integer")return Zh_({nameOverride:l,generatedName:h,title:y,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:mJi(e.exclusiveMinimum),exclusiveMaximum:mJi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,example:ALo({schema:e,logger:i.logger,fallback:u}),namespace:c,groupName:_,defaultIntegerFormat:i.options.defaultIntegerFormat});if(e.type==="float")return Hsc({nameOverride:l,generatedName:h,title:y,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:mJi(e.exclusiveMinimum),exclusiveMaximum:mJi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,example:ALo({schema:e,logger:i.logger,fallback:u}),namespace:c,groupName:_});if(e.type==="string"){if(e.format==="date-time")return $3({nameOverride:l,generatedName:h,title:y,primitive:Un.datetime({example:h9t({schema:e,logger:i.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_});if(e.format==="date"&&i.options.typeDatesAsStrings===!1)return $3({nameOverride:l,generatedName:h,title:y,primitive:Un.date({example:h9t({schema:e,logger:i.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_});if(e.format==="json-string"){let D=ni.unknown({nameOverride:l,generatedName:h,title:y,description:b,availability:v,namespace:c,groupName:_,example:void 0});return r&&(D=ni.nullable({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:D})),t&&(D=ni.optional({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:D})),D}let E=dy_(e,"const");return E!=null?sy_({nameOverride:l,generatedName:h,title:y,literal:Rj.string(E),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_}):$3({nameOverride:l,generatedName:h,title:y,primitive:Un.string({default:uUn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:h9t({schema:e,logger:i.logger,fallback:u})}),namespace:c,groupName:_,wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v})}if(e.type==="array")return $h_({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,item:e.items,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,example:uy_({schema:e,logger:i.logger,fallback:u}),source:o});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&mLo(e))return Kh_({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,additionalProperties:e.additionalProperties,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,encoding:a,example:e.example,source:o});if(e.oneOf!=null&&e.oneOf.length>0&&Di(e,xi.IS_DISCRIMINATED)===!1)return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,subtypes:e.oneOf,namespace:c,groupName:_,encoding:a,source:o});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return i.options.discriminatedUnionV2?Jsc({nameOverride:l,generatedName:h,title:y,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,discriminator:e.discriminator,encoding:a,source:o}):xsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,encoding:a,source:o});if(e.oneOf!=null&&e.oneOf.length>0){let E=Di(e,xi.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return i.options.discriminatedUnionV2||E?Jsc({nameOverride:l,generatedName:h,title:y,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,discriminator:e.discriminator,encoding:a,source:o}):xsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,encoding:a,source:o});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(i.options.preserveSingleSchemaOneOf)return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,subtypes:e.oneOf.filter(B=>Pn(B)||B.type!=="null"),encoding:a,namespace:c,groupName:_,source:o});let D=Sl(e.oneOf[0],t,r,i,n,o,c,s);return y9t(D,b,c,_)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let N=e.oneOf[0],R=e.oneOf[1];if(!Pn(N)&&N.type==="null"){let z=Sl(R,t,!0,i,n,o,c);return y9t(z,b,c,_)}else if(!Pn(R)&&R.type==="null"){let z=Sl(N,t,!0,i,n,o,c);return y9t(z,b,c,_)}}let D=nrM({schemas:e.oneOf});if(D!=null)return LCi({nameOverride:l,generatedName:h,title:y,fernEnum:void 0,enumVarNames:void 0,enumValues:D,_default:e.default,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:_,context:i,source:o,inline:void 0});let B=cy_({schemas:e.oneOf,context:i});if(B!=null&&!i.options.discriminatedUnionV2&&!E)return Gsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,properties:e.properties??{},required:e.required,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,discriminant:B.discriminant,variants:B.schemas,context:i,namespace:c,groupName:_,encoding:a,source:o});let F=e.oneOf.filter(N=>!Pn(N)&&N.type==="null").length>0;return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r||F,context:i,subtypes:e.oneOf.filter(N=>Pn(N)||N.type!=="null"),encoding:a,namespace:c,groupName:_,source:o})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let B=Sl(e.anyOf[0],t,r,i,n,o,c,s);return y9t(B,b,c,_)}if(e.anyOf.length===2){let[B,F]=e.anyOf;if(B!=null&&F!=null){if(!Pn(B)&&B.type==="null"){let N=Sl(F,t,!0,i,n,o,c);return y9t(N,b,c,_)}else if(!Pn(F)&&F.type==="null"){let N=Sl(B,t,!0,i,n,o,c);return y9t(N,b,c,_)}}}let E=cy_({schemas:e.anyOf,context:i});if(E!=null&&!i.options.discriminatedUnionV2)return Gsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,properties:e.properties??{},required:e.required,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,discriminant:E.discriminant,variants:E.schemas,context:i,namespace:c,groupName:_,encoding:a,source:o});let D=e.anyOf.filter(B=>!Pn(B)&&B.type==="null").length>0;return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r||D,context:i,subtypes:e.anyOf.filter(B=>Pn(B)||B.type!=="null"),encoding:a,namespace:c,groupName:_,source:o})}if(e.allOf!=null||e.properties!=null){let E=[];for(let B of e.allOf??[])(Pn(B)||Object.keys(B).length>0)&&E.push(B);if((e.properties==null||mLo(e))&&E.length===1&&E[0]!=null){let B=Sl(E[0],t,r,i,n,o,c,s);return y9t(B,b,c,_)}let D=E.filter(B=>{let F=PLo(B);return F||i.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(B)}`),F});if((e.properties==null||mLo(e))&&D.length===1&&D[0]!=null){let B=Sl(D[0],t,r,i,n,o,c,s);return y9t(B,b,c,_)}return ry_({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,properties:e.properties??{},description:b,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:D,context:i,propertiesToExclude:f,namespace:c,groupName:_,fullExamples:O,additionalProperties:e.additionalProperties,availability:v,encoding:a,source:o})}if(e.type==="object"&&rrM(e)&&irM(e)&&mLo(e))return Wsc({nameOverride:l,generatedName:h,title:y,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${h}Key`,title:void 0,description:void 0,availability:void 0,schema:Un.string({default:uUn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:h9t({schema:e,logger:i.logger,fallback:u})}),namespace:c,groupName:_},valueSchema:ni.unknown({nameOverride:void 0,generatedName:`${h}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:c,groupName:_}),namespace:c,groupName:_,encoding:a,example:e.example});e.type!=null&&i.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${n.join("->")}. Coercing to unknown.`);let j=e.example??e.default,M=ni.unknown({nameOverride:l,generatedName:h,title:y,description:b,availability:v,namespace:c,groupName:_,example:j});return r&&(M=ni.nullable({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:M})),t&&(M=ni.optional({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:M})),M}catch(j){return i.logger.debug(`Error converting schema: ${j.message}
|
|
1411
|
+
`)),{ok:!0,value:t}):i}}function iUo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var EQn=class e extends Error{errors;constructor(t){super(t.map(iUo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var SQn=class e extends Error{errors;constructor(t){super(t.map(iUo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Jm(e){return{optional:()=>hsc(e),transform:t=>ysc(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new SQn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new EQn(i.errors)}}}function hsc(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>nh.OPTIONAL};return{...t,...Jm(t)}}function ysc(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...Jm(r)}}function A__(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:MA(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:MA(t,"bigint")}]},getType:()=>nh.BIGINT};return{...yz(e),...Jm(e)}}var veM=/^([+-]?\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 m__(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:MA(t,"string")}]}:veM.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:MA(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:MA(t,"Date object")}]},getType:()=>nh.DATE};return{...yz(e),...Jm(e)}}function H3(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...yz(r),...Jm(r)}}}function nUo(e){let t=new Set(e);return H3(nh.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:MA(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:MA(i,"enum")}]}:{ok:!0,value:i})()}function P__(e){let t=bsc(e);return{...t,...Jm(t)}}function bsc(e){return{parse:(t,r)=>MQn(e).parse(t,r),json:(t,r)=>MQn(e).json(t,r),getType:()=>MQn(e).getType()}}function MQn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function FPa(e){return Object.entries(e)}function QPa(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function BCi(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 UPa(e){return Object.keys(e)}function j__(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function yFt(e){return{withParsedProperties:t=>vsc(e,t)}}function vsc(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,s])=>({...c,[f]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...o}}},json:(i,n)=>{if(!BCi(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:MA(i,"object")}]};let a=new Set(Object.keys(t)),o=QPa(i,Object.keys(i).filter(c=>!a.has(c)));return e.json(o,n)},getType:()=>e.getType()};return{...r,...Jm(r),...yFt(r)}}function w__(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function ICi(e){return e.isProperty}function aUo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>ICi(i)?i.rawKey:r),_getParsedProperties:()=>UPa(e),parse:(r,i)=>{let n={},a=[];for(let[o,c]of FPa(e)){let f=ICi(c)?c.rawKey:o,s=ICi(c)?c.valueSchema:c,u={rawKey:f,parsedKey:o,valueSchema:s};n[f]=u,M__(s)&&a.push(f)}return E__({value:r,requiredKeys:a,getProperty:o=>{let c=n[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,o]of FPa(e)){let c=ICi(o)?o.valueSchema:o;M__(c)&&n.push(a)}return E__({value:r,requiredKeys:n,getProperty:a=>{let o=e[a];if(o!=null)return ICi(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>nh.OBJECT};return{...yz(t),...Jm(t),...yFt(t),...yJi(t)}}function E__({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!BCi(e))return{ok:!1,errors:[{path:a,message:MA(e,"object")}]};let o=new Set(t),c=[],f={};for(let[s,u]of Object.entries(e)){let l=r(s);if(l!=null){o.delete(s);let p=l.transform(u);p.ok?f[l.transformedKey]=p.value:(f[s]=u,c.push(...p.errors))}else switch(i){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":f[s]=u;break}}return c.push(...t.filter(s=>o.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||n?{ok:!0,value:f}:{ok:!1,errors:c}}function yJi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>S__({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>S__({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>nh.OBJECT};return{...r,...Jm(r),...yFt(r),...yJi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>nh.OBJECT};return{...t,...Jm(t),...yFt(t),...yJi(t)}}}}function S__({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,o]=j__(UPa(t),s=>n.has(s)),c=r(QPa(t,o)),f=i(QPa(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function M__(e){return!geM(e)}function geM(e){switch(e.getType()){case nh.ANY:case nh.UNKNOWN:case nh.OPTIONAL:return!0;default:return!1}}function D__(e){return aUo(e)}function B__(e){let t={...bsc(e),_getRawProperties:()=>MQn(e)._getRawProperties(),_getParsedProperties:()=>MQn(e)._getParsedProperties()};return{...t,...Jm(t),...yFt(t),...yJi(t)}}function oUo(e){let t={parse:(r,i)=>I__(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>I__(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>nh.LIST};return{...yz(t),...Jm(t)}}function I__(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:MA(e,"list"),path:[]}]}}function C__(e){return H3(nh.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:MA(r,`"${e}"`)}]})()}function q__(e){return H3(nh.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:MA(r,`${e.toString()}`)}]})()}var T__=H3(nh.ANY,e=>({ok:!0,value:e}));var R__=H3(nh.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:MA(e,"boolean")}]});var z__=H3(nh.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:MA(e,"number")}]});var N__=H3(nh.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:MA(e,"string")}]});var F__=H3(nh.UNKNOWN,e=>({ok:!0,value:e}));function U__(e,t){let r={parse:(i,n)=>Q__({value:i,isKeyNumeric:e.getType()===nh.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>Q__({value:i,isKeyNumeric:e.getType()===nh.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>nh.RECORD};return{...yz(r),...Jm(r)}}function Q__({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return BCi(e)?FPa(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,s=o;if(t){let _=o.length>0?Number(o):NaN;isNaN(_)||(s=_)}let u=r(s),l=i(c,s);if(f.ok&&u.ok&&l.ok)return{ok:!0,value:{...f.value,[u.value]:l.value}};let p=[];return f.ok||p.push(...f.errors),u.ok||p.push(...u.errors),l.ok||p.push(...l.errors),{ok:!1,errors:p}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:MA(e,"object")}]}}function L__(e){let t=oUo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:MA(i,"Set")}]},getType:()=>nh.SET};return{...yz(r),...Jm(r)}}function W__(e){let t={parse:(r,i)=>V__((n,a)=>n.parse(r,a),e,i),json:(r,i)=>V__((n,a)=>n.json(r,a),e,i),getType:()=>nh.UNDISCRIMINATED_UNION};return{...yz(t),...Jm(t)}}function V__(e,t,r){let i=[];for(let[n,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)i.push({path:c.path,message:`[Variant ${n}] ${c.message}`})}return{ok:!1,errors:i}}function x__(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function H__(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=nUo(UPa(t)),a={parse:(o,c)=>G__({value:o,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:f=>n.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,s)=>s.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>G__({value:o,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:f=>n.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,s)=>s.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>nh.UNION};return{...yz(a),...Jm(a),...yFt(a)}}function G__({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!BCi(e))return{ok:!1,errors:[{path:c,message:MA(e,"object")}]};let{[t]:f,...s}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let u=i(f);if(!u.ok)return{ok:!1,errors:u.errors};let l=n(u.value);if(l==null)return a?{ok:!0,value:{[r]:u.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let p=o(s,l);return p.ok?{ok:!0,value:{[r]:f,...p.value}}:p}var xd=V.objectWithoutOptionalProperties({title:V.string().optional()});var uUo=V.objectWithoutOptionalProperties({file:V.string()});var sUo=V.objectWithoutOptionalProperties({file:V.string()});var cUo=V.union("type",{openapi:uUo,protobuf:sUo}).transform({transform:e=>{switch(e.type){case"openapi":return G3.openapi(e);case"protobuf":return G3.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var ru=V.objectWithoutOptionalProperties({source:cUo.optional()});var lUo=V.objectWithoutOptionalProperties({typeName:V.string()});var fUo=V.union("type",{protobuf:lUo}).transform({transform:e=>{switch(e.type){case"protobuf":return wQn.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var tK=V.objectWithoutOptionalProperties({encoding:fUo.optional()});var qi=V.objectWithoutOptionalProperties({description:V.string().optional()});var dUo=V.enum_(["GenerallyAvailable","Beta","Deprecated"]);var vu=V.objectWithoutOptionalProperties({availability:dUo.optional()});var l9t=V.number();var H0e=V.objectWithoutOptionalProperties({statusCode:l9t.optional()});var xl=V.objectWithoutOptionalProperties({nameOverride:V.string().optional(),generatedName:V.string()});var fO=V.objectWithoutOptionalProperties({inline:V.boolean().optional()});var gx=V.string();var Ox=V.string();var pUo=V.objectWithoutOptionalProperties({id:Ox}).extend(qi);var CCi=V.string();var _Uo=V.objectWithoutOptionalProperties({usernameVariableName:V.string().optional(),usernameEnvVar:V.string().optional(),passwordVariableName:V.string().optional(),passwordEnvVar:V.string().optional()});var hUo=V.objectWithoutOptionalProperties({tokenVariableName:V.string().optional(),tokenEnvVar:V.string().optional()});var yUo=V.objectWithoutOptionalProperties({headerName:V.string(),prefix:V.string().optional(),headerVariableName:V.string().optional(),headerEnvVar:V.string().optional()});var bUo=V.objectWithoutOptionalProperties({queryParameterName:V.string()});var vUo=V.objectWithoutOptionalProperties({snake:V.string().optional(),camel:V.string().optional(),screamingSnake:V.string().optional(),pascal:V.string().optional()});var qCi=V.objectWithoutOptionalProperties({nameOverride:V.string().optional(),generatedName:V.string(),value:V.string(),casing:vUo.optional()}).extend(qi).extend(vu);var gUo=V.objectWithoutOptionalProperties({type:V.stringLiteral("namespace"),name:V.string()});var OUo=V.undiscriminatedUnion([V.string(),gUo]);var TCi=V.list(OUo);var Gd=V.objectWithoutOptionalProperties({groupName:TCi.optional()});var El=V.objectWithoutOptionalProperties({namespace:V.string().optional()});var DQn=V.objectWithoutOptionalProperties({default:qCi.optional(),values:V.list(qCi)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var AUo=V.objectWithoutOptionalProperties({scopesEnum:DQn.optional()});var mUo=V.union("type",{basic:_Uo,bearer:hUo,header:yUo,query:bUo,oauth:AUo}).transform({transform:e=>{switch(e.type){case"basic":return dz.basic(e);case"bearer":return dz.bearer(e);case"header":return dz.header(e);case"query":return dz.query(e);case"oauth":return dz.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var LPa=V.objectWithoutOptionalProperties({name:V.string().optional(),url:V.string(),audiences:V.list(V.string()).optional()}).extend(qi);var PUo=V.string();var f9t=V.objectWithoutOptionalProperties({sdkMethodName:V.string().optional()});var Osc={};Yt(Osc,{FullExample:()=>$m,FullObjectExample:()=>EUo,FullOneOfExample:()=>MUo,KeyValuePair:()=>SUo,LiteralExample:()=>jUo,NullExample:()=>wUo,PrimitiveExample:()=>IQn,PropertyKey:()=>BQn});var BQn=V.string();var IQn=V.union("type",{int:V.object({value:V.number()}),int64:V.object({value:V.number()}),uint:V.object({value:V.number()}),uint64:V.object({value:V.number()}),float:V.object({value:V.number()}),double:V.object({value:V.number()}),string:V.object({value:V.string()}),datetime:V.object({value:V.string()}),date:V.object({value:V.string()}),base64:V.object({value:V.string()}),boolean:V.object({value:V.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return Ka.int(e.value);case"int64":return Ka.int64(e.value);case"uint":return Ka.uint(e.value);case"uint64":return Ka.uint64(e.value);case"float":return Ka.float(e.value);case"double":return Ka.double(e.value);case"string":return Ka.string(e.value);case"datetime":return Ka.datetime(e.value);case"date":return Ka.date(e.value);case"base64":return Ka.base64(e.value);case"boolean":return Ka.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var jUo=V.union("type",{boolean:V.object({value:V.boolean()}),string:V.object({value:V.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return MCi.boolean(e.value);case"string":return MCi.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var wUo=V.objectWithoutOptionalProperties({});var $m=V.union("type",{primitive:V.object({value:IQn}),object:V.lazyObject(()=>EUo),array:V.object({value:V.list(V.lazy(()=>$m))}),map:V.object({value:V.list(V.lazyObject(()=>SUo))}),enum:V.object({value:V.string()}),literal:V.object({value:jUo}),oneOf:V.object({value:V.lazy(()=>MUo)}),null:wUo,unknown:V.object({value:V.lazy(()=>$m)})}).transform({transform:e=>{switch(e.type){case"primitive":return wl.primitive(e.value);case"object":return wl.object(e);case"array":return wl.array(e.value);case"map":return wl.map(e.value);case"enum":return wl.enum(e.value);case"literal":return wl.literal(e.value);case"oneOf":return wl.oneOf(e.value);case"null":return wl.null(e);case"unknown":return wl.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var EUo=V.objectWithoutOptionalProperties({properties:V.record(BQn,V.lazy(()=>$m))});var SUo=V.objectWithoutOptionalProperties({key:IQn,value:V.lazy(()=>$m)});var MUo=V.union("type",{discriminated:V.object({value:V.record(BQn,V.lazy(()=>$m))}),undiscriminated:V.object({value:V.lazy(()=>$m)})}).transform({transform:e=>{switch(e.type){case"discriminated":return DCi.discriminated(e.value);case"undiscriminated":return DCi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Asc={};Yt(Asc,{AllOfPropertyConflict:()=>YQn,ArraySchema:()=>O4o,Availability:()=>dUo,BooleanSchema:()=>p4o,BytesResponse:()=>UQn,CasingOverrides:()=>vUo,CommonProperty:()=>M4o,CursorPagination:()=>YUo,CustomCodeSample:()=>JUo,CustomCodeSampleLanguage:()=>GUo,CustomCodeSampleSdk:()=>KUo,CustomPagination:()=>ZUo,DiscriminatedOneOfSchema:()=>E4o,DoubleSchema:()=>f4o,Endpoint:()=>kUo,EndpointExample:()=>xQn,EndpointResponseExample:()=>xUo,EndpointSdkName:()=>d9t,EndpointSecurity:()=>CQn,EnumSchema:()=>DQn,EnumValue:()=>qCi,ErrorExample:()=>QUo,FernExample:()=>LUo,FileResponse:()=>FQn,FileSchema:()=>IUo,FormUrlEncodedRequest:()=>zUo,FullEndpointExample:()=>$Uo,GlobalHeader:()=>y4o,GlobalSecurity:()=>h4o,Header:()=>RCi,HeaderExample:()=>WQn,HttpEndpointServer:()=>LQn,HttpError:()=>UUo,HttpMethod:()=>qQn,IdempotencyHeader:()=>b4o,IntSchema:()=>c4o,JsonRequest:()=>RUo,JsonResponse:()=>QQn,LiteralSchema:()=>$Qn,LiteralSchemaValue:()=>v4o,LongSchema:()=>l4o,MapSchema:()=>A4o,MultipartRequest:()=>NQn,MultipartRequestProperty:()=>TUo,MultipartRequestPropertyEncoding:()=>qUo,MultipartSchema:()=>CUo,NullableSchema:()=>P4o,ObjectProperty:()=>w4o,ObjectPropertyConflictInfo:()=>XQn,ObjectSchema:()=>g4o,OctetStreamRequest:()=>zQn,OffsetPagination:()=>XUo,OneOfSchema:()=>j4o,OpenApiIntermediateRepresentation:()=>K__,OptionalSchema:()=>m4o,Pagination:()=>GQn,PathParameter:()=>TQn,PathParameterExample:()=>VUo,PrimitiveSchema:()=>NCi,PrimitiveSchemaValue:()=>_4o,QueryParameter:()=>RQn,QueryParameterExample:()=>VQn,ReferencedSchema:()=>p9t,Request:()=>NUo,Response:()=>FUo,RetriesConfiguration:()=>HQn,Schema:()=>id,Schemas:()=>s4o,SdkGroupInfo:()=>DUo,StreamingResponseExample:()=>WUo,StringSchema:()=>d4o,SupportedSdkLanguage:()=>HUo,Tags:()=>BUo,TextResponse:()=>zCi,UnDiscriminatedOneOfSchema:()=>S4o,Webhook:()=>e4o,WebhookExampleCall:()=>JQn,WebhookHttpMethod:()=>KQn,WebsocketChannel:()=>u4o,WebsocketHandshake:()=>t4o,WebsocketMessageExample:()=>a4o,WebsocketMessageOrigin:()=>r4o,WebsocketMessageSchema:()=>i4o,WebsocketServer:()=>n4o,WebsocketSessionExample:()=>o4o});var DUo=V.objectWithoutOptionalProperties({summary:V.string().optional(),description:V.string().optional()});var BUo=V.objectWithoutOptionalProperties({tagsById:V.record(Ox,pUo),orderedTagIds:V.list(Ox).optional()});var CQn=V.list(V.record(CCi,V.list(V.string())));var qQn=V.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var TQn=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>id),variableReference:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var RQn=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>id),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var RCi=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>id),env:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var d9t=V.objectWithoutOptionalProperties({groupName:TCi,methodName:V.string()});var zQn=V.objectWithoutOptionalProperties({contentType:V.string().optional()}).extend(qi).extend(ru);var IUo=V.objectWithoutOptionalProperties({isOptional:V.boolean(),isArray:V.boolean()}).extend(qi);var CUo=V.union("type",{file:IUo,json:V.object({value:V.lazy(()=>id)})}).transform({transform:e=>{switch(e.type){case"file":return s9t.file(e);case"json":return s9t.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var qUo=V.enum_(["json","form"]);var TUo=V.objectWithoutOptionalProperties({key:V.string(),schema:CUo,contentType:V.string().optional(),exploded:V.boolean().optional(),encoding:qUo.optional()}).extend(qi);var NQn=V.objectWithoutOptionalProperties({name:V.string().optional(),properties:V.list(TUo)}).extend(qi).extend(ru);var RUo=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id),contentType:V.string().optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru);var zUo=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id),contentType:V.string().optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru);var NUo=V.union("type",{octetStream:zQn,multipart:NQn,json:RUo,formUrlEncoded:zUo}).transform({transform:e=>{switch(e.type){case"octetStream":return hFt.octetStream(e);case"multipart":return hFt.multipart(e);case"json":return hFt.json(e);case"formUrlEncoded":return hFt.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var FQn=V.objectWithoutOptionalProperties({}).extend(qi).extend(ru).extend(H0e);var QQn=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id),responseProperty:V.string().optional()}).extend(qi).extend(ru).extend(H0e);var zCi=V.objectWithoutOptionalProperties({}).extend(qi).extend(ru).extend(H0e);var UQn=V.objectWithoutOptionalProperties({}).extend(qi).extend(ru).extend(H0e);var FUo=V.union("type",{file:FQn,json:QQn,text:zCi,bytes:UQn,streamingSse:QQn,streamingText:zCi,streamingJson:QQn}).transform({transform:e=>{switch(e.type){case"file":return KQ.file(e);case"json":return KQ.json(e);case"text":return KQ.text(e);case"bytes":return KQ.bytes(e);case"streamingSse":return KQ.streamingSse(e);case"streamingText":return KQ.streamingText(e);case"streamingJson":return KQ.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var QUo=V.objectWithoutOptionalProperties({name:V.string().optional(),description:V.string().optional(),example:V.lazy(()=>$m)});var UUo=V.objectWithoutOptionalProperties({schema:V.lazy(()=>id).optional(),examples:V.list(QUo).optional()}).extend(qi).extend(xl).extend(ru);var LQn=V.objectWithoutOptionalProperties({name:V.string().optional(),url:V.string().optional(),audiences:V.list(V.string()).optional()});var LUo=V.unknown();var VUo=V.objectWithoutOptionalProperties({name:V.string(),parameterNameOverride:V.string().optional(),value:V.lazy(()=>$m)});var VQn=V.objectWithoutOptionalProperties({name:V.string(),value:V.lazy(()=>$m)});var WQn=V.objectWithoutOptionalProperties({name:V.string(),value:V.lazy(()=>$m)});var WUo=V.objectWithoutOptionalProperties({sse:V.boolean(),events:V.list(V.lazy(()=>$m))});var xUo=V.union("type",{withStreaming:WUo,withoutStreaming:V.object({value:V.lazy(()=>$m)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return G0e.withStreaming(e);case"withoutStreaming":return G0e.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var GUo=V.objectWithoutOptionalProperties({name:V.string().optional(),language:V.string(),code:V.string(),install:V.string().optional()}).extend(qi);var HUo=V.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var KUo=V.objectWithoutOptionalProperties({name:V.string().optional(),sdk:HUo,code:V.string()}).extend(qi);var JUo=V.union("type",{language:GUo,sdk:KUo}).transform({transform:e=>{switch(e.type){case"language":return u9t.language(e);case"sdk":return u9t.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var $Uo=V.objectWithoutOptionalProperties({name:V.string().optional(),pathParameters:V.list(VUo).optional(),queryParameters:V.list(VQn).optional(),headers:V.list(WQn).optional(),request:V.lazy(()=>$m).optional(),response:xUo.optional(),codeSamples:V.list(JUo)}).extend(qi);var xQn=V.union("type",{unknown:V.object({value:LUo}),full:$Uo}).transform({transform:e=>{switch(e.type){case"unknown":return x0e.unknown(e.value);case"full":return x0e.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var YUo=V.objectWithoutOptionalProperties({cursor:V.string(),nextCursor:V.property("next_cursor",V.string()),results:V.string()});var XUo=V.objectWithoutOptionalProperties({offset:V.string(),results:V.string(),step:V.string().optional(),hasNextPage:V.string().optional()});var ZUo=V.objectWithoutOptionalProperties({results:V.string()});var GQn=V.union("type",{cursor:YUo,offset:XUo,custom:ZUo}).transform({transform:e=>{switch(e.type){case"cursor":return She.cursor(e);case"offset":return She.offset(e);case"custom":return She.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var HQn=V.union("type",{disabled:V.object({value:V.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return NPa.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var kUo=V.objectWithoutOptionalProperties({authed:V.boolean(),security:CQn.optional(),internal:V.boolean().optional(),idempotent:V.boolean().optional(),method:qQn,audiences:V.list(V.string()),path:V.string(),summary:V.string().optional(),operationId:V.string().optional(),tags:V.list(Ox),pathParameters:V.list(TQn),queryParameters:V.list(RQn),headers:V.list(RCi),sdkName:d9t.optional(),generatedRequestName:V.string(),requestNameOverride:V.string().optional(),request:NUo.optional(),response:FUo.optional(),errors:V.record(l9t,UUo),servers:V.list(LQn),examples:V.list(xQn),pagination:GQn.optional(),retries:HQn.optional()}).extend(qi).extend(vu).extend(ru).extend(El);var KQn=V.enum_(["GET","POST"]);var JQn=V.objectWithoutOptionalProperties({name:V.string().optional(),payload:V.lazy(()=>$m)}).extend(qi);var e4o=V.objectWithoutOptionalProperties({audiences:V.list(V.string()),sdkName:d9t.optional(),method:KQn,summary:V.string().optional(),operationId:V.string(),tags:V.list(Ox),headers:V.list(RCi),generatedPayloadName:V.string(),payload:V.lazy(()=>id),examples:V.list(JQn)}).extend(qi).extend(ru).extend(El);var t4o=V.objectWithoutOptionalProperties({queryParameters:V.list(RQn),headers:V.list(RCi),pathParameters:V.list(TQn)});var r4o=V.enum_(["client","server"]);var i4o=V.objectWithoutOptionalProperties({name:V.string(),origin:r4o,body:V.lazy(()=>id)});var n4o=V.objectWithoutOptionalProperties({name:V.string(),url:V.string()});var a4o=V.objectWithoutOptionalProperties({messageType:V.string(),payload:V.lazy(()=>$m)}).extend(qi);var o4o=V.objectWithoutOptionalProperties({name:V.string().optional(),queryParameters:V.list(VQn).optional(),headers:V.list(WQn).optional(),messages:V.list(a4o)}).extend(qi);var u4o=V.objectWithoutOptionalProperties({audiences:V.list(V.string()),path:V.string(),groupName:TCi,summary:V.string().optional(),handshake:t4o,messages:V.list(i4o),servers:V.list(n4o),examples:V.list(o4o)}).extend(qi).extend(ru);var s4o=V.objectWithoutOptionalProperties({rootSchemas:V.record(gx,V.lazy(()=>id)),namespacedSchemas:V.record(PUo,V.record(gx,V.lazy(()=>id)))});var c4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional()});var l4o=V.objectWithoutOptionalProperties({default:V.number().optional()});var f4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional()});var d4o=V.objectWithoutOptionalProperties({default:V.string().optional(),pattern:V.string().optional(),format:V.string().optional(),minLength:V.number().optional(),maxLength:V.number().optional()});var p4o=V.objectWithoutOptionalProperties({default:V.boolean().optional()});var _4o=V.union("type",{int:c4o,int64:l4o,uint:V.object({}),uint64:V.object({}),float:V.object({}),double:f4o,string:d4o,datetime:V.object({}),date:V.object({}),base64:V.object({}),boolean:p4o}).transform({transform:e=>{switch(e.type){case"int":return ih.int(e);case"int64":return ih.int64(e);case"uint":return ih.uint();case"uint64":return ih.uint64();case"float":return ih.float();case"double":return ih.double(e);case"string":return ih.string(e);case"datetime":return ih.datetime();case"date":return ih.date();case"base64":return ih.base64();case"boolean":return ih.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var NCi=V.objectWithoutOptionalProperties({schema:_4o}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var h4o=V.list(V.record(CCi,V.list(V.string())));var y4o=V.objectWithoutOptionalProperties({header:V.string(),name:V.string().optional(),optional:V.boolean().optional(),env:V.string().optional(),schema:V.lazy(()=>id).optional()});var b4o=V.objectWithoutOptionalProperties({header:V.string(),name:V.string().optional(),env:V.string().optional(),schema:V.lazy(()=>id).optional()});var K__=V.objectWithoutOptionalProperties({apiVersion:V.unknown().optional(),title:V.string().optional(),description:V.string().optional(),basePath:V.string().optional(),servers:V.list(LPa),websocketServers:V.list(LPa),groups:V.record(V.string(),DUo),tags:BUo,hasEndpointsMarkedInternal:V.boolean(),endpoints:V.list(kUo),webhooks:V.list(e4o),channels:V.record(V.string(),u4o),groupedSchemas:s4o,variables:V.record(V.string(),NCi),nonRequestReferencedSchemas:V.set(gx),securitySchemes:V.record(CCi,mUo),security:h4o.optional(),globalHeaders:V.list(y4o).optional(),idempotencyHeaders:V.list(b4o).optional()});var p9t=V.objectWithoutOptionalProperties({schema:gx}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd);var v4o=V.union("type",{boolean:V.object({value:V.boolean()}),string:V.object({value:V.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return Rj.boolean(e.value);case"string":return Rj.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var $Qn=V.objectWithoutOptionalProperties({value:v4o}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var id=V.union("type",{primitive:NCi,object:V.lazyObject(()=>g4o),array:V.lazyObject(()=>O4o),map:V.lazyObject(()=>A4o),optional:V.lazyObject(()=>m4o),enum:DQn,reference:p9t,literal:$Qn,oneOf:V.object({value:V.lazy(()=>j4o)}),nullable:V.lazyObject(()=>P4o),unknown:xl}).transform({transform:e=>{switch(e.type){case"primitive":return Xs.primitive(e);case"object":return Xs.object(e);case"array":return Xs.array(e);case"map":return Xs.map(e);case"optional":return Xs.optional(e);case"enum":return Xs.enum(e);case"reference":return Xs.reference(e);case"literal":return Xs.literal(e);case"oneOf":return Xs.oneOf(e.value);case"nullable":return Xs.nullable(e);case"unknown":return Xs.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var YQn=V.objectWithoutOptionalProperties({propertyKey:V.string(),allOfSchemaIds:V.list(gx),conflictingTypeSignatures:V.boolean()});var g4o=V.objectWithoutOptionalProperties({allOf:V.list(p9t),properties:V.list(V.lazyObject(()=>w4o)),allOfPropertyConflicts:V.list(YQn),additionalProperties:V.boolean()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var XQn=V.objectWithoutOptionalProperties({differentSchema:V.boolean()});var w4o=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>id),readonly:V.boolean().optional(),writeonly:V.boolean().optional(),conflict:V.record(gx,XQn),generatedName:V.string(),nameOverride:V.string().optional(),audiences:V.list(V.string())}).extend(vu);var O4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var A4o=V.objectWithoutOptionalProperties({key:NCi,value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(xd).extend(fO);var m4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var P4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>id)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var j4o=V.union("type",{discriminated:V.lazyObject(()=>E4o),undiscriminated:V.lazyObject(()=>S4o)}).transform({transform:e=>{switch(e.type){case"discriminated":return c9t.discriminated(e);case"undiscriminated":return c9t.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var E4o=V.objectWithoutOptionalProperties({discriminantProperty:V.string(),commonProperties:V.list(V.lazyObject(()=>M4o)),schemas:V.record(V.string(),V.lazy(()=>id))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var M4o=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>id)});var S4o=V.objectWithoutOptionalProperties({schemas:V.list(V.lazy(()=>id))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var msc={};Yt(msc,{ArraySchemaWithExample:()=>X4o,Base64WithExample:()=>H4o,BooleanWithExample:()=>K4o,CommonPropertyWithExample:()=>oLo,DateWithExample:()=>G4o,DatetimeWithExample:()=>x4o,DiscriminatedOneOfSchemaWithExample:()=>nLo,DoubleWithExample:()=>V4o,EndpointWithExample:()=>$__,EnumSchemaWithExample:()=>$4o,FloatWithExample:()=>L4o,HeaderWithExample:()=>FCi,HttpErrorWithExample:()=>z4o,Int64WithExample:()=>F4o,IntWithExample:()=>N4o,JsonRequestWithExample:()=>C4o,JsonResponseWithExample:()=>kQn,MapSchemaWithExample:()=>Z4o,NamedFullExample:()=>K0e,NullableSchemaWithExample:()=>eLo,ObjectPropertyWithExample:()=>iLo,ObjectSchemaWithExample:()=>tLo,OneOfSchemaWithExample:()=>rLo,OptionalSchemaWithExample:()=>k4o,ParseFormUrlEncodedRequest:()=>q4o,ParseMultipartRequest:()=>I4o,ParseOctetStreamRequest:()=>B4o,PathParameterWithExample:()=>D4o,PrimitiveSchemaValueWithExample:()=>J4o,PrimitiveSchemaWithExample:()=>eUn,QueryParameterWithExample:()=>ZQn,RequestWithExample:()=>T4o,ResponseWithExample:()=>R4o,SchemaWithExample:()=>dO,StringSchemaWithExample:()=>W4o,Uint64WithExample:()=>U4o,UintWithExample:()=>Q4o,UnDiscriminatedOneOfSchemaWithExample:()=>aLo,UnknownSchemaWithExample:()=>Y4o,WebhookWithExample:()=>Y__,WebsocketHandshakeWithExample:()=>J__});var K0e=V.objectWithoutOptionalProperties({name:V.string().optional(),value:V.unknown()}).extend(qi);var ZQn=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>dO),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var FCi=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>dO),env:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var J__=V.objectWithoutOptionalProperties({queryParameters:V.list(ZQn),headers:V.list(FCi)});var D4o=V.objectWithoutOptionalProperties({name:V.string(),schema:V.lazy(()=>dO),variableReference:V.string().optional(),parameterNameOverride:V.string().optional()}).extend(qi).extend(vu).extend(ru);var B4o=V.objectWithoutOptionalProperties({}).extend(zQn).extend(f9t);var I4o=V.objectWithoutOptionalProperties({}).extend(NQn).extend(f9t);var C4o=V.objectWithoutOptionalProperties({schema:V.lazy(()=>dO),contentType:V.string().optional(),fullExamples:V.list(K0e).optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru).extend(f9t);var q4o=V.objectWithoutOptionalProperties({schema:V.lazy(()=>dO),contentType:V.string().optional(),fullExamples:V.list(K0e).optional(),additionalProperties:V.boolean()}).extend(qi).extend(ru).extend(f9t);var T4o=V.union("type",{octetStream:B4o,multipart:I4o,json:C4o,formUrlEncoded:q4o}).transform({transform:e=>{switch(e.type){case"octetStream":return vx.octetStream(e);case"multipart":return vx.multipart(e);case"json":return vx.json(e);case"formUrlEncoded":return vx.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var kQn=V.objectWithoutOptionalProperties({schema:V.lazy(()=>dO),responseProperty:V.string().optional(),fullExamples:V.list(K0e).optional()}).extend(qi).extend(ru).extend(H0e);var R4o=V.union("type",{file:FQn,json:kQn,text:zCi,bytes:UQn,streamingSse:kQn,streamingText:zCi,streamingJson:kQn}).transform({transform:e=>{switch(e.type){case"file":return yP.file(e);case"json":return yP.json(e);case"text":return yP.text(e);case"bytes":return yP.bytes(e);case"streamingSse":return yP.streamingSse(e);case"streamingText":return yP.streamingText(e);case"streamingJson":return yP.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var z4o=V.objectWithoutOptionalProperties({statusCode:l9t,schema:V.lazy(()=>dO),fullExamples:V.list(K0e).optional()}).extend(qi).extend(xl).extend(ru);var $__=V.objectWithoutOptionalProperties({authed:V.boolean(),security:CQn.optional(),internal:V.boolean().optional(),idempotent:V.boolean().optional(),method:qQn,audiences:V.list(V.string()),path:V.string(),summary:V.string().optional(),operationId:V.string().optional(),tags:V.list(Ox),pathParameters:V.list(D4o),queryParameters:V.list(ZQn),headers:V.list(FCi),sdkName:d9t.optional(),generatedRequestName:V.string(),requestNameOverride:V.string().optional(),request:T4o.optional(),response:R4o.optional(),errors:V.record(l9t,z4o),servers:V.list(LQn),examples:V.list(xQn),pagination:GQn.optional(),retries:HQn.optional()}).extend(qi).extend(vu).extend(ru).extend(El);var Y__=V.objectWithoutOptionalProperties({audiences:V.list(V.string()),sdkName:d9t.optional(),method:KQn,summary:V.string().optional(),operationId:V.string(),tags:V.list(Ox),headers:V.list(FCi),generatedPayloadName:V.string(),payload:V.lazy(()=>dO),examples:V.list(JQn)}).extend(qi).extend(ru).extend(El);var N4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional(),example:V.number().optional()});var F4o=V.objectWithoutOptionalProperties({default:V.number().optional(),example:V.number().optional()});var Q4o=V.objectWithoutOptionalProperties({default:V.number().optional(),example:V.number().optional()});var U4o=V.objectWithoutOptionalProperties({default:V.number().optional(),example:V.number().optional()});var L4o=V.objectWithoutOptionalProperties({example:V.number().optional()});var V4o=V.objectWithoutOptionalProperties({default:V.number().optional(),minimum:V.number().optional(),maximum:V.number().optional(),exclusiveMinimum:V.boolean().optional(),exclusiveMaximum:V.boolean().optional(),multipleOf:V.number().optional(),example:V.number().optional()});var W4o=V.objectWithoutOptionalProperties({default:V.string().optional(),pattern:V.string().optional(),format:V.string().optional(),minLength:V.number().optional(),maxLength:V.number().optional(),example:V.string().optional()});var x4o=V.objectWithoutOptionalProperties({example:V.string().optional()});var G4o=V.objectWithoutOptionalProperties({example:V.string().optional()});var H4o=V.objectWithoutOptionalProperties({example:V.string().optional()});var K4o=V.objectWithoutOptionalProperties({default:V.boolean().optional(),example:V.boolean().optional()});var J4o=V.union("type",{int:N4o,int64:F4o,uint:Q4o,uint64:U4o,float:L4o,double:V4o,string:W4o,datetime:x4o,date:G4o,base64:H4o,boolean:K4o}).transform({transform:e=>{switch(e.type){case"int":return Un.int(e);case"int64":return Un.int64(e);case"uint":return Un.uint(e);case"uint64":return Un.uint64(e);case"float":return Un.float(e);case"double":return Un.double(e);case"string":return Un.string(e);case"datetime":return Un.datetime(e);case"date":return Un.date(e);case"base64":return Un.base64(e);case"boolean":return Un.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var eUn=V.objectWithoutOptionalProperties({schema:J4o}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var $4o=V.objectWithoutOptionalProperties({default:qCi.optional(),values:V.list(qCi),example:V.string().optional()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var Y4o=V.objectWithoutOptionalProperties({example:V.unknown()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd);var dO=V.union("type",{primitive:eUn,object:V.lazyObject(()=>tLo),array:V.lazyObject(()=>X4o),map:V.lazyObject(()=>Z4o),optional:V.lazyObject(()=>k4o),enum:$4o,reference:p9t,literal:$Qn,oneOf:V.object({value:V.lazy(()=>rLo)}),nullable:V.lazyObject(()=>eLo),unknown:Y4o}).transform({transform:e=>{switch(e.type){case"primitive":return ni.primitive(e);case"object":return ni.object(e);case"array":return ni.array(e);case"map":return ni.map(e);case"optional":return ni.optional(e);case"enum":return ni.enum(e);case"reference":return ni.reference(e);case"literal":return ni.literal(e);case"oneOf":return ni.oneOf(e.value);case"nullable":return ni.nullable(e);case"unknown":return ni.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var X4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>dO),example:V.list(V.unknown()).optional()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var Z4o=V.objectWithoutOptionalProperties({key:eUn,value:V.lazy(()=>dO),example:V.unknown().optional()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(xd).extend(fO);var k4o=V.objectWithoutOptionalProperties({value:V.lazy(()=>dO)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var eLo=V.objectWithoutOptionalProperties({value:V.lazy(()=>dO)}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(xd).extend(fO);var tLo=V.objectWithoutOptionalProperties({allOf:V.list(p9t),properties:V.list(V.lazyObject(()=>iLo)),allOfPropertyConflicts:V.list(YQn),fullExamples:V.list(K0e).optional(),additionalProperties:V.boolean()}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(ru).extend(xd).extend(fO);var iLo=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>dO),readonly:V.boolean().optional(),writeonly:V.boolean().optional(),audiences:V.list(V.string()),conflict:V.record(gx,XQn),nameOverride:V.string().optional(),generatedName:V.string()}).extend(vu);var rLo=V.union("type",{discriminated:V.lazyObject(()=>nLo),undiscriminated:V.lazyObject(()=>aLo)}).transform({transform:e=>{switch(e.type){case"discriminated":return Mhe.discriminated(e);case"undiscriminated":return Mhe.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var nLo=V.objectWithoutOptionalProperties({discriminantProperty:V.string(),commonProperties:V.list(V.lazyObject(()=>oLo)),schemas:V.record(V.string(),V.lazy(()=>dO))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var oLo=V.objectWithoutOptionalProperties({key:V.string(),schema:V.lazy(()=>dO)});var aLo=V.objectWithoutOptionalProperties({schemas:V.list(V.lazy(()=>dO))}).extend(Gd).extend(El).extend(xl).extend(qi).extend(vu).extend(tK).extend(ru).extend(xd).extend(fO);var X__=/^(\d+)/,tUn=/^[a-zA-Z][a-zA-Z0-9_]*$/,Z__={"<":"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 bJi(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let o=Math.floor(e/10),c=e%10;return c===0?i[o]:`${i[o]}_${t[c]}`}if(e<1e3){let o=Math.floor(e/100),c=e%100;return c===0?`${t[o]}_hundred`:`${t[o]}_hundred_${bJi(c)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${bJi(a)}`}function VPa(e){let t=e.match(X__);if(t&&t[0]!=null){let r=t[0],i=e.substring(r.length),n=parseFloat(r);if(!isNaN(n)&&isFinite(n)){let a=bJi(n);return i.length>0?`${a}_${i}`:a}}}function rUn(e){let t=VPa(e),r=Z__[e];return t!=null?TP(Fo(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":TP(Fo(e)))}function rK(e,t){return e.type==="primitive"&&t.type==="primitive"?k__(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?OeM(e.values,t.values):e.type==="array"&&t.type==="array"?rK(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"?rK(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?AeM(e.value,t.value):e.type==="object"&&t.type==="object"?meM(e,t):e.type==="map"&&t.type==="map"?k__(e.key.schema,t.key.schema)&&rK(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function k__(e,t){return e.type===t.type}function OeM(e,t){let r=new Set(...e.map(n=>n.value)),i=new Set(...t.map(n=>n.value));return kq(r,i)}function AeM(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,i])=>{let n=t.schemas[r];return n==null?!1:rK(i,n)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,i)=>{let n=t.schemas[i];return n==null?!1:rK(r,n)}):!1}function meM(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(i=>[i.key,i.schema]));return Object.entries(t.properties).every(([i,n])=>{let a=r[i];return a==null?!1:rK(a,n.schema)})}function ZE(e){switch(e){case pz.Deprecated:return"deprecated";case pz.Beta:return"pre-release";case pz.GenerallyAvailable:return"generally-available";default:return}}function PeM(e){let t=e.find(i=>typeof i=="object"&&i.type==="namespace"),r=e.filter(i=>typeof i=="string"||i.type!=="namespace");return t?[t,...r]:r}function eh_(e){let t=e?PeM(e):void 0;if(t==null||t.length===0)return Lxi;let r=[];for(let[i,n]of t.entries())if(typeof n=="string")r.push(Fo(n));else if(typeof n=="object")switch(n.type){case"namespace":{i<t.length-1?r.push(Fo(n.name)):r.push(n.name,Lxi);break}default:Ot(n.type)}else Ot(n);return r.join("/")}function QCi(e){return qu.of(`${eh_(e)}.yml`)}function Psc({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?Lxi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(i=>typeof i=="string"||i.type!=="namespace")]:r=e.groupName,eh_(r))}function th_({sdkName:e,namespaceOverride:t}){return qu.of(`${Psc({sdkName:e,namespaceOverride:t})}.yml`)}function rh_({location:e,namespaceOverride:t}){return t!=null?tD(qu.of(t),e):e}function uLo(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Ot(e.type)}}function iUn(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:Ot(e)}}function pO(e){return typeof e=="string"?e:e.type}function nUn(e){if(typeof e!="string")return e.docs}function WPa(e){if(typeof e!="string")return e.default}function jsc(e){if(typeof e!="string")return e.validation}function xPa(e){let t=e.match(/^optional<\s*nullable<\s*(.+)\s*>\s*>$/);if(t!=null&&t[1]!=null)return t[1].trim();let r=e.match(/^nullable<\s*(.+)\s*>$/);return r!=null&&r[1]!=null?r[1].trim():e}function nh_(e){let t=pO(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?ih_(e):{...e,type:ih_(e.type)}}function ih_(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function vJi(e){return pO(e).startsWith("optional<")?e:typeof e=="string"?ah_(e):{...e,type:ah_(e.type)}}function ah_(e){return e.startsWith("optional<")?e:`optional<${e}>`}var jeM=-2147483648,weM=2147483647,EeM=-17976931348623157e292,SeM=17976931348623157e292;function Of({schema:e,fileContainingReference:t,declarationFile:r=t,context:i,namespace:n,declarationDepth:a}){switch(i.shouldMarkSchemaAsReferenced()&&i.markSchemaAsReferenced(e,n),e.type){case"primitive":return sLo(e);case"array":return Ssc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"map":return Msc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"reference":return Esc({schema:e,fileContainingReference:t,context:i,namespace:n});case"unknown":return Bsc();case"optional":return cLo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"nullable":return Dsc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"enum":return zeM({schema:e,fileContainingReference:t,context:i,declarationFile:r,declarationDepth:a});case"literal":return e.value,Isc(e);case"object":return NeM({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"oneOf":return FeM({schema:e.value,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});default:Ot(e)}}function sLo(e){switch(e.schema.type){case"string":return BeM({description:e.description,schema:e.schema});case"int":return IeM({description:e.description,schema:e.schema});case"float":return CeM({description:e.description,schema:e.schema});case"double":return qeM({description:e.description,schema:e.schema});case"boolean":return MeM({description:e.description,schema:e.schema});case"int64":return DeM({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:ZE(e.availability)}:{}}}function MeM({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function DeM({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function BeM({description:e,schema:t}){let r="string",i=TeM(t);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function IeM({description:e,schema:t}){let r="integer",i=oh_(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function CeM({description:e,schema:t}){let r="float";if(e==null)return r;let i={type:r};return e!=null&&(i.docs=e),i}function qeM({description:e,schema:t}){let r="double",i=oh_(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function TeM(e){if(e==null)return;let{format:t,pattern:r,minLength:i,maxLength:n}=e,a=ReM(t);if(!(a==null&&r==null&&i==null&&n==null))return{format:a,pattern:r,minLength:i,maxLength:n}}function ReM(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 oh_(e,t){if(e==null)return;let{minimum:r,maximum:i,multipleOf:n}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=wsc(r,t),i=wsc(i,t),n=wsc(n,t),!(r==null&&i==null&&a==null&&o==null&&n==null))return{min:r,max:i,exclusiveMin:a,exclusiveMax:o,multipleOf:n}}function wsc(e,t){if(e===void 0)return;let[r,i]=t==="integer"?[jeM,weM]:[EeM,SeM];return e<r||e>i?void 0:e}function Esc({schema:e,fileContainingReference:t,context:r,namespace:i}){let n=r.getSchema(e.schema,i);if(n==null)return"unknown";let a=QeM(n)??e.schema,o=iUn(n),c=UeM(n),s=lLo({context:r,fileContainingReference:t,declarationFile:QCi(o),type:a});return n.type==="nullable"&&(s=r.options.wrapReferencesToNullableInOptional?`optional<${s}>`:`nullable<${s}>`),n.type==="optional"&&!s.startsWith("optional<")&&(s=`optional<${s}>`),e.description==null&&c==null?s:{type:s,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function Ssc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=`list<${pO(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{},type:c}}function Msc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=sLo(e.key),c=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),f=e.encoding!=null?uLo(e.encoding):void 0,s=`map<${pO(o)}, ${pO(c)}>`;if(e.description==null&&f==null&&e.title==null)return s;let u={type:s};return e.description!=null&&(u.docs=e.description),e.encoding!=null&&(u.encoding=f),e.availability!=null&&(u.availability=ZE(e.availability)),u}function Dsc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){if(!i.options.respectNullableSchemas)return cLo({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});let o=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=pO(o),f=nUn(o),s=WPa(o),u=jsc(o),l=nh_(c);if(i.options.wrapReferencesToNullableInOptional&&(l=vJi(l)),e.availability==null&&e.description==null&&f==null&&s==null&&u==null&&e.title==null)return l;let p=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(p.docs=e.description??f),s!=null&&(p.default=s),u!=null&&(p.validation=u),e.availability!=null&&(p.availability=ZE(e.availability)),p}function cLo({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=Of({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=pO(o),f=nUn(o),s=WPa(o),u=jsc(o),l=vJi(c);if(e.availability==null&&e.description==null&&f==null&&s==null&&u==null&&e.title==null)return l;let p=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(p.docs=e.description??f),s!=null&&(p.default=s),u!=null&&(p.validation=u),e.availability!=null&&(p.availability=ZE(e.availability)),p}function Bsc(){return"unknown"}function Isc(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ot(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function zeM({schema:e,fileContainingReference:t,declarationFile:r,context:i,declarationDepth:n}){let a=GPa(e,n),o=e.nameOverride??e.generatedName;i.builder.addType(r,{name:o,schema:a.schema});let c=lLo({type:o,fileContainingReference:t,declarationFile:r,context:i});if(e.description==null&&e.default==null&&e.title==null)return c;let f={type:c};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.availability!=null&&(f.availability=ZE(e.availability)),f}function NeM({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=Csc({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=e.nameOverride??e.generatedName;i.builder.addType(r,{name:c,schema:o.schema});let f=lLo({type:c,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?f:{type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function FeM({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let o=qsc({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=e.nameOverride??e.generatedName;i.builder.addType(r,{name:c,schema:o.schema});let f=lLo({type:c,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ZE(e.availability)}:{}}}function lLo({type:e,fileContainingReference:t,declarationFile:r,context:i}){if(r===t)return e;let n=i.builder.addImport({file:t,fileToImport:r});return n!=null?`${n}.${e}`:e}function QeM(e){return Xs._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 UeM(e){return Xs._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 I1;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(I1||(I1={}));function Fvi(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ot(e)}}function sh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a;switch(e.type){case"primitive":a=WeM(e);break;case"array":a=LeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"map":a=VeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"reference":a=xeM({schema:e,context:t,declarationFile:r,namespace:i});break;case"unknown":a=HeM(e.nameOverride,e.generatedName);break;case"optional":a=lh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"nullable":a=GeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"enum":a=GPa(e,n);break;case"literal":a=KeM(e,e.nameOverride,e.generatedName);break;case"object":a=Csc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"oneOf":a=qsc({schema:e.value,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;default:Ot(e)}return a}function Csc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=t.isInState(I1.Request)&&t.options.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},f=new Set;for(let _ of e.properties){if(_.readonly&&(o=!0),a&&_.readonly)continue;if(Object.keys(_.conflict).length>0){if(Object.entries(_.conflict).every(([g,m])=>!m.differentSchema))continue;Object.entries(_.conflict).forEach(([g])=>{Tsc({property:_.key,schemaId:g,context:t,namespace:i}).forEach(j=>{f.add(j)})})}let h=Of({schema:_.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}),y=_.audiences,b=_.nameOverride,v=ZE(_.availability),O=XeM(_);c[_.key]=YeM({typeReference:h,audiences:y,name:b,availability:v,propertyAccess:O})}let s=new Set;for(let _ of e.allOfPropertyConflicts)_.allOfSchemaIds.forEach(h=>f.add(h)),_.conflictingTypeSignatures&&s.add(_.propertyKey);let u=[];for(let _ of e.allOf){let h=fh_({schema:_.schema,context:t,namespace:i});if(h==null||f.has(_.schema)||f.has(h))continue;let y=Of({schema:Xs.reference(_),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});u.push(xPa(pO(y)))}for(let _ of f){let h=Rsc(t,_,i);for(let y of h.properties)c[y.key]==null&&(s.has(y.key)&&(c[y.key]="unknown"),c[y.key]=Of({schema:y.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}));for(let y of h.allOf){if(f.has(y.schema))continue;let b=Of({schema:Xs.reference(y),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});u.push(xPa(pO(b)))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([_,h])=>$eM(_)?[_,typeof h=="string"?{type:h,name:`_${_}`}:{...h,name:`_${_}`}]:[_,h]))};u.length>0&&(l.extends=u),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=ZE(e.availability)),e.source!=null&&(l.source=Fvi(e.source)),l.inline=zsc(e,n);let p=e.nameOverride??e.generatedName;return{name:o&&t.options.respectReadonlySchemas&&!a?`${p}Read`:p,schema:l}}function Tsc({property:e,schemaId:t,context:r,namespace:i}){let n=r.getSchema(t,i);if(n==null)return[];if(n.type==="reference")return Tsc({property:e,schemaId:n.schema,context:r,namespace:i});if(n.type==="object"){let{properties:a,allOf:o}=Rsc(r,t,i),c=a.some(s=>s.key===e),f=[...o.flatMap(s=>Tsc({property:e,context:r,schemaId:s.schema,namespace:i}))];if(c||f.length>0)return[t,...f]}return[]}function ch_(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?Rsc(e,t.schema,r):t.type==="nullable"?ch_(e,t.value,r):{properties:[],allOf:[]}}function Rsc(e,t,r){let i=e.getSchema(t,r);return i==null?{properties:[],allOf:[]}:ch_(e,i,r)}function LeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:Ssc({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function VeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:Msc({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function WeM(e){let t=sLo(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...i}=t;return{name:e.nameOverride??e.generatedName,schema:{...i}}}function uh_(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function GPa(e,t){let r={enum:e.values.map(a=>{let o=a.nameOverride??a.generatedName,c=a.value;if(o===c&&a.description==null&&(a.casing==null||uh_(a.casing)))return o;let f={value:a.value};if(o!==c&&(f.name=o),a.description!=null&&(f.docs=a.description),a.casing!=null&&!uh_(a.casing)){let s={},u=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,u=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,u=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,u=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,u=!0),u&&(f.casing=s)}return f})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=zsc(e,t);let i=new Set,n={...r,enum:[],source:e.source!=null?Fvi(e.source):void 0};for(let a of r.enum){let o=typeof a=="string"?a:a.name??a.value;i.has(o.toLowerCase())||(n.enum.push(a),i.add(o.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:n}}function xeM({schema:e,context:t,declarationFile:r,namespace:i}){return{name:e.nameOverride??e.generatedName,schema:Esc({schema:e,context:t,fileContainingReference:r,namespace:i})}}function GeM({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:Dsc({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}:lh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n})}function lh_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:cLo({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}}function HeM(e,t){return{name:e??t,schema:Bsc()}}function KeM(e,t,r){return{name:t??r,schema:Isc(e)}}function qsc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=e.encoding!=null?uLo(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let s of e.commonProperties)c[s.key]=Of({schema:s.schema,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1});let f={};for(let[s,u]of Object.entries(e.schemas))f[s]=Of({schema:u,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?ZE(e.availability):void 0,union:f,encoding:a,source:e.source!=null?Fvi(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(Of({schema:c,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:o,encoding:a,source:e.source!=null?Fvi(e.source):void 0,inline:zsc(e,n)}}}var JeM=/^[0-9]/;function $eM(e){return JeM.test(e)}function fh_({schema:e,context:t,namespace:r}){let i=t.getSchema(e,r);if(i!=null)return i.type==="reference"?fh_({context:t,schema:i.schema,namespace:r}):e}function YeM({typeReference:e,audiences:t,name:r,availability:i,propertyAccess:n}){return t.length===0&&r==null&&i==null&&n==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...i!=null?{availability:i}:{},...n!=null?{access:n}:{}}}function zsc(e,t){return e.inline===!0||t>0?!0:void 0}function XeM(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return OD.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return OD.ObjectPropertyAccess.WriteOnly}}function dh_(e){let t=e.replace(/^x-|^X-/,"");return Fo(t)}function ph_(e){if(e.authOverrides!=null){for(let[r,i]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:i});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,i]of Object.entries(e.ir.securitySchemes))if(i.type==="basic"){let n={scheme:"basic"};i.usernameVariableName!=null&&(n.username===void 0?n.username={name:i.usernameVariableName}:n.username.name=i.usernameVariableName),i.usernameEnvVar!=null&&(n.username===void 0?n.username={env:i.usernameEnvVar}:n.username.env=i.usernameEnvVar),i.passwordVariableName!=null&&(n.password===void 0?n.password={name:i.passwordVariableName}:n.password.name=i.passwordVariableName),i.passwordEnvVar!=null&&(n.password===void 0?n.password={env:i.passwordEnvVar}:n.password.env=i.passwordEnvVar),e.builder.addAuthScheme({name:r,schema:n}),t||(e.builder.setAuth(r),t=!0)}else if(i.type==="bearer"){let n={scheme:"bearer"};i.tokenVariableName!=null&&(n.token===void 0?n.token={name:i.tokenVariableName}:n.token.name=i.tokenVariableName),i.tokenEnvVar!=null&&(n.token===void 0?n.token={env:i.tokenEnvVar}:n.token.env=i.tokenEnvVar),e.builder.addAuthScheme({name:r,schema:n}),t||(e.builder.setAuth(r),t=!0)}else if(i.type==="header")if(t)e.builder.addGlobalHeader({name:i.headerName,schema:{type:"string",name:i.headerVariableName??dh_(i.headerName),env:i.headerEnvVar}});else{let n={header:i.headerName,name:i.headerVariableName??"apiKey",type:"string"};i.headerEnvVar!=null&&(n.env=i.headerEnvVar),i.prefix!=null&&(n.prefix=i.prefix),e.builder.addAuthScheme({name:r,schema:n}),e.builder.setAuth(r),t=!0}else if(i.type==="oauth"){let n={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:n}),t||(e.builder.setAuth(r),t=!0),i.scopesEnum!=null&&i.scopesEnum.values.length>0&&e.builder.addType(qu.of("__package__.yml"),{name:"OauthScope",schema:GPa(i.scopesEnum,0).schema})}}function _9t({header:e,context:t,fileContainingReference:r,namespace:i}){let n=Of({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),a=pO(n),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:Fo(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let f={type:a};return c!==e.name&&(f.name=c),e.description!=null&&(f.docs=e.description),e.env!=null&&(f.env=e.env),e.availability!=null&&(f.availability=ZE(e.availability)),f}function fLo({pathParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=Of({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return pO(n);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:pO(n)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=ZE(e.availability)),a}function pLo({queryParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=Nsc({schema:e.schema,context:t,fileContainingReference:r,namespace:i});if(n==null)return;let a=pO(n.value),o=WPa(n.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return o!=null&&(c.default=o),n.allowMultiple&&(c["allow-multiple"]=!0),e.description!=null&&(c.docs=e.description),e.parameterNameOverride!=null&&(c.name=e.parameterNameOverride),e.availability!=null&&(c.availability=ZE(e.availability)),ZeM(n.value)&&n.value.validation!==void 0&&(c.validation=n.value.validation),c.default==null&&c["allow-multiple"]==null&&c.docs==null&&c.name==null&&c.availability==null&&c.validation==null?a:c}function Nsc({schema:e,context:t,fileContainingReference:r,namespace:i}){if(e.type==="reference"){let n=t.getSchema(e.schema,i);if(n==null)return;if(n.type==="array")return{value:Of({schema:Xs.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:qu.of(ib),fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(n.type==="oneOf"&&n.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(n.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(tUn.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:rUn(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(n.value.schemas.length===2){let[c,f]=n.value.schemas;if(c!=null&&f!=null&&dLo({array:c,primitive:f}))return{value:Of({schema:Xs.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&dLo({array:c,primitive:f}))return{value:Of({schema:Xs.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:i,declarationDepth:0}),allowMultiple:!0}}for(let[c,f]of Object.entries(n.value.schemas))return Nsc({schema:f,context:t,fileContainingReference:r,namespace:i})}else if(t.options.objectQueryParameters)return{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let n=e.type==="optional"?Xs.optional:Xs.nullable;if(e.value.type==="reference"){let a=t.getSchema(e.value.schema,i);if(a==null)return;if(a.type==="array")return{value:Of({schema:n({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a.value,description:e.description??a.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Of({schema:n({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:i,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(e.value.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(tUn.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:rUn(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[c,f]=e.value.value.schemas;if(c!=null&&f!=null&&dLo({array:c,primitive:f}))return{value:Of({schema:n({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&dLo({array:f,primitive:c}))return{value:Of({schema:n({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:i,declarationDepth:0}),allowMultiple:!0}}if(t.options.objectQueryParameters)return{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1};for(let[c,f]of Object.entries(e.value.value.schemas))return Nsc({schema:n({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i})}else if(e.value.type==="object")return t.options.objectQueryParameters?{value:Of({schema:e,context:t,fileContainingReference:r,declarationFile:qu.of(ib),namespace:i,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Of({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Of({schema:Xs.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:i,declarationDepth:0}),allowMultiple:!0}:{value:Of({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}function dLo({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function ZeM(e){return typeof e=="object"&&e!==null&&"type"in e}function _h_({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"]=keM(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=etM({context:t,namedFullExamples:e.headers}));for(let i of e.messages){let n=UCi(i.payload);n!=null&&r.messages.push({type:i.messageType,body:n})}return r}function keM(e){let t={};return e.forEach(r=>{let i=UCi(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function etM({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),i={};return t.forEach(n=>{let a=UCi(n.value);r.has(n.name)||a!=null&&(i[n.name]=a)}),i}function UCi(e){switch(e.type){case"primitive":return hh_(e.value);case"object":return yh_(e.properties);case"array":return ttM(e.value);case"map":return rtM(e.value);case"oneOf":return itM(e.value);case"enum":return e.value;case"literal":return ntM(e.value);case"unknown":return UCi(e.value);case"null":return null;default:Ot(e)}}function hh_(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:Ot(e)}}function yh_(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,UCi(r)]))}function ttM(e){return e.map(t=>UCi(t))}function rtM(e){return Object.fromEntries(e.map(t=>[hh_(t.key),UCi(t.value)]))}function itM(e){return e.type==="discriminated"?yh_(e.value):UCi(e.value)}function ntM(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ot(e)}}function HPa(e){try{let r=new URL(e).pathname.split("/").filter(i=>i.length>0);if(r.length>0)return r[r.length-1]}catch{}}function _Lo(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function hLo(e,t,r=!1){let i=HPa(t);return r&&i!=null?i:e!=null&&i!=null?`${e}_${i}`:i??e??"websocket"}function Qvi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function yLo(e,t){return t??(e?.groupName!=null?Qvi(e.groupName):void 0)}function bh_({channel:e,context:t,declarationFile:r}){let i=e.servers[0],n=i!=null?t.options.groupEnvironmentsByHost?t.getUrlId(i.url)??hLo(i.name,i.url,!0):i.name:void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${i?.name}", server url="${i?.url}", resolved urlId="${n}" (from collision map: ${t.getUrlId(i?.url??"")!=null})`);let a={path:e.path,url:n,auth:!1};e.audiences!=null&&e.audiences.length>0&&(a.audiences=e.audiences),e.summary!=null&&(a["display-name"]=e.summary),e.description!=null&&(a.docs=e.description);let o=Qvi(e.groupName),c={};if(e.handshake.pathParameters.length>0)for(let u of e.handshake.pathParameters)c[u.name]=fLo({pathParameter:u,context:t,fileContainingReference:r,namespace:o});Object.keys(c).length>0&&(a["path-parameters"]=c);let f={};if(e.handshake.queryParameters.length>0)for(let u of e.handshake.queryParameters){let l=pLo({queryParameter:u,context:t,fileContainingReference:r,namespace:o});l!=null&&(f[u.name]=l)}Object.keys(f).length>0&&(a["query-parameters"]=f);let s={};if(e.handshake.headers.length>0)for(let u of e.handshake.headers){let l=_9t({header:u,context:t,fileContainingReference:r,namespace:o});s[u.name]=l}Object.keys(s).length>0&&(a.headers=s),t.builder.addChannel(r,{channel:a});for(let u of e.messages)t.builder.addChannelMessage(r,{messageId:u.name,message:{origin:u.origin,body:Of({schema:u.body,context:t,fileContainingReference:r,namespace:o,declarationDepth:0})}});for(let u of e.examples){let l=_h_({context:t,websocketExample:u});t.builder.addChannelExample(r,{example:l})}}function Fsc(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var J0e="Base",Oh_="Default";function vh_(e){try{return new URL(e).hostname}catch{return}}function gh_(e){return e??Oh_}function atM(e,t){let r=new Map;for(let i of e){if(Fsc(i)||!("url"in i)||!i.url)continue;let n=vh_(i.url)??i.url;r.has(n)||r.set(n,{environmentName:gh_(i.name),httpServers:[],websocketServers:[]}),r.get(n)?.httpServers.push({name:i.name,url:i.url,audiences:i.audiences})}for(let i of t){let n=vh_(i.url)??i.url;r.has(n)||r.set(n,{environmentName:gh_(i.name),httpServers:[],websocketServers:[]}),r.get(n)?.websocketServers.push(i)}return r}function gJi(e){return Object.entries(e).reduce((t,[r,i])=>(bhe(i)?Object.entries(i.urls).forEach(([n,a])=>{t[n]=a}):t[r]=typeof i=="string"?i:i.url,t),{})}function Ah_(e){if(e.environmentOverrides!=null){for(let[v,O]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:v,schema:O});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],i=e.ir.servers.some(v=>Fsc(v)),n=e.ir.servers;for(let v of n)if(Fsc(v)){let O={urls:{}};for(let[A,g]of Object.entries(v.urls))O.urls[A]=g.url;v.name&&(t[v.name]=O)}else if("url"in v&&v.url){let O=v.audiences?{url:v.url,audiences:v.audiences}:v.url;if(v.name==null){r.push(O);continue}t[v.name]=O}let a={},o={},c=[];for(let v of e.ir.endpoints)for(let O of v.servers){if(O.url==null&&O.name!=null){a[O.name]||(a[O.name]=[]);continue}if(O.url==null)continue;let A=O.audiences?{url:O.url,audiences:O.audiences}:O.url;if(O.name==null){c.push(A);continue}a[O.name]||(a[O.name]=[]),a[O.name]?.push({url:O.url,audiences:O.audiences}),o[O.name]=A}let f={},s=[];for(let v of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${v.name}", url="${v.url}"`);let O=v.audiences?{url:v.url,audiences:v.audiences}:v.url;if(v.name==null){s.push(O);continue}f[v.name]=O}let u=Object.keys(t).length,l=u>0,p=Object.keys(o).length>0,_=Object.keys(a).some(v=>a[v]?.length===0),h=Object.keys(f).length>0;if(e.options.groupEnvironmentsByHost&&h&&(l||e.ir.servers.length>0)){let v=Object.entries(f).map(([A,g])=>({name:A,url:typeof g=="string"?g:g.url,audiences:typeof g=="string"?void 0:g.audiences})),O=atM(n,v);if(O.size>0){let A=!0;for(let[g,m]of O.entries()){let j={},M=[...m.httpServers.map(D=>({...D,isHttp:!0})),...m.websocketServers.map(D=>({...D,isHttp:!1}))],E=new Map;for(let D of M){let B=HPa(D.url),F=_Lo(D.url);B&&F&&(E.has(B)||E.set(B,new Set),E.get(B)?.add(F))}if(m.httpServers.length>0){let D=m.httpServers[0];D!=null&&(j[J0e]=D.url,e.setUrlId(D.url,J0e));for(let B=1;B<m.httpServers.length;B++){let F=m.httpServers[B];if(F!=null){let N=HPa(F.url),R=_Lo(F.url),z=N?E.get(N):void 0,U=z&&z.size>1,K=U&&R!=="https"?`${N}_${R}`:N||`Http${B+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${F.url}", pathSegment="${N}", protocol="${R}", hasCollision=${U}, urlId="${K}"`),j[K]=F.url,e.setUrlId(F.url,K)}}}for(let D of m.websocketServers){let B=HPa(D.url),F=_Lo(D.url),N=B?E.get(B):void 0,R=N&&N.size>1,z=R?`${B}_${F}`:hLo(D.name,D.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${D.name}", url="${D.url}", pathSegment="${B}", protocol="${F}", hasCollision=${R}, urlId="${z}"`),j[z]=D.url,e.setUrlId(D.url,z)}if(Object.keys(j).length>1)e.builder.addEnvironment({name:m.environmentName,schema:{urls:j}});else if(Object.keys(j).length===1){let D=Object.values(j)[0];D!=null&&e.builder.addEnvironment({name:m.environmentName,schema:D})}A&&(e.builder.setDefaultEnvironment(m.environmentName),Object.keys(j).length>1&&e.builder.setDefaultUrl(J0e),A=!1)}return}}if(!l&&!p&&h&&e.ir.servers.length===0){for(let[v,O]of Object.entries(f))e.builder.addEnvironment({name:v,schema:O});e.builder.setDefaultEnvironment(Object.keys(f)[0]),e.builder.setDefaultUrl(J0e);return}if(c.length>0&&e.logger.debug(`Skipping endpoint level servers ${c.map(v=>typeof v=="string"?v:v.url).join(", ")} because x-fern-server-name was not provided.`),!l){let v=e.ir.servers[0]?.url,O=e.ir.servers[0]?.audiences;if(v!=null){let A=O?{url:v,audiences:O}:v;t[Oh_]=A}}let y=Object.values(t).map(v=>typeof v=="string"?v:bhe(v)?Object.values(v.urls)[0]:v.url),b=r.filter(v=>{let O=typeof v=="string"?v:v.url;return!y.includes(O)});if(b.length>0&&e.logger.debug(`Skipping top level servers ${b.map(v=>typeof v=="string"?v:v.url).join(", ")} because x-fern-server-name was not provided.`),i){let v=!0;for(let[O,A]of Object.entries(t))if(e.builder.addEnvironment({name:O,schema:A}),v){if(e.builder.setDefaultEnvironment(O),bhe(A)){let g=Object.keys(A.urls)[0];g&&e.builder.setDefaultUrl(g)}v=!1}return}if(!p&&!_){let v=!0;for(let[O,A]of Object.entries(t))if(v){if(h){let g=typeof A=="string"?A:bhe(A)?Object.values(A.urls)[0]:A.url;e.builder.addEnvironment({name:O,schema:{urls:{[J0e]:g??"",...gJi(f)}}})}else e.builder.addEnvironment({name:O,schema:A});e.builder.setDefaultEnvironment(O),v=!1}else if(h){let g=typeof A=="string"?A:bhe(A)?Object.values(A.urls)[0]:A.url;e.builder.addEnvironment({name:O,schema:{urls:{[J0e]:g??"",...gJi(f)}}})}else e.builder.addEnvironment({name:O,schema:A});h&&e.builder.setDefaultUrl(J0e)}else if(u===1){let v=Object.keys(t)[0],O=Object.values(t)[0],A=typeof O=="string"?O:bhe(O)?Object.values(O.urls)[0]:O.url;e.builder.addEnvironment({name:v,schema:{urls:{[J0e]:A??"",...gJi(o),...gJi(f)}}}),e.builder.setDefaultEnvironment(v),e.builder.setDefaultUrl(J0e)}else{let v=new Map;for(let O of e.ir.endpoints)for(let A of O.servers)if(A.url!=null&&A.name!=null){v.has(A.name)||v.set(A.name,new Map);let g=A.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",m=v.get(A.name);m&&m.set(g,A.url)}if(v.size>0){let O=!0;for(let[A,g]of Object.entries(t)){let m=typeof g=="string"?g:bhe(g)?Object.values(g.urls)[0]:g.url;if(!m)continue;let j=m.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",M={[J0e]:m};for(let[E,D]of v.entries()){let B=D.get(j)||D.get("production")||D.values().next().value;B&&(M[E]=B)}h&&Object.assign(M,gJi(f)),Object.keys(M).length>1?e.builder.addEnvironment({name:A,schema:{urls:M}}):e.builder.addEnvironment({name:A,schema:m}),O&&(e.builder.setDefaultEnvironment(A),O=!1)}v.size>0&&e.builder.setDefaultUrl(J0e)}else{let O=!0;for(let[A,g]of Object.entries(t)){if(h||Object.keys(o).length>0){let m=typeof g=="string"?g:bhe(g)?Object.values(g.urls)[0]:g.url;e.builder.addEnvironment({name:A,schema:{urls:{[J0e]:m??"",...gJi(o),...gJi(f)}}})}else e.builder.addEnvironment({name:A,schema:g});O&&(e.builder.setDefaultEnvironment(A),O=!1)}}}}var Qsc=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},otM=.75,utM=new Set("authorization");function mh_(e){if(e.globalHeaderOverrides!=null){for(let[r,i]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:i});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,i]of Object.entries(t)){let n="optional<string>";if(i.name==null&&i.env==null&&typeof i.schema=="string")n=i.schema;else if(i!=null){let a=i.schema?iUn(i.schema):void 0,o=a!=null?Qvi(a):void 0,c=qu.of("api.yml");n={name:i.name,env:i.env,type:i.schema!=null?pO(Of({schema:i.schema,context:e,fileContainingReference:o?tD(qu.of(Fo(o)),c):c,namespace:o,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:n})}if(e.options.detectGlobalHeaders){let r={};for(let n of e.ir.endpoints)for(let a of n.headers){if(utM.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],f=_9t({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:qu.of(t1),context:e,namespace:void 0});o=new Qsc(f),r[a.name]=o}o.increment()}let i=e.ir.endpoints.length*otM;for(let[n,a]of Object.entries(r)){let o=t[n],c=a.count===e.ir.endpoints.length,f=a.count>=i;o==null&&(c?e.builder.addGlobalHeader({name:n,schema:a.schema}):f&&e.builder.addGlobalHeader({name:n,schema:vJi(a.schema)}))}}}function Ph_(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?iUn(t.schema):void 0,i=r!=null?Qvi(r):void 0,n=_9t({header:{...t,schema:t.schema??Xs.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:ih.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:qu.of(t1),context:e,namespace:i});e.builder.addIdempotencyHeader({name:t.header,schema:vJi(n)})}}function K3(e){switch(e.type){case"primitive":return wh_(e.value);case"object":return Eh_(e.properties);case"array":return Sh_(e.value);case"map":return ctM(e.value);case"oneOf":return ltM(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return ftM(e.value);case"unknown":return K3(e.value);case"null":return null;default:Ot(e)}}function jh_(e){switch(e.type){case"withStreaming":return e.sse?{stream:stM(e.events)}:{stream:Sh_(e.events)};case"withoutStreaming":return{body:K3(e.value)};default:Ot(e)}}function wh_(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:Ot(e)}}function Eh_(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,K3(r)]))}function stM(e){return e.map(t=>({event:"",data:K3(t)}))}function Sh_(e){return e.map(t=>K3(t))}function ctM(e){return Object.fromEntries(e.map(t=>[wh_(t.key),K3(t.value)]))}function ltM(e){return e.type==="discriminated"?Eh_(e.value):K3(e.value)}function ftM(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:Ot(e)}}function Mh_({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"]=dtM(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=ptM(e.queryParameters));let i=e.headers!=null&&e.headers.length>0,n=t.builder.getGlobalHeaders(),a=Object.keys(n).length>0,o=new Set(e.headers?.map(c=>c.name)??[]);if(i||a){let c=[];if(e.headers!=null)for(let f of e.headers)f.name!==t.builder.getAuthHeaderName()&&c.push(f);for(let[f,s]of Object.entries(n))if(!o.has(f))if(s!=null&&typeof s=="object"&&s.type!=null){let u=PB({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:Mt}});u!=null&&c.push({name:f,value:wl.literal(MCi.string(u))})}else c.push({name:f,value:wl.primitive(Ka.string(f))});r.headers=_tM({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=K3(e.request)),e.response!=null&&(r.response=jh_(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(Xu)),r}function dtM(e){let t={};return e.forEach(r=>{let i=K3(r.value);i!=null&&(t[r.parameterNameOverride??r.name]=i)}),t}function ptM(e){let t={};return e.forEach(r=>{let i=K3(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function _tM({context:e,namedFullExamples:t}){let r={};return t.forEach(i=>{let n=K3(i.value);n!=null&&(r[i.name]=n)}),r}function Dh_(e){return hz._visit(e,{get:()=>OD.HttpMethodSchema.Get,post:()=>OD.HttpMethodSchema.Post,put:()=>OD.HttpMethodSchema.Put,patch:()=>OD.HttpMethodSchema.Patch,delete:()=>OD.HttpMethodSchema.Delete,head:()=>OD.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 Bh_(e){return e==="POST"||e==="PUT"||e==="PATCH"}function Ih_({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:i}=r.ir,n=[],a=new Set,o=e.path,c=yLo(e.sdkName,e.namespace),f={};for(let b of e.pathParameters)b.parameterNameOverride&&(o=o.replace(b.name,b.parameterNameOverride)),f[b.parameterNameOverride??b.name]=fLo({pathParameter:b,context:r,fileContainingReference:t,namespace:c}),a.add(b.name);let s={};for(let b of e.queryParameters){let v=pLo({queryParameter:b,context:r,fileContainingReference:t,namespace:c});v!=null&&(s[b.name]=v,a.add(b.name))}let u;if(e.pagination!=null)switch(e.pagination.type){case"cursor":u={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":u={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":u={type:"custom",results:e.pagination.results};break;default:Ot(e.pagination)}let l={path:o,method:Dh_(e.method),auth:htM({endpoint:e,context:r}),docs:e.description??void 0,pagination:u,source:e.source!=null?Fvi(e.source):void 0};!gtM({context:r,request:e.request})&&Object.keys(f).length>0&&(l["path-parameters"]=f),e.summary!=null&&(l["display-name"]=e.summary);let p={},_=r.builder.getGlobalHeaderNames(),h=r.builder.getAuthHeaderName();h!=null&&_.add(h);let y=e.headers.filter(b=>!_.has(b.name));for(let b of y){let v=_9t({header:b,context:r,fileContainingReference:t,namespace:c});p[b.name]=v,a.add(typeof v=="string"?b.name:v.name??b.name)}if(e.request!=null){r.setInState(I1.Request);let b=vtM({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(s).length>0?s:void 0,nonRequestReferencedSchemas:Array.from(i),headers:Object.keys(p).length>0?p:void 0,usedNames:a,namespace:c});l.request=b.value,n=[...n,...b.schemaIdsToExclude??[]],r.unsetInState(I1.Request)}else{let b=r.options.inlinePathParameters&&Object.keys(f).length>0,v=Object.keys(s).length>0,O=Object.keys(p).length>0,A={};(b||v||O)&&(A.name=e.requestNameOverride??e.generatedRequestName),b&&(A["path-parameters"]=f),v&&(A["query-parameters"]=s),O&&(A.headers=p),Object.keys(A).length>0&&(l.request=A)}if(e.response!=null&&e.response._visit({json:b=>{let v=Of({schema:b.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:b.description??void 0,type:pO(v)},b.statusCode!=null&&(l.response["status-code"]=b.statusCode),b.responseProperty!=null&&(l.response.property=b.responseProperty)},streamingJson:b=>{let v=Of({schema:b.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:b.description??void 0,type:pO(v),format:"json"}},streamingSse:b=>{let v=Of({schema:b.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:b.description??void 0,type:pO(v),format:"sse"}},file:b=>{l.response={docs:b.description??void 0,type:"file","status-code":b.statusCode}},bytes:b=>{l.response={docs:b.description??void 0,type:"bytes","status-code":b.statusCode}},streamingText:b=>{l["response-stream"]={docs:b.description??void 0,type:"text"}},text:b=>{l.response={docs:b.description??void 0,type:"text","status-code":b.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let b=r.getDefaultServerName(),v=e.servers[0];v==null?b!=null&&(l.url=b):l.url=v.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=ZE(e.availability)),Object.entries(e.errors).forEach(([b,v])=>{let O=v.generatedName,A=qu.of(ib);r.builder.enableUniqueErrorsPerEndpoint&&(O=`${e.generatedRequestName}${v.generatedName}`,v.schema!=null&&(v.schema.type!=="reference"&&v.schema.type!=="oneOf"?v.schema.generatedName=`${e.generatedRequestName}${v.schema.generatedName}`:v.schema.type==="oneOf"&&(v.schema.value.generatedName=`${e.generatedRequestName}${v.schema.value.generatedName}`)));let g={"status-code":parseInt(b)},m=rh_({location:Ch_,namespaceOverride:c});if(v.schema!=null){let E=Of({schema:v.schema,context:r,fileContainingReference:m,declarationFile:m,namespace:c,declarationDepth:0});g.type=pO(E),g.docs=v.description}r.builder.addError(m,{name:O,schema:r.isErrorUnknownSchema(parseInt(b))?{...g,type:"unknown"}:g}),l.errors==null&&(l.errors=[]);let j=r.builder.addImport({file:t,fileToImport:m});l.errors.push(j!=null?`${j}.${O}`:O),g.type!=null&&v.examples?.forEach(E=>{let D={value:K3(E.example),name:E.name,docs:E.description};r.builder.addErrorExample(m,{name:O,example:D})})}),e.examples.length>0&&(l.examples=ytM({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=btM({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[Usc,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:n}}function htM({endpoint:e,context:t}){if(e.security==null)return t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0;if(e.security.length!==0)return JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function ytM({endpointExamples:e,context:t}){return e.map(r=>{try{return Mh_({endpointExample:r,context:t})}catch(i){throw console.error(`Error building endpoint example: ${i}`),i}})}function btM({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:Ot(e)}}function vtM({endpoint:e,declarationFile:t,context:r,request:i,requestNameOverride:n,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:f,headers:s,usedNames:u,namespace:l}){if(i.type==="json"||i.type==="formUrlEncoded"){let p=i.schema.type==="reference"?i.schema.schema:void 0,_=i.schema.type==="reference"?r.getSchema(i.schema.schema,l):i.schema;if(_?.type!=="object"||p!=null&&f.includes(p)){let O=Of({schema:i.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),A={schemaIdsToExclude:[],value:{body:O}},g=Object.keys(o??{}).length>0,m=Object.keys(c??{}).length>0,j=Object.keys(s??{}).length>0;return g&&(A.value["path-parameters"]=o),m&&(A.value["query-parameters"]=c),j&&(A.value.headers=s),(g||m||j)&&(A.value.name=n??a),i.contentType!=null&&(A.value["content-type"]=i.contentType),i.description!=null&&(A.value.docs=i.description),A}let h=Object.fromEntries(_.properties.filter(O=>O.readonly==null?!0:!(Bh_(e.method)&&O.readonly)).map(O=>{let A=Of({schema:O.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),g=O.nameOverride??O.key,m=ZE(O.availability);if(!u.has(g)&&O.audiences.length<=0)return u.add(g),O.nameOverride!=null?[O.key,{type:pO(A),docs:nUn(A),name:O.nameOverride,availability:m}]:[O.key,m?{...typeof A=="string"?{type:A}:A,availability:m}:A];let j={type:pO(A),docs:nUn(A)};return u.has(g)&&(j.name=O.generatedName),O.audiences.length>0&&(j.audiences=O.audiences),m!=null&&(j.availability=m),u.add(g),[O.key,j]})),y=_.allOf.map(O=>{let A=Of({schema:Xs.reference(O),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return xPa(pO(A))}).filter(O=>O!=="unknown"),b={properties:h};y.length>0&&(b.extends=y),i.additionalProperties&&(b["extra-properties"]=!0);let v={name:n??_.nameOverride??_.generatedName,"path-parameters":o,"query-parameters":c,headers:s,body:b};return i.contentType!=null&&(v["content-type"]=i.contentType),i.description!=null&&(v.docs=i.description),{schemaIdsToExclude:p!=null?[p]:[],value:v}}else if(i.type==="octetStream"){let p={body:"bytes","content-type":i.contentType??nO.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(p.name=n??a),i.description!=null&&(p.docs=i.description),{schemaIdsToExclude:[],value:p}}else if(i.type==="multipart"){let p=Object.fromEntries(i.properties.map(_=>{if(_.schema.type==="file"){let h=_.schema.isArray?"list<file>":"file";if(h=_.schema.isOptional?`optional<${h}>`:h,_.description!=null||_.contentType!=null){let y={type:h};if(_.description!=null&&(y.docs=_.description),_.contentType!=null){let b=_.contentType.split(",")[0];y["content-type"]=b}return[_.key,y]}return[_.key,h]}else{let h=Of({schema:_.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(_.contentType||_.exploded||_.encoding){let y=typeof h=="string"?{type:h}:h;_.contentType!=null&&(y["content-type"]=_.contentType),_.encoding==="form"?y.style="form":_.encoding==="json"?y.style="json":_.exploded&&(y.style="exploded"),h=y}return[_.key,h]}}));return{schemaIdsToExclude:i.name==null?[]:[i.name],value:{name:n??i.name??a,"path-parameters":o,"query-parameters":c,headers:s,body:{properties:p},"content-type":nO.MULTIPART_FORM_DATA,...i.description?{docs:i.description}:{}}}}else Ot(i)}function gtM({context:e,request:t}){if(!e.options.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:Ot(t)}}function OtM({location:e,namespaceOverride:t}){return t!=null?{...e,file:tD(qu.of(t),e.file)}:e}function AtM(e){let t=e.namespace,r=e.tags.filter(f=>f!==t)[0],i=e.operationId;if(i==null)return r!=null?{file:qu.of(`${Fo(r)}.yml`),endpointId:e.summary!=null?Fo(e.summary):Fo(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:qu.of(ib),endpointId:Fo(e.summary)}:{file:qu.of(ib),endpointId:Fo(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:qu.of(ib),endpointId:i};let n=KPa(r),a=KPa(i);if(kq(n,a))return{file:qu.of("__package__.yml"),endpointId:r};let o=jtM({operationId:i,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let f=0;f<n.length;++f){let s=n[f];if(s!=null&&s===a[f])c.push(s);else{let u=Fo(r);return{file:qu.of(`${u}.yml`),endpointId:i,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:qu.of(Fo(c.join("_"))+".yml"),endpointId:Fo(a.slice(c.length).join("_")),tag:r}}function JPa(e){let t=e.tags[0];if(e.sdkName!=null){let r=Psc({sdkName:e.sdkName,namespaceOverride:e.namespace}),i=`${r}.yml`,n=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:qu.of(i),endpointId:e.sdkName.methodName,tag:n?t:void 0}}return OtM({namespaceOverride:e.namespace,location:AtM(e)})}function KPa(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=JOe(t),t}var mtM=new RegExp("[^a-zA-Z0-9{}]+"),PtM=new RegExp("[{}]","g");function jtM({operationId:e,tag:t,path:r,method:i}){let a=`${r.split(mtM).join("_").replaceAll(PtM,"_")}_${i.toLowerCase()}`;if(e.endsWith(a))return{file:qu.of(Fo(t)+".yml"),endpointId:Fo(e.slice(0,-1*a.length)),tag:t}}function qh_(e){let t=new Set,{endpoints:r,tags:i}=e.ir,n=[];for(let a of r){let{endpointId:o,file:c,tag:f}=JPa(a),s=c.split(".")[0];s!=null&&t.add(s);let u;if(a.sdkName!=null){let _=e.ir.groups;for(let h of a.sdkName.groupName){let y=typeof h=="string"?h:h.name,b=_[y];if(b==null)break;if(b.summary!=null||b.description!=null){u=_[y];break}}}let l=f==null?void 0:i.tagsById[f];e.setInState(I1.Endpoint),e.setEndpointMethod(a.method);let p=Ih_({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(I1.Endpoint),n=[...n,...p.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:p.value,source:a.source!=null?Fvi(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":u?.summary??l?.id,docs:u?.description??l?.description??void 0})}return{schemaIdsToExclude:n,sdkGroups:t}}function Th_(e){for(let[t,r]of Object.entries(e.ir.variables)){let i=r.groupName!=null?Qvi(r.groupName):void 0,n=Of({schema:Xs.primitive(r),context:e,fileContainingReference:qu.of(ib),namespace:i,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:pO(n),docs:r.description??void 0}})}}function Rh_(e){for(let t of e.ir.webhooks){let r=StM({webhook:t,context:e});if(r==null)continue;let i=yLo(t.sdkName,t.namespace),n={};for(let o of t.headers)n[o.name]=_9t({header:o,context:e,fileContainingReference:r.file,namespace:i});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:n,payload:Of({schema:t.payload,context:e,fileContainingReference:r.file,namespace:i,declarationDepth:0}),examples:t.examples!=null?t.examples.map(o=>({docs:o.description,name:o.name,payload:K3(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function wtM({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:tD(qu.of(t),e.file)}:e}function EtM({webhook:e,context:t}){let r=e.tags[0],i=e.operationId;if(r==null)return{file:qu.of(ib),endpointId:i};let n=KPa(r),a=KPa(i);if(kq(n,a))return{file:qu.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<n.length;++c){let f=n[c];if(f!=null&&f===a[c])o.push(f);else{let s=Fo(r);return{file:qu.of(`${s}.yml`),endpointId:i,tag:r}}}if(o.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:qu.of(Fo(o.join("_"))+".yml"),endpointId:Fo(a.slice(o.length).join("_")),tag:r}}function StM({webhook:e,context:t}){return e.sdkName!=null?{file:th_({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:wtM({namespaceOverride:e.namespace,location:EtM({webhook:e,context:t})})}var MtM=qu.of(ib);function Nh_(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return zh_({namespace:e.namespace,groupName:e.groupName});case"oneOf":return zh_({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return MtM;default:Ot(e)}}function zh_({namespace:e,groupName:t}){return e!=null&&t!=null?QCi([{type:"namespace",name:e},...t]):e!=null?QCi([{type:"namespace",name:e}]):QCi(t)}var Usc="external",Ch_=qu.of(ib);function Fh_({schemas:e,schemaIdsToExclude:t,namespace:r,context:i}){for(let[n,a]of Object.entries(e)){if(t.includes(n))continue;let o=Nh_(a),c=sh_({schema:a,context:i,declarationFile:o,namespace:r,declarationDepth:0});if(_Ci(c.schema)){let f=pO(c.schema);if(f===(c.name??n)||f===`optional<${c.name??n}>`||f===`nullable<${c.name??n}>`||f===`optional<nullable<${c.name??n}>>`)continue}i.builder.addType(o,{name:c.name??n,schema:c.schema})}}function Qh_(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),Ah_(e),mh_(e),Ph_(e),ph_(e),Th_(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(Usc);let t=qh_(e),r=t.sdkGroups;e.setInState(I1.Webhook),Rh_(e),e.unsetInState(I1.Webhook),e.setInState(I1.Channel);for(let n of Object.values(e.ir.channels)){let a=QCi(n.groupName);bh_({channel:n,context:e,declarationFile:a})}e.unsetInState(I1.Channel);let i=DtM({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});Fh_({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:i,namespace:void 0,context:e});for(let[n,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))Fh_({schemas:a,schemaIdsToExclude:i,namespace:n,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(a=>r.has(a))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.optimizeServiceAuth(),e.builder.build()}function DtM({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let i=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),n=new Set(t);for(let a of i)r.includes(a)||n.add(a);return Array.from(n)}var $Pa=class{context;constructor(t){this.context=t}};var bLo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[o,c]of Object.entries(i.files)){let f=n!=null?qu.of(`${n}${"/"}${o}`):qu.of(o);t[f]=c}let a=Object.keys(i.directories).sort();for(let o of a){let c=n!=null?`${n}${"/"}${o}`:o,f=i.directories[o];r(f,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[qu.of(t[0])]??={};let[r,...i]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(i)}};var OJi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new bLo,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":i,"display-name":n,docs:a}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(o.service.auth=r),i!=null&&(o.service["base-path"]=i),n!=null&&(o.service["display-name"]=n),a!=null&&(o.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return e9t(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let i of Object.values(this.rootApiFile["auth-schemes"]))Uh_(i)&&t.push(i.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(Uh_(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}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:i}){if(t===r)return;let n=i??Fo((fAe(r)+"/"+f6i(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===qu.of(t1))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=auo(fAe(TDn.of(`/${t}`)),TDn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=auo(fAe(TDn.of(`/${t}`)),TDn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===qu.of(t1))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(c=>kq(c,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=tD(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}optimizeServiceAuth(){let t=[this.packageMarkerFile,...Object.values(this.root.getAllFiles())];for(let r of t){if(r.service==null)continue;let i=Object.values(r.service.endpoints);if(i.length===0)continue;if(i.every(a=>a.auth===!0)){r.service.auth=!0;for(let a of Object.values(r.service.endpoints))delete a.auth}}}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:tD(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,o])=>[a,{...o,path:tD(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===ib?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 Uh_(e){return e?.header!=null}var vLo=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:i,environmentOverrides:n,globalHeaderOverrides:a,authOverrides:o}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=n,this.authOverrides=o,this.globalHeaderOverrides=a,this.options=hJi({options:i}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new OJi(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let f of r.endpoints)for(let[s,u]of Object.entries(f.errors)){let l=parseInt(s),p=c[l];p==null&&u.schema!=null?c[l]=u.schema:p!=null&&u.schema!=null&&rK(p,u.schema)||this.unknownSchema.add(l)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.options.onlyIncludeReferencedSchemas&&this.isInAnyState(I1.Channel,I1.Endpoint,I1.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:Ot(t)}}markObjectSchemaAsReferenced(t,r){for(let i of t.allOf)this.markSchemaIdAsReferenced(i.schema,r);for(let i of t.properties)this.markSchemaAsReferenced(i.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let i of Object.values(t.schemas))this.markSchemaAsReferenced(i,r);return;case"undiscriminated":for(let i of t.schemas)this.markSchemaAsReferenced(i,r);return;default:Ot(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let i=this.getSchema(t,r);i!=null&&this.markSchemaAsReferenced(i,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function Lsc(e){let t=new vLo(e);return Qh_(t)}function BtM(e){return DKi(e,{single:t=>[typeof t=="string"?t:t.scheme],any:t=>t.any.map(r=>typeof r=="string"?r:r.scheme)})}function ItM(e,t){if(e==null)return;let r=BtM(t),i={};for(let n of r)e[n]!=null&&(i[n]=e[n]);return Object.keys(i).length>0?i:void 0}var gLo=class{args;constructor(t){this.args=t}buildAuthOverrides(t,r){let i=this.args.generatorsConfiguration?.api?.["auth-schemes"],n=this.args.generatorsConfiguration?.api?.auth,a=t??n;if(a==null)return;let o=r!=null||i!=null?{...i,...r}:void 0,c=ItM(o,a);return{auth:a,"auth-schemes":c}}convert({context:t,ir:r,settings:i,absoluteFilePath:n}){let a=Lsc({taskContext:t,ir:r,options:hJi({options:i,overrides:this.args}),authOverrides:this.buildAuthOverrides(i?.auth,i?.authSchemes),environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.args.generatorsConfiguration?.api?.headers!=null?{...this.args.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:n??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Ii.dump(a.rootApiFile)},namedDefinitionFiles:{..._n(a.definitionFiles,o=>({absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Ii.dump(o),contents:o})),[qu.of(ib)]:{absoluteFilepath:n??this.args.absoluteFilePath,rawContents:Ii.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var YPa=class extends pFt{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;coerceEnumsToLiterals;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;groupEnvironmentsByHost;removeDiscriminantsFromSchemas;defaultIntegerFormat;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.coerceEnumsToLiterals=t.coerceEnumsToLiterals,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.groupEnvironmentsByHost=t.groupEnvironmentsByHost,this.removeDiscriminantsFromSchemas=t.removeDiscriminantsFromSchemas,this.defaultIntegerFormat=t.defaultIntegerFormat,this.converter=new gLo(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:i},n){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:i},n);return this.converter.convert({context:t,ir:a,settings:n,absoluteFilePath:r})}async toFernWorkspace({context:t},r,i){let n=await this.getDefinition({context:t},r);return new eK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var JQ={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 aUn={of(e){return e}};var Lh_={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},Vsc={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:Lh_,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},xi={SOURCE:aUn.of("source"),SDK_NAMESPACE:aUn.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:aUn.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:aUn.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:aUn.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",RETRIES:"x-fern-retries",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport",IS_DISCRIMINATED:"x-fern-discriminated",EXPLORER_ENABLED:"x-fern-explorer-enabled"};var CtM={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!1,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!1,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,preserveSchemaIds:!1,objectQueryParameters:!0,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!0,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!1,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,groupEnvironmentsByHost:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,removeDiscriminantsFromSchemas:hn.RemoveDiscriminantsFromSchemas.Always,defaultIntegerFormat:hn.DefaultIntegerFormat.Int32};function qtM(e){let{defaults:t,options:r,overrides:i,overrideOnly:n=new Set,undefinedIfAbsent:a=new Set}=e,o={};for(let c of Object.keys(t))n.has(c)?o[c]=i?.[c]!==void 0?i[c]:t[c]:a.has(c)?o[c]=i?.[c]!==void 0?i[c]:r?.[c]!==void 0?r[c]:void 0:o[c]=i?.[c]??r?.[c]??t[c];return o}function $0e({options:e,overrides:t}){return qtM({defaults:CtM,options:e,overrides:t,overrideOnly:new Set(["disableExamples","preserveSchemaIds"]),undefinedIfAbsent:new Set(["exampleGeneration","defaultFormParameterEncoding"])})}var Vh_={naming:"v1"};function Di(e,t){let r=Array.isArray(t)?t:[t];for(let i of r){let n=e[i];if(n!=null)return n}}function XPa(e,t,r,i,n=[]){try{let a=Di(e,t);if(a!=null)return r.parse(a)}catch{let o=JOe(n).join(" -> ");i.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function AJi(e){let t=Di(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 Wh_({schema:e,logger:t}){return Di(e,xi.ENCODING)??void 0}function xh_(e){return Di(e,xi.FERN_ENUM)}function Gh_({nameOverride:e,generatedName:t,title:r,schema:i,description:n,availability:a}){let o=Di(i,xi.SDK_NAMESPACE),c=Di(i,xi.SDK_GROUP_NAME),f=Di(i,xi.TYPE_DEFINITION);if(f!=null)return ZPa({fernType:f,nameOverride:e,generatedName:t,title:r,description:n,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function ZPa({fernType:e,nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c}){return PB({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.base64({example:void 0})});case"BOOLEAN":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.boolean({default:void 0,example:void 0})});case"DATE":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.date({example:void 0})});case"DATE_TIME":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.datetime({example:void 0})});case"FLOAT":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.float({example:void 0})});case"DOUBLE":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.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 ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.uint({default:void 0,example:void 0})});case"INTEGER":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.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 ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.uint64({default:void 0,example:void 0})});case"LONG":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return ni.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,schema:Un.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Ot(f.v1)}},unknown:()=>ni.unknown({nameOverride:t,generatedName:r,title:i,example:void 0,description:n,availability:a,namespace:o,groupName:c}),map:({keyType:f,valueType:s})=>f?.type==="primitive"&&s!=null?ni.map({nameOverride:t,generatedName:r,title:i,key:f,value:s,description:n,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:f=>f!=null?ni.array({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:f=>f!=null?ni.optional({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:f=>f!=null?ni.nullable({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:f=>f!=null?ni.array({nameOverride:t,generatedName:r,title:i,value:f,description:n,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:f=>ni.literal({nameOverride:t,generatedName:r,title:i,value:f._visit({string:s=>Rj.string(s),boolean:s=>Rj.boolean(s),_other:()=>{throw new Error("Unexpected literal type")}}),description:n,availability:a,namespace:o,groupName:c}),named:f=>ni.reference({schema:f,nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:o,groupName:c,source:G3.openapi({file:"<memory>"})})}})}function Hh_(e){let t=Di(e,xi.SOURCE);if(t!=null)return t.endsWith(".proto")?G3.protobuf({file:t}):G3.openapi({file:t})}function mJi(e){if(e!=null&&typeof e=="boolean")return e}function Pn(e){return e?.$ref!=null}function Kh_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,additionalProperties:n,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:s,namespace:u,groupName:l,example:p,encoding:_,source:h}){return n===void 0&&(n=s.options.additionalPropertiesDefaultsTo),Wsc({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Un.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof n=="boolean"||kPa(n,s.options)?ni.unknown({...TtM(n),generatedName:`${t}Value`}):Jh_(Sl(n,!1,s.options.optionalAdditionalProperties?f:!1,s,[...i,"Value"],h,u,void 0,void 0,void 0)),namespace:u,groupName:l,example:p,encoding:_})}function Jh_(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=Jh_(e.value);break;case"oneOf":e.value.inline=!0;break;default:Ot(e)}return e}function Wsc({nameOverride:e,generatedName:t,title:r,keySchema:i,valueSchema:n,wrapAsOptional:a,wrapAsNullable:o,description:c,availability:f,namespace:s,groupName:u,example:l,encoding:p}){let _=ni.map({nameOverride:e,generatedName:t,title:r,description:c,availability:f,key:i,value:n,namespace:s,groupName:u,encoding:p,example:l,inline:void 0});return o&&(_=ni.nullable({nameOverride:e,generatedName:t,title:r,value:_,description:c,availability:f,namespace:s,groupName:u,inline:void 0})),a&&(_=ni.optional({nameOverride:e,generatedName:t,title:r,value:_,description:c,availability:f,namespace:s,groupName:u,inline:void 0})),_}function kPa(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!(Pn(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null||"allOf"in e&&e.allOf!=null||"enum"in e&&e.enum!=null)}function TtM(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||Pn(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function $h_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,item:n,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:s,namespace:u,groupName:l,example:p,source:_}){let h=n==null?ni.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:l}):Sl(n,!1,!1,s,[...i,"Item"],_,u);return RtM({nameOverride:e,generatedName:t,title:r,namespace:u,groupName:l,itemSchema:h,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,example:p})}function RtM({nameOverride:e,generatedName:t,title:r,itemSchema:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:s,example:u}){let l=ni.array({nameOverride:e,generatedName:t,title:r,value:i,description:o,availability:c,namespace:f,groupName:s,example:u,inline:void 0});return a&&(l=ni.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),n&&(l=ni.optional({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),l}function J3(e){switch(Di(e,xi.AVAILABILITY)){case"deprecated":return pz.Deprecated;case"beta":return pz.Beta;case"generally-available":return pz.GenerallyAvailable;default:break}if(!Pn(e)&&e.deprecated)return pz.Deprecated}function xsc({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:s,discriminator:u,context:l,namespace:p,groupName:_,encoding:h,source:y}){let b=u.propertyName,v=Object.fromEntries(Object.entries(u.mapping??{}).map(([A,g])=>{let m=Uvi({$ref:g},!1,!1,l,[g],h,y,p);return l.markReferencedByDiscriminatedUnion({$ref:g},b,1),[A,m]})),O=Object.entries(n).filter(([A])=>A!==b).map(([A,g])=>{let m=c!=null&&c.includes(A),[j,M]=l.options.coerceOptionalSchemasToNullable?[!1,!m]:[!m,!1],E=Sl(g,j,M,l,[...i,A],y,p);return{key:A,schema:E}});return Yh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:s,properties:O,description:a,availability:o,discriminant:b,subtypes:v,namespace:p,groupName:_,source:y})}function Gsc({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:s,discriminant:u,variants:l,context:p,namespace:_,groupName:h,encoding:y,source:b}){let v=Object.fromEntries(Object.entries(l).map(([A,g])=>{if(Pn(g)){let m=Uvi(g,!1,!1,p,[g.$ref],y,b,_);return p.markReferencedByDiscriminatedUnion(g,u,1),[A,m]}else{let m=oUn(g,!1,!1,p,[...i,A],y,b,_,new Set([u]));return[A,m]}})),O=Object.entries(n).filter(([A])=>A!==u).map(([A,g])=>{let m=c!=null&&c.includes(A),[j,M]=p.options.coerceOptionalSchemasToNullable?[!1,!m]:[!m,!1],E=Sl(g,j,M,p,[...i,A],b,_);return{key:A,schema:E}});return Yh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:s,properties:O,description:a,availability:o,discriminant:u,subtypes:v,namespace:_,groupName:h,source:b})}function Yh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,properties:a,description:o,availability:c,discriminant:f,subtypes:s,namespace:u,groupName:l,source:p}){let _=ni.oneOf(Mhe.discriminated({description:o,availability:c,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:s,commonProperties:a,namespace:u,groupName:l,encoding:void 0,source:p,inline:void 0}));return n&&(_=ni.nullable({nameOverride:e,generatedName:t,title:r,value:_,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),i&&(_=ni.optional({nameOverride:e,generatedName:t,title:r,value:_,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),_}function Xh_(e){if(e.proto!=null)return wQn.protobuf({typeName:e.proto.type})}function LCi({nameOverride:e,generatedName:t,title:r,fernEnum:i,enumVarNames:n,enumValues:a,_default:o,description:c,availability:f,wrapAsOptional:s,wrapAsNullable:u,namespace:l,groupName:p,context:_,source:h,inline:y}){let b=NtM(n??[]),v=new Set(a),O=Array.from(v).map((g,m)=>{let j=i?.[g],M=b[m],E=tUn.test(g),D=j?.name??M,B=E?g:rUn(g);return D!=null&&!tUn.test(D)&&(_?.logger.warn(`Enum name override ${D} is not a valid name. Falling back on ${B}.`),D=void 0),{nameOverride:D,generatedName:B,value:g,description:j?.description,availability:f,casing:{snake:j?.casing?.snake??void 0,pascal:j?.casing?.pascal??void 0,screamingSnake:j?.casing?.screamingSnake??void 0,camel:j?.casing?.camel??void 0}}}),A=o!=null?O.find(g=>g.value===o):void 0;return ztM({wrapAsOptional:s,wrapAsNullable:u,nameOverride:e,generatedName:t,title:r,values:O,_default:A,description:c,availability:f,namespace:l,groupName:p,source:h,inline:y})}function ztM({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:i,title:n,values:a,_default:o,description:c,availability:f,namespace:s,groupName:u,source:l,inline:p}){let _=ni.enum({nameOverride:r,generatedName:i,title:n,values:a,description:c,availability:f,default:o,example:void 0,namespace:s,groupName:u,source:l,inline:p});return t&&(_=ni.nullable({nameOverride:r,generatedName:i,title:n,value:_,description:c,availability:f,namespace:s,groupName:u,inline:p})),e&&(_=ni.optional({nameOverride:r,generatedName:i,title:n,value:_,description:c,availability:f,namespace:s,groupName:u,inline:p})),_}function NtM(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(i=>i[r]===t[r]);)r++;return e.map(i=>i.substring(r))}function Zh_({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,description:u,availability:l,wrapAsOptional:p,wrapAsNullable:_,example:h,namespace:y,groupName:b,defaultIntegerFormat:v=hn.DefaultIntegerFormat.Int32}){let O=i??v,A=(()=>{switch(O){case hn.DefaultIntegerFormat.Int64:return Un.int64({default:n,example:h});case hn.DefaultIntegerFormat.Uint32:return Un.uint({default:n,example:h});case hn.DefaultIntegerFormat.Uint64:return Un.uint64({default:n,example:h});default:return Un.int({default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,example:h})}})();return $3({nameOverride:e,generatedName:t,title:r,primitive:A,wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b})}function FtM(e){return typeof e=="string"?Rj.string(e):typeof e=="boolean"?Rj.boolean(e):Rj.string(`${e}`)}function kh_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,value:a,description:o,availability:c,namespace:f,groupName:s}){let u=ni.literal({nameOverride:e,generatedName:t,title:r,value:FtM(a),description:o,availability:c,namespace:f,groupName:s});return n&&(u=ni.nullable({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),i&&(u=ni.optional({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),u}function Hsc({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,description:u,availability:l,wrapAsOptional:p,wrapAsNullable:_,example:h,namespace:y,groupName:b}){return i==null||i==="double"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.double({default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="float"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.float({example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="int32"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.int({default:n,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:s,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="int64"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.int64({default:n,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="uint32"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.uint({default:n,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="uint64"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.uint64({default:n,example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):i==="time-delta"?$3({nameOverride:e,generatedName:t,title:r,primitive:Un.float({example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b}):$3({nameOverride:e,generatedName:t,title:r,primitive:Un.float({example:h}),wrapAsOptional:p,wrapAsNullable:_,description:u,availability:l,namespace:y,groupName:b})}var QtM={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},UtM={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}}},LtM={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}}},VtM={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},WtM={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},xtM={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},GtM={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},HtM={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function eja(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],i=[QtM,UtM,LtM,VtM,WtM,xtM,GtM,HtM],n;do{n=t;for(let a of i)if(a.isApplicable(t)){let{refUnderProcessing:o,newBreadcrumbs:c}=a.applyStrategy(t);t=o,r=[...r,...c]}}while(t.join("")!==n.join(""));return r}function qC(e,t){let i=e.map(n=>/^[^a-zA-Z0-9]+$/.test(n)?n:TP(Fo(n))).join("");return/^\d/.test(i)?VPa(i)??i:i}function ey_(e){let t=e.join("_");return Fo(t)}function WO(e){switch(e.type){case"object":return Xs.object({allOf:e.allOf,properties:e.properties.map(t=>JtM(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 Xs.array({description:e.description,availability:e.availability,value:WO(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return Xs.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 Xs.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 Xs.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:WO(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return Xs.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:WO(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return Xs.primitive({description:e.description,availability:e.availability,schema:ty_(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Xs.map({description:e.description,availability:e.availability,key:Xs.primitive({description:e.key.description,availability:e.key.availability,schema:ty_(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:WO(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 Xs.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 Xs.oneOf(KtM(e.value));case"unknown":return Xs.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Ot(e)}}function KtM(e){switch(e.type){case"discriminated":return c9t.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:WO(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,WO(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return c9t.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>WO(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:Ot(e)}}function ty_(e){switch(e.type){case"string":return ih.string(e);case"base64":return ih.base64();case"boolean":return ih.boolean(e);case"date":return ih.date();case"datetime":return ih.datetime();case"double":return ih.double(e);case"float":return ih.float();case"int":return ih.int(e);case"int64":return ih.int64(e);case"uint":return ih.uint();case"uint64":return ih.uint64();default:Ot(e)}}function JtM(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:WO(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function OLo(e,t){return rK(WO(e),WO(t))}function ry_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,required:o,wrapAsOptional:c,wrapAsNullable:f,allOf:s,context:u,propertiesToExclude:l,namespace:p,groupName:_,fullExamples:h,additionalProperties:y,availability:b,source:v}){let O=[...o??[]],A={...iy_({properties:n,breadcrumbs:i,context:u})},g=[],m=[];for(let B of s)if(!u.options.inlineAllOfSchemas&&Pn(B)){let F=u.resolveSchemaReference(B);if(F.discriminator!=null&&F.discriminator.mapping!=null)continue;if(F.oneOf!=null||F.anyOf!=null){let R=F.oneOf??F.anyOf;if(R!=null){for(let z of R){let U=Pn(z)?u.resolveSchemaReference(z):z,W=Sl(U,!1,!1,u.DUMMY,i,v,p);W.type==="object"&&g.push(...W.properties.map(K=>K.schema.type!=="optional"&&K.schema.type!=="nullable"?{...K,schema:ni.optional({nameOverride:void 0,generatedName:"",title:void 0,value:K.schema,description:void 0,availability:K.availability,namespace:void 0,groupName:void 0,inline:void 0})}:K))}continue}}let N=VCi(B);if(N==null)continue;m.push({schemaId:N,convertedSchema:Ksc(B,[N],v,u.options.preserveSchemaIds),properties:ny_({schema:B,context:u,breadcrumbs:i,source:v,namespace:p})}),u.markSchemaAsReferencedByNonRequest(N)}else if(Pn(B)){let F=u.resolveSchemaReference(B),N=Sl(F,!1,!1,u,i,v,p);N.type==="object"&&g.push(...N.properties)}else{let F=B.required??[];g=g.map(R=>(R.schema.type==="optional"||R.schema.type==="nullable")&&F.includes(R.key)?{...R,schema:R.schema.value}:R);let N=Sl(B,!1,!1,u,i,v,p);N.type==="object"&&g.push(...N.properties)}let j={};for(let B of m)for(let[F,N]of Object.entries(B.properties)){let R=j[F];R!=null?(R.schemaIds.push(B.schemaId),R.schemas.some(U=>OLo(U,N))||R.schemas.push(N)):j[F]={schemaIds:[B.schemaId],schemas:[N]}}let M=[];for(let[B,F]of Object.entries(j))F.schemaIds.length>1&&M.push({propertyKey:B,allOfSchemaIds:F.schemaIds,conflictingTypeSignatures:F.schemas.length>1});let E=Object.fromEntries(Object.entries(A).filter(([B,F])=>!(!Pn(F)&&F.type==="null"))),D=Object.entries(E).map(([B,F])=>{let N=Di(F,xi.AUDIENCES)??[],R=J3(F),z=Pn(F)?!1:F.readOnly,U=Pn(F)?!1:F.writeOnly,K=!(O.includes(B)&&!z),fe=Di(F,xi.FERN_PROPERTY_NAME),pe=[...i,B],L=ey_(pe),G=Sl(F,K,!1,u,pe,v,p),Re={};for(let le of m){let Ie=le.properties[B];Ie!=null&&!OLo(G,Ie)?Re[le.schemaId]={differentSchema:!0}:Ie!=null&&(Re[le.schemaId]={differentSchema:!1})}return{key:B,schema:G,nameOverride:fe,audiences:N,conflict:Re,generatedName:L,availability:R,readonly:z,writeonly:U}});return D.push(...g.map(B=>{let F=B.conflict;for(let N of m){let R=N.properties[B.key];R!=null&&!OLo(B.schema,R)?F[N.schemaId]={differentSchema:!0}:R!=null&&(F[N.schemaId]={differentSchema:!1})}return{...B,conflict:F}})),$tM({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,properties:D.filter(B=>!l.has(B.key)),description:a,allOf:m.map(B=>B.convertedSchema),allOfPropertyConflicts:M,namespace:p,groupName:_,fullExamples:h,additionalProperties:y,availability:b,source:v,context:u})}function $tM({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,properties:a,description:o,allOf:c,allOfPropertyConflicts:f,namespace:s,groupName:u,fullExamples:l,additionalProperties:p,availability:_,source:h,context:y}){let b=ni.object({description:o,properties:a,nameOverride:e,generatedName:t,title:r,allOf:c,allOfPropertyConflicts:f,namespace:s,groupName:u,fullExamples:l,additionalProperties:kPa(p,y.options),availability:_,source:h,inline:void 0});return n&&(b=ni.nullable({nameOverride:e,generatedName:t,title:r,value:b,description:o,availability:_,namespace:s,groupName:u,inline:void 0})),i&&(b=ni.optional({nameOverride:e,generatedName:t,title:r,value:b,description:o,availability:_,namespace:s,groupName:u,inline:void 0})),b}function iy_({properties:e,breadcrumbs:t,context:r}){return Object.fromEntries(Object.entries(e).filter(([i,n])=>{let a=Di(n,xi.IGNORE);return a&&r.logger.debug(`Property ${t.join(".")}.${i} is marked with x-fern-ignore. Skipping.`),!a}))}function ny_({schema:e,context:t,breadcrumbs:r,source:i,namespace:n}){let a={},[o,c]=Pn(e)?[t.resolveSchemaReference(e),eja(e.$ref)]:[e,r];for(let f of o.allOf??[])a={...a,...ny_({schema:f,context:t,breadcrumbs:c,source:i,namespace:n})};for(let[f,s]of Object.entries(iy_({properties:o.properties??{},breadcrumbs:r,context:t}))){let u=Sl(s,!1,!1,t,[...c,f],i,n);a[f]=u}return a}function WCi({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,description:n,availability:a,wrapAsOptional:o,wrapAsNullable:c,context:f,subtypes:s,namespace:u,groupName:l,encoding:p,source:_,subtypeSuffixOverrides:h}){let y=ZtM({schemas:s}),b=s.flatMap((O,A)=>{if(!Pn(O)&&O.enum!=null&&f.options.coerceEnumsToLiterals&&O.type==="string")return O.enum.map(m=>ni.literal({nameOverride:void 0,generatedName:qC([t,m],f.options.preserveSchemaIds),title:void 0,value:Rj.string(String(m)),namespace:u,groupName:void 0,description:void 0,availability:m.availability}));let g=y[A];if(h!=null){let m=h[A];m!=null&&"name"in m&&(g=m.name)}return[Sl(O,!1,!1,f,[...i,g??`${A}`],_,u)]}),v=YtM(b);return XtM({uniqueSubtypes:v,nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:c,description:n,availability:a,namespace:u,groupName:l,context:f,encoding:p,source:_})}function YtM(e){let t=[];for(let r=0;r<e.length;++r){let i=e[r],n=!1;for(let a=r+1;a<e.length;++a){let o=e[a];if(i!=null&&o!=null&&rK(i,o)){n=!0;break}}i!=null&&!n&&t.push(i)}return t}function XtM({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:s,context:u,encoding:l,source:p}){if(Object.entries(e).every(([h,y])=>y.type==="literal")){let h={},y=[];return Object.entries(e).forEach(([b,v])=>{v.type==="literal"&&v.value.type==="string"&&(y.push(v.value.value),v.description!=null&&(h[v.value.value]={description:v.description}))}),LCi({nameOverride:t,generatedName:r,title:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,fernEnum:h,enumVarNames:void 0,enumValues:y,_default:void 0,namespace:f,groupName:s,context:u,source:p,inline:void 0})}if(e.length===1&&e[0]!=null&&!u.options.preserveSingleSchemaOneOf){let h=e[0];return a&&(h=ni.nullable({nameOverride:t,generatedName:r,title:i,value:h,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),n&&(h=ni.optional({nameOverride:t,generatedName:r,title:i,value:h,description:o,availability:c,namespace:f,groupName:s,inline:void 0})),h}return ay_({nameOverride:t,generatedName:r,title:i,wrapAsOptional:n,wrapAsNullable:a,description:o,availability:c,subtypes:e,namespace:f,groupName:s,encoding:l,source:p})}function Jsc({nameOverride:e,generatedName:t,title:r,description:i,availability:n,wrapAsOptional:a,wrapAsNullable:o,context:c,namespace:f,groupName:s,discriminator:u,encoding:l,source:p}){let _=Object.entries(u.mapping??{}).map(([b,v],O)=>{let A={$ref:v},g=Uvi(A,!1,!1,c,[v],l,p,f);return c.markSchemaWithDiscriminantValue(A,u.propertyName,b),g.type==="object"&&(g.properties={[u.propertyName]:ni.literal({nameOverride:void 0,generatedName:qC([t,b],c.options.preserveSchemaIds),title:void 0,value:Rj.string(b),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...g.properties.filter(m=>m.key!==u.propertyName)}),g}),h=[];for(let b=0;b<_.length;++b){let v=_[b],O=!1;for(let A=b+1;A<_.length;++A){let g=_[A];if(v!=null&&g!=null&&rK(v,g)){O=!0;break}}v!=null&&!O&&h.push(v)}if(Object.entries(h).every(([b,v])=>v.type==="literal")){let b={},v=[];return Object.entries(h).forEach(([O,A])=>{A.type==="literal"&&A.value.type==="string"&&(v.push(A.value.value),A.description!=null&&(b[A.value.value]={description:A.description}))}),LCi({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:i,availability:n,fernEnum:b,enumVarNames:void 0,enumValues:v,_default:void 0,namespace:f,groupName:s,context:c,source:p,inline:void 0})}return h.length===1&&h[0]!=null&&!c.options.preserveSingleSchemaOneOf?h[0]:ay_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:i,availability:n,subtypes:h,namespace:f,groupName:s,encoding:l,source:p})}function ZtM({schemas:e}){let t={},r=0;for(let n of e){if(!Pn(n)){if(n.properties!=null&&Object.entries(n.properties).length>0){let a=Object.keys(n.properties),o={},c=a;for(let[f,s]of Object.entries(t)){let u=bro(s,a);c=bro(c,s),o[f]=u}o[r]=c,t=o}}r++}return e.map((n,a)=>{let o=t[a];if(o!=null&&o.length>0){let c=o.sort();if(c[0]!=null)return c[0]}return bJi(a)??`${a}`})}function ay_({nameOverride:e,generatedName:t,title:r,wrapAsOptional:i,wrapAsNullable:n,description:a,availability:o,subtypes:c,namespace:f,groupName:s,encoding:u,source:l}){let p=ni.oneOf(Mhe.undiscriminated({description:a,availability:o,nameOverride:e,generatedName:t,title:r,schemas:c,namespace:f,groupName:s,encoding:u,source:l,inline:void 0}));return n&&(p=ni.nullable({nameOverride:e,generatedName:t,title:r,value:p,description:a,availability:o,namespace:f,groupName:s,inline:void 0})),i&&(p=ni.optional({nameOverride:e,generatedName:t,title:r,value:p,description:a,availability:o,namespace:f,groupName:s,inline:void 0})),p}function uUn(e){if(e.default!=null&&typeof e.default=="string")return e.default}function ALo({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let i=AJi(e);for(let n of i??[])if(typeof n=="number")return n;if(r&&typeof r=="number")return r}function oy_({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let i=AJi(e);for(let n of i??[])if(typeof n=="boolean")return n;if(r&&typeof r=="boolean")return r}function h9t({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let i=AJi(e);for(let n of i??[])if(typeof n=="string")return n;if(r&&typeof r=="string")return r}function uy_({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let i=AJi(e);for(let n of i??[])if(Array.isArray(n))return n;if(r&&Array.isArray(r))return r}var PJi="#/components/schemas/";function ly_(e,t){let r=Pn(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"integer":return!0;case"string":return r.enum==null;case"array":return ly_(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function ktM(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:ly_(t,r):!1}function Sl(e,t,r,i,n,a,o,c=!1,f=new Set,s){let u=Hh_(e)??a,l=urM({schema:e,logger:i.logger});if(Pn(e)){let p=VCi(e);return p!=null?ktM(p,e,i)?oUn(i.resolveSchemaReference(e),t,r,i,eja(e.$ref),l,u,o,f,c,s):(c?i.markSchemaAsReferencedByRequest(p):i.markSchemaAsReferencedByNonRequest(p),Uvi(e,t,r,i,n,l,u,o)):oUn(i.resolveSchemaReference(e),t,r,i,eja(e.$ref),l,u,o,f,c,s)}return oUn(e,t,r,i,n,l,u,o,f,c,s)}function Uvi(e,t,r,i,n,a,o,c){let f=e.$ref.includes("properties")?oUn(i.resolveSchemaReference(e),t,r,i,n,a,o,c,new Set):ni.reference(Ksc(e,n,o,i.options.preserveSchemaIds));if(r===!1){let s=i.resolveSchemaReference(e);(s.nullable===!0||Array.isArray(s.type)&&s.type.length>=2&&s.type.includes("null"))&&(r=!0)}return r&&(f=ni.nullable({title:void 0,nameOverride:void 0,generatedName:qC(n,i.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(f=ni.optional({title:void 0,nameOverride:void 0,generatedName:qC(n,i.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),f}function erM(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function oUn(e,t,r,i,n,a,o,c,f=new Set,s=!1,u){typeof e=="string"&&(e={type:e});let l=Di(e,xi.TYPE_NAME)??(i.options.useTitlesAsName?erM(e.title):void 0),p=Di(e,xi.SDK_GROUP_NAME)??Di(e,JQ.TAGS)?.[0],_=(typeof p=="string"?[p]:p)??[];_=i.resolveGroupName(_);let h=qC(n,i.options.preserveSchemaIds),y=e.title,b=e.description,v=J3(e),O=[];e.example!=null&&O.push({name:void 0,value:e.example,description:void 0});let A=Di(e,JQ.EXAMPLES);A!=null&&Object.keys(A).length>0&&O.push(...Object.entries(A).map(([j,M])=>({name:M?.summary??j,value:M.value,description:M.description})));let g=AJi(e);g!=null&&Object.keys(g).length>0&&O.push(...g.map(j=>({name:void 0,value:j,description:void 0})));let m=Gh_({schema:e,description:b,title:y,nameOverride:l,generatedName:h,availability:v});if(m!=null){let j=m;return r&&(j=ni.nullable({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:j})),t&&(j=ni.optional({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:j})),j}try{if(Array.isArray(e.type)){let E=e.type.indexOf("null"),D=E!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&D)e.type.splice(E,1),e.type=e.type[0],e.nullable=!0;else if(D&&(e.type.splice(E,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let B=new Set([...e.oneOf,...e.type]);e.oneOf=[...B]}}if(r=r||e.nullable===!0,"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(D=>D!==null),!jLo(e.enum))return $3({nameOverride:l,generatedName:h,title:y,primitive:Un.string({default:uUn(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:h9t({schema:e,logger:i.logger,fallback:u})}),namespace:c,groupName:_,wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v});let E=xh_(e);return i.options.coerceEnumsToLiterals&&e.enum.length===1&&e.enum[0]!=null&&E==null?kh_({nameOverride:l,generatedName:h,title:y,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:b,availability:v,namespace:c,groupName:_}):LCi({nameOverride:l,generatedName:h,title:y,fernEnum:E,enumVarNames:Di(e,[JQ.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:_,context:i,source:o,inline:void 0})}if(jLo(e.type)&&e.type.length>1){let E=e.type.includes("null"),D=e.type.filter(B=>B!=="null").map(B=>({type:B,nullable:E}));return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,subtypes:D,namespace:c,groupName:_,encoding:a,source:o})}if(e.type==="boolean"){let E=Di(e,xi.BOOLEAN_LITERAL);return E!=null?sy_({nameOverride:l,generatedName:h,title:y,literal:Rj.boolean(E),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_}):$3({nameOverride:l,generatedName:h,title:y,primitive:Un.boolean({default:trM(e.default),example:oy_({schema:e,logger:i.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_})}if(e.type==="number")return Hsc({nameOverride:l,generatedName:h,title:y,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:mJi(e.exclusiveMinimum),exclusiveMaximum:mJi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,example:ALo({schema:e,logger:i.logger,fallback:u}),namespace:c,groupName:_});if(e.type==="integer")return Zh_({nameOverride:l,generatedName:h,title:y,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:mJi(e.exclusiveMinimum),exclusiveMaximum:mJi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,example:ALo({schema:e,logger:i.logger,fallback:u}),namespace:c,groupName:_,defaultIntegerFormat:i.options.defaultIntegerFormat});if(e.type==="float")return Hsc({nameOverride:l,generatedName:h,title:y,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:mJi(e.exclusiveMinimum),exclusiveMaximum:mJi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,example:ALo({schema:e,logger:i.logger,fallback:u}),namespace:c,groupName:_});if(e.type==="string"){if(e.format==="date-time")return $3({nameOverride:l,generatedName:h,title:y,primitive:Un.datetime({example:h9t({schema:e,logger:i.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_});if(e.format==="date"&&i.options.typeDatesAsStrings===!1)return $3({nameOverride:l,generatedName:h,title:y,primitive:Un.date({example:h9t({schema:e,logger:i.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_});if(e.format==="json-string"){let D=ni.unknown({nameOverride:l,generatedName:h,title:y,description:b,availability:v,namespace:c,groupName:_,example:void 0});return r&&(D=ni.nullable({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:D})),t&&(D=ni.optional({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:D})),D}let E=dy_(e,"const");return E!=null?sy_({nameOverride:l,generatedName:h,title:y,literal:Rj.string(E),wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v,namespace:c,groupName:_}):$3({nameOverride:l,generatedName:h,title:y,primitive:Un.string({default:uUn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:h9t({schema:e,logger:i.logger,fallback:u})}),namespace:c,groupName:_,wrapAsOptional:t,wrapAsNullable:r,description:b,availability:v})}if(e.type==="array")return $h_({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,item:e.items,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,example:uy_({schema:e,logger:i.logger,fallback:u}),source:o});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&mLo(e))return Kh_({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,additionalProperties:e.additionalProperties,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,encoding:a,example:e.example,source:o});if(e.oneOf!=null&&e.oneOf.length>0&&Di(e,xi.IS_DISCRIMINATED)===!1)return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,subtypes:e.oneOf,namespace:c,groupName:_,encoding:a,source:o});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return i.options.discriminatedUnionV2?Jsc({nameOverride:l,generatedName:h,title:y,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,discriminator:e.discriminator,encoding:a,source:o}):xsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,encoding:a,source:o});if(e.oneOf!=null&&e.oneOf.length>0){let E=Di(e,xi.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return i.options.discriminatedUnionV2||E?Jsc({nameOverride:l,generatedName:h,title:y,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,discriminator:e.discriminator,encoding:a,source:o}):xsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:i,namespace:c,groupName:_,encoding:a,source:o});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(i.options.preserveSingleSchemaOneOf)return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,context:i,subtypes:e.oneOf.filter(B=>Pn(B)||B.type!=="null"),encoding:a,namespace:c,groupName:_,source:o});let D=Sl(e.oneOf[0],t,r,i,n,o,c,s);return y9t(D,b,c,_)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let N=e.oneOf[0],R=e.oneOf[1];if(!Pn(N)&&N.type==="null"){let z=Sl(R,t,!0,i,n,o,c);return y9t(z,b,c,_)}else if(!Pn(R)&&R.type==="null"){let z=Sl(N,t,!0,i,n,o,c);return y9t(z,b,c,_)}}let D=nrM({schemas:e.oneOf});if(D!=null)return LCi({nameOverride:l,generatedName:h,title:y,fernEnum:void 0,enumVarNames:void 0,enumValues:D,_default:e.default,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:_,context:i,source:o,inline:void 0});let B=cy_({schemas:e.oneOf,context:i});if(B!=null&&!i.options.discriminatedUnionV2&&!E)return Gsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,properties:e.properties??{},required:e.required,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,discriminant:B.discriminant,variants:B.schemas,context:i,namespace:c,groupName:_,encoding:a,source:o});let F=e.oneOf.filter(N=>!Pn(N)&&N.type==="null").length>0;return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r||F,context:i,subtypes:e.oneOf.filter(N=>Pn(N)||N.type!=="null"),encoding:a,namespace:c,groupName:_,source:o})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let B=Sl(e.anyOf[0],t,r,i,n,o,c,s);return y9t(B,b,c,_)}if(e.anyOf.length===2){let[B,F]=e.anyOf;if(B!=null&&F!=null){if(!Pn(B)&&B.type==="null"){let N=Sl(F,t,!0,i,n,o,c);return y9t(N,b,c,_)}else if(!Pn(F)&&F.type==="null"){let N=Sl(B,t,!0,i,n,o,c);return y9t(N,b,c,_)}}}let E=cy_({schemas:e.anyOf,context:i});if(E!=null&&!i.options.discriminatedUnionV2)return Gsc({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,properties:e.properties??{},required:e.required,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,discriminant:E.discriminant,variants:E.schemas,context:i,namespace:c,groupName:_,encoding:a,source:o});let D=e.anyOf.filter(B=>!Pn(B)&&B.type==="null").length>0;return WCi({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r||D,context:i,subtypes:e.anyOf.filter(B=>Pn(B)||B.type!=="null"),encoding:a,namespace:c,groupName:_,source:o})}if(e.allOf!=null||e.properties!=null){let E=[];for(let B of e.allOf??[])(Pn(B)||Object.keys(B).length>0)&&E.push(B);if((e.properties==null||mLo(e))&&E.length===1&&E[0]!=null){let B=Sl(E[0],t,r,i,n,o,c,s);return y9t(B,b,c,_)}let D=E.filter(B=>{let F=PLo(B);return F||i.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(B)}`),F});if((e.properties==null||mLo(e))&&D.length===1&&D[0]!=null){let B=Sl(D[0],t,r,i,n,o,c,s);return y9t(B,b,c,_)}return ry_({nameOverride:l,generatedName:h,title:y,breadcrumbs:n,properties:e.properties??{},description:b,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:D,context:i,propertiesToExclude:f,namespace:c,groupName:_,fullExamples:O,additionalProperties:e.additionalProperties,availability:v,encoding:a,source:o})}if(e.type==="object"&&rrM(e)&&irM(e)&&mLo(e))return Wsc({nameOverride:l,generatedName:h,title:y,description:b,availability:v,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${h}Key`,title:void 0,description:void 0,availability:void 0,schema:Un.string({default:uUn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:h9t({schema:e,logger:i.logger,fallback:u})}),namespace:c,groupName:_},valueSchema:ni.unknown({nameOverride:void 0,generatedName:`${h}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:c,groupName:_}),namespace:c,groupName:_,encoding:a,example:e.example});e.type!=null&&i.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${n.join("->")}. Coercing to unknown.`);let j=e.example??e.default,M=ni.unknown({nameOverride:l,generatedName:h,title:y,description:b,availability:v,namespace:c,groupName:_,example:j});return r&&(M=ni.nullable({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:M})),t&&(M=ni.optional({availability:v,namespace:c,groupName:_,description:b,generatedName:h,inline:void 0,nameOverride:l,title:y,value:M})),M}catch(j){return i.logger.debug(`Error converting schema: ${j.message}
|
|
1412
1412
|
Location: ${n.join("-> ")}`),ni.unknown({nameOverride:l,generatedName:h,title:y,description:b,availability:v,namespace:c,groupName:_,example:void 0})}}function trM(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 VCi(e){if(e.$ref.startsWith(PJi))return e.$ref.replace(PJi,"")}function Ksc(e,t,r,i){let n=Di(e,xi.TYPE_NAME),a=qC(t,i),o=e.description,c=J3(e),f=VCi(e);if(f==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return Xs.reference({generatedName:a,nameOverride:n,title:void 0,schema:f,description:o??void 0,availability:c,namespace:void 0,groupName:void 0,source:r})}function rrM(e){return e.oneOf==null||e.oneOf.length===0}function irM(e){return e.allOf==null||e.allOf.length===0}function mLo(e){return e.properties==null||VA(e.properties)===0}function jLo(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function y9t(e,t,r,i){if(e.type==="reference")return ni.reference({...e,description:t,availability:e.availability,namespace:r,groupName:i});if(e.type==="optional"){let n=y9t(e.value,t,r,i);return ni.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n,description:t,availability:e.availability,namespace:r,groupName:i,inline:void 0})}else if(e.type==="nullable"){let n=y9t(e.value,t,r,i);return ni.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n,description:t,availability:e.availability,namespace:r,groupName:i,inline:void 0})}else if(e.type==="primitive"&&t!=null&&e.description==null)return ni.primitive({...e,description:t});return e}function PLo(e){return Pn(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>PLo(t)):e.oneOf!=null?e.oneOf.every(t=>PLo(t)):e.anyOf!=null?e.anyOf.every(t=>PLo(t)):!1}function sy_({literal:e,wrapAsOptional:t,wrapAsNullable:r,namespace:i,groupName:n,description:a,availability:o,nameOverride:c,generatedName:f,title:s}){let u=ni.literal({nameOverride:c,generatedName:f,title:s,value:e,namespace:i,groupName:n,description:a,availability:o});return r&&(u=ni.nullable({nameOverride:c,generatedName:f,title:s,value:u,namespace:i,groupName:n,description:a,availability:o,inline:void 0})),t&&(u=ni.optional({nameOverride:c,generatedName:f,title:s,value:u,namespace:i,groupName:n,description:a,availability:o,inline:void 0})),u}function $3({primitive:e,wrapAsOptional:t,wrapAsNullable:r,namespace:i,groupName:n,description:a,availability:o,generatedName:c,nameOverride:f,title:s}){n=typeof n=="string"?[n]:n;let u=ni.primitive({nameOverride:f,generatedName:c,title:s,schema:e,description:a,availability:o,namespace:i,groupName:n});return r&&(u=ni.nullable({nameOverride:f,generatedName:c,title:s,value:u,namespace:i,groupName:n,description:a,availability:o,inline:void 0})),t&&(u=ni.optional({nameOverride:f,generatedName:c,title:s,value:u,namespace:i,groupName:n,description:a,availability:o,inline:void 0})),u}function nrM({schemas:e}){let t=new Set;for(let r of e){if(Pn(r))return;if(r.enum!=null&&jLo(r.enum))r.enum.forEach(i=>t.add(i));else return}return Array.from(t)}function cy_({schemas:e,context:t}){let r={};for(let i of e){let n=fy_({schema:i,context:t});for(let[a,o]of Object.entries(n)){let c=r[a];c!=null?c[o]=i:r[a]={[o]:i}}}for(let[i,n]of Object.entries(r))if(Object.keys(n).length===e.length)return{discriminant:i,schemas:n}}function fy_({schema:e,context:t}){let r=Pn(e)?t.resolveSchemaReference(e):e;return arM({schema:r,context:t})}function arM({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let i of e.anyOf){let n=fy_({schema:i,context:t});for(let[a,o]of Object.entries(n??{}))r[a]=o}return r}for(let[i,n]of Object.entries(e.properties??{})){let a=Pn(n)?t.resolveSchemaReference(n):n;a.type==="string"&&a.enum!=null&&jLo(a.enum)&&orM(a.enum).length===1&&a.enum[0]!=null&&(r[i]=a.enum[0]);let o=dy_(a,"const");a.type==="string"&&o!=null&&(r[i]=o),i==="type"&&a.example!=null&&(r[i]=a.example)}return r}function orM(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 dy_(e,t){let r=e[t];if(r!=null)return r}function urM({schema:e,logger:t}){let r=Wh_({schema:e,logger:t});if(r!=null)return Xh_(r)}var sUn=class{document;taskContext;logger;DUMMY;options;namespace;static MESSAGE_REFERENCE_PREFIX="#/components/messages/";constructor({document:t,taskContext:r,options:i,namespace:n}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=i,this.namespace=n}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveTags(t,r){if(this.namespace==null&&t==null&&r!=null)return[r];let i=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};i.push(n)}return i.concat(t??[])}resolveSchemaReference(t){if(!t.$ref.startsWith(PJi))throw new Error(`Failed to resolve schema reference: ${t.$ref}`);let i=t.$ref.substring(PJi.length).split("/"),n=this.document.components;if(n==null||n.schemas==null)throw new Error("Document does not have components.schemas.");let[a,o,c]=i;if(a==null||a==="")throw new Error(`${t.$ref} cannot be resolved. No schema key provided.`);let f=n.schemas[a];if(f==null)throw new Error(`Schema "${a}" is undefined in document.components.schemas.`);if(Pn(f)&&(f=this.resolveSchemaReference(f)),o==="properties"&&c!=null){let s=f.properties?.[c];if(s==null)throw new Error(`Property "${c}" not found on "${a}". Full ref: ${t.$ref}`);Pn(s)?f=this.resolveSchemaReference(s):f=s}return f}referenceExists(t){let r=t.substring(2).split("/").map(n=>n.replace(/~1/g,"/")),i=this.document;for(let n of r){if(typeof i!="object"||i==null)return!1;i=i[n]}return!0}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,i){}markSchemaWithDiscriminantValue(t,r,i){}};var wLo=class extends sUn{getExampleMessageReference(t){return`#/components/messages/${t.messageId}`}resolveMessageReference(t){let r="#/components/messages/",i=this.document.components;if(i==null||i.messages==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve message reference: ${t.$ref} in v2 components`);let n=t.$ref.substring(r.length),a=i.messages[n];if(a==null)throw new Error(`${t.$ref} is undefined`);return a}};function cUn(e,t){let r={};if(e!=null)return{rootSchemas:r,namespacedSchemas:{[e]:t}};let i={};for(let[n,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[n]=a;continue}let o=a.namespace;i[o]??={},i[o][n]=a;continue}case"oneOf":case"unknown":r[n]=a;continue;default:Ot(a)}return{rootSchemas:r,namespacedSchemas:i}}var lUn=ue(require("fs"),1),jJi=ue(require("path"),1);function xCi(e){if(typeof e=="string")return wl.primitive(Ka.string(e));if(typeof e=="number")return Number.isInteger(e)?wl.primitive(Ka.int(e)):wl.primitive(Ka.double(e));if(typeof e=="boolean")return wl.primitive(Ka.boolean(e));if(Array.isArray(e)){let t=e.map(r=>xCi(r));return t.length===0?void 0:wl.array(t.filter(r=>r!=null))}else if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string")){let t=[];for(let[r,i]of Object.entries(e)){let n=xCi(i);n!=null&&t.push({key:Ka.string(r),value:n})}return wl.map(t)}}function tja(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function py_(e){if(e!=null&&Array.isArray(e))return e}var GCi=class{schemas;nonRequestReferencedSchemas;context;constructor(t,r,i){this.schemas=t,this.nonRequestReferencedSchemas=r,this.context=i}buildExample({schema:t,exampleId:r,example:i,options:n,skipReadonly:a}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:i,options:{...n,maxCheckerDepth:n.maxCheckerDepth??5},depth:0,skipReadonly:a??!1})}buildExampleHelper({exampleId:t,example:r,schema:i,depth:n,visitedSchemaIds:a,options:o,skipReadonly:c}){switch(i.type){case"enum":return typeof r=="string"&&_y_({schema:i,value:r})?wl.enum(r):i.values[0]!=null?wl.enum(i.values[0]?.value):void 0;case"literal":return wl.literal(i.value);case"nullable":{if(r==null&&!this.hasExample(i.value,0,a,o)&&this.exceedsMaxDepth(n,o))return wl.null({});let f=this.buildExampleHelper({schema:i.value,visitedSchemaIds:a,exampleId:t,example:r,depth:n,options:o,skipReadonly:c});return f??wl.null({})}case"optional":{if(r==null&&!this.hasExample(i.value,0,a,o)&&(o.ignoreOptionals||this.exceedsMaxDepth(n,o))||Object.is(r,null))return;let f=this.buildExampleHelper({schema:i.value,visitedSchemaIds:a,exampleId:t,example:r,depth:n,options:o,skipReadonly:c});return f!=null&&f.type==="array"&&f.value.length===0||f!=null&&f.type==="map"&&f.value.length===0||f!=null&&f.type==="object"&&Object.keys(f.properties).length===0?void 0:f}case"primitive":{let f=this.buildExampleFromPrimitive({schema:i.schema,example:r,options:o});return wl.primitive(f)}case"reference":{let f=this.schemas[i.schema];if(f!=null&&!a.has(i.schema)){a.add(i.schema);let s=f?.type==="object"&&!this.nonRequestReferencedSchemas.has(i.schema),u=this.buildExampleHelper({example:r,schema:f,exampleId:t,visitedSchemaIds:a,depth:n,options:o,skipReadonly:s||this.context.options.respectReadonlySchemas?c:!1});return a.delete(i.schema),u}return}case"oneOf":switch(i.value.type){case"discriminated":{let f={},s={},u={},l=tja(r),p=l?.[i.value.discriminantProperty],_=i.value.schemas[p],h=[],y=this.getDiscriminatedUnionVariantSchema(i.value,l);y!=null&&h.push(y),h.push(...Object.entries(i.value.schemas));for(let b of h)if(p!=null&&_!=null&&_.type==="object"){s=this.getAllProperties(_),u=this.getAllRequiredProperties(_),f[i.value.discriminantProperty]=wl.primitive(Ka.string(p));break}else{let v=this.buildExampleHelper({exampleId:t,schema:b[1],example:void 0,visitedSchemaIds:a,depth:n,options:o,skipReadonly:c});if(v!=null){this.mergeExampleWith(v,f),f[i.value.discriminantProperty]=wl.primitive(Ka.string(b[0]));break}}for(let b of i.value.commonProperties){s[b.key]={schema:b.schema,readonly:!1};let v=this.getResolvedSchema(b.schema);v.type!=="optional"&&v.type!=="nullable"&&(u[b.key]=b.schema)}for(let[b,v]of Object.entries(s)){let O=b in u;if(O&&l?.[b]!=null){let A=this.buildExampleHelper({schema:v.schema,exampleId:t,example:l[b],visitedSchemaIds:a,depth:n+1,options:o,skipReadonly:c});if(A!=null)f[b]=A;else return}else{let A=this.buildExampleHelper({exampleId:t,schema:v.schema,example:l?.[b],visitedSchemaIds:a,depth:n+1,options:o,skipReadonly:c});if(A!=null)f[b]=A;else if(O)return}}return wl.oneOf(DCi.discriminated(f))}case"undiscriminated":{let f=this.getUnDiscriminatedUnionVariantSchema(i.value,r);if(f!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:f,visitedSchemaIds:a,depth:n,options:o,skipReadonly:c});break}}return;case"unknown":if(r!=null){let f=xCi(r);if(f!=null)return wl.unknown(f)}return o.ignoreOptionals||this.exceedsMaxDepth(n,o)?void 0:o.isParameter?wl.primitive(Ka.string(o.name??"string")):wl.map([{key:Ka.string("key"),value:wl.primitive(Ka.string("value"))}]);case"array":{let f=py_(r),s=[];if(f!=null&&f.length>0)for(let u of f){let l=this.buildExampleHelper({exampleId:t,example:u,schema:i.value,depth:n+1,visitedSchemaIds:a,options:o,skipReadonly:c});l!=null&&s.push(l)}else if(i.example!=null&&i.example.length>0)for(let u of i.example){let l=this.buildExampleHelper({exampleId:t,example:u,schema:i.value,depth:n+1,visitedSchemaIds:a,options:o,skipReadonly:c});l!=null&&s.push(l)}else{let u=this.buildExampleHelper({exampleId:t,example:void 0,schema:i.value,depth:n+1,visitedSchemaIds:a,options:o,skipReadonly:c});u!=null&&s.push(u)}return wl.array(s)}case"map":{let f=tja(r??i.example);if(f!=null&&Object.entries(f).length>0){let l=[];for(let[p,_]of Object.entries(f)){let h=this.buildExampleFromPrimitive({schema:i.key.schema,example:p,options:o}),y=this.buildExampleHelper({exampleId:t,example:_,schema:i.value,visitedSchemaIds:a,depth:n+1,options:o,skipReadonly:c});y!=null&&l.push({key:h,value:y})}return wl.map(l)}if(i.key.schema.type==="string"&&i.value.type==="unknown")return wl.map([{key:Ka.string("key"),value:wl.unknown(wl.primitive(Ka.string("value")))}]);let s=this.buildExampleFromPrimitive({schema:i.key.schema,example:void 0,options:{...o,name:"key"}}),u=this.buildExampleHelper({exampleId:t,example:void 0,schema:i.value,visitedSchemaIds:a,depth:n+1,options:{...o,name:"value"},skipReadonly:c});return u!=null&&u.type!=="null"?wl.map([{key:s,value:u}]):wl.map([])}case"object":{let f={},s=i.fullExamples?.find(_=>_.name===t)??i.fullExamples?.find(_=>_.name==null)??i.fullExamples?.[0],u=tja(r)??(s!=null?tja(s.value):{})??{},l=this.getAllProperties(i),p=this.getAllRequiredProperties(i);for(let[_,h]of Object.entries(l)){if(c&&h.readonly||h.schema._visit({optional:m=>typeof m.availability=="string"&&m.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 y=_ in p,b=Object.keys(u).includes(_),v=u[_],O=this.getSchemaExample(h.schema),A=v??O,g=this.buildExampleHelper({schema:h.schema,exampleId:t,example:A,visitedSchemaIds:a,depth:n+1,options:{...o,name:_},skipReadonly:c});if(y&&g!=null)f[_]=g;else{if(y)return;(b&&g!=null||!o.ignoreOptionals&&g!=null)&&(f[_]=g)}}if(i.additionalProperties){for(let[_,h]of Object.entries(u))if(!(_ in f)){let y=this.buildExampleHelper({schema:ni.unknown({example:h,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0}),exampleId:t,example:h,visitedSchemaIds:a,depth:n+1,options:{...o,name:_},skipReadonly:c});y!=null&&(f[_]=y)}}return wl.object({properties:f})}default:Ot(i)}}mergeExampleWith(t,r){t._visit({array:Mt,enum:Mt,literal:Mt,map:i=>{for(let n of i){let a=n.key;a.type==="string"&&(r[a.value]=n.value)}},object:i=>{for(let[n,a]of Object.entries(i.properties))r[n]=a},oneOf:i=>{if(i.type==="discriminated")for(let[n,a]of Object.entries(i.value))r[n]=a;else this.mergeExampleWith(i.value,r)},primitive:Mt,unknown:Mt,null:Mt,_other:Mt})}getObjectSchema(t){if(t.type==="object")return t;if(t.type==="reference"){let r=this.schemas[t.schema];if(r!=null)return this.getObjectSchema(r)}}getDiscriminatedUnionVariantSchema(t,r){let i=r?.[t.discriminantProperty];if(i==null||typeof i!="string")return Object.entries(t.schemas)[0];let n=t.schemas[i];return n==null?Object.entries(t.schemas)[0]:[i,n]}getUnDiscriminatedUnionVariantSchema(t,r){if(r==null){let a=t.schemas.find(c=>this.hasExample(c,0,new Set,{ignoreOptionals:!1,isParameter:!1}));if(a!=null)return a;let o=t.schemas.find(c=>this.hasInherentExample(c));return o??t.schemas[0]}return t.schemas.map(a=>({schema:a,heuristic:this.calcExampleHeuristic(a,r)})).sort((a,o)=>o.heuristic-a.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return _y_({schema:t,value:r})?5:0;case"object":{if(!$c(r))return 0;let i=this.getAllProperties(t),n=0;for(let[a,o]of Object.entries(i))r[a]!=null?(n++,n+=this.calcExampleHeuristic(o.schema,r[a])):n--;return n}case"array":{if(!Array.isArray(r))return 0;let i=0;for(let n of r)i+=this.calcExampleHeuristic(t.value,n);return i}case"map":{if(!$c(r))return 0;let i=0;for(let[,n]of Object.entries(r))i+=this.calcExampleHeuristic(t.value,n);return i}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let i=this.getResolvedSchema(t);return i==null?0:this.calcExampleHeuristic(i,r)}case"oneOf":return Object.values(t.value.schemas).map(n=>this.calcExampleHeuristic(n,r)).sort((n,a)=>a-n)[0]??0;case"primitive":return r==null?0:t.schema._visit({int:()=>typeof r=="number",int64:()=>typeof r=="number",uint:()=>typeof r=="number",uint64:()=>typeof r=="number",float:()=>typeof r=="number",double:()=>typeof r=="number",string:()=>typeof r=="string",datetime:()=>typeof r=="string",date:()=>typeof r=="string",base64:()=>typeof r=="string",boolean:()=>typeof r=="boolean",_other:()=>!0})?1:-1;default:return 0}}hasExample(t,r,i=new Set,n){if(this.exceedsMaxCheckerDepth(r,n))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,i,n);case"enum":return t.example!=null;case"literal":return!1;case"map":return t.example!=null||t.key.schema.example!=null&&this.hasExample(t.value,r+1,i,n);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let o of t.properties)if(this.hasExample(o.schema,r+1,i,n))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let a=this.schemas[t.schema];if(a!=null&&!i.has(t.schema)){i.add(t.schema);let o=this.hasExample(a,r,i,n);return i.delete(t.schema),o}return!1}case"unknown":return t.example!=null;case"oneOf":return Object.values(t.value.schemas).some(a=>this.hasExample(a,r,i,n));default:return!1}}hasInherentExample(t){switch(t.type){case"literal":return!0;case"enum":return t.values.length>0;case"optional":case"nullable":return this.hasInherentExample(t.value);case"reference":{let r=this.schemas[t.schema];return r!=null?this.hasInherentExample(r):!1}default:return!1}}exceedsMaxCheckerDepth(t,r){return t>(r.maxCheckerDepth??0)}exceedsMaxDepth(t,r){return t>(r.maxDepth??0)}getAllProperties(t){let r={};for(let i of t.properties)r[i.key]={schema:i.schema,readonly:i.readonly??!1};for(let i of t.allOf){let n=this.schemas[i.schema];if(n==null)continue;let a=this.getResolvedSchema(n);a.type==="object"&&(r={...this.getAllProperties(a),...r})}return r}getAllRequiredProperties(t){let r={};for(let i of t.properties){let n=this.getResolvedSchema(i.schema);n.type!=="optional"&&n.type!=="nullable"&&(r[i.key]=i.schema)}for(let i of t.allOf){let n=this.schemas[i.schema];if(n==null)continue;let a=this.getResolvedSchema(n);a.type==="object"&&(r={...this.getAllRequiredProperties(a),...r})}return r}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}getSchemaExample(t){return t._visit({primitive:r=>r.schema.example,object:r=>r.fullExamples?.[0]?.value,array:r=>r.example,map:r=>r.example,optional:r=>this.getSchemaExample(r.value),enum:r=>r.example,reference:r=>{let i=this.schemas[r.schema];return i!=null?this.getSchemaExample(i):void 0},literal:()=>{},oneOf:()=>{},nullable:r=>this.getSchemaExample(r.value),unknown:r=>r.example,_other:()=>{}})}buildExampleFromPrimitive({example:t,schema:r,options:i}){switch(r.type){case"string":return t!=null&&typeof t=="string"?Ka.string(t):r.example!=null?Ka.string(r.example):Ka.string(i.name??Tn.STRING);case"base64":return t!=null&&typeof t=="string"?Ka.base64(t):r.example!=null?Ka.base64(r.example):Ka.base64(Tn.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?Ka.boolean(t):r.example!=null?Ka.boolean(r.example):Ka.boolean(Tn.BOOLEAN);case"date":return t!=null&&typeof t=="string"?Ka.date(t):r.example!=null?Ka.date(r.example):Ka.date(Tn.DATE);case"datetime":return t!=null&&typeof t=="string"?Ka.datetime(t):r.example!=null?Ka.datetime(r.example):Ka.datetime(Tn.DATE_TIME);case"double":return t!=null&&typeof t=="number"?Ka.double(t):r.example!=null?Ka.double(r.example):Ka.double(Tn.DOUBLE);case"float":return t!=null&&typeof t=="number"?Ka.float(t):r.example!=null?Ka.float(r.example):Ka.float(Tn.FLOAT);case"int":return t!=null&&typeof t=="number"?Ka.int(t):r.example!=null?Ka.int(r.example):Ka.int(Tn.INT);case"int64":return t!=null&&typeof t=="number"?Ka.int64(t):r.example!=null?Ka.int64(r.example):Ka.int64(Tn.INT64);case"uint":return t!=null&&typeof t=="number"?Ka.uint(t):r.example!=null?Ka.uint(r.example):Ka.uint(Tn.UINT);case"uint64":return t!=null&&typeof t=="number"?Ka.uint64(t):r.example!=null?Ka.uint64(r.example):Ka.uint64(Tn.UINT64);default:Ot(r)}}};function _y_({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function bFt(e){switch(e.type){case"object":return ni.object({allOf:e.allOf,properties:e.properties.map(t=>crM(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 ni.array({description:e.description,availability:e.availability,value:bFt(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 ni.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 ni.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 ni.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:bFt(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"optional":return ni.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:bFt(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"primitive":return ni.primitive({description:e.description,availability:e.availability,schema:hy_(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return ni.map({description:e.description,availability:e.availability,key:ni.primitive({description:e.key.description,availability:e.key.availability,schema:hy_(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,namespace:e.namespace,groupName:e.groupName}),value:bFt(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 ni.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 ni.oneOf(srM(e.value));case"unknown":return ni.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:Ot(e)}}function srM(e){switch(e.type){case"discriminated":return Mhe.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:bFt(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,bFt(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return Mhe.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>bFt(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:Ot(e)}}function hy_(e){switch(e.type){case"string":return Un.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return Un.base64({example:void 0});case"boolean":return Un.boolean({default:e.default,example:void 0});case"date":return Un.date({example:void 0});case"datetime":return Un.datetime({example:void 0});case"double":return Un.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 Un.float({example:void 0});case"int":return Un.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 Un.int64({default:e.default,example:void 0});case"uint":return Un.uint({default:void 0,example:void 0});case"uint64":return Un.uint64({default:void 0,example:void 0});default:Ot(e)}}function crM(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:bFt(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function ELo(e){return e.type!=="optional"&&e.type!=="nullable"}function $sc(e){return e==="POST"||e==="PUT"||e==="PATCH"}function rja(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 SLo=class{schemas;context;globalHeaders;exampleTypeFactory;logger;missingExamples=[];constructor(t,r,i){this.schemas=t,this.context=r,this.globalHeaders=i,this.schemas=t,this.exampleTypeFactory=new GCi(t,r.nonRequestReferencedSchemas,r),this.logger=r.logger}addMissingExampleRecord(t,r,i,n,a={}){this.missingExamples.push({endpoint:t.path,method:t.method.toUpperCase(),type:r,schemaType:i,reason:n,operationSummary:t.summary,operationDescription:t.description,schemaDescription:a.schemaDescription,autoGeneratedExample:a.autoGeneratedExample})}writeMissingExamplesLog(){if(this.missingExamples.length===0)return;let t;if(this.context.source.type==="openapi"){let a=this.context.source.file,o=jJi.dirname(a),c=o;for(;c!==jJi.dirname(c);){let f=jJi.join(c,"fern");if(lUn.existsSync(f)&&lUn.statSync(f).isDirectory()){t=f;break}c=jJi.dirname(c)}t||(t=o)}else t=process.cwd();let r=t??process.cwd(),i=jJi.join(r,"schemas_missing_examples.txt"),n=["# Schemas Missing Examples Report",`# Generated on: ${new Date().toISOString()}`,`# Total missing examples: ${this.missingExamples.length}`,"",...this.missingExamples.flatMap(a=>{let o=[];if(o.push(`${a.method} ${a.endpoint} - ${a.type.toUpperCase()} (${a.schemaType}): ${a.reason}`),a.operationSummary&&o.push(` Operation: ${a.operationSummary}`),a.operationDescription&&a.operationDescription!==a.operationSummary&&o.push(` Description: ${a.operationDescription}`),a.schemaDescription&&o.push(` ${a.type==="request"?"Request":"Response"} Schema: ${a.schemaDescription}`),a.autoGeneratedExample){o.push(" Auto-generated example:");let f=JSON.stringify(a.autoGeneratedExample,null,4).split(`
|
|
1413
1413
|
`).map(s=>` ${s}`).join(`
|
|
1414
1414
|
`);o.push(f)}return o.push(""),o}),""].join(`
|
|
@@ -1449,7 +1449,7 @@ plugins:
|
|
|
1449
1449
|
- enum_type=string
|
|
1450
1450
|
- default_response=false
|
|
1451
1451
|
- source_root=${e}
|
|
1452
|
-
`}async function pPe({context:e,specs:t,relativePathToDependency:r}){let i=new b6o({context:e}),n=t.filter(f=>f.type==="openapi").map(f=>({...f,relativePathToDependency:r})),a=t.filter(f=>f.type==="protobuf"),c=(await Promise.all(a.map(async f=>{if(f.absoluteFilepathToProtobufTarget!=null){let p=await fq_({generator:i,protobufSpec:f,relativePathToDependency:r});return p?[p.openApiSpec]:[]}let s=await ZF(f.absoluteFilepathToProtobufRoot,"proto"),u,l=[];for(let p of s){let _=await fq_({generator:i,protobufSpec:{...f,absoluteFilepathToProtobufTarget:p},relativePathToDependency:r,existingBufLockContents:u});_!=null&&(l.push(_.openApiSpec),_.bufLockContents!=null&&(u=_.bufLockContents))}return l}))).flat().filter(f=>Xu(f));return[...n,...c]}async function fq_({generator:e,protobufSpec:t,relativePathToDependency:r,existingBufLockContents:i}){if(t.absoluteFilepathToProtobufTarget==null)return;let n=await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally,deps:t.dependencies,existingBufLockContents:i});return{bufLockContents:n.bufLockContents,openApiSpec:{type:"openapi",absoluteFilepath:n.absoluteFilepath,absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}}function TqM(e){return e.every(t=>t.settings?.removeDiscriminantsFromSchemas===hn.RemoveDiscriminantsFromSchemas.Never)?hn.RemoveDiscriminantsFromSchemas.Never:hn.RemoveDiscriminantsFromSchemas.Always}var Xw=class e extends YPa{type="oss";allSpecs;specs;sources;loader;parseOptions;groupMultiApiEnvironments;constructor({allSpecs:t,specs:r,...i}){super({...i,respectReadonlySchemas:r.every(n=>n.settings?.respectReadonlySchemas),respectNullableSchemas:r.every(n=>n.settings?.respectNullableSchemas),wrapReferencesToNullableInOptional:r.every(n=>n.settings?.wrapReferencesToNullableInOptional),removeDiscriminantsFromSchemas:TqM(r),coerceOptionalSchemasToNullable:r.every(n=>n.settings?.coerceOptionalSchemasToNullable),onlyIncludeReferencedSchemas:r.every(n=>n.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:r.every(n=>n.settings?.inlinePathParameters),objectQueryParameters:r.every(n=>n.settings?.objectQueryParameters),useBytesForBinaryResponse:r.filter(n=>n.type==="openapi"&&n.source.type==="openapi").some(n=>n.settings?.useBytesForBinaryResponse),respectForwardCompatibleEnums:r.filter(n=>n.type==="openapi"&&n.source.type==="openapi").some(n=>n.settings?.respectForwardCompatibleEnums),inlineAllOfSchemas:r.every(n=>n.settings?.inlineAllOfSchemas),resolveAliases:r.every(o=>o.settings?.resolveAliases)?{except:r.flatMap(o=>typeof o.settings?.resolveAliases=="object"?o.settings.resolveAliases.except??[]:[])}:!1,exampleGeneration:r[0]?.settings?.exampleGeneration,groupEnvironmentsByHost:r.some(n=>n.settings?.groupEnvironmentsByHost),defaultIntegerFormat:r[0]?.settings?.defaultIntegerFormat}),this.specs=r,this.allSpecs=t,this.sources=this.convertSpecsToIdentifiableSources(r),this.loader=new CFt(this.absoluteFilePath),this.groupMultiApiEnvironments=this.specs.some(n=>n.settings?.groupMultiApiEnvironments),this.parseOptions={onlyIncludeReferencedSchemas:this.onlyIncludeReferencedSchemas,respectReadonlySchemas:this.respectReadonlySchemas,respectNullableSchemas:this.respectNullableSchemas,wrapReferencesToNullableInOptional:this.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:this.coerceOptionalSchemasToNullable,inlinePathParameters:this.inlinePathParameters,objectQueryParameters:this.objectQueryParameters,exampleGeneration:this.exampleGeneration,useBytesForBinaryResponse:this.useBytesForBinaryResponse,respectForwardCompatibleEnums:this.respectForwardCompatibleEnums,inlineAllOfSchemas:this.inlineAllOfSchemas,resolveAliases:this.resolveAliases,removeDiscriminantsFromSchemas:this.removeDiscriminantsFromSchemas,groupMultiApiEnvironments:this.groupMultiApiEnvironments,groupEnvironmentsByHost:this.groupEnvironmentsByHost,defaultIntegerFormat:this.defaultIntegerFormat}}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await pPe({context:t,specs:this.specs,relativePathToDependency:r});return EJi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,...this.parseOptions}})}async getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:i,generateV1Examples:n,logWarnings:a}){let o=await pPe({context:t,specs:this.specs}),c=await this.loader.loadDocuments({context:t,specs:o}),f=this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0;f&&t.logger.trace("Using auth overrides from generators configuration");let s=this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0;s&&t.logger.trace("Using environment overrides from generators configuration");let u=this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0;u&&t.logger.trace("Using global header overrides from generators configuration");let l,p=[];for(let _ of c){let h=Ft(this.absoluteFilePath,Ze.of(_.source?.file??"")),y=P7(q0(),h),b=new T0e({logger:t.logger,relativeFilepathToSpec:y});p.push(b);let v;switch(_.type){case"openapi":{let A=new Pgi({namespace:_.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:_.value,exampleGenerationArgs:{disabled:!1},errorCollector:b,authOverrides:f,environmentOverrides:s,globalHeaderOverrides:u,enableUniqueErrorsPerEndpoint:i,generateV1Examples:n,settings:SFt({options:_.settings}),documentBaseDir:nn(h)});v=await new uEa({context:A,audiences:r}).convert();break}case"asyncapi":{let A=new nEa({namespace:_.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:_.value,exampleGenerationArgs:{disabled:!1},errorCollector:b,enableUniqueErrorsPerEndpoint:i,settings:SFt({options:_.settings}),generateV1Examples:n});v=await new iEa({context:A,audiences:r}).convert();break}default:b.collect({message:`Unsupported document type: ${_}`,path:[]});break}let O=u6o({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});v!=null&&(l=l===void 0?v:TKi(l,v,O))}for(let _ of this.allSpecs)if(_.type==="openrpc"){let h=_.absoluteFilepath,y=P7(q0(),h),b=new T0e({logger:t.logger,relativeFilepathToSpec:y});p.push(b);let v=new cEa({namespace:_.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:await Jyc({context:t,absoluteFilePath:_.absoluteFilepath,absoluteFilePathToOverrides:_.absoluteFilepathToOverrides}),exampleGenerationArgs:{disabled:!1},errorCollector:b,enableUniqueErrorsPerEndpoint:i,generateV1Examples:n,settings:SFt()}),A=await new sEa({context:v,audiences:r}).convert(),g=u6o({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});A!=null&&(l=l===void 0?A:TKi(l,A,g))}else if(_.type==="protobuf")try{let y=await new y6o({context:t}).generate({absoluteFilepathToProtobufRoot:_.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:_.absoluteFilepathToProtobufTarget,local:!0,deps:_.dependencies}),b=await(0,dq_.readFile)(y,"utf-8"),v=u6o({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});if(b!=null){let O;try{if(O=Cn.IntermediateRepresentation.parse(JSON.parse(b),{allowUnrecognizedEnumValues:!0,skipValidation:!0}),O.ok)l=l===void 0?O.value:TKi(l,O.value,v);else throw new Error}catch{t.logger.log("error","Failed to parse protobuf IR: ")}}}catch(h){t.logger.log("warn","Failed to parse protobuf IR: "+h)}for(let _ of p)if(_.hasErrors()){let h=_.getErrorStats(),y=_.relativeFilepathToSpec?` for ${_.relativeFilepathToSpec}`:"";h.numErrors>0?t.logger.log("error",`API validation${y} completed with ${h.numErrors} errors and ${h.numWarnings} warnings.`):h.numWarnings>0?t.logger.log("warn",`API validation${y} completed with ${h.numWarnings} warnings.`):t.logger.log("info",`All checks passed when parsing OpenAPI${y}.`),t.logger.log("info",""),await _.logErrors({logWarnings:a})}if(l===void 0)throw new Error("Failed to generate intermediate representation");return l}async toFernWorkspace({context:t},r,i){if(i!=null)return this.createWorkspaceWithSpecsOverride({context:t},i,r);let n=await this.getDefinition({context:t},r);return new eK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion,sources:this.sources})}async createWorkspaceWithSpecsOverride({context:t},r,i){let n=await this.convertSpecsOverrideToSpecs(r),a=n.filter(f=>f.type!=="protobuf"||!f.fromOpenAPI),o=new e({allSpecs:a,specs:n.filter(f=>f.type==="openapi"||f.type==="protobuf"),generatorsConfiguration:this.generatorsConfiguration,workspaceName:this.workspaceName,cliVersion:this.cliVersion,absoluteFilePath:this.absoluteFilePath,changelog:this.changelog}),c=await o.getDefinition({context:t},i);return new eK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:c,cliVersion:this.cliVersion,sources:o.sources})}async convertSpecsOverrideToSpecs(t){if(!Array.isArray(t))throw new Error("Conjure specs override is not yet supported");let r=[];for(let i of t)if(hn.isOpenApiSpecSchema(i)){let n=Ft(this.absoluteFilePath,Ze.of(i.openapi)),a=i.overrides?Ft(this.absoluteFilePath,Ze.of(i.overrides)):void 0,o={type:"openapi",absoluteFilepath:n,absoluteFilepathToOverrides:a,settings:this.specs.length>0?this.specs[0]?.settings:void 0,source:{type:"openapi",file:n},namespace:i.namespace??this.workspaceName};r.push(o)}else throw new Error("Spec type override not yet supported. Only OpenAPI specs are currently supported in specs override.");return r}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.allSpecs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(Xu)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let o=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(o)||(r.add(o),n.push({type:a.type,id:Z_e(),absoluteFilePath:o})),n},i)}};function RqM(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function dbc(e,t){for(let[r,i]of JD(e.failures))zqM({relativeFilepath:r,failure:i,logger:t})}function zqM({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case h_.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case h_.FILE_READ:r.error("Failed to open file: "+e);break;case h_.FILE_MISSING:r.error("Missing file: "+e);break;case h_.FILE_PARSE:t.error instanceof Bpa?r.error(aPe({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case h_.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of NqM(i))r.error(aPe({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case h_.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case h_.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${hio}: `+t.dependencyName);break;case h_.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case h_.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case h_.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let i=t.error.error.instancePath.split("/").filter(n=>n!=="").map(RqM);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?i.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&i.push(t.error.error.params.additionalProperty),r.error(aPe({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...i]}))}break;default:Ot(t)}}function NqM(e){switch(e.code){case gi.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Ut.underline(e.expected)} but received ${Ut.underline(e.received)}`}];case gi.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Ut.underline(t)}`}));case gi.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Ut.underline(t)).join(", ")}`}];case gi.invalid_union:case gi.invalid_arguments:case gi.invalid_return_type:case gi.invalid_date:case gi.invalid_string:case gi.too_small:case gi.too_big:case gi.invalid_intersection_types:case gi.not_multiple_of:case gi.custom:default:return[{title:e.message}]}}var pq_=require("fs/promises");async function _q_(e,t){let r=[];for(let i of await ZF(e,t))r.push(await FqM({relativeFilepath:nb(e,i),absoluteFilepath:i}));return r}async function FqM({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,pq_.readFile)(t)).toString()}}async function hq_({absolutePathToWorkspace:e}){let t=Ft(e,Ze.of(oId));if(!await Ri(t))return;let i=await _q_(t,"{md,mdx}");return{files:await Promise.all(i.map(n=>({absoluteFilepath:n.absoluteFilepath,contents:n.fileContents})))}}async function pbc({absolutePathToWorkspace:e,namespace:t,definitions:r}){let i=[];for(let n of r){let a=n.overrides!=null?Ft(e,Ze.of(n.overrides)):void 0;if(n.schema.type==="protobuf"){let f=Ze.of(n.schema.root),s=Ft(e,f);if(!await Ri(s))return{didSucceed:!1,failures:{[Ze.of(n.schema.root)]:{type:h_.FILE_MISSING}}};let u=n.schema.target.length===0?void 0:Ft(e,Ze.of(n.schema.target));if(u!=null&&!await Ri(u))return{didSucceed:!1,failures:{[Ze.of(n.schema.target)]:{type:h_.FILE_MISSING}}};let l=F5o(n.settings);i.push({type:"protobuf",absoluteFilepathToProtobufRoot:s,absoluteFilepathToProtobufTarget:u,absoluteFilepathToOverrides:a,relativeFilepathToProtobufRoot:f,dependencies:n.schema.dependencies,generateLocally:n.schema.localGeneration,fromOpenAPI:n.schema.fromOpenAPI,settings:{...l,audiences:n.audiences??[]}});continue}if(n.schema.type==="openrpc"){let f=Ze.of(n.schema.path),s=Ft(e,f);i.push({type:"openrpc",absoluteFilepath:s,absoluteFilepathToOverrides:a,namespace:t});continue}let o=Ft(e,Ze.of(n.schema.path));if(!await Ri(o))return{didSucceed:!1,failures:{[Ze.of(n.schema.path)]:{type:h_.FILE_MISSING}}};if(n.overrides!=null&&a!=null&&!await Ri(a))return{didSucceed:!1,failures:{[Ze.of(n.overrides)]:{type:h_.FILE_MISSING}}};let c=F5o(n.settings);i.push({type:"openapi",absoluteFilepath:o,absoluteFilepathToOverrides:a,settings:{...c,audiences:n.audiences??[]},source:{type:"openapi",file:o},namespace:t})}return i}async function _Ea({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:i}){let n=await K_e({absolutePathToWorkspace:e,context:t}),a;try{a=await hq_({absolutePathToWorkspace:e})}catch{}if(n?.api!=null&&n?.api.type==="conjure")return{didSucceed:!0,workspace:new sWo({workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r,context:t,relativePathToConjureDirectory:Ze.of(n.api.pathToConjureDefinition)})};if(n?.api!=null&&(n.api.type==="singleNamespace"&&n.api.definitions.length>0||n.api.type==="multiNamespace")){let o=[];if(n.api.type==="singleNamespace"){let c=await pbc({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.definitions});if(!Array.isArray(c))return c;o.push(...c)}else{for(let[c,f]of Object.entries(n.api.definitions)){let s=await pbc({absolutePathToWorkspace:e,namespace:c,definitions:f});if(!Array.isArray(s))return s;o.push(...s)}if(n.api.rootDefinitions!=null){let c=await pbc({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.rootDefinitions});if(!Array.isArray(c))return c;o.push(...c)}}return{didSucceed:!0,workspace:new Xw({specs:o.filter(c=>!(c.type==="openrpc"||c.type==="protobuf"&&!c.fromOpenAPI)),allSpecs:o.filter(c=>!(c.type==="protobuf"&&c.fromOpenAPI)),workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r})}}if(await Ri(Ft(e,Ze.of(lR))))return{didSucceed:!0,workspace:new T9t({absoluteFilePath:e,generatorsConfiguration:n,workspaceName:i,changelog:a,context:t,cliVersion:r,loadAPIWorkspace:_Ea})};if(await ZMs(Ft(e,Ze.of(lR)))){let o=e.split("/").pop();t.logger.warn(`Detected empty API definiton: ${o}. Remove to resolve error.`)}return{didSucceed:!1,failures:{[Ze.of(Sda)]:{type:h_.MISCONFIGURED_DIRECTORY}}}}var yq_=require("fs/promises");var _bc={};Yt(_bc,{additionalProperties:()=>VqM,default:()=>xqM,definitions:()=>WqM,properties:()=>UqM,required:()=>LqM,type:()=>QqM});var QqM="object",UqM={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},products:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ProductConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},languages:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.Language"}},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-search":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},settings:{oneOf:[{$ref:"#/definitions/docs.DocsSettingsConfig"},{type:"null"}]},theme:{oneOf:[{$ref:"#/definitions/docs.ThemeConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]}},LqM=["instances"],VqM=!1,WqM={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]}},additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.Audience":{anyOf:[{$ref:"#/definitions/docs.AudienceId"},{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}}]},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},private:{oneOf:[{type:"boolean"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.Target":{type:"string",enum:["_blank","_self","_parent","_top"]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.InternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.ExternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},href:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["display-name","href"],additionalProperties:!1},"docs.ProductConfig":{anyOf:[{$ref:"#/definitions/docs.InternalProduct"},{$ref:"#/definitions/docs.ExternalProduct"}]},"docs.Availability":{type:"string",enum:["stable","generally-available","in-development","pre-release","deprecated","beta"]},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},php:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},swift:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},rust:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},"tag-description-pages":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},postman:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.FolderConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},folder:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["folder"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"},{$ref:"#/definitions/docs.FolderConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItemWithLayout":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabVariant":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},layout:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","layout"],additionalProperties:!1},"docs.TabbedNavigationItemWithVariants":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},variants:{type:"array",items:{$ref:"#/definitions/docs.TabVariant"}}},required:["tab","variants"],additionalProperties:!1},"docs.TabbedNavigationItem":{anyOf:[{$ref:"#/definitions/docs.TabbedNavigationItemWithLayout"},{$ref:"#/definitions/docs.TabbedNavigationItemWithVariants"}]},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfigWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},url:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.NavbarGithubConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.NavbarGithubConfigWithOptions"}]},"docs.NavbarLinkConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","dropdown","primary","secondary"]}},oneOf:[{properties:{type:{const:"filled"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"dropdown"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},links:{type:"array",items:{$ref:"#/definitions/docs.NavbarLinkConfig"}},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type","links"]},{properties:{type:{const:"primary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionOption":{type:"string",enum:["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]},"docs.PageActionOptions":{type:"object",properties:{"copy-page":{oneOf:[{type:"boolean"},{type:"null"}]},"view-as-markdown":{oneOf:[{type:"boolean"},{type:"null"}]},"ask-ai":{oneOf:[{type:"boolean"},{type:"null"}]},chatgpt:{oneOf:[{type:"boolean"},{type:"null"}]},claude:{oneOf:[{type:"boolean"},{type:"null"}]},cursor:{oneOf:[{type:"boolean"},{type:"null"}]},vscode:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionsConfig":{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/docs.PageActionOption"},{type:"null"}]},options:{oneOf:[{$ref:"#/definitions/docs.PageActionOptions"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]},"dynamic-snippets":{oneOf:[{type:"boolean"},{type:"null"}]},"ai-examples":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.Language":{type:"string",enum:["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]},"docs.AIChatModel":{type:"string",enum:["claude-3.7","claude-4","command-a"]},"docs.AIChatLocation":{type:"string",enum:["docs","slack","discord"]},"docs.AIChatWebsiteDatasource":{type:"object",properties:{url:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.AIChatDatasource":{anyOf:[{$ref:"#/definitions/docs.AIChatWebsiteDatasource"}]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]},location:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatLocation"}},{type:"null"}]},datasources:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatDatasource"}},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]},"canonical-host":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},"right-text":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-nav-links":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-feedback":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.HttpSnippetLanguage":{type:"string",enum:["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]},"docs.HttpSnippetsConfig":{anyOf:[{type:"boolean"},{type:"array",items:{$ref:"#/definitions/docs.HttpSnippetLanguage"}}]},"docs.DocsSettingsConfig":{type:"object",properties:{"search-text":{oneOf:[{type:"string"},{type:"null"}]},"disable-search":{oneOf:[{type:"boolean"},{type:"null"}]},"dark-mode-code":{oneOf:[{type:"boolean"},{type:"null"}]},"default-search-filters":{oneOf:[{type:"boolean"},{type:"null"}]},"http-snippets":{oneOf:[{$ref:"#/definitions/docs.HttpSnippetsConfig"},{type:"null"}]},"hide-404-page":{oneOf:[{type:"boolean"},{type:"null"}]},"use-javascript-as-typescript":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-explorer-proxy":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-analytics":{oneOf:[{type:"boolean"},{type:"null"}]},language:{oneOf:[{$ref:"#/definitions/docs.Language"},{type:"null"}]},"substitute-env-vars":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.SidebarThemeConfig":{type:"string",enum:["default","minimal"]},"docs.BodyThemeConfig":{type:"string",enum:["default","canvas"]},"docs.TabsThemeConfig":{type:"string",enum:["default","bubble"]},"docs.PageActionsThemeConfig":{type:"string",enum:["default","toolbar"]},"docs.FooterNavThemeConfig":{type:"string",enum:["default","minimal"]},"docs.ThemeConfig":{type:"object",properties:{sidebar:{oneOf:[{$ref:"#/definitions/docs.SidebarThemeConfig"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/docs.BodyThemeConfig"},{type:"null"}]},tabs:{oneOf:[{$ref:"#/definitions/docs.TabsThemeConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsThemeConfig"},{type:"null"}]},"footer-nav":{oneOf:[{$ref:"#/definitions/docs.FooterNavThemeConfig"},{type:"null"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},xqM={type:QqM,properties:UqM,required:LqM,additionalProperties:VqM,definitions:WqM};async function hbc({fernDirectory:e,context:t}){let r=Ft(e,Ze.of(uP));if(!await Ri(r))return;let i=await GqM({absolutePathToDocsDefinition:e,context:t});if(i!=null)return{type:"docs",absoluteFilePath:e,config:i,workspaceName:void 0,absoluteFilepathToDocsConfig:Ft(e,Ze.of(uP))}}async function GqM({absolutePathToDocsDefinition:e,context:t}){if(!await Ri(e))return;let r=Ft(e,Ze.of(uP));return await HqM({absolutePathOfConfiguration:r,context:t})}async function HqM({absolutePathOfConfiguration:e,context:t}){let r=await(0,yq_.readFile)(e),i=Ii.load(r.toString()),n=tzt(i,_bc,{filePath:e});if(n.success){let a=[];t.logger.debug("About to sanitize docs configuration JSON structure");let o=YOe(i,[],a);a.length>0?t.logger.warn(`docs.yml contained null/undefined sections that were ignored: ${a.map(c=>c.join(".")).join(", ")}`):t.logger.debug("No null/undefined values found during sanitization");try{return t.logger.debug("Attempting to parse sanitized docs configuration"),m7.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(o)}catch(c){throw t.logger.error(`Parsing failed even after sanitization: ${c instanceof Error?c.message:String(c)}`),t.logger.debug(`Sanitized JSON structure: ${JSON.stringify(o,null,2)}`),new Error(`Failed to parse ${e}: ${c instanceof Error?c.message:String(c)}`)}}else throw new Error(`Failed to parse docs.yml:
|
|
1452
|
+
`}async function pPe({context:e,specs:t,relativePathToDependency:r}){let i=new b6o({context:e}),n=t.filter(f=>f.type==="openapi").map(f=>({...f,relativePathToDependency:r})),a=t.filter(f=>f.type==="protobuf"),c=(await Promise.all(a.map(async f=>{if(f.absoluteFilepathToProtobufTarget!=null){let p=await fq_({generator:i,protobufSpec:f,relativePathToDependency:r});return p?[p.openApiSpec]:[]}let s=await ZF(f.absoluteFilepathToProtobufRoot,"proto"),u,l=[];for(let p of s){let _=await fq_({generator:i,protobufSpec:{...f,absoluteFilepathToProtobufTarget:p},relativePathToDependency:r,existingBufLockContents:u});_!=null&&(l.push(_.openApiSpec),_.bufLockContents!=null&&(u=_.bufLockContents))}return l}))).flat().filter(f=>Xu(f));return[...n,...c]}async function fq_({generator:e,protobufSpec:t,relativePathToDependency:r,existingBufLockContents:i}){if(t.absoluteFilepathToProtobufTarget==null)return;let n=await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally,deps:t.dependencies,existingBufLockContents:i});return{bufLockContents:n.bufLockContents,openApiSpec:{type:"openapi",absoluteFilepath:n.absoluteFilepath,absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}}function TqM(e){return e.every(t=>t.settings?.removeDiscriminantsFromSchemas===hn.RemoveDiscriminantsFromSchemas.Never)?hn.RemoveDiscriminantsFromSchemas.Never:hn.RemoveDiscriminantsFromSchemas.Always}var Xw=class e extends YPa{type="oss";allSpecs;specs;sources;loader;parseOptions;groupMultiApiEnvironments;constructor({allSpecs:t,specs:r,...i}){super({...i,respectReadonlySchemas:r.every(n=>n.settings?.respectReadonlySchemas),respectNullableSchemas:r.every(n=>n.settings?.respectNullableSchemas),wrapReferencesToNullableInOptional:r.every(n=>n.settings?.wrapReferencesToNullableInOptional),removeDiscriminantsFromSchemas:TqM(r),coerceOptionalSchemasToNullable:r.every(n=>n.settings?.coerceOptionalSchemasToNullable),coerceEnumsToLiterals:r.every(n=>n.settings?.coerceEnumsToLiterals),onlyIncludeReferencedSchemas:r.every(n=>n.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:r.every(n=>n.settings?.inlinePathParameters),objectQueryParameters:r.every(n=>n.settings?.objectQueryParameters),useBytesForBinaryResponse:r.filter(n=>n.type==="openapi"&&n.source.type==="openapi").some(n=>n.settings?.useBytesForBinaryResponse),respectForwardCompatibleEnums:r.filter(n=>n.type==="openapi"&&n.source.type==="openapi").some(n=>n.settings?.respectForwardCompatibleEnums),inlineAllOfSchemas:r.every(n=>n.settings?.inlineAllOfSchemas),resolveAliases:r.every(o=>o.settings?.resolveAliases)?{except:r.flatMap(o=>typeof o.settings?.resolveAliases=="object"?o.settings.resolveAliases.except??[]:[])}:!1,exampleGeneration:r[0]?.settings?.exampleGeneration,groupEnvironmentsByHost:r.some(n=>n.settings?.groupEnvironmentsByHost),defaultIntegerFormat:r[0]?.settings?.defaultIntegerFormat}),this.specs=r,this.allSpecs=t,this.sources=this.convertSpecsToIdentifiableSources(r),this.loader=new CFt(this.absoluteFilePath),this.groupMultiApiEnvironments=this.specs.some(n=>n.settings?.groupMultiApiEnvironments),this.parseOptions={onlyIncludeReferencedSchemas:this.onlyIncludeReferencedSchemas,respectReadonlySchemas:this.respectReadonlySchemas,respectNullableSchemas:this.respectNullableSchemas,wrapReferencesToNullableInOptional:this.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:this.coerceOptionalSchemasToNullable,coerceEnumsToLiterals:this.coerceEnumsToLiterals,inlinePathParameters:this.inlinePathParameters,objectQueryParameters:this.objectQueryParameters,exampleGeneration:this.exampleGeneration,useBytesForBinaryResponse:this.useBytesForBinaryResponse,respectForwardCompatibleEnums:this.respectForwardCompatibleEnums,inlineAllOfSchemas:this.inlineAllOfSchemas,resolveAliases:this.resolveAliases,removeDiscriminantsFromSchemas:this.removeDiscriminantsFromSchemas,groupMultiApiEnvironments:this.groupMultiApiEnvironments,groupEnvironmentsByHost:this.groupEnvironmentsByHost,defaultIntegerFormat:this.defaultIntegerFormat}}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await pPe({context:t,specs:this.specs,relativePathToDependency:r});return EJi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,...this.parseOptions}})}async getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:i,generateV1Examples:n,logWarnings:a}){let o=await pPe({context:t,specs:this.specs}),c=await this.loader.loadDocuments({context:t,specs:o}),f=this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0;f&&t.logger.trace("Using auth overrides from generators configuration");let s=this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0;s&&t.logger.trace("Using environment overrides from generators configuration");let u=this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0;u&&t.logger.trace("Using global header overrides from generators configuration");let l,p=[];for(let _ of c){let h=Ft(this.absoluteFilePath,Ze.of(_.source?.file??"")),y=P7(q0(),h),b=new T0e({logger:t.logger,relativeFilepathToSpec:y});p.push(b);let v;switch(_.type){case"openapi":{let A=new Pgi({namespace:_.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:_.value,exampleGenerationArgs:{disabled:!1},errorCollector:b,authOverrides:f,environmentOverrides:s,globalHeaderOverrides:u,enableUniqueErrorsPerEndpoint:i,generateV1Examples:n,settings:SFt({options:_.settings}),documentBaseDir:nn(h)});v=await new uEa({context:A,audiences:r}).convert();break}case"asyncapi":{let A=new nEa({namespace:_.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:_.value,exampleGenerationArgs:{disabled:!1},errorCollector:b,enableUniqueErrorsPerEndpoint:i,settings:SFt({options:_.settings}),generateV1Examples:n});v=await new iEa({context:A,audiences:r}).convert();break}default:b.collect({message:`Unsupported document type: ${_}`,path:[]});break}let O=u6o({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});v!=null&&(l=l===void 0?v:TKi(l,v,O))}for(let _ of this.allSpecs)if(_.type==="openrpc"){let h=_.absoluteFilepath,y=P7(q0(),h),b=new T0e({logger:t.logger,relativeFilepathToSpec:y});p.push(b);let v=new cEa({namespace:_.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:await Jyc({context:t,absoluteFilePath:_.absoluteFilepath,absoluteFilePathToOverrides:_.absoluteFilepathToOverrides}),exampleGenerationArgs:{disabled:!1},errorCollector:b,enableUniqueErrorsPerEndpoint:i,generateV1Examples:n,settings:SFt()}),A=await new sEa({context:v,audiences:r}).convert(),g=u6o({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});A!=null&&(l=l===void 0?A:TKi(l,A,g))}else if(_.type==="protobuf")try{let y=await new y6o({context:t}).generate({absoluteFilepathToProtobufRoot:_.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:_.absoluteFilepathToProtobufTarget,local:!0,deps:_.dependencies}),b=await(0,dq_.readFile)(y,"utf-8"),v=u6o({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});if(b!=null){let O;try{if(O=Cn.IntermediateRepresentation.parse(JSON.parse(b),{allowUnrecognizedEnumValues:!0,skipValidation:!0}),O.ok)l=l===void 0?O.value:TKi(l,O.value,v);else throw new Error}catch{t.logger.log("error","Failed to parse protobuf IR: ")}}}catch(h){t.logger.log("warn","Failed to parse protobuf IR: "+h)}for(let _ of p)if(_.hasErrors()){let h=_.getErrorStats(),y=_.relativeFilepathToSpec?` for ${_.relativeFilepathToSpec}`:"";h.numErrors>0?t.logger.log("error",`API validation${y} completed with ${h.numErrors} errors and ${h.numWarnings} warnings.`):h.numWarnings>0?t.logger.log("warn",`API validation${y} completed with ${h.numWarnings} warnings.`):t.logger.log("info",`All checks passed when parsing OpenAPI${y}.`),t.logger.log("info",""),await _.logErrors({logWarnings:a})}if(l===void 0)throw new Error("Failed to generate intermediate representation");return l}async toFernWorkspace({context:t},r,i){if(i!=null)return this.createWorkspaceWithSpecsOverride({context:t},i,r);let n=await this.getDefinition({context:t},r);return new eK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion,sources:this.sources})}async createWorkspaceWithSpecsOverride({context:t},r,i){let n=await this.convertSpecsOverrideToSpecs(r),a=n.filter(f=>f.type!=="protobuf"||!f.fromOpenAPI),o=new e({allSpecs:a,specs:n.filter(f=>f.type==="openapi"||f.type==="protobuf"),generatorsConfiguration:this.generatorsConfiguration,workspaceName:this.workspaceName,cliVersion:this.cliVersion,absoluteFilePath:this.absoluteFilePath,changelog:this.changelog}),c=await o.getDefinition({context:t},i);return new eK({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:c,cliVersion:this.cliVersion,sources:o.sources})}async convertSpecsOverrideToSpecs(t){if(!Array.isArray(t))throw new Error("Conjure specs override is not yet supported");let r=[];for(let i of t)if(hn.isOpenApiSpecSchema(i)){let n=Ft(this.absoluteFilePath,Ze.of(i.openapi)),a=i.overrides?Ft(this.absoluteFilePath,Ze.of(i.overrides)):void 0,o={type:"openapi",absoluteFilepath:n,absoluteFilepathToOverrides:a,settings:this.specs.length>0?this.specs[0]?.settings:void 0,source:{type:"openapi",file:n},namespace:i.namespace??this.workspaceName};r.push(o)}else throw new Error("Spec type override not yet supported. Only OpenAPI specs are currently supported in specs override.");return r}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.allSpecs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(Xu)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let o=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(o)||(r.add(o),n.push({type:a.type,id:Z_e(),absoluteFilePath:o})),n},i)}};function RqM(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function dbc(e,t){for(let[r,i]of JD(e.failures))zqM({relativeFilepath:r,failure:i,logger:t})}function zqM({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case h_.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case h_.FILE_READ:r.error("Failed to open file: "+e);break;case h_.FILE_MISSING:r.error("Missing file: "+e);break;case h_.FILE_PARSE:t.error instanceof Bpa?r.error(aPe({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case h_.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of NqM(i))r.error(aPe({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case h_.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case h_.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${hio}: `+t.dependencyName);break;case h_.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case h_.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case h_.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let i=t.error.error.instancePath.split("/").filter(n=>n!=="").map(RqM);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?i.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&i.push(t.error.error.params.additionalProperty),r.error(aPe({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...i]}))}break;default:Ot(t)}}function NqM(e){switch(e.code){case gi.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Ut.underline(e.expected)} but received ${Ut.underline(e.received)}`}];case gi.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Ut.underline(t)}`}));case gi.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Ut.underline(t)).join(", ")}`}];case gi.invalid_union:case gi.invalid_arguments:case gi.invalid_return_type:case gi.invalid_date:case gi.invalid_string:case gi.too_small:case gi.too_big:case gi.invalid_intersection_types:case gi.not_multiple_of:case gi.custom:default:return[{title:e.message}]}}var pq_=require("fs/promises");async function _q_(e,t){let r=[];for(let i of await ZF(e,t))r.push(await FqM({relativeFilepath:nb(e,i),absoluteFilepath:i}));return r}async function FqM({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,pq_.readFile)(t)).toString()}}async function hq_({absolutePathToWorkspace:e}){let t=Ft(e,Ze.of(oId));if(!await Ri(t))return;let i=await _q_(t,"{md,mdx}");return{files:await Promise.all(i.map(n=>({absoluteFilepath:n.absoluteFilepath,contents:n.fileContents})))}}async function pbc({absolutePathToWorkspace:e,namespace:t,definitions:r}){let i=[];for(let n of r){let a=n.overrides!=null?Ft(e,Ze.of(n.overrides)):void 0;if(n.schema.type==="protobuf"){let f=Ze.of(n.schema.root),s=Ft(e,f);if(!await Ri(s))return{didSucceed:!1,failures:{[Ze.of(n.schema.root)]:{type:h_.FILE_MISSING}}};let u=n.schema.target.length===0?void 0:Ft(e,Ze.of(n.schema.target));if(u!=null&&!await Ri(u))return{didSucceed:!1,failures:{[Ze.of(n.schema.target)]:{type:h_.FILE_MISSING}}};let l=F5o(n.settings);i.push({type:"protobuf",absoluteFilepathToProtobufRoot:s,absoluteFilepathToProtobufTarget:u,absoluteFilepathToOverrides:a,relativeFilepathToProtobufRoot:f,dependencies:n.schema.dependencies,generateLocally:n.schema.localGeneration,fromOpenAPI:n.schema.fromOpenAPI,settings:{...l,audiences:n.audiences??[]}});continue}if(n.schema.type==="openrpc"){let f=Ze.of(n.schema.path),s=Ft(e,f);i.push({type:"openrpc",absoluteFilepath:s,absoluteFilepathToOverrides:a,namespace:t});continue}let o=Ft(e,Ze.of(n.schema.path));if(!await Ri(o))return{didSucceed:!1,failures:{[Ze.of(n.schema.path)]:{type:h_.FILE_MISSING}}};if(n.overrides!=null&&a!=null&&!await Ri(a))return{didSucceed:!1,failures:{[Ze.of(n.overrides)]:{type:h_.FILE_MISSING}}};let c=F5o(n.settings);i.push({type:"openapi",absoluteFilepath:o,absoluteFilepathToOverrides:a,settings:{...c,audiences:n.audiences??[]},source:{type:"openapi",file:o},namespace:t})}return i}async function _Ea({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:i}){let n=await K_e({absolutePathToWorkspace:e,context:t}),a;try{a=await hq_({absolutePathToWorkspace:e})}catch{}if(n?.api!=null&&n?.api.type==="conjure")return{didSucceed:!0,workspace:new sWo({workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r,context:t,relativePathToConjureDirectory:Ze.of(n.api.pathToConjureDefinition)})};if(n?.api!=null&&(n.api.type==="singleNamespace"&&n.api.definitions.length>0||n.api.type==="multiNamespace")){let o=[];if(n.api.type==="singleNamespace"){let c=await pbc({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.definitions});if(!Array.isArray(c))return c;o.push(...c)}else{for(let[c,f]of Object.entries(n.api.definitions)){let s=await pbc({absolutePathToWorkspace:e,namespace:c,definitions:f});if(!Array.isArray(s))return s;o.push(...s)}if(n.api.rootDefinitions!=null){let c=await pbc({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.rootDefinitions});if(!Array.isArray(c))return c;o.push(...c)}}return{didSucceed:!0,workspace:new Xw({specs:o.filter(c=>!(c.type==="openrpc"||c.type==="protobuf"&&!c.fromOpenAPI)),allSpecs:o.filter(c=>!(c.type==="protobuf"&&c.fromOpenAPI)),workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r})}}if(await Ri(Ft(e,Ze.of(lR))))return{didSucceed:!0,workspace:new T9t({absoluteFilePath:e,generatorsConfiguration:n,workspaceName:i,changelog:a,context:t,cliVersion:r,loadAPIWorkspace:_Ea})};if(await ZMs(Ft(e,Ze.of(lR)))){let o=e.split("/").pop();t.logger.warn(`Detected empty API definiton: ${o}. Remove to resolve error.`)}return{didSucceed:!1,failures:{[Ze.of(Sda)]:{type:h_.MISCONFIGURED_DIRECTORY}}}}var yq_=require("fs/promises");var _bc={};Yt(_bc,{additionalProperties:()=>VqM,default:()=>xqM,definitions:()=>WqM,properties:()=>UqM,required:()=>LqM,type:()=>QqM});var QqM="object",UqM={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},products:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ProductConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},languages:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.Language"}},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-search":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},settings:{oneOf:[{$ref:"#/definitions/docs.DocsSettingsConfig"},{type:"null"}]},theme:{oneOf:[{$ref:"#/definitions/docs.ThemeConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]}},LqM=["instances"],VqM=!1,WqM={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]}},additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.Audience":{anyOf:[{$ref:"#/definitions/docs.AudienceId"},{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}}]},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},private:{oneOf:[{type:"boolean"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.Target":{type:"string",enum:["_blank","_self","_parent","_top"]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.InternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.ExternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},href:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["display-name","href"],additionalProperties:!1},"docs.ProductConfig":{anyOf:[{$ref:"#/definitions/docs.InternalProduct"},{$ref:"#/definitions/docs.ExternalProduct"}]},"docs.Availability":{type:"string",enum:["stable","generally-available","in-development","pre-release","deprecated","beta"]},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},php:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},swift:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},rust:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},"tag-description-pages":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},postman:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.FolderConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},folder:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["folder"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"},{$ref:"#/definitions/docs.FolderConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItemWithLayout":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabVariant":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},layout:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","layout"],additionalProperties:!1},"docs.TabbedNavigationItemWithVariants":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},variants:{type:"array",items:{$ref:"#/definitions/docs.TabVariant"}}},required:["tab","variants"],additionalProperties:!1},"docs.TabbedNavigationItem":{anyOf:[{$ref:"#/definitions/docs.TabbedNavigationItemWithLayout"},{$ref:"#/definitions/docs.TabbedNavigationItemWithVariants"}]},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfigWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},url:{type:"string"},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.NavbarGithubConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.NavbarGithubConfigWithOptions"}]},"docs.NavbarLinkConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","dropdown","primary","secondary"]}},oneOf:[{properties:{type:{const:"filled"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"dropdown"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},links:{type:"array",items:{$ref:"#/definitions/docs.NavbarLinkConfig"}},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type","links"]},{properties:{type:{const:"primary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},target:{oneOf:[{$ref:"#/definitions/docs.Target"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionOption":{type:"string",enum:["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]},"docs.PageActionOptions":{type:"object",properties:{"copy-page":{oneOf:[{type:"boolean"},{type:"null"}]},"view-as-markdown":{oneOf:[{type:"boolean"},{type:"null"}]},"ask-ai":{oneOf:[{type:"boolean"},{type:"null"}]},chatgpt:{oneOf:[{type:"boolean"},{type:"null"}]},claude:{oneOf:[{type:"boolean"},{type:"null"}]},cursor:{oneOf:[{type:"boolean"},{type:"null"}]},vscode:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionsConfig":{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/docs.PageActionOption"},{type:"null"}]},options:{oneOf:[{$ref:"#/definitions/docs.PageActionOptions"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]},"dynamic-snippets":{oneOf:[{type:"boolean"},{type:"null"}]},"ai-examples":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.Language":{type:"string",enum:["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]},"docs.AIChatModel":{type:"string",enum:["claude-3.7","claude-4","command-a"]},"docs.AIChatLocation":{type:"string",enum:["docs","slack","discord"]},"docs.AIChatWebsiteDatasource":{type:"object",properties:{url:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.AIChatDatasource":{anyOf:[{$ref:"#/definitions/docs.AIChatWebsiteDatasource"}]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]},location:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatLocation"}},{type:"null"}]},datasources:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatDatasource"}},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]},"canonical-host":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},"right-text":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-nav-links":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-feedback":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.HttpSnippetLanguage":{type:"string",enum:["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]},"docs.HttpSnippetsConfig":{anyOf:[{type:"boolean"},{type:"array",items:{$ref:"#/definitions/docs.HttpSnippetLanguage"}}]},"docs.DocsSettingsConfig":{type:"object",properties:{"search-text":{oneOf:[{type:"string"},{type:"null"}]},"disable-search":{oneOf:[{type:"boolean"},{type:"null"}]},"dark-mode-code":{oneOf:[{type:"boolean"},{type:"null"}]},"default-search-filters":{oneOf:[{type:"boolean"},{type:"null"}]},"http-snippets":{oneOf:[{$ref:"#/definitions/docs.HttpSnippetsConfig"},{type:"null"}]},"hide-404-page":{oneOf:[{type:"boolean"},{type:"null"}]},"use-javascript-as-typescript":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-explorer-proxy":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-analytics":{oneOf:[{type:"boolean"},{type:"null"}]},language:{oneOf:[{$ref:"#/definitions/docs.Language"},{type:"null"}]},"substitute-env-vars":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.SidebarThemeConfig":{type:"string",enum:["default","minimal"]},"docs.BodyThemeConfig":{type:"string",enum:["default","canvas"]},"docs.TabsThemeConfig":{type:"string",enum:["default","bubble"]},"docs.PageActionsThemeConfig":{type:"string",enum:["default","toolbar"]},"docs.FooterNavThemeConfig":{type:"string",enum:["default","minimal"]},"docs.ThemeConfig":{type:"object",properties:{sidebar:{oneOf:[{$ref:"#/definitions/docs.SidebarThemeConfig"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/docs.BodyThemeConfig"},{type:"null"}]},tabs:{oneOf:[{$ref:"#/definitions/docs.TabsThemeConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsThemeConfig"},{type:"null"}]},"footer-nav":{oneOf:[{$ref:"#/definitions/docs.FooterNavThemeConfig"},{type:"null"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},xqM={type:QqM,properties:UqM,required:LqM,additionalProperties:VqM,definitions:WqM};async function hbc({fernDirectory:e,context:t}){let r=Ft(e,Ze.of(uP));if(!await Ri(r))return;let i=await GqM({absolutePathToDocsDefinition:e,context:t});if(i!=null)return{type:"docs",absoluteFilePath:e,config:i,workspaceName:void 0,absoluteFilepathToDocsConfig:Ft(e,Ze.of(uP))}}async function GqM({absolutePathToDocsDefinition:e,context:t}){if(!await Ri(e))return;let r=Ft(e,Ze.of(uP));return await HqM({absolutePathOfConfiguration:r,context:t})}async function HqM({absolutePathOfConfiguration:e,context:t}){let r=await(0,yq_.readFile)(e),i=Ii.load(r.toString()),n=tzt(i,_bc,{filePath:e});if(n.success){let a=[];t.logger.debug("About to sanitize docs configuration JSON structure");let o=YOe(i,[],a);a.length>0?t.logger.warn(`docs.yml contained null/undefined sections that were ignored: ${a.map(c=>c.join(".")).join(", ")}`):t.logger.debug("No null/undefined values found during sanitization");try{return t.logger.debug("Attempting to parse sanitized docs configuration"),m7.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(o)}catch(c){throw t.logger.error(`Parsing failed even after sanitization: ${c instanceof Error?c.message:String(c)}`),t.logger.debug(`Sanitized JSON structure: ${JSON.stringify(o,null,2)}`),new Error(`Failed to parse ${e}: ${c instanceof Error?c.message:String(c)}`)}}else throw new Error(`Failed to parse docs.yml:
|
|
1453
1453
|
${n.error?.message??"Unknown error"}`)}var bq_=require("fs/promises");async function ybc({context:e,nameOverride:t,...r}){let i=await Gw(t);return i==null?e.failAndThrow(`Directory "${t??e1}" not found.`):await vq_({absolutePathToFernDirectory:i,context:e,nameOverride:t,...r})}async function vq_({absolutePathToFernDirectory:e,cliName:t,cliVersion:r,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n,context:a}){let o=[];(await Ri(Ft(e,Ze.of(vhi)))||await Ri(Ft(e,Ze.of(lR)))||await Ri(Ft(e,Ze.of(IS)))||await Ri(Ft(e,Ze.of(yio)))||await Ri(Ft(e,Ze.of(Sda)))||await Ri(Ft(e,Ze.of(bSs))))&&(o=await gq_({cliName:t,fernDirectory:e,cliVersion:r,context:a,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n}));let c=await hbc({fernDirectory:e,context:a});return o.length===0&&c==null?a.failAndThrow(`No SDK specifications or docs specifications found. Please ensure one of the following .yml (not .yaml) files is present:
|
|
1454
1454
|
\u203A ${IS}
|
|
1455
1455
|
\u203A ${uP}
|